Add vendor files to dist
This commit is contained in:
110
vendor/composer/autoload_classmap.php
vendored
110
vendor/composer/autoload_classmap.php
vendored
@@ -184,7 +184,7 @@ return array(
|
||||
'Carbon\\CarbonPeriod' => $vendorDir . '/nesbot/carbon/src/Carbon/CarbonPeriod.php',
|
||||
'Carbon\\Exceptions\\InvalidDateException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php',
|
||||
'Carbon\\Laravel\\ServiceProvider' => $vendorDir . '/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php',
|
||||
'Carbon\\Translator' => $vendorDir . '/nesbot/carbon/src/Carbon/Translator.php',
|
||||
'Carbon\\Translator' => $baseDir . '/overrides/nesbot/carbon/src/Carbon/Translator.php',
|
||||
'Chumper\\Zipper\\Facades\\Zipper' => $vendorDir . '/chumper/zipper/src/Chumper/Zipper/Facades/Zipper.php',
|
||||
'Chumper\\Zipper\\Repositories\\RepositoryInterface' => $vendorDir . '/chumper/zipper/src/Chumper/Zipper/Repositories/RepositoryInterface.php',
|
||||
'Chumper\\Zipper\\Repositories\\ZipRepository' => $baseDir . '/overrides/chumper/zipper/src/Chumper/Zipper/Repositories/ZipRepository.php',
|
||||
@@ -207,7 +207,7 @@ return array(
|
||||
'Codedge\\Updater\\UpdaterServiceProvider' => $vendorDir . '/codedge/laravel-selfupdater/src/UpdaterServiceProvider.php',
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'Cron\\AbstractField' => $vendorDir . '/mtdowling/cron-expression/src/Cron/AbstractField.php',
|
||||
'Cron\\CronExpression' => $vendorDir . '/mtdowling/cron-expression/src/Cron/CronExpression.php',
|
||||
'Cron\\CronExpression' => $baseDir . '/overrides/mtdowling/cron-expression/src/Cron/CronExpression.php',
|
||||
'Cron\\DayOfMonthField' => $vendorDir . '/mtdowling/cron-expression/src/Cron/DayOfMonthField.php',
|
||||
'Cron\\DayOfWeekField' => $vendorDir . '/mtdowling/cron-expression/src/Cron/DayOfWeekField.php',
|
||||
'Cron\\FieldFactory' => $vendorDir . '/mtdowling/cron-expression/src/Cron/FieldFactory.php',
|
||||
@@ -724,7 +724,7 @@ return array(
|
||||
'GuzzleHttp\\Exception\\ServerException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ServerException.php',
|
||||
'GuzzleHttp\\Exception\\TooManyRedirectsException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php',
|
||||
'GuzzleHttp\\Exception\\TransferException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/TransferException.php',
|
||||
'GuzzleHttp\\HandlerStack' => $vendorDir . '/guzzlehttp/guzzle/src/HandlerStack.php',
|
||||
'GuzzleHttp\\HandlerStack' => $baseDir . '/overrides/guzzlehttp/guzzle/src/HandlerStack.php',
|
||||
'GuzzleHttp\\Handler\\CurlFactory' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php',
|
||||
'GuzzleHttp\\Handler\\CurlFactoryInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php',
|
||||
'GuzzleHttp\\Handler\\CurlHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php',
|
||||
@@ -1020,7 +1020,7 @@ return array(
|
||||
'HTMLPurifier_Zipper' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier/Zipper.php',
|
||||
'Html2Text\\Html2Text' => $vendorDir . '/html2text/html2text/src/Html2Text.php',
|
||||
'Illuminate\\Auth\\Access\\AuthorizationException' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php',
|
||||
'Illuminate\\Auth\\Access\\Gate' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/Gate.php',
|
||||
'Illuminate\\Auth\\Access\\Gate' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Auth/Access/Gate.php',
|
||||
'Illuminate\\Auth\\Access\\HandlesAuthorization' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php',
|
||||
'Illuminate\\Auth\\Access\\Response' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/Response.php',
|
||||
'Illuminate\\Auth\\AuthManager' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/AuthManager.php',
|
||||
@@ -1060,7 +1060,7 @@ return array(
|
||||
'Illuminate\\Broadcasting\\BroadcastController' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastEvent' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastException' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastManager' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastManager' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php',
|
||||
'Illuminate\\Broadcasting\\Broadcasters\\Broadcaster' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php',
|
||||
'Illuminate\\Broadcasting\\Broadcasters\\LogBroadcaster' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php',
|
||||
@@ -1073,7 +1073,7 @@ return array(
|
||||
'Illuminate\\Broadcasting\\PresenceChannel' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php',
|
||||
'Illuminate\\Broadcasting\\PrivateChannel' => $vendorDir . '/laravel/framework/src/Illuminate/Broadcasting/PrivateChannel.php',
|
||||
'Illuminate\\Bus\\BusServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php',
|
||||
'Illuminate\\Bus\\Dispatcher' => $vendorDir . '/laravel/framework/src/Illuminate/Bus/Dispatcher.php',
|
||||
'Illuminate\\Bus\\Dispatcher' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Bus/Dispatcher.php',
|
||||
'Illuminate\\Bus\\Queueable' => $vendorDir . '/laravel/framework/src/Illuminate/Bus/Queueable.php',
|
||||
'Illuminate\\Cache\\ApcStore' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/ApcStore.php',
|
||||
'Illuminate\\Cache\\ApcWrapper' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/ApcWrapper.php',
|
||||
@@ -1105,7 +1105,7 @@ return array(
|
||||
'Illuminate\\Cache\\TaggableStore' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/TaggableStore.php',
|
||||
'Illuminate\\Cache\\TaggedCache' => $vendorDir . '/laravel/framework/src/Illuminate/Cache/TaggedCache.php',
|
||||
'Illuminate\\Config\\Repository' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Config/Repository.php',
|
||||
'Illuminate\\Console\\Application' => $vendorDir . '/laravel/framework/src/Illuminate/Console/Application.php',
|
||||
'Illuminate\\Console\\Application' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Console/Application.php',
|
||||
'Illuminate\\Console\\Command' => $vendorDir . '/laravel/framework/src/Illuminate/Console/Command.php',
|
||||
'Illuminate\\Console\\ConfirmableTrait' => $vendorDir . '/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php',
|
||||
'Illuminate\\Console\\DetectsApplicationNamespace' => $vendorDir . '/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php',
|
||||
@@ -1251,16 +1251,16 @@ return array(
|
||||
'Illuminate\\Database\\DatabaseServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php',
|
||||
'Illuminate\\Database\\DetectsDeadlocks' => $vendorDir . '/laravel/framework/src/Illuminate/Database/DetectsDeadlocks.php',
|
||||
'Illuminate\\Database\\DetectsLostConnections' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php',
|
||||
'Illuminate\\Database\\Eloquent\\Builder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php',
|
||||
'Illuminate\\Database\\Eloquent\\Builder' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php',
|
||||
'Illuminate\\Database\\Eloquent\\Collection' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\GuardsAttributes' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasAttributes' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasEvents' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasGlobalScopes' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasGlobalScopes' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasRelationships' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasTimestamps' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HidesAttributes' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\QueriesRelationships' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\QueriesRelationships' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php',
|
||||
'Illuminate\\Database\\Eloquent\\Factory' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php',
|
||||
'Illuminate\\Database\\Eloquent\\FactoryBuilder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php',
|
||||
'Illuminate\\Database\\Eloquent\\JsonEncodingException' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php',
|
||||
@@ -1284,7 +1284,7 @@ return array(
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\MorphTo' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php',
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\MorphToMany' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php',
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\Pivot' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php',
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\Relation' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php',
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\Relation' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php',
|
||||
'Illuminate\\Database\\Eloquent\\Scope' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php',
|
||||
'Illuminate\\Database\\Eloquent\\SoftDeletes' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletes.php',
|
||||
'Illuminate\\Database\\Eloquent\\SoftDeletingScope' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php',
|
||||
@@ -1304,7 +1304,7 @@ return array(
|
||||
'Illuminate\\Database\\MySqlConnection' => $vendorDir . '/laravel/framework/src/Illuminate/Database/MySqlConnection.php',
|
||||
'Illuminate\\Database\\PostgresConnection' => $vendorDir . '/laravel/framework/src/Illuminate/Database/PostgresConnection.php',
|
||||
'Illuminate\\Database\\QueryException' => $vendorDir . '/laravel/framework/src/Illuminate/Database/QueryException.php',
|
||||
'Illuminate\\Database\\Query\\Builder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Query/Builder.php',
|
||||
'Illuminate\\Database\\Query\\Builder' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Query/Builder.php',
|
||||
'Illuminate\\Database\\Query\\Expression' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Query/Expression.php',
|
||||
'Illuminate\\Database\\Query\\Grammars\\Grammar' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php',
|
||||
'Illuminate\\Database\\Query\\Grammars\\MySqlGrammar' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php',
|
||||
@@ -1320,7 +1320,7 @@ return array(
|
||||
'Illuminate\\Database\\Query\\Processors\\SqlServerProcessor' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php',
|
||||
'Illuminate\\Database\\SQLiteConnection' => $vendorDir . '/laravel/framework/src/Illuminate/Database/SQLiteConnection.php',
|
||||
'Illuminate\\Database\\Schema\\Blueprint' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php',
|
||||
'Illuminate\\Database\\Schema\\Builder' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/Builder.php',
|
||||
'Illuminate\\Database\\Schema\\Builder' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Schema/Builder.php',
|
||||
'Illuminate\\Database\\Schema\\Grammars\\ChangeColumn' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php',
|
||||
'Illuminate\\Database\\Schema\\Grammars\\Grammar' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php',
|
||||
'Illuminate\\Database\\Schema\\Grammars\\MySqlGrammar' => $vendorDir . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php',
|
||||
@@ -1467,7 +1467,7 @@ return array(
|
||||
'Illuminate\\Http\\JsonResponse' => $vendorDir . '/laravel/framework/src/Illuminate/Http/JsonResponse.php',
|
||||
'Illuminate\\Http\\Middleware\\CheckResponseForModifications' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php',
|
||||
'Illuminate\\Http\\Middleware\\FrameGuard' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php',
|
||||
'Illuminate\\Http\\RedirectResponse' => $vendorDir . '/laravel/framework/src/Illuminate/Http/RedirectResponse.php',
|
||||
'Illuminate\\Http\\RedirectResponse' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Http/RedirectResponse.php',
|
||||
'Illuminate\\Http\\Request' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Http/Request.php',
|
||||
'Illuminate\\Http\\Resources\\CollectsResources' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php',
|
||||
'Illuminate\\Http\\Resources\\ConditionallyLoadsAttributes' => $vendorDir . '/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php',
|
||||
@@ -1488,12 +1488,12 @@ return array(
|
||||
'Illuminate\\Http\\UploadedFile' => $vendorDir . '/laravel/framework/src/Illuminate/Http/UploadedFile.php',
|
||||
'Illuminate\\Log\\Events\\MessageLogged' => $vendorDir . '/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php',
|
||||
'Illuminate\\Log\\LogServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Log/LogServiceProvider.php',
|
||||
'Illuminate\\Log\\Writer' => $vendorDir . '/laravel/framework/src/Illuminate/Log/Writer.php',
|
||||
'Illuminate\\Log\\Writer' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Log/Writer.php',
|
||||
'Illuminate\\Mail\\Events\\MessageSending' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php',
|
||||
'Illuminate\\Mail\\Events\\MessageSent' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php',
|
||||
'Illuminate\\Mail\\MailServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php',
|
||||
'Illuminate\\Mail\\Mailable' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Mailable.php',
|
||||
'Illuminate\\Mail\\Mailer' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Mailer.php',
|
||||
'Illuminate\\Mail\\Mailer' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Mail/Mailer.php',
|
||||
'Illuminate\\Mail\\Markdown' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Markdown.php',
|
||||
'Illuminate\\Mail\\Message' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Message.php',
|
||||
'Illuminate\\Mail\\PendingMail' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/PendingMail.php',
|
||||
@@ -1508,7 +1508,7 @@ return array(
|
||||
'Illuminate\\Mail\\Transport\\Transport' => $vendorDir . '/laravel/framework/src/Illuminate/Mail/Transport/Transport.php',
|
||||
'Illuminate\\Notifications\\Action' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/Action.php',
|
||||
'Illuminate\\Notifications\\AnonymousNotifiable' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php',
|
||||
'Illuminate\\Notifications\\ChannelManager' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/ChannelManager.php',
|
||||
'Illuminate\\Notifications\\ChannelManager' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Notifications/ChannelManager.php',
|
||||
'Illuminate\\Notifications\\Channels\\BroadcastChannel' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php',
|
||||
'Illuminate\\Notifications\\Channels\\DatabaseChannel' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php',
|
||||
'Illuminate\\Notifications\\Channels\\MailChannel' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php',
|
||||
@@ -1532,17 +1532,17 @@ return array(
|
||||
'Illuminate\\Notifications\\Messages\\SlackMessage' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/Messages/SlackMessage.php',
|
||||
'Illuminate\\Notifications\\Notifiable' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/Notifiable.php',
|
||||
'Illuminate\\Notifications\\Notification' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/Notification.php',
|
||||
'Illuminate\\Notifications\\NotificationSender' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/NotificationSender.php',
|
||||
'Illuminate\\Notifications\\NotificationSender' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Notifications/NotificationSender.php',
|
||||
'Illuminate\\Notifications\\NotificationServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php',
|
||||
'Illuminate\\Notifications\\RoutesNotifications' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php',
|
||||
'Illuminate\\Notifications\\SendQueuedNotifications' => $vendorDir . '/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php',
|
||||
'Illuminate\\Notifications\\RoutesNotifications' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php',
|
||||
'Illuminate\\Notifications\\SendQueuedNotifications' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php',
|
||||
'Illuminate\\Pagination\\AbstractPaginator' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php',
|
||||
'Illuminate\\Pagination\\LengthAwarePaginator' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php',
|
||||
'Illuminate\\Pagination\\PaginationServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php',
|
||||
'Illuminate\\Pagination\\Paginator' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Pagination/Paginator.php',
|
||||
'Illuminate\\Pagination\\UrlWindow' => $vendorDir . '/laravel/framework/src/Illuminate/Pagination/UrlWindow.php',
|
||||
'Illuminate\\Pipeline\\Hub' => $vendorDir . '/laravel/framework/src/Illuminate/Pipeline/Hub.php',
|
||||
'Illuminate\\Pipeline\\Pipeline' => $vendorDir . '/laravel/framework/src/Illuminate/Pipeline/Pipeline.php',
|
||||
'Illuminate\\Pipeline\\Pipeline' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Pipeline/Pipeline.php',
|
||||
'Illuminate\\Pipeline\\PipelineServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php',
|
||||
'Illuminate\\Queue\\BeanstalkdQueue' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php',
|
||||
'Illuminate\\Queue\\CallQueuedHandler' => $vendorDir . '/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php',
|
||||
@@ -1740,7 +1740,7 @@ return array(
|
||||
'Illuminate\\Validation\\Concerns\\ReplacesAttributes' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php',
|
||||
'Illuminate\\Validation\\Concerns\\ValidatesAttributes' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php',
|
||||
'Illuminate\\Validation\\DatabasePresenceVerifier' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php',
|
||||
'Illuminate\\Validation\\Factory' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/Factory.php',
|
||||
'Illuminate\\Validation\\Factory' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Validation/Factory.php',
|
||||
'Illuminate\\Validation\\PresenceVerifierInterface' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php',
|
||||
'Illuminate\\Validation\\Rule' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/Rule.php',
|
||||
'Illuminate\\Validation\\Rules\\DatabaseRule' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php',
|
||||
@@ -1753,7 +1753,7 @@ return array(
|
||||
'Illuminate\\Validation\\ValidatesWhenResolvedTrait' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php',
|
||||
'Illuminate\\Validation\\ValidationData' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/ValidationData.php',
|
||||
'Illuminate\\Validation\\ValidationException' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/ValidationException.php',
|
||||
'Illuminate\\Validation\\ValidationRuleParser' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php',
|
||||
'Illuminate\\Validation\\ValidationRuleParser' => $baseDir . '/overrides/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php',
|
||||
'Illuminate\\Validation\\ValidationServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php',
|
||||
'Illuminate\\Validation\\Validator' => $vendorDir . '/laravel/framework/src/Illuminate/Validation/Validator.php',
|
||||
'Illuminate\\View\\Compilers\\BladeCompiler' => $vendorDir . '/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php',
|
||||
@@ -1784,7 +1784,7 @@ return array(
|
||||
'Illuminate\\View\\Engines\\FileEngine' => $vendorDir . '/laravel/framework/src/Illuminate/View/Engines/FileEngine.php',
|
||||
'Illuminate\\View\\Engines\\PhpEngine' => $vendorDir . '/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php',
|
||||
'Illuminate\\View\\Factory' => $vendorDir . '/laravel/framework/src/Illuminate/View/Factory.php',
|
||||
'Illuminate\\View\\FileViewFinder' => $vendorDir . '/laravel/framework/src/Illuminate/View/FileViewFinder.php',
|
||||
'Illuminate\\View\\FileViewFinder' => $baseDir . '/overrides/laravel/framework/src/Illuminate/View/FileViewFinder.php',
|
||||
'Illuminate\\View\\Middleware\\ShareErrorsFromSession' => $vendorDir . '/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php',
|
||||
'Illuminate\\View\\View' => $baseDir . '/overrides/laravel/framework/src/Illuminate/View/View.php',
|
||||
'Illuminate\\View\\ViewFinderInterface' => $vendorDir . '/laravel/framework/src/Illuminate/View/ViewFinderInterface.php',
|
||||
@@ -1826,9 +1826,9 @@ return array(
|
||||
'League\\Flysystem\\File' => $vendorDir . '/league/flysystem/src/File.php',
|
||||
'League\\Flysystem\\FileExistsException' => $vendorDir . '/league/flysystem/src/FileExistsException.php',
|
||||
'League\\Flysystem\\FileNotFoundException' => $vendorDir . '/league/flysystem/src/FileNotFoundException.php',
|
||||
'League\\Flysystem\\Filesystem' => $vendorDir . '/league/flysystem/src/Filesystem.php',
|
||||
'League\\Flysystem\\Filesystem' => $baseDir . '/overrides/league/flysystem/src/Filesystem.php',
|
||||
'League\\Flysystem\\FilesystemException' => $vendorDir . '/league/flysystem/src/FilesystemException.php',
|
||||
'League\\Flysystem\\FilesystemInterface' => $vendorDir . '/league/flysystem/src/FilesystemInterface.php',
|
||||
'League\\Flysystem\\FilesystemInterface' => $baseDir . '/overrides/league/flysystem/src/FilesystemInterface.php',
|
||||
'League\\Flysystem\\FilesystemNotFoundException' => $vendorDir . '/league/flysystem/src/FilesystemNotFoundException.php',
|
||||
'League\\Flysystem\\Handler' => $vendorDir . '/league/flysystem/src/Handler.php',
|
||||
'League\\Flysystem\\InvalidRootException' => $vendorDir . '/league/flysystem/src/InvalidRootException.php',
|
||||
@@ -1871,7 +1871,7 @@ return array(
|
||||
'Lord\\Laroute\\Routes\\Exceptions\\ZeroRoutesException' => $vendorDir . '/lord/laroute/src/Routes/Exceptions/ZeroRoutesException.php',
|
||||
'MailboxesTableSeeder' => $baseDir . '/database/seeds/MailboxesTableSeeder.php',
|
||||
'Mews\\Purifier\\Facades\\Purifier' => $vendorDir . '/mews/purifier/src/Facades/Purifier.php',
|
||||
'Mews\\Purifier\\Purifier' => $vendorDir . '/mews/purifier/src/Purifier.php',
|
||||
'Mews\\Purifier\\Purifier' => $baseDir . '/overrides/mews/purifier/src/Purifier.php',
|
||||
'Mews\\Purifier\\PurifierServiceProvider' => $vendorDir . '/mews/purifier/src/PurifierServiceProvider.php',
|
||||
'Monolog\\ErrorHandler' => $vendorDir . '/monolog/monolog/src/Monolog/ErrorHandler.php',
|
||||
'Monolog\\Formatter\\ChromePHPFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
|
||||
@@ -2537,7 +2537,7 @@ return array(
|
||||
'Ramsey\\Uuid\\Provider\\Time\\FixedTimeProvider' => $vendorDir . '/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php',
|
||||
'Ramsey\\Uuid\\Provider\\Time\\SystemTimeProvider' => $vendorDir . '/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php',
|
||||
'Ramsey\\Uuid\\Uuid' => $baseDir . '/overrides/ramsey/uuid/src/Uuid.php',
|
||||
'Ramsey\\Uuid\\UuidFactory' => $vendorDir . '/ramsey/uuid/src/UuidFactory.php',
|
||||
'Ramsey\\Uuid\\UuidFactory' => $baseDir . '/overrides/ramsey/uuid/src/UuidFactory.php',
|
||||
'Ramsey\\Uuid\\UuidFactoryInterface' => $vendorDir . '/ramsey/uuid/src/UuidFactoryInterface.php',
|
||||
'Ramsey\\Uuid\\UuidInterface' => $vendorDir . '/ramsey/uuid/src/UuidInterface.php',
|
||||
'Rap2hpoutre\\LaravelLogViewer\\LaravelLogViewer' => $baseDir . '/overrides/rap2hpoutre/laravel-log-viewer/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php',
|
||||
@@ -2564,25 +2564,37 @@ return array(
|
||||
'Spatie\\String\\Str' => $baseDir . '/overrides/spatie/string/src/Str.php',
|
||||
'Swift_Attachment' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php',
|
||||
'Swift_EmbeddedFile' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/EmbeddedFile.php',
|
||||
'Swift_Encoder_QpEncoder' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php',
|
||||
'Swift_KeyCache' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache.php',
|
||||
'Swift_KeyCache_DiskKeyCache' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php',
|
||||
'Swift_KeyCache_SimpleKeyCacheInputStream' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php',
|
||||
'Swift_MailTransport' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php',
|
||||
'Swift_Message' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Message.php',
|
||||
'Swift_MimePart' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php',
|
||||
'Swift_Mime_ContentEncoder_Base64ContentEncoder' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php',
|
||||
'Swift_Mime_ContentEncoder_QpContentEncoder' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php',
|
||||
'Swift_Mime_Headers_AbstractHeader' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php',
|
||||
'Swift_Mime_Headers_IdentificationHeader' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php',
|
||||
'Swift_Mime_Headers_MailboxHeader' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php',
|
||||
'Swift_Mime_Headers_ParameterizedHeader' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php',
|
||||
'Swift_Mime_MimePart' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php',
|
||||
'Swift_Mime_SimpleHeaderFactory' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php',
|
||||
'Swift_Mime_SimpleHeaderSet' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php',
|
||||
'Swift_SendmailTransport' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php',
|
||||
'Swift_SmtpTransport' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php',
|
||||
'Swift_SwiftException' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/SwiftException.php',
|
||||
'Swift_Transport_AbstractSmtpTransport' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php',
|
||||
'Swift_Transport_EsmtpTransport' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php',
|
||||
'Swift_Transport_Esmtp_AuthHandler' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php',
|
||||
'Swift_Transport_MailInvoker' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php',
|
||||
'Swift_Transport_MailTransport' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php',
|
||||
'Swift_Transport_SimpleMailInvoker' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php',
|
||||
'Swift_Transport_StreamBuffer' => $baseDir . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php',
|
||||
'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Application.php',
|
||||
'Symfony\\Component\\Console\\Application' => $baseDir . '/overrides/symfony/console/Application.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => $vendorDir . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/ContainerCommandLoader.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\FactoryCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/FactoryCommandLoader.php',
|
||||
'Symfony\\Component\\Console\\Command\\Command' => $vendorDir . '/symfony/console/Command/Command.php',
|
||||
'Symfony\\Component\\Console\\Command\\Command' => $baseDir . '/overrides/symfony/console/Command/Command.php',
|
||||
'Symfony\\Component\\Console\\Command\\HelpCommand' => $vendorDir . '/symfony/console/Command/HelpCommand.php',
|
||||
'Symfony\\Component\\Console\\Command\\ListCommand' => $vendorDir . '/symfony/console/Command/ListCommand.php',
|
||||
'Symfony\\Component\\Console\\Command\\LockableTrait' => $vendorDir . '/symfony/console/Command/LockableTrait.php',
|
||||
@@ -2616,10 +2628,10 @@ return array(
|
||||
'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => $vendorDir . '/symfony/console/Helper/DescriptorHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\FormatterHelper' => $vendorDir . '/symfony/console/Helper/FormatterHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\Helper' => $baseDir . '/overrides/symfony/console/Helper/Helper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperInterface' => $vendorDir . '/symfony/console/Helper/HelperInterface.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperInterface' => $baseDir . '/overrides/symfony/console/Helper/HelperInterface.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperSet' => $baseDir . '/overrides/symfony/console/Helper/HelperSet.php',
|
||||
'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => $vendorDir . '/symfony/console/Helper/InputAwareHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProcessHelper' => $vendorDir . '/symfony/console/Helper/ProcessHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProcessHelper' => $baseDir . '/overrides/symfony/console/Helper/ProcessHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProgressBar' => $vendorDir . '/symfony/console/Helper/ProgressBar.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProgressIndicator' => $vendorDir . '/symfony/console/Helper/ProgressIndicator.php',
|
||||
'Symfony\\Component\\Console\\Helper\\QuestionHelper' => $vendorDir . '/symfony/console/Helper/QuestionHelper.php',
|
||||
@@ -2629,8 +2641,8 @@ return array(
|
||||
'Symfony\\Component\\Console\\Helper\\TableSeparator' => $vendorDir . '/symfony/console/Helper/TableSeparator.php',
|
||||
'Symfony\\Component\\Console\\Helper\\TableStyle' => $vendorDir . '/symfony/console/Helper/TableStyle.php',
|
||||
'Symfony\\Component\\Console\\Input\\ArgvInput' => $vendorDir . '/symfony/console/Input/ArgvInput.php',
|
||||
'Symfony\\Component\\Console\\Input\\ArrayInput' => $vendorDir . '/symfony/console/Input/ArrayInput.php',
|
||||
'Symfony\\Component\\Console\\Input\\Input' => $vendorDir . '/symfony/console/Input/Input.php',
|
||||
'Symfony\\Component\\Console\\Input\\ArrayInput' => $baseDir . '/overrides/symfony/console/Input/ArrayInput.php',
|
||||
'Symfony\\Component\\Console\\Input\\Input' => $baseDir . '/overrides/symfony/console/Input/Input.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputArgument' => $vendorDir . '/symfony/console/Input/InputArgument.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputAwareInterface' => $vendorDir . '/symfony/console/Input/InputAwareInterface.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputDefinition' => $vendorDir . '/symfony/console/Input/InputDefinition.php',
|
||||
@@ -2710,7 +2722,7 @@ return array(
|
||||
'Symfony\\Component\\Debug\\ExceptionHandler' => $baseDir . '/overrides/symfony/debug/ExceptionHandler.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\ClassNotFoundException' => $vendorDir . '/symfony/debug/Exception/ClassNotFoundException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\ContextErrorException' => $vendorDir . '/symfony/debug/Exception/ContextErrorException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => $vendorDir . '/symfony/debug/Exception/FatalErrorException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => $baseDir . '/overrides/symfony/debug/Exception/FatalErrorException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\FatalThrowableError' => $vendorDir . '/symfony/debug/Exception/FatalThrowableError.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\FlattenException' => $vendorDir . '/symfony/debug/Exception/FlattenException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\OutOfMemoryException' => $vendorDir . '/symfony/debug/Exception/OutOfMemoryException.php',
|
||||
@@ -2819,7 +2831,7 @@ return array(
|
||||
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\NativeProxy' => $vendorDir . '/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php',
|
||||
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy' => $vendorDir . '/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php',
|
||||
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => $vendorDir . '/symfony/http-foundation/Session/Storage/SessionStorageInterface.php',
|
||||
'Symfony\\Component\\HttpFoundation\\StreamedResponse' => $vendorDir . '/symfony/http-foundation/StreamedResponse.php',
|
||||
'Symfony\\Component\\HttpFoundation\\StreamedResponse' => $baseDir . '/overrides/symfony/http-foundation/StreamedResponse.php',
|
||||
'Symfony\\Component\\HttpKernel\\Bundle\\Bundle' => $vendorDir . '/symfony/http-kernel/Bundle/Bundle.php',
|
||||
'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface' => $vendorDir . '/symfony/http-kernel/Bundle/BundleInterface.php',
|
||||
'Symfony\\Component\\HttpKernel\\CacheClearer\\CacheClearerInterface' => $vendorDir . '/symfony/http-kernel/CacheClearer/CacheClearerInterface.php',
|
||||
@@ -2906,21 +2918,21 @@ return array(
|
||||
'Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent' => $vendorDir . '/symfony/http-kernel/Event/GetResponseForExceptionEvent.php',
|
||||
'Symfony\\Component\\HttpKernel\\Event\\KernelEvent' => $vendorDir . '/symfony/http-kernel/Event/KernelEvent.php',
|
||||
'Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent' => $vendorDir . '/symfony/http-kernel/Event/PostResponseEvent.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException' => $vendorDir . '/symfony/http-kernel/Exception/AccessDeniedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException' => $baseDir . '/overrides/symfony/http-kernel/Exception/AccessDeniedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException' => $vendorDir . '/symfony/http-kernel/Exception/BadRequestHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\ConflictHttpException' => $vendorDir . '/symfony/http-kernel/Exception/ConflictHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\GoneHttpException' => $vendorDir . '/symfony/http-kernel/Exception/GoneHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\HttpException' => $baseDir . '/overrides/symfony/http-kernel/Exception/HttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface' => $vendorDir . '/symfony/http-kernel/Exception/HttpExceptionInterface.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\LengthRequiredHttpException' => $vendorDir . '/symfony/http-kernel/Exception/LengthRequiredHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException' => $vendorDir . '/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException' => $baseDir . '/overrides/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\NotAcceptableHttpException' => $vendorDir . '/symfony/http-kernel/Exception/NotAcceptableHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException' => $vendorDir . '/symfony/http-kernel/Exception/NotFoundHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException' => $baseDir . '/overrides/symfony/http-kernel/Exception/NotFoundHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\PreconditionFailedHttpException' => $vendorDir . '/symfony/http-kernel/Exception/PreconditionFailedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\PreconditionRequiredHttpException' => $vendorDir . '/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\ServiceUnavailableHttpException' => $vendorDir . '/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\ServiceUnavailableHttpException' => $baseDir . '/overrides/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\TooManyRequestsHttpException' => $vendorDir . '/symfony/http-kernel/Exception/TooManyRequestsHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException' => $vendorDir . '/symfony/http-kernel/Exception/UnauthorizedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException' => $baseDir . '/overrides/symfony/http-kernel/Exception/UnauthorizedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\UnprocessableEntityHttpException' => $vendorDir . '/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\UnsupportedMediaTypeHttpException' => $vendorDir . '/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Fragment\\AbstractSurrogateFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php',
|
||||
@@ -3060,11 +3072,11 @@ return array(
|
||||
'Symfony\\Component\\Translation\\Extractor\\PhpExtractor' => $vendorDir . '/symfony/translation/Extractor/PhpExtractor.php',
|
||||
'Symfony\\Component\\Translation\\Extractor\\PhpStringTokenParser' => $vendorDir . '/symfony/translation/Extractor/PhpStringTokenParser.php',
|
||||
'Symfony\\Component\\Translation\\Formatter\\ChoiceMessageFormatterInterface' => $vendorDir . '/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php',
|
||||
'Symfony\\Component\\Translation\\Formatter\\MessageFormatter' => $vendorDir . '/symfony/translation/Formatter/MessageFormatter.php',
|
||||
'Symfony\\Component\\Translation\\Formatter\\MessageFormatter' => $baseDir . '/overrides/symfony/translation/Formatter/MessageFormatter.php',
|
||||
'Symfony\\Component\\Translation\\Formatter\\MessageFormatterInterface' => $vendorDir . '/symfony/translation/Formatter/MessageFormatterInterface.php',
|
||||
'Symfony\\Component\\Translation\\IdentityTranslator' => $vendorDir . '/symfony/translation/IdentityTranslator.php',
|
||||
'Symfony\\Component\\Translation\\Interval' => $vendorDir . '/symfony/translation/Interval.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\ArrayLoader' => $vendorDir . '/symfony/translation/Loader/ArrayLoader.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\ArrayLoader' => $baseDir . '/overrides/symfony/translation/Loader/ArrayLoader.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\CsvFileLoader' => $vendorDir . '/symfony/translation/Loader/CsvFileLoader.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\FileLoader' => $vendorDir . '/symfony/translation/Loader/FileLoader.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\IcuDatFileLoader' => $vendorDir . '/symfony/translation/Loader/IcuDatFileLoader.php',
|
||||
@@ -3086,7 +3098,7 @@ return array(
|
||||
'Symfony\\Component\\Translation\\PluralizationRules' => $vendorDir . '/symfony/translation/PluralizationRules.php',
|
||||
'Symfony\\Component\\Translation\\Reader\\TranslationReader' => $vendorDir . '/symfony/translation/Reader/TranslationReader.php',
|
||||
'Symfony\\Component\\Translation\\Reader\\TranslationReaderInterface' => $vendorDir . '/symfony/translation/Reader/TranslationReaderInterface.php',
|
||||
'Symfony\\Component\\Translation\\Translator' => $vendorDir . '/symfony/translation/Translator.php',
|
||||
'Symfony\\Component\\Translation\\Translator' => $baseDir . '/overrides/symfony/translation/Translator.php',
|
||||
'Symfony\\Component\\Translation\\TranslatorBagInterface' => $vendorDir . '/symfony/translation/TranslatorBagInterface.php',
|
||||
'Symfony\\Component\\Translation\\TranslatorInterface' => $vendorDir . '/symfony/translation/TranslatorInterface.php',
|
||||
'Symfony\\Component\\Translation\\Util\\ArrayConverter' => $vendorDir . '/symfony/translation/Util/ArrayConverter.php',
|
||||
@@ -3177,12 +3189,13 @@ return array(
|
||||
'Webklex\\PHPIMAP\\Attachment' => $baseDir . '/overrides/webklex/php-imap/src/Attachment.php',
|
||||
'Webklex\\PHPIMAP\\Attribute' => $vendorDir . '/webklex/php-imap/src/Attribute.php',
|
||||
'Webklex\\PHPIMAP\\Client' => $baseDir . '/overrides/webklex/php-imap/src/Client.php',
|
||||
'Webklex\\PHPIMAP\\ClientManager' => $vendorDir . '/webklex/php-imap/src/ClientManager.php',
|
||||
'Webklex\\PHPIMAP\\ClientManager' => $baseDir . '/overrides/webklex/php-imap/src/ClientManager.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\ImapProtocol' => $baseDir . '/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\LegacyProtocol' => $baseDir . '/overrides/webklex/php-imap/src/Connection/Protocols/LegacyProtocol.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\PopProtocol' => $baseDir . '/overrides/webklex/php-imap/src/Connection/Protocols/PopProtocol.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\Protocol' => $vendorDir . '/webklex/php-imap/src/Connection/Protocols/Protocol.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\ProtocolInterface' => $vendorDir . '/webklex/php-imap/src/Connection/Protocols/ProtocolInterface.php',
|
||||
'Webklex\\PHPIMAP\\EncodingAliases' => $vendorDir . '/webklex/php-imap/src/EncodingAliases.php',
|
||||
'Webklex\\PHPIMAP\\EncodingAliases' => $baseDir . '/overrides/webklex/php-imap/src/EncodingAliases.php',
|
||||
'Webklex\\PHPIMAP\\Events\\Event' => $vendorDir . '/webklex/php-imap/src/Events/Event.php',
|
||||
'Webklex\\PHPIMAP\\Events\\FlagDeletedEvent' => $vendorDir . '/webklex/php-imap/src/Events/FlagDeletedEvent.php',
|
||||
'Webklex\\PHPIMAP\\Events\\FlagNewEvent' => $vendorDir . '/webklex/php-imap/src/Events/FlagNewEvent.php',
|
||||
@@ -3212,13 +3225,13 @@ return array(
|
||||
'Webklex\\PHPIMAP\\Exceptions\\NotSupportedCapabilityException' => $vendorDir . '/webklex/php-imap/src/Exceptions/NotSupportedCapabilityException.php',
|
||||
'Webklex\\PHPIMAP\\Exceptions\\ProtocolNotSupportedException' => $vendorDir . '/webklex/php-imap/src/Exceptions/ProtocolNotSupportedException.php',
|
||||
'Webklex\\PHPIMAP\\Exceptions\\RuntimeException' => $vendorDir . '/webklex/php-imap/src/Exceptions/RuntimeException.php',
|
||||
'Webklex\\PHPIMAP\\Folder' => $vendorDir . '/webklex/php-imap/src/Folder.php',
|
||||
'Webklex\\PHPIMAP\\Folder' => $baseDir . '/overrides/webklex/php-imap/src/Folder.php',
|
||||
'Webklex\\PHPIMAP\\Header' => $baseDir . '/overrides/webklex/php-imap/src/Header.php',
|
||||
'Webklex\\PHPIMAP\\IMAP' => $vendorDir . '/webklex/php-imap/src/IMAP.php',
|
||||
'Webklex\\PHPIMAP\\Message' => $baseDir . '/overrides/webklex/php-imap/src/Message.php',
|
||||
'Webklex\\PHPIMAP\\Part' => $baseDir . '/overrides/webklex/php-imap/src/Part.php',
|
||||
'Webklex\\PHPIMAP\\Query\\Query' => $baseDir . '/overrides/webklex/php-imap/src/Query/Query.php',
|
||||
'Webklex\\PHPIMAP\\Query\\WhereQuery' => $vendorDir . '/webklex/php-imap/src/Query/WhereQuery.php',
|
||||
'Webklex\\PHPIMAP\\Query\\WhereQuery' => $baseDir . '/overrides/webklex/php-imap/src/Query/WhereQuery.php',
|
||||
'Webklex\\PHPIMAP\\Structure' => $baseDir . '/overrides/webklex/php-imap/src/Structure.php',
|
||||
'Webklex\\PHPIMAP\\Support\\AttachmentCollection' => $vendorDir . '/webklex/php-imap/src/Support/AttachmentCollection.php',
|
||||
'Webklex\\PHPIMAP\\Support\\FlagCollection' => $vendorDir . '/webklex/php-imap/src/Support/FlagCollection.php',
|
||||
@@ -3229,6 +3242,7 @@ return array(
|
||||
'Webklex\\PHPIMAP\\Support\\MessageCollection' => $vendorDir . '/webklex/php-imap/src/Support/MessageCollection.php',
|
||||
'Webklex\\PHPIMAP\\Support\\PaginatedCollection' => $vendorDir . '/webklex/php-imap/src/Support/PaginatedCollection.php',
|
||||
'Webklex\\PHPIMAP\\Traits\\HasEvents' => $vendorDir . '/webklex/php-imap/src/Traits/HasEvents.php',
|
||||
'Whoops\\Run' => $baseDir . '/overrides/filp/whoops/src/Whoops/Run.php',
|
||||
'XdgBaseDir\\Xdg' => $vendorDir . '/dnoegel/php-xdg-base-dir/src/Xdg.php',
|
||||
'aCssAtBlockEndToken' => $baseDir . '/overrides/natxet/cssmin/src/CssMin.php',
|
||||
'aCssAtBlockStartToken' => $baseDir . '/overrides/natxet/cssmin/src/CssMin.php',
|
||||
|
||||
29
vendor/composer/autoload_psr4.php
vendored
29
vendor/composer/autoload_psr4.php
vendored
@@ -8,9 +8,8 @@ $baseDir = dirname($vendorDir);
|
||||
return array(
|
||||
'enshrined\\svgSanitize\\' => array($vendorDir . '/enshrined/svg-sanitize/src'),
|
||||
'XdgBaseDir\\' => array($vendorDir . '/dnoegel/php-xdg-base-dir/src'),
|
||||
'Whoops\\' => array($baseDir . '/overrides/filp/whoops/src/Whoops'),
|
||||
'Webklex\\PHPIMAP\\' => array($baseDir . '/overrides/webklex/php-imap/src', $vendorDir . '/webklex/php-imap/src'),
|
||||
'Webklex\\IMAP\\Providers\\' => array($baseDir . '/overrides/webklex/laravel-imap/src/IMAP/Providers'),
|
||||
'Webklex\\IMAP\\' => array($baseDir . '/overrides/webklex/laravel-imap/src/IMAP'),
|
||||
'Watson\\Rememberable\\' => array($vendorDir . '/watson/rememberable/src'),
|
||||
'Underscore\\' => array($vendorDir . '/anahkiasen/underscore-php/src', $vendorDir . '/anahkiasen/underscore-php/tests'),
|
||||
'TorMorten\\Eventy\\' => array($baseDir . '/overrides/tormjens/eventy/src', $vendorDir . '/tormjens/eventy/src'),
|
||||
@@ -23,7 +22,9 @@ return array(
|
||||
'Symfony\\Component\\VarDumper\\Dumper\\' => array($baseDir . '/overrides/symfony/var-dumper/Dumper'),
|
||||
'Symfony\\Component\\VarDumper\\Cloner\\' => array($baseDir . '/overrides/symfony/var-dumper/Cloner'),
|
||||
'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'),
|
||||
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
|
||||
'Symfony\\Component\\Translation\\Loader\\' => array($baseDir . '/overrides/symfony/translation/Loader'),
|
||||
'Symfony\\Component\\Translation\\Formatter\\' => array($baseDir . '/overrides/symfony/translation/Formatter'),
|
||||
'Symfony\\Component\\Translation\\' => array($baseDir . '/overrides/symfony/translation', $vendorDir . '/symfony/translation'),
|
||||
'Symfony\\Component\\Routing\\' => array($baseDir . '/overrides/symfony/routing', $vendorDir . '/symfony/routing'),
|
||||
'Symfony\\Component\\Process\\' => array($baseDir . '/overrides/symfony/process', $vendorDir . '/symfony/process'),
|
||||
'Symfony\\Component\\HttpKernel\\HttpCache\\' => array($baseDir . '/overrides/symfony/http-kernel/HttpCache'),
|
||||
@@ -34,12 +35,15 @@ return array(
|
||||
'Symfony\\Component\\Finder\\Iterator\\' => array($baseDir . '/overrides/symfony/finder/Iterator'),
|
||||
'Symfony\\Component\\Finder\\' => array($baseDir . '/overrides/symfony/finder', $vendorDir . '/symfony/finder'),
|
||||
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
|
||||
'Symfony\\Component\\Debug\\Exception\\' => array($baseDir . '/overrides/symfony/debug/Exception'),
|
||||
'Symfony\\Component\\Debug\\' => array($baseDir . '/overrides/symfony/debug', $vendorDir . '/symfony/debug'),
|
||||
'Symfony\\Component\\CssSelector\\XPath\\Extension\\' => array($baseDir . '/overrides/symfony/css-selector/XPath/Extension'),
|
||||
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
|
||||
'Symfony\\Component\\Console\\Input\\' => array($baseDir . '/overrides/symfony/console/Input'),
|
||||
'Symfony\\Component\\Console\\Helper\\' => array($baseDir . '/overrides/symfony/console/Helper'),
|
||||
'Symfony\\Component\\Console\\Descriptor\\' => array($baseDir . '/overrides/symfony/console/Descriptor'),
|
||||
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
|
||||
'Symfony\\Component\\Console\\Command\\' => array($baseDir . '/overrides/symfony/console/Command'),
|
||||
'Symfony\\Component\\Console\\' => array($baseDir . '/overrides/symfony/console', $vendorDir . '/symfony/console'),
|
||||
'Spatie\\String\\' => array($baseDir . '/overrides/spatie/string/src', $vendorDir . '/spatie/string/src'),
|
||||
'Spatie\\Activitylog\\' => array($vendorDir . '/spatie/laravel-activitylog/src'),
|
||||
'Rap2hpoutre\\LaravelLogViewer\\' => array($baseDir . '/overrides/rap2hpoutre/laravel-log-viewer/src/Rap2hpoutre/LaravelLogViewer'),
|
||||
@@ -60,11 +64,11 @@ return array(
|
||||
'Nwidart\\Modules\\' => array($baseDir . '/overrides/nwidart/laravel-modules/src', $vendorDir . '/nwidart/laravel-modules/src'),
|
||||
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
|
||||
'Modules\\' => array($baseDir . '/Modules'),
|
||||
'Mews\\Purifier\\' => array($vendorDir . '/mews/purifier/src'),
|
||||
'Mews\\Purifier\\' => array($baseDir . '/overrides/mews/purifier/src', $vendorDir . '/mews/purifier/src'),
|
||||
'Lord\\Laroute\\Routes\\' => array($baseDir . '/overrides/lord/laroute/src/Routes'),
|
||||
'Lord\\Laroute\\' => array($vendorDir . '/lord/laroute/src'),
|
||||
'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'),
|
||||
'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),
|
||||
'League\\Flysystem\\' => array($baseDir . '/overrides/league/flysystem/src', $vendorDir . '/league/flysystem/src'),
|
||||
'Laravel\\Tinker\\' => array($vendorDir . '/laravel/tinker/src'),
|
||||
'Javoscript\\MacroableModels\\' => array($baseDir . '/overrides/javoscript/laravel-macroable-models/src', $vendorDir . '/javoscript/laravel-macroable-models/src'),
|
||||
'JakubOnderka\\PhpConsoleHighlighter\\' => array($vendorDir . '/jakub-onderka/php-console-highlighter/src'),
|
||||
@@ -74,29 +78,40 @@ return array(
|
||||
'Illuminate\\View\\Compilers\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/View/Compilers'),
|
||||
'Illuminate\\View\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/View'),
|
||||
'Illuminate\\Validation\\Concerns\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Validation/Concerns'),
|
||||
'Illuminate\\Validation\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Validation'),
|
||||
'Illuminate\\Support\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Support'),
|
||||
'Illuminate\\Session\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Session'),
|
||||
'Illuminate\\Routing\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Routing'),
|
||||
'Illuminate\\Queue\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Queue'),
|
||||
'Illuminate\\Pipeline\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Pipeline'),
|
||||
'Illuminate\\Pagination\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Pagination'),
|
||||
'Illuminate\\Notifications\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Notifications'),
|
||||
'Illuminate\\Mail\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Mail'),
|
||||
'Illuminate\\Log\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Log'),
|
||||
'Illuminate\\Http\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Http'),
|
||||
'Illuminate\\Foundation\\Testing\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Foundation/Testing'),
|
||||
'Illuminate\\Foundation\\Http\\Middleware\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Foundation/Http/Middleware'),
|
||||
'Illuminate\\Foundation\\Bootstrap\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Foundation/Bootstrap'),
|
||||
'Illuminate\\Foundation\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Foundation'),
|
||||
'Illuminate\\Filesystem\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Filesystem'),
|
||||
'Illuminate\\Database\\Schema\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Schema'),
|
||||
'Illuminate\\Database\\Query\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Query'),
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Relations'),
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Concerns'),
|
||||
'Illuminate\\Database\\Eloquent\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent'),
|
||||
'Illuminate\\Database\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Database'),
|
||||
'Illuminate\\Cookie\\Middleware\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Cookie/Middleware'),
|
||||
'Illuminate\\Cookie\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Cookie'),
|
||||
'Illuminate\\Container\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Container'),
|
||||
'Illuminate\\Console\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Console'),
|
||||
'Illuminate\\Config\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Config'),
|
||||
'Illuminate\\Cache\\Console\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Cache/Console'),
|
||||
'Illuminate\\Cache\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Cache'),
|
||||
'Illuminate\\Bus\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Bus'),
|
||||
'Illuminate\\Broadcasting\\Broadcasters\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Broadcasting/Broadcasters'),
|
||||
'Illuminate\\Broadcasting\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Broadcasting'),
|
||||
'Illuminate\\Auth\\Middleware\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Auth/Middleware'),
|
||||
'Illuminate\\Auth\\Access\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Auth/Access'),
|
||||
'Illuminate\\Auth\\' => array($baseDir . '/overrides/laravel/framework/src/Illuminate/Auth'),
|
||||
'Illuminate\\' => array($vendorDir . '/laravel/framework/src/Illuminate'),
|
||||
'Html2Text\\' => array($vendorDir . '/html2text/html2text/src', $vendorDir . '/html2text/html2text/test'),
|
||||
@@ -121,7 +136,7 @@ return array(
|
||||
'Devfactory\\Minify\\' => array($vendorDir . '/devfactory/minify/src'),
|
||||
'DebugBar\\DataFormatter\\' => array($baseDir . '/overrides/maximebf/debugbar/src/DataFormatter/DataFormatter'),
|
||||
'DebugBar\\' => array($baseDir . '/overrides/maximebf/debugbar/src/DebugBar'),
|
||||
'Cron\\' => array($vendorDir . '/mtdowling/cron-expression/src/Cron'),
|
||||
'Cron\\' => array($baseDir . '/overrides/mtdowling/cron-expression/src/Cron', $vendorDir . '/mtdowling/cron-expression/src/Cron'),
|
||||
'Codedge\\Updater\\SourceRepositoryTypes\\' => array($baseDir . '/overrides/codedge/laravel-selfupdater/src/SourceRepositoryTypes'),
|
||||
'Codedge\\Updater\\' => array($vendorDir . '/codedge/laravel-selfupdater/src'),
|
||||
'Chumper\\Zipper\\Repositories\\' => array($baseDir . '/overrides/chumper/zipper/src/Chumper/Zipper/Repositories'),
|
||||
|
||||
220
vendor/composer/autoload_static.php
vendored
220
vendor/composer/autoload_static.php
vendored
@@ -41,9 +41,8 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
),
|
||||
'W' =>
|
||||
array (
|
||||
'Whoops\\' => 7,
|
||||
'Webklex\\PHPIMAP\\' => 16,
|
||||
'Webklex\\IMAP\\Providers\\' => 23,
|
||||
'Webklex\\IMAP\\' => 13,
|
||||
'Watson\\Rememberable\\' => 20,
|
||||
),
|
||||
'U' =>
|
||||
@@ -65,6 +64,8 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\VarDumper\\Dumper\\' => 35,
|
||||
'Symfony\\Component\\VarDumper\\Cloner\\' => 35,
|
||||
'Symfony\\Component\\VarDumper\\' => 28,
|
||||
'Symfony\\Component\\Translation\\Loader\\' => 37,
|
||||
'Symfony\\Component\\Translation\\Formatter\\' => 40,
|
||||
'Symfony\\Component\\Translation\\' => 30,
|
||||
'Symfony\\Component\\Routing\\' => 26,
|
||||
'Symfony\\Component\\Process\\' => 26,
|
||||
@@ -76,11 +77,14 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\Finder\\Iterator\\' => 34,
|
||||
'Symfony\\Component\\Finder\\' => 25,
|
||||
'Symfony\\Component\\EventDispatcher\\' => 34,
|
||||
'Symfony\\Component\\Debug\\Exception\\' => 34,
|
||||
'Symfony\\Component\\Debug\\' => 24,
|
||||
'Symfony\\Component\\CssSelector\\XPath\\Extension\\' => 46,
|
||||
'Symfony\\Component\\CssSelector\\' => 30,
|
||||
'Symfony\\Component\\Console\\Input\\' => 32,
|
||||
'Symfony\\Component\\Console\\Helper\\' => 33,
|
||||
'Symfony\\Component\\Console\\Descriptor\\' => 37,
|
||||
'Symfony\\Component\\Console\\Command\\' => 34,
|
||||
'Symfony\\Component\\Console\\' => 26,
|
||||
'Spatie\\String\\' => 14,
|
||||
'Spatie\\Activitylog\\' => 19,
|
||||
@@ -137,29 +141,40 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\View\\Compilers\\' => 26,
|
||||
'Illuminate\\View\\' => 16,
|
||||
'Illuminate\\Validation\\Concerns\\' => 31,
|
||||
'Illuminate\\Validation\\' => 22,
|
||||
'Illuminate\\Support\\' => 19,
|
||||
'Illuminate\\Session\\' => 19,
|
||||
'Illuminate\\Routing\\' => 19,
|
||||
'Illuminate\\Queue\\' => 17,
|
||||
'Illuminate\\Pipeline\\' => 20,
|
||||
'Illuminate\\Pagination\\' => 22,
|
||||
'Illuminate\\Notifications\\' => 25,
|
||||
'Illuminate\\Mail\\' => 16,
|
||||
'Illuminate\\Log\\' => 15,
|
||||
'Illuminate\\Http\\' => 16,
|
||||
'Illuminate\\Foundation\\Testing\\' => 30,
|
||||
'Illuminate\\Foundation\\Http\\Middleware\\' => 38,
|
||||
'Illuminate\\Foundation\\Bootstrap\\' => 32,
|
||||
'Illuminate\\Foundation\\' => 22,
|
||||
'Illuminate\\Filesystem\\' => 22,
|
||||
'Illuminate\\Database\\Schema\\' => 27,
|
||||
'Illuminate\\Database\\Query\\' => 26,
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\' => 39,
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\' => 38,
|
||||
'Illuminate\\Database\\Eloquent\\' => 29,
|
||||
'Illuminate\\Database\\' => 20,
|
||||
'Illuminate\\Cookie\\Middleware\\' => 29,
|
||||
'Illuminate\\Cookie\\' => 18,
|
||||
'Illuminate\\Container\\' => 21,
|
||||
'Illuminate\\Console\\' => 19,
|
||||
'Illuminate\\Config\\' => 18,
|
||||
'Illuminate\\Cache\\Console\\' => 25,
|
||||
'Illuminate\\Cache\\' => 17,
|
||||
'Illuminate\\Bus\\' => 15,
|
||||
'Illuminate\\Broadcasting\\Broadcasters\\' => 37,
|
||||
'Illuminate\\Broadcasting\\' => 24,
|
||||
'Illuminate\\Auth\\Middleware\\' => 27,
|
||||
'Illuminate\\Auth\\Access\\' => 23,
|
||||
'Illuminate\\Auth\\' => 16,
|
||||
'Illuminate\\' => 11,
|
||||
),
|
||||
@@ -232,19 +247,15 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src',
|
||||
),
|
||||
'Whoops\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/filp/whoops/src/Whoops',
|
||||
),
|
||||
'Webklex\\PHPIMAP\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src',
|
||||
1 => __DIR__ . '/..' . '/webklex/php-imap/src',
|
||||
),
|
||||
'Webklex\\IMAP\\Providers\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/webklex/laravel-imap/src/IMAP/Providers',
|
||||
),
|
||||
'Webklex\\IMAP\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/webklex/laravel-imap/src/IMAP',
|
||||
),
|
||||
'Watson\\Rememberable\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/watson/rememberable/src',
|
||||
@@ -295,9 +306,18 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/var-dumper',
|
||||
),
|
||||
'Symfony\\Component\\Translation\\Loader\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/translation/Loader',
|
||||
),
|
||||
'Symfony\\Component\\Translation\\Formatter\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/translation/Formatter',
|
||||
),
|
||||
'Symfony\\Component\\Translation\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/translation',
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/translation',
|
||||
1 => __DIR__ . '/..' . '/symfony/translation',
|
||||
),
|
||||
'Symfony\\Component\\Routing\\' =>
|
||||
array (
|
||||
@@ -344,6 +364,10 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/event-dispatcher',
|
||||
),
|
||||
'Symfony\\Component\\Debug\\Exception\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/debug/Exception',
|
||||
),
|
||||
'Symfony\\Component\\Debug\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/debug',
|
||||
@@ -357,6 +381,10 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/css-selector',
|
||||
),
|
||||
'Symfony\\Component\\Console\\Input\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/console/Input',
|
||||
),
|
||||
'Symfony\\Component\\Console\\Helper\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/console/Helper',
|
||||
@@ -365,9 +393,14 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/console/Descriptor',
|
||||
),
|
||||
'Symfony\\Component\\Console\\Command\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/console/Command',
|
||||
),
|
||||
'Symfony\\Component\\Console\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/console',
|
||||
0 => __DIR__ . '/../..' . '/overrides/symfony/console',
|
||||
1 => __DIR__ . '/..' . '/symfony/console',
|
||||
),
|
||||
'Spatie\\String\\' =>
|
||||
array (
|
||||
@@ -454,7 +487,8 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
),
|
||||
'Mews\\Purifier\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/mews/purifier/src',
|
||||
0 => __DIR__ . '/../..' . '/overrides/mews/purifier/src',
|
||||
1 => __DIR__ . '/..' . '/mews/purifier/src',
|
||||
),
|
||||
'Lord\\Laroute\\Routes\\' =>
|
||||
array (
|
||||
@@ -470,7 +504,8 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
),
|
||||
'League\\Flysystem\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/league/flysystem/src',
|
||||
0 => __DIR__ . '/../..' . '/overrides/league/flysystem/src',
|
||||
1 => __DIR__ . '/..' . '/league/flysystem/src',
|
||||
),
|
||||
'Laravel\\Tinker\\' =>
|
||||
array (
|
||||
@@ -509,6 +544,10 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Validation/Concerns',
|
||||
),
|
||||
'Illuminate\\Validation\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Validation',
|
||||
),
|
||||
'Illuminate\\Support\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Support',
|
||||
@@ -525,14 +564,26 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Queue',
|
||||
),
|
||||
'Illuminate\\Pipeline\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Pipeline',
|
||||
),
|
||||
'Illuminate\\Pagination\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Pagination',
|
||||
),
|
||||
'Illuminate\\Notifications\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Notifications',
|
||||
),
|
||||
'Illuminate\\Mail\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Mail',
|
||||
),
|
||||
'Illuminate\\Log\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Log',
|
||||
),
|
||||
'Illuminate\\Http\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Http',
|
||||
@@ -557,6 +608,18 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Filesystem',
|
||||
),
|
||||
'Illuminate\\Database\\Schema\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Schema',
|
||||
),
|
||||
'Illuminate\\Database\\Query\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Query',
|
||||
),
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Relations',
|
||||
),
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Concerns',
|
||||
@@ -581,6 +644,10 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Container',
|
||||
),
|
||||
'Illuminate\\Console\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Console',
|
||||
),
|
||||
'Illuminate\\Config\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Config',
|
||||
@@ -593,14 +660,26 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Cache',
|
||||
),
|
||||
'Illuminate\\Bus\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Bus',
|
||||
),
|
||||
'Illuminate\\Broadcasting\\Broadcasters\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Broadcasting/Broadcasters',
|
||||
),
|
||||
'Illuminate\\Broadcasting\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Broadcasting',
|
||||
),
|
||||
'Illuminate\\Auth\\Middleware\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Auth/Middleware',
|
||||
),
|
||||
'Illuminate\\Auth\\Access\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Auth/Access',
|
||||
),
|
||||
'Illuminate\\Auth\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Auth',
|
||||
@@ -703,7 +782,8 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
),
|
||||
'Cron\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron',
|
||||
0 => __DIR__ . '/../..' . '/overrides/mtdowling/cron-expression/src/Cron',
|
||||
1 => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron',
|
||||
),
|
||||
'Codedge\\Updater\\SourceRepositoryTypes\\' =>
|
||||
array (
|
||||
@@ -984,7 +1064,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Carbon\\CarbonPeriod' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/CarbonPeriod.php',
|
||||
'Carbon\\Exceptions\\InvalidDateException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php',
|
||||
'Carbon\\Laravel\\ServiceProvider' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php',
|
||||
'Carbon\\Translator' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Translator.php',
|
||||
'Carbon\\Translator' => __DIR__ . '/../..' . '/overrides/nesbot/carbon/src/Carbon/Translator.php',
|
||||
'Chumper\\Zipper\\Facades\\Zipper' => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper/Facades/Zipper.php',
|
||||
'Chumper\\Zipper\\Repositories\\RepositoryInterface' => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper/Repositories/RepositoryInterface.php',
|
||||
'Chumper\\Zipper\\Repositories\\ZipRepository' => __DIR__ . '/../..' . '/overrides/chumper/zipper/src/Chumper/Zipper/Repositories/ZipRepository.php',
|
||||
@@ -1007,7 +1087,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Codedge\\Updater\\UpdaterServiceProvider' => __DIR__ . '/..' . '/codedge/laravel-selfupdater/src/UpdaterServiceProvider.php',
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'Cron\\AbstractField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/AbstractField.php',
|
||||
'Cron\\CronExpression' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/CronExpression.php',
|
||||
'Cron\\CronExpression' => __DIR__ . '/../..' . '/overrides/mtdowling/cron-expression/src/Cron/CronExpression.php',
|
||||
'Cron\\DayOfMonthField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/DayOfMonthField.php',
|
||||
'Cron\\DayOfWeekField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/DayOfWeekField.php',
|
||||
'Cron\\FieldFactory' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/FieldFactory.php',
|
||||
@@ -1524,7 +1604,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'GuzzleHttp\\Exception\\ServerException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ServerException.php',
|
||||
'GuzzleHttp\\Exception\\TooManyRedirectsException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php',
|
||||
'GuzzleHttp\\Exception\\TransferException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/TransferException.php',
|
||||
'GuzzleHttp\\HandlerStack' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/HandlerStack.php',
|
||||
'GuzzleHttp\\HandlerStack' => __DIR__ . '/../..' . '/overrides/guzzlehttp/guzzle/src/HandlerStack.php',
|
||||
'GuzzleHttp\\Handler\\CurlFactory' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php',
|
||||
'GuzzleHttp\\Handler\\CurlFactoryInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php',
|
||||
'GuzzleHttp\\Handler\\CurlHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php',
|
||||
@@ -1820,7 +1900,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'HTMLPurifier_Zipper' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier/Zipper.php',
|
||||
'Html2Text\\Html2Text' => __DIR__ . '/..' . '/html2text/html2text/src/Html2Text.php',
|
||||
'Illuminate\\Auth\\Access\\AuthorizationException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php',
|
||||
'Illuminate\\Auth\\Access\\Gate' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/Gate.php',
|
||||
'Illuminate\\Auth\\Access\\Gate' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Auth/Access/Gate.php',
|
||||
'Illuminate\\Auth\\Access\\HandlesAuthorization' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php',
|
||||
'Illuminate\\Auth\\Access\\Response' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/Response.php',
|
||||
'Illuminate\\Auth\\AuthManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/AuthManager.php',
|
||||
@@ -1860,7 +1940,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Broadcasting\\BroadcastController' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastEvent' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastManager' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php',
|
||||
'Illuminate\\Broadcasting\\BroadcastServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php',
|
||||
'Illuminate\\Broadcasting\\Broadcasters\\Broadcaster' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php',
|
||||
'Illuminate\\Broadcasting\\Broadcasters\\LogBroadcaster' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php',
|
||||
@@ -1873,7 +1953,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Broadcasting\\PresenceChannel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php',
|
||||
'Illuminate\\Broadcasting\\PrivateChannel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Broadcasting/PrivateChannel.php',
|
||||
'Illuminate\\Bus\\BusServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php',
|
||||
'Illuminate\\Bus\\Dispatcher' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Bus/Dispatcher.php',
|
||||
'Illuminate\\Bus\\Dispatcher' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Bus/Dispatcher.php',
|
||||
'Illuminate\\Bus\\Queueable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Bus/Queueable.php',
|
||||
'Illuminate\\Cache\\ApcStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/ApcStore.php',
|
||||
'Illuminate\\Cache\\ApcWrapper' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/ApcWrapper.php',
|
||||
@@ -1905,7 +1985,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Cache\\TaggableStore' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/TaggableStore.php',
|
||||
'Illuminate\\Cache\\TaggedCache' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Cache/TaggedCache.php',
|
||||
'Illuminate\\Config\\Repository' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Config/Repository.php',
|
||||
'Illuminate\\Console\\Application' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Application.php',
|
||||
'Illuminate\\Console\\Application' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Console/Application.php',
|
||||
'Illuminate\\Console\\Command' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/Command.php',
|
||||
'Illuminate\\Console\\ConfirmableTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php',
|
||||
'Illuminate\\Console\\DetectsApplicationNamespace' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php',
|
||||
@@ -2051,16 +2131,16 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Database\\DatabaseServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php',
|
||||
'Illuminate\\Database\\DetectsDeadlocks' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/DetectsDeadlocks.php',
|
||||
'Illuminate\\Database\\DetectsLostConnections' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php',
|
||||
'Illuminate\\Database\\Eloquent\\Builder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php',
|
||||
'Illuminate\\Database\\Eloquent\\Builder' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php',
|
||||
'Illuminate\\Database\\Eloquent\\Collection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\GuardsAttributes' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasAttributes' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasEvents' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasGlobalScopes' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasGlobalScopes' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasRelationships' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HasTimestamps' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\HidesAttributes' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\QueriesRelationships' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php',
|
||||
'Illuminate\\Database\\Eloquent\\Concerns\\QueriesRelationships' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php',
|
||||
'Illuminate\\Database\\Eloquent\\Factory' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php',
|
||||
'Illuminate\\Database\\Eloquent\\FactoryBuilder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php',
|
||||
'Illuminate\\Database\\Eloquent\\JsonEncodingException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php',
|
||||
@@ -2084,7 +2164,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\MorphTo' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php',
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\MorphToMany' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php',
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\Pivot' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php',
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\Relation' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php',
|
||||
'Illuminate\\Database\\Eloquent\\Relations\\Relation' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php',
|
||||
'Illuminate\\Database\\Eloquent\\Scope' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php',
|
||||
'Illuminate\\Database\\Eloquent\\SoftDeletes' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletes.php',
|
||||
'Illuminate\\Database\\Eloquent\\SoftDeletingScope' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php',
|
||||
@@ -2104,7 +2184,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Database\\MySqlConnection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/MySqlConnection.php',
|
||||
'Illuminate\\Database\\PostgresConnection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/PostgresConnection.php',
|
||||
'Illuminate\\Database\\QueryException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/QueryException.php',
|
||||
'Illuminate\\Database\\Query\\Builder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Builder.php',
|
||||
'Illuminate\\Database\\Query\\Builder' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Query/Builder.php',
|
||||
'Illuminate\\Database\\Query\\Expression' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Expression.php',
|
||||
'Illuminate\\Database\\Query\\Grammars\\Grammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php',
|
||||
'Illuminate\\Database\\Query\\Grammars\\MySqlGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php',
|
||||
@@ -2120,7 +2200,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Database\\Query\\Processors\\SqlServerProcessor' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php',
|
||||
'Illuminate\\Database\\SQLiteConnection' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/SQLiteConnection.php',
|
||||
'Illuminate\\Database\\Schema\\Blueprint' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php',
|
||||
'Illuminate\\Database\\Schema\\Builder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Builder.php',
|
||||
'Illuminate\\Database\\Schema\\Builder' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Database/Schema/Builder.php',
|
||||
'Illuminate\\Database\\Schema\\Grammars\\ChangeColumn' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php',
|
||||
'Illuminate\\Database\\Schema\\Grammars\\Grammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php',
|
||||
'Illuminate\\Database\\Schema\\Grammars\\MySqlGrammar' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php',
|
||||
@@ -2267,7 +2347,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Http\\JsonResponse' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/JsonResponse.php',
|
||||
'Illuminate\\Http\\Middleware\\CheckResponseForModifications' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php',
|
||||
'Illuminate\\Http\\Middleware\\FrameGuard' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php',
|
||||
'Illuminate\\Http\\RedirectResponse' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/RedirectResponse.php',
|
||||
'Illuminate\\Http\\RedirectResponse' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Http/RedirectResponse.php',
|
||||
'Illuminate\\Http\\Request' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Http/Request.php',
|
||||
'Illuminate\\Http\\Resources\\CollectsResources' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php',
|
||||
'Illuminate\\Http\\Resources\\ConditionallyLoadsAttributes' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php',
|
||||
@@ -2288,12 +2368,12 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Http\\UploadedFile' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Http/UploadedFile.php',
|
||||
'Illuminate\\Log\\Events\\MessageLogged' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php',
|
||||
'Illuminate\\Log\\LogServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Log/LogServiceProvider.php',
|
||||
'Illuminate\\Log\\Writer' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Log/Writer.php',
|
||||
'Illuminate\\Log\\Writer' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Log/Writer.php',
|
||||
'Illuminate\\Mail\\Events\\MessageSending' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php',
|
||||
'Illuminate\\Mail\\Events\\MessageSent' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php',
|
||||
'Illuminate\\Mail\\MailServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php',
|
||||
'Illuminate\\Mail\\Mailable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Mailable.php',
|
||||
'Illuminate\\Mail\\Mailer' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Mailer.php',
|
||||
'Illuminate\\Mail\\Mailer' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Mail/Mailer.php',
|
||||
'Illuminate\\Mail\\Markdown' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Markdown.php',
|
||||
'Illuminate\\Mail\\Message' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Message.php',
|
||||
'Illuminate\\Mail\\PendingMail' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/PendingMail.php',
|
||||
@@ -2308,7 +2388,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Mail\\Transport\\Transport' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Mail/Transport/Transport.php',
|
||||
'Illuminate\\Notifications\\Action' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/Action.php',
|
||||
'Illuminate\\Notifications\\AnonymousNotifiable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php',
|
||||
'Illuminate\\Notifications\\ChannelManager' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/ChannelManager.php',
|
||||
'Illuminate\\Notifications\\ChannelManager' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Notifications/ChannelManager.php',
|
||||
'Illuminate\\Notifications\\Channels\\BroadcastChannel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php',
|
||||
'Illuminate\\Notifications\\Channels\\DatabaseChannel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php',
|
||||
'Illuminate\\Notifications\\Channels\\MailChannel' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php',
|
||||
@@ -2332,17 +2412,17 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Notifications\\Messages\\SlackMessage' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/Messages/SlackMessage.php',
|
||||
'Illuminate\\Notifications\\Notifiable' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/Notifiable.php',
|
||||
'Illuminate\\Notifications\\Notification' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/Notification.php',
|
||||
'Illuminate\\Notifications\\NotificationSender' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/NotificationSender.php',
|
||||
'Illuminate\\Notifications\\NotificationSender' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Notifications/NotificationSender.php',
|
||||
'Illuminate\\Notifications\\NotificationServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php',
|
||||
'Illuminate\\Notifications\\RoutesNotifications' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php',
|
||||
'Illuminate\\Notifications\\SendQueuedNotifications' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php',
|
||||
'Illuminate\\Notifications\\RoutesNotifications' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php',
|
||||
'Illuminate\\Notifications\\SendQueuedNotifications' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php',
|
||||
'Illuminate\\Pagination\\AbstractPaginator' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php',
|
||||
'Illuminate\\Pagination\\LengthAwarePaginator' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php',
|
||||
'Illuminate\\Pagination\\PaginationServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php',
|
||||
'Illuminate\\Pagination\\Paginator' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Pagination/Paginator.php',
|
||||
'Illuminate\\Pagination\\UrlWindow' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pagination/UrlWindow.php',
|
||||
'Illuminate\\Pipeline\\Hub' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pipeline/Hub.php',
|
||||
'Illuminate\\Pipeline\\Pipeline' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pipeline/Pipeline.php',
|
||||
'Illuminate\\Pipeline\\Pipeline' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Pipeline/Pipeline.php',
|
||||
'Illuminate\\Pipeline\\PipelineServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php',
|
||||
'Illuminate\\Queue\\BeanstalkdQueue' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php',
|
||||
'Illuminate\\Queue\\CallQueuedHandler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php',
|
||||
@@ -2540,7 +2620,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Validation\\Concerns\\ReplacesAttributes' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php',
|
||||
'Illuminate\\Validation\\Concerns\\ValidatesAttributes' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php',
|
||||
'Illuminate\\Validation\\DatabasePresenceVerifier' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php',
|
||||
'Illuminate\\Validation\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/Factory.php',
|
||||
'Illuminate\\Validation\\Factory' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Validation/Factory.php',
|
||||
'Illuminate\\Validation\\PresenceVerifierInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php',
|
||||
'Illuminate\\Validation\\Rule' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/Rule.php',
|
||||
'Illuminate\\Validation\\Rules\\DatabaseRule' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php',
|
||||
@@ -2553,7 +2633,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\Validation\\ValidatesWhenResolvedTrait' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php',
|
||||
'Illuminate\\Validation\\ValidationData' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/ValidationData.php',
|
||||
'Illuminate\\Validation\\ValidationException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/ValidationException.php',
|
||||
'Illuminate\\Validation\\ValidationRuleParser' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php',
|
||||
'Illuminate\\Validation\\ValidationRuleParser' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php',
|
||||
'Illuminate\\Validation\\ValidationServiceProvider' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php',
|
||||
'Illuminate\\Validation\\Validator' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Validation/Validator.php',
|
||||
'Illuminate\\View\\Compilers\\BladeCompiler' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php',
|
||||
@@ -2584,7 +2664,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Illuminate\\View\\Engines\\FileEngine' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Engines/FileEngine.php',
|
||||
'Illuminate\\View\\Engines\\PhpEngine' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php',
|
||||
'Illuminate\\View\\Factory' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Factory.php',
|
||||
'Illuminate\\View\\FileViewFinder' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/FileViewFinder.php',
|
||||
'Illuminate\\View\\FileViewFinder' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/View/FileViewFinder.php',
|
||||
'Illuminate\\View\\Middleware\\ShareErrorsFromSession' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php',
|
||||
'Illuminate\\View\\View' => __DIR__ . '/../..' . '/overrides/laravel/framework/src/Illuminate/View/View.php',
|
||||
'Illuminate\\View\\ViewFinderInterface' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/View/ViewFinderInterface.php',
|
||||
@@ -2626,9 +2706,9 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'League\\Flysystem\\File' => __DIR__ . '/..' . '/league/flysystem/src/File.php',
|
||||
'League\\Flysystem\\FileExistsException' => __DIR__ . '/..' . '/league/flysystem/src/FileExistsException.php',
|
||||
'League\\Flysystem\\FileNotFoundException' => __DIR__ . '/..' . '/league/flysystem/src/FileNotFoundException.php',
|
||||
'League\\Flysystem\\Filesystem' => __DIR__ . '/..' . '/league/flysystem/src/Filesystem.php',
|
||||
'League\\Flysystem\\Filesystem' => __DIR__ . '/../..' . '/overrides/league/flysystem/src/Filesystem.php',
|
||||
'League\\Flysystem\\FilesystemException' => __DIR__ . '/..' . '/league/flysystem/src/FilesystemException.php',
|
||||
'League\\Flysystem\\FilesystemInterface' => __DIR__ . '/..' . '/league/flysystem/src/FilesystemInterface.php',
|
||||
'League\\Flysystem\\FilesystemInterface' => __DIR__ . '/../..' . '/overrides/league/flysystem/src/FilesystemInterface.php',
|
||||
'League\\Flysystem\\FilesystemNotFoundException' => __DIR__ . '/..' . '/league/flysystem/src/FilesystemNotFoundException.php',
|
||||
'League\\Flysystem\\Handler' => __DIR__ . '/..' . '/league/flysystem/src/Handler.php',
|
||||
'League\\Flysystem\\InvalidRootException' => __DIR__ . '/..' . '/league/flysystem/src/InvalidRootException.php',
|
||||
@@ -2671,7 +2751,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Lord\\Laroute\\Routes\\Exceptions\\ZeroRoutesException' => __DIR__ . '/..' . '/lord/laroute/src/Routes/Exceptions/ZeroRoutesException.php',
|
||||
'MailboxesTableSeeder' => __DIR__ . '/../..' . '/database/seeds/MailboxesTableSeeder.php',
|
||||
'Mews\\Purifier\\Facades\\Purifier' => __DIR__ . '/..' . '/mews/purifier/src/Facades/Purifier.php',
|
||||
'Mews\\Purifier\\Purifier' => __DIR__ . '/..' . '/mews/purifier/src/Purifier.php',
|
||||
'Mews\\Purifier\\Purifier' => __DIR__ . '/../..' . '/overrides/mews/purifier/src/Purifier.php',
|
||||
'Mews\\Purifier\\PurifierServiceProvider' => __DIR__ . '/..' . '/mews/purifier/src/PurifierServiceProvider.php',
|
||||
'Monolog\\ErrorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/ErrorHandler.php',
|
||||
'Monolog\\Formatter\\ChromePHPFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
|
||||
@@ -3337,7 +3417,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Ramsey\\Uuid\\Provider\\Time\\FixedTimeProvider' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php',
|
||||
'Ramsey\\Uuid\\Provider\\Time\\SystemTimeProvider' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php',
|
||||
'Ramsey\\Uuid\\Uuid' => __DIR__ . '/../..' . '/overrides/ramsey/uuid/src/Uuid.php',
|
||||
'Ramsey\\Uuid\\UuidFactory' => __DIR__ . '/..' . '/ramsey/uuid/src/UuidFactory.php',
|
||||
'Ramsey\\Uuid\\UuidFactory' => __DIR__ . '/../..' . '/overrides/ramsey/uuid/src/UuidFactory.php',
|
||||
'Ramsey\\Uuid\\UuidFactoryInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/UuidFactoryInterface.php',
|
||||
'Ramsey\\Uuid\\UuidInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/UuidInterface.php',
|
||||
'Rap2hpoutre\\LaravelLogViewer\\LaravelLogViewer' => __DIR__ . '/../..' . '/overrides/rap2hpoutre/laravel-log-viewer/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php',
|
||||
@@ -3364,25 +3444,37 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Spatie\\String\\Str' => __DIR__ . '/../..' . '/overrides/spatie/string/src/Str.php',
|
||||
'Swift_Attachment' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php',
|
||||
'Swift_EmbeddedFile' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/EmbeddedFile.php',
|
||||
'Swift_Encoder_QpEncoder' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php',
|
||||
'Swift_KeyCache' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache.php',
|
||||
'Swift_KeyCache_DiskKeyCache' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php',
|
||||
'Swift_KeyCache_SimpleKeyCacheInputStream' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php',
|
||||
'Swift_MailTransport' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php',
|
||||
'Swift_Message' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Message.php',
|
||||
'Swift_MimePart' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php',
|
||||
'Swift_Mime_ContentEncoder_Base64ContentEncoder' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php',
|
||||
'Swift_Mime_ContentEncoder_QpContentEncoder' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php',
|
||||
'Swift_Mime_Headers_AbstractHeader' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php',
|
||||
'Swift_Mime_Headers_IdentificationHeader' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php',
|
||||
'Swift_Mime_Headers_MailboxHeader' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php',
|
||||
'Swift_Mime_Headers_ParameterizedHeader' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php',
|
||||
'Swift_Mime_MimePart' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php',
|
||||
'Swift_Mime_SimpleHeaderFactory' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php',
|
||||
'Swift_Mime_SimpleHeaderSet' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php',
|
||||
'Swift_SendmailTransport' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php',
|
||||
'Swift_SmtpTransport' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php',
|
||||
'Swift_SwiftException' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/SwiftException.php',
|
||||
'Swift_Transport_AbstractSmtpTransport' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php',
|
||||
'Swift_Transport_EsmtpTransport' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php',
|
||||
'Swift_Transport_Esmtp_AuthHandler' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php',
|
||||
'Swift_Transport_MailInvoker' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php',
|
||||
'Swift_Transport_MailTransport' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php',
|
||||
'Swift_Transport_SimpleMailInvoker' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php',
|
||||
'Swift_Transport_StreamBuffer' => __DIR__ . '/../..' . '/overrides/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php',
|
||||
'Symfony\\Component\\Console\\Application' => __DIR__ . '/..' . '/symfony/console/Application.php',
|
||||
'Symfony\\Component\\Console\\Application' => __DIR__ . '/../..' . '/overrides/symfony/console/Application.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => __DIR__ . '/..' . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/ContainerCommandLoader.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\FactoryCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/FactoryCommandLoader.php',
|
||||
'Symfony\\Component\\Console\\Command\\Command' => __DIR__ . '/..' . '/symfony/console/Command/Command.php',
|
||||
'Symfony\\Component\\Console\\Command\\Command' => __DIR__ . '/../..' . '/overrides/symfony/console/Command/Command.php',
|
||||
'Symfony\\Component\\Console\\Command\\HelpCommand' => __DIR__ . '/..' . '/symfony/console/Command/HelpCommand.php',
|
||||
'Symfony\\Component\\Console\\Command\\ListCommand' => __DIR__ . '/..' . '/symfony/console/Command/ListCommand.php',
|
||||
'Symfony\\Component\\Console\\Command\\LockableTrait' => __DIR__ . '/..' . '/symfony/console/Command/LockableTrait.php',
|
||||
@@ -3416,10 +3508,10 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DescriptorHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\FormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/FormatterHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\Helper' => __DIR__ . '/../..' . '/overrides/symfony/console/Helper/Helper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperInterface' => __DIR__ . '/..' . '/symfony/console/Helper/HelperInterface.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperInterface' => __DIR__ . '/../..' . '/overrides/symfony/console/Helper/HelperInterface.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperSet' => __DIR__ . '/../..' . '/overrides/symfony/console/Helper/HelperSet.php',
|
||||
'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => __DIR__ . '/..' . '/symfony/console/Helper/InputAwareHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProcessHelper' => __DIR__ . '/..' . '/symfony/console/Helper/ProcessHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProcessHelper' => __DIR__ . '/../..' . '/overrides/symfony/console/Helper/ProcessHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProgressBar' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressBar.php',
|
||||
'Symfony\\Component\\Console\\Helper\\ProgressIndicator' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressIndicator.php',
|
||||
'Symfony\\Component\\Console\\Helper\\QuestionHelper' => __DIR__ . '/..' . '/symfony/console/Helper/QuestionHelper.php',
|
||||
@@ -3429,8 +3521,8 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\Console\\Helper\\TableSeparator' => __DIR__ . '/..' . '/symfony/console/Helper/TableSeparator.php',
|
||||
'Symfony\\Component\\Console\\Helper\\TableStyle' => __DIR__ . '/..' . '/symfony/console/Helper/TableStyle.php',
|
||||
'Symfony\\Component\\Console\\Input\\ArgvInput' => __DIR__ . '/..' . '/symfony/console/Input/ArgvInput.php',
|
||||
'Symfony\\Component\\Console\\Input\\ArrayInput' => __DIR__ . '/..' . '/symfony/console/Input/ArrayInput.php',
|
||||
'Symfony\\Component\\Console\\Input\\Input' => __DIR__ . '/..' . '/symfony/console/Input/Input.php',
|
||||
'Symfony\\Component\\Console\\Input\\ArrayInput' => __DIR__ . '/../..' . '/overrides/symfony/console/Input/ArrayInput.php',
|
||||
'Symfony\\Component\\Console\\Input\\Input' => __DIR__ . '/../..' . '/overrides/symfony/console/Input/Input.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputArgument' => __DIR__ . '/..' . '/symfony/console/Input/InputArgument.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputAwareInterface' => __DIR__ . '/..' . '/symfony/console/Input/InputAwareInterface.php',
|
||||
'Symfony\\Component\\Console\\Input\\InputDefinition' => __DIR__ . '/..' . '/symfony/console/Input/InputDefinition.php',
|
||||
@@ -3510,7 +3602,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\Debug\\ExceptionHandler' => __DIR__ . '/../..' . '/overrides/symfony/debug/ExceptionHandler.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\ClassNotFoundException' => __DIR__ . '/..' . '/symfony/debug/Exception/ClassNotFoundException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\ContextErrorException' => __DIR__ . '/..' . '/symfony/debug/Exception/ContextErrorException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => __DIR__ . '/..' . '/symfony/debug/Exception/FatalErrorException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => __DIR__ . '/../..' . '/overrides/symfony/debug/Exception/FatalErrorException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\FatalThrowableError' => __DIR__ . '/..' . '/symfony/debug/Exception/FatalThrowableError.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\FlattenException' => __DIR__ . '/..' . '/symfony/debug/Exception/FlattenException.php',
|
||||
'Symfony\\Component\\Debug\\Exception\\OutOfMemoryException' => __DIR__ . '/..' . '/symfony/debug/Exception/OutOfMemoryException.php',
|
||||
@@ -3619,7 +3711,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\NativeProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php',
|
||||
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php',
|
||||
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/SessionStorageInterface.php',
|
||||
'Symfony\\Component\\HttpFoundation\\StreamedResponse' => __DIR__ . '/..' . '/symfony/http-foundation/StreamedResponse.php',
|
||||
'Symfony\\Component\\HttpFoundation\\StreamedResponse' => __DIR__ . '/../..' . '/overrides/symfony/http-foundation/StreamedResponse.php',
|
||||
'Symfony\\Component\\HttpKernel\\Bundle\\Bundle' => __DIR__ . '/..' . '/symfony/http-kernel/Bundle/Bundle.php',
|
||||
'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Bundle/BundleInterface.php',
|
||||
'Symfony\\Component\\HttpKernel\\CacheClearer\\CacheClearerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/CacheClearer/CacheClearerInterface.php',
|
||||
@@ -3706,21 +3798,21 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/GetResponseForExceptionEvent.php',
|
||||
'Symfony\\Component\\HttpKernel\\Event\\KernelEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/KernelEvent.php',
|
||||
'Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/PostResponseEvent.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/AccessDeniedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException' => __DIR__ . '/../..' . '/overrides/symfony/http-kernel/Exception/AccessDeniedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/BadRequestHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\ConflictHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/ConflictHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\GoneHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/GoneHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\HttpException' => __DIR__ . '/../..' . '/overrides/symfony/http-kernel/Exception/HttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/HttpExceptionInterface.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\LengthRequiredHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/LengthRequiredHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException' => __DIR__ . '/../..' . '/overrides/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\NotAcceptableHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/NotAcceptableHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/NotFoundHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException' => __DIR__ . '/../..' . '/overrides/symfony/http-kernel/Exception/NotFoundHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\PreconditionFailedHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/PreconditionFailedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\PreconditionRequiredHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\ServiceUnavailableHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\ServiceUnavailableHttpException' => __DIR__ . '/../..' . '/overrides/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\TooManyRequestsHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/TooManyRequestsHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/UnauthorizedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException' => __DIR__ . '/../..' . '/overrides/symfony/http-kernel/Exception/UnauthorizedHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\UnprocessableEntityHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Exception\\UnsupportedMediaTypeHttpException' => __DIR__ . '/..' . '/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php',
|
||||
'Symfony\\Component\\HttpKernel\\Fragment\\AbstractSurrogateFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php',
|
||||
@@ -3860,11 +3952,11 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\Translation\\Extractor\\PhpExtractor' => __DIR__ . '/..' . '/symfony/translation/Extractor/PhpExtractor.php',
|
||||
'Symfony\\Component\\Translation\\Extractor\\PhpStringTokenParser' => __DIR__ . '/..' . '/symfony/translation/Extractor/PhpStringTokenParser.php',
|
||||
'Symfony\\Component\\Translation\\Formatter\\ChoiceMessageFormatterInterface' => __DIR__ . '/..' . '/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php',
|
||||
'Symfony\\Component\\Translation\\Formatter\\MessageFormatter' => __DIR__ . '/..' . '/symfony/translation/Formatter/MessageFormatter.php',
|
||||
'Symfony\\Component\\Translation\\Formatter\\MessageFormatter' => __DIR__ . '/../..' . '/overrides/symfony/translation/Formatter/MessageFormatter.php',
|
||||
'Symfony\\Component\\Translation\\Formatter\\MessageFormatterInterface' => __DIR__ . '/..' . '/symfony/translation/Formatter/MessageFormatterInterface.php',
|
||||
'Symfony\\Component\\Translation\\IdentityTranslator' => __DIR__ . '/..' . '/symfony/translation/IdentityTranslator.php',
|
||||
'Symfony\\Component\\Translation\\Interval' => __DIR__ . '/..' . '/symfony/translation/Interval.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\ArrayLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/ArrayLoader.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\ArrayLoader' => __DIR__ . '/../..' . '/overrides/symfony/translation/Loader/ArrayLoader.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\CsvFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/CsvFileLoader.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\FileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/FileLoader.php',
|
||||
'Symfony\\Component\\Translation\\Loader\\IcuDatFileLoader' => __DIR__ . '/..' . '/symfony/translation/Loader/IcuDatFileLoader.php',
|
||||
@@ -3886,7 +3978,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Symfony\\Component\\Translation\\PluralizationRules' => __DIR__ . '/..' . '/symfony/translation/PluralizationRules.php',
|
||||
'Symfony\\Component\\Translation\\Reader\\TranslationReader' => __DIR__ . '/..' . '/symfony/translation/Reader/TranslationReader.php',
|
||||
'Symfony\\Component\\Translation\\Reader\\TranslationReaderInterface' => __DIR__ . '/..' . '/symfony/translation/Reader/TranslationReaderInterface.php',
|
||||
'Symfony\\Component\\Translation\\Translator' => __DIR__ . '/..' . '/symfony/translation/Translator.php',
|
||||
'Symfony\\Component\\Translation\\Translator' => __DIR__ . '/../..' . '/overrides/symfony/translation/Translator.php',
|
||||
'Symfony\\Component\\Translation\\TranslatorBagInterface' => __DIR__ . '/..' . '/symfony/translation/TranslatorBagInterface.php',
|
||||
'Symfony\\Component\\Translation\\TranslatorInterface' => __DIR__ . '/..' . '/symfony/translation/TranslatorInterface.php',
|
||||
'Symfony\\Component\\Translation\\Util\\ArrayConverter' => __DIR__ . '/..' . '/symfony/translation/Util/ArrayConverter.php',
|
||||
@@ -3977,12 +4069,13 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Webklex\\PHPIMAP\\Attachment' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Attachment.php',
|
||||
'Webklex\\PHPIMAP\\Attribute' => __DIR__ . '/..' . '/webklex/php-imap/src/Attribute.php',
|
||||
'Webklex\\PHPIMAP\\Client' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Client.php',
|
||||
'Webklex\\PHPIMAP\\ClientManager' => __DIR__ . '/..' . '/webklex/php-imap/src/ClientManager.php',
|
||||
'Webklex\\PHPIMAP\\ClientManager' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/ClientManager.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\ImapProtocol' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Connection/Protocols/ImapProtocol.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\LegacyProtocol' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Connection/Protocols/LegacyProtocol.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\PopProtocol' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Connection/Protocols/PopProtocol.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\Protocol' => __DIR__ . '/..' . '/webklex/php-imap/src/Connection/Protocols/Protocol.php',
|
||||
'Webklex\\PHPIMAP\\Connection\\Protocols\\ProtocolInterface' => __DIR__ . '/..' . '/webklex/php-imap/src/Connection/Protocols/ProtocolInterface.php',
|
||||
'Webklex\\PHPIMAP\\EncodingAliases' => __DIR__ . '/..' . '/webklex/php-imap/src/EncodingAliases.php',
|
||||
'Webklex\\PHPIMAP\\EncodingAliases' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/EncodingAliases.php',
|
||||
'Webklex\\PHPIMAP\\Events\\Event' => __DIR__ . '/..' . '/webklex/php-imap/src/Events/Event.php',
|
||||
'Webklex\\PHPIMAP\\Events\\FlagDeletedEvent' => __DIR__ . '/..' . '/webklex/php-imap/src/Events/FlagDeletedEvent.php',
|
||||
'Webklex\\PHPIMAP\\Events\\FlagNewEvent' => __DIR__ . '/..' . '/webklex/php-imap/src/Events/FlagNewEvent.php',
|
||||
@@ -4012,13 +4105,13 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Webklex\\PHPIMAP\\Exceptions\\NotSupportedCapabilityException' => __DIR__ . '/..' . '/webklex/php-imap/src/Exceptions/NotSupportedCapabilityException.php',
|
||||
'Webklex\\PHPIMAP\\Exceptions\\ProtocolNotSupportedException' => __DIR__ . '/..' . '/webklex/php-imap/src/Exceptions/ProtocolNotSupportedException.php',
|
||||
'Webklex\\PHPIMAP\\Exceptions\\RuntimeException' => __DIR__ . '/..' . '/webklex/php-imap/src/Exceptions/RuntimeException.php',
|
||||
'Webklex\\PHPIMAP\\Folder' => __DIR__ . '/..' . '/webklex/php-imap/src/Folder.php',
|
||||
'Webklex\\PHPIMAP\\Folder' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Folder.php',
|
||||
'Webklex\\PHPIMAP\\Header' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Header.php',
|
||||
'Webklex\\PHPIMAP\\IMAP' => __DIR__ . '/..' . '/webklex/php-imap/src/IMAP.php',
|
||||
'Webklex\\PHPIMAP\\Message' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Message.php',
|
||||
'Webklex\\PHPIMAP\\Part' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Part.php',
|
||||
'Webklex\\PHPIMAP\\Query\\Query' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Query/Query.php',
|
||||
'Webklex\\PHPIMAP\\Query\\WhereQuery' => __DIR__ . '/..' . '/webklex/php-imap/src/Query/WhereQuery.php',
|
||||
'Webklex\\PHPIMAP\\Query\\WhereQuery' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Query/WhereQuery.php',
|
||||
'Webklex\\PHPIMAP\\Structure' => __DIR__ . '/../..' . '/overrides/webklex/php-imap/src/Structure.php',
|
||||
'Webklex\\PHPIMAP\\Support\\AttachmentCollection' => __DIR__ . '/..' . '/webklex/php-imap/src/Support/AttachmentCollection.php',
|
||||
'Webklex\\PHPIMAP\\Support\\FlagCollection' => __DIR__ . '/..' . '/webklex/php-imap/src/Support/FlagCollection.php',
|
||||
@@ -4029,6 +4122,7 @@ class ComposerStaticInitbf8dc242a640d7c740f283f226d0bdb4
|
||||
'Webklex\\PHPIMAP\\Support\\MessageCollection' => __DIR__ . '/..' . '/webklex/php-imap/src/Support/MessageCollection.php',
|
||||
'Webklex\\PHPIMAP\\Support\\PaginatedCollection' => __DIR__ . '/..' . '/webklex/php-imap/src/Support/PaginatedCollection.php',
|
||||
'Webklex\\PHPIMAP\\Traits\\HasEvents' => __DIR__ . '/..' . '/webklex/php-imap/src/Traits/HasEvents.php',
|
||||
'Whoops\\Run' => __DIR__ . '/../..' . '/overrides/filp/whoops/src/Whoops/Run.php',
|
||||
'XdgBaseDir\\Xdg' => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src/Xdg.php',
|
||||
'aCssAtBlockEndToken' => __DIR__ . '/../..' . '/overrides/natxet/cssmin/src/CssMin.php',
|
||||
'aCssAtBlockStartToken' => __DIR__ . '/../..' . '/overrides/natxet/cssmin/src/CssMin.php',
|
||||
|
||||
4
vendor/composer/installed.php
vendored
4
vendor/composer/installed.php
vendored
@@ -3,7 +3,7 @@
|
||||
'name' => 'freescout-helpdesk/freescout',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'fa46d45662ab0a6713dbcef7eb315d3a4d931cbe',
|
||||
'reference' => '7efa8f5a1cd821f8d6ab93bafa20191d1f14213e',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@@ -175,7 +175,7 @@
|
||||
'freescout-helpdesk/freescout' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'fa46d45662ab0a6713dbcef7eb315d3a4d931cbe',
|
||||
'reference' => '7efa8f5a1cd821f8d6ab93bafa20191d1f14213e',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
||||
277
vendor/guzzlehttp/guzzle/src/HandlerStack.php
vendored
277
vendor/guzzlehttp/guzzle/src/HandlerStack.php
vendored
@@ -1,277 +0,0 @@
|
||||
<?php
|
||||
namespace GuzzleHttp;
|
||||
|
||||
use GuzzleHttp\Promise\PromiseInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Creates a composed Guzzle handler function by stacking middlewares on top of
|
||||
* an HTTP handler function.
|
||||
*/
|
||||
class HandlerStack
|
||||
{
|
||||
/** @var callable|null */
|
||||
private $handler;
|
||||
|
||||
/** @var array */
|
||||
private $stack = [];
|
||||
|
||||
/** @var callable|null */
|
||||
private $cached;
|
||||
|
||||
/**
|
||||
* Creates a default handler stack that can be used by clients.
|
||||
*
|
||||
* The returned handler will wrap the provided handler or use the most
|
||||
* appropriate default handler for your system. The returned HandlerStack has
|
||||
* support for cookies, redirects, HTTP error exceptions, and preparing a body
|
||||
* before sending.
|
||||
*
|
||||
* The returned handler stack can be passed to a client in the "handler"
|
||||
* option.
|
||||
*
|
||||
* @param callable $handler HTTP handler function to use with the stack. If no
|
||||
* handler is provided, the best handler for your
|
||||
* system will be utilized.
|
||||
*
|
||||
* @return HandlerStack
|
||||
*/
|
||||
public static function create(callable $handler = null)
|
||||
{
|
||||
$stack = new self($handler ?: choose_handler());
|
||||
$stack->push(Middleware::httpErrors(), 'http_errors');
|
||||
$stack->push(Middleware::redirect(), 'allow_redirects');
|
||||
$stack->push(Middleware::cookies(), 'cookies');
|
||||
$stack->push(Middleware::prepareBody(), 'prepare_body');
|
||||
|
||||
return $stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $handler Underlying HTTP handler.
|
||||
*/
|
||||
public function __construct(callable $handler = null)
|
||||
{
|
||||
$this->handler = $handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the handler stack as a composed handler
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
* @param array $options
|
||||
*
|
||||
* @return ResponseInterface|PromiseInterface
|
||||
*/
|
||||
public function __invoke(RequestInterface $request, array $options)
|
||||
{
|
||||
$handler = $this->resolve();
|
||||
|
||||
return $handler($request, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps a string representation of the stack.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$depth = 0;
|
||||
$stack = [];
|
||||
if ($this->handler) {
|
||||
$stack[] = "0) Handler: " . $this->debugCallable($this->handler);
|
||||
}
|
||||
|
||||
$result = '';
|
||||
foreach (array_reverse($this->stack) as $tuple) {
|
||||
$depth++;
|
||||
$str = "{$depth}) Name: '{$tuple[1]}', ";
|
||||
$str .= "Function: " . $this->debugCallable($tuple[0]);
|
||||
$result = "> {$str}\n{$result}";
|
||||
$stack[] = $str;
|
||||
}
|
||||
|
||||
foreach (array_keys($stack) as $k) {
|
||||
$result .= "< {$stack[$k]}\n";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the HTTP handler that actually returns a promise.
|
||||
*
|
||||
* @param callable $handler Accepts a request and array of options and
|
||||
* returns a Promise.
|
||||
*/
|
||||
public function setHandler(callable $handler)
|
||||
{
|
||||
$this->handler = $handler;
|
||||
$this->cached = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the builder has a handler.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHandler()
|
||||
{
|
||||
return (bool) $this->handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unshift a middleware to the bottom of the stack.
|
||||
*
|
||||
* @param callable $middleware Middleware function
|
||||
* @param string $name Name to register for this middleware.
|
||||
*/
|
||||
public function unshift(callable $middleware, $name = null)
|
||||
{
|
||||
array_unshift($this->stack, [$middleware, $name]);
|
||||
$this->cached = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a middleware to the top of the stack.
|
||||
*
|
||||
* @param callable $middleware Middleware function
|
||||
* @param string $name Name to register for this middleware.
|
||||
*/
|
||||
public function push(callable $middleware, $name = '')
|
||||
{
|
||||
$this->stack[] = [$middleware, $name];
|
||||
$this->cached = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a middleware before another middleware by name.
|
||||
*
|
||||
* @param string $findName Middleware to find
|
||||
* @param callable $middleware Middleware function
|
||||
* @param string $withName Name to register for this middleware.
|
||||
*/
|
||||
public function before($findName, callable $middleware, $withName = '')
|
||||
{
|
||||
$this->splice($findName, $withName, $middleware, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a middleware after another middleware by name.
|
||||
*
|
||||
* @param string $findName Middleware to find
|
||||
* @param callable $middleware Middleware function
|
||||
* @param string $withName Name to register for this middleware.
|
||||
*/
|
||||
public function after($findName, callable $middleware, $withName = '')
|
||||
{
|
||||
$this->splice($findName, $withName, $middleware, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a middleware by instance or name from the stack.
|
||||
*
|
||||
* @param callable|string $remove Middleware to remove by instance or name.
|
||||
*/
|
||||
public function remove($remove)
|
||||
{
|
||||
$this->cached = null;
|
||||
$idx = is_callable($remove) ? 0 : 1;
|
||||
$this->stack = array_values(array_filter(
|
||||
$this->stack,
|
||||
function ($tuple) use ($idx, $remove) {
|
||||
return $tuple[$idx] !== $remove;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Compose the middleware and handler into a single callable function.
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function resolve()
|
||||
{
|
||||
if (!$this->cached) {
|
||||
if (!($prev = $this->handler)) {
|
||||
throw new \LogicException('No handler has been specified');
|
||||
}
|
||||
|
||||
foreach (array_reverse($this->stack) as $fn) {
|
||||
$prev = $fn[0]($prev);
|
||||
}
|
||||
|
||||
$this->cached = $prev;
|
||||
}
|
||||
|
||||
return $this->cached;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return int
|
||||
*/
|
||||
private function findByName($name)
|
||||
{
|
||||
foreach ($this->stack as $k => $v) {
|
||||
if ($v[1] === $name) {
|
||||
return $k;
|
||||
}
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException("Middleware not found: $name");
|
||||
}
|
||||
|
||||
/**
|
||||
* Splices a function into the middleware list at a specific position.
|
||||
*
|
||||
* @param string $findName
|
||||
* @param string $withName
|
||||
* @param callable $middleware
|
||||
* @param bool $before
|
||||
*/
|
||||
private function splice($findName, $withName, callable $middleware, $before)
|
||||
{
|
||||
$this->cached = null;
|
||||
$idx = $this->findByName($findName);
|
||||
$tuple = [$middleware, $withName];
|
||||
|
||||
if ($before) {
|
||||
if ($idx === 0) {
|
||||
array_unshift($this->stack, $tuple);
|
||||
} else {
|
||||
$replacement = [$tuple, $this->stack[$idx]];
|
||||
array_splice($this->stack, $idx, 1, $replacement);
|
||||
}
|
||||
} elseif ($idx === count($this->stack) - 1) {
|
||||
$this->stack[] = $tuple;
|
||||
} else {
|
||||
$replacement = [$this->stack[$idx], $tuple];
|
||||
array_splice($this->stack, $idx, 1, $replacement);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a debug string for a given callable.
|
||||
*
|
||||
* @param array|callable $fn Function to write as a string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function debugCallable($fn)
|
||||
{
|
||||
if (is_string($fn)) {
|
||||
return "callable({$fn})";
|
||||
}
|
||||
|
||||
if (is_array($fn)) {
|
||||
return is_string($fn[0])
|
||||
? "callable({$fn[0]}::{$fn[1]})"
|
||||
: "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])";
|
||||
}
|
||||
|
||||
return 'callable(' . spl_object_hash($fn) . ')';
|
||||
}
|
||||
}
|
||||
@@ -1,560 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Auth\Access;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
|
||||
|
||||
class Gate implements GateContract
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* The container instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Container\Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* The user resolver callable.
|
||||
*
|
||||
* @var callable
|
||||
*/
|
||||
protected $userResolver;
|
||||
|
||||
/**
|
||||
* All of the defined abilities.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $abilities = [];
|
||||
|
||||
/**
|
||||
* All of the defined policies.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [];
|
||||
|
||||
/**
|
||||
* All of the registered before callbacks.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $beforeCallbacks = [];
|
||||
|
||||
/**
|
||||
* All of the registered after callbacks.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $afterCallbacks = [];
|
||||
|
||||
/**
|
||||
* Create a new gate instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container $container
|
||||
* @param callable $userResolver
|
||||
* @param array $abilities
|
||||
* @param array $policies
|
||||
* @param array $beforeCallbacks
|
||||
* @param array $afterCallbacks
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Container $container, callable $userResolver, array $abilities = [],
|
||||
array $policies = [], array $beforeCallbacks = [], array $afterCallbacks = [])
|
||||
{
|
||||
$this->policies = $policies;
|
||||
$this->container = $container;
|
||||
$this->abilities = $abilities;
|
||||
$this->userResolver = $userResolver;
|
||||
$this->afterCallbacks = $afterCallbacks;
|
||||
$this->beforeCallbacks = $beforeCallbacks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given ability has been defined.
|
||||
*
|
||||
* @param string|array $ability
|
||||
* @return bool
|
||||
*/
|
||||
public function has($ability)
|
||||
{
|
||||
$abilities = is_array($ability) ? $ability : func_get_args();
|
||||
|
||||
foreach ($abilities as $ability) {
|
||||
if (! isset($this->abilities[$ability])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a new ability.
|
||||
*
|
||||
* @param string $ability
|
||||
* @param callable|string $callback
|
||||
* @return $this
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function define($ability, $callback)
|
||||
{
|
||||
if (is_callable($callback)) {
|
||||
$this->abilities[$ability] = $callback;
|
||||
} elseif (is_string($callback) && Str::contains($callback, '@')) {
|
||||
$this->abilities[$ability] = $this->buildAbilityCallback($ability, $callback);
|
||||
} else {
|
||||
throw new InvalidArgumentException("Callback must be a callable or a 'Class@method' string.");
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define abilities for a resource.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $class
|
||||
* @param array $abilities
|
||||
* @return $this
|
||||
*/
|
||||
public function resource($name, $class, array $abilities = null)
|
||||
{
|
||||
$abilities = $abilities ?: [
|
||||
'view' => 'view',
|
||||
'create' => 'create',
|
||||
'update' => 'update',
|
||||
'delete' => 'delete',
|
||||
];
|
||||
|
||||
foreach ($abilities as $ability => $method) {
|
||||
$this->define($name.'.'.$ability, $class.'@'.$method);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the ability callback for a callback string.
|
||||
*
|
||||
* @param string $ability
|
||||
* @param string $callback
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function buildAbilityCallback($ability, $callback)
|
||||
{
|
||||
return function () use ($ability, $callback) {
|
||||
list($class, $method) = Str::parseCallback($callback);
|
||||
|
||||
$policy = $this->resolvePolicy($class);
|
||||
|
||||
$arguments = func_get_args();
|
||||
|
||||
$user = array_shift($arguments);
|
||||
|
||||
$result = $this->callPolicyBefore(
|
||||
$policy, $user, $ability, $arguments
|
||||
);
|
||||
|
||||
if (! is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return $policy->{$method}(...func_get_args());
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a policy class for a given class type.
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $policy
|
||||
* @return $this
|
||||
*/
|
||||
public function policy($class, $policy)
|
||||
{
|
||||
$this->policies[$class] = $policy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback to run before all Gate checks.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function before(callable $callback)
|
||||
{
|
||||
$this->beforeCallbacks[] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback to run after all Gate checks.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function after(callable $callback)
|
||||
{
|
||||
$this->afterCallbacks[] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given ability should be granted for the current user.
|
||||
*
|
||||
* @param string $ability
|
||||
* @param array|mixed $arguments
|
||||
* @return bool
|
||||
*/
|
||||
public function allows($ability, $arguments = [])
|
||||
{
|
||||
return $this->check($ability, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given ability should be denied for the current user.
|
||||
*
|
||||
* @param string $ability
|
||||
* @param array|mixed $arguments
|
||||
* @return bool
|
||||
*/
|
||||
public function denies($ability, $arguments = [])
|
||||
{
|
||||
return ! $this->allows($ability, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if all of the given abilities should be granted for the current user.
|
||||
*
|
||||
* @param iterable|string $abilities
|
||||
* @param array|mixed $arguments
|
||||
* @return bool
|
||||
*/
|
||||
public function check($abilities, $arguments = [])
|
||||
{
|
||||
return collect($abilities)->every(function ($ability) use ($arguments) {
|
||||
try {
|
||||
return (bool) $this->raw($ability, $arguments);
|
||||
} catch (AuthorizationException $e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if any one of the given abilities should be granted for the current user.
|
||||
*
|
||||
* @param iterable|string $abilities
|
||||
* @param array|mixed $arguments
|
||||
* @return bool
|
||||
*/
|
||||
public function any($abilities, $arguments = [])
|
||||
{
|
||||
return collect($abilities)->contains(function ($ability) use ($arguments) {
|
||||
return $this->check($ability, $arguments);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given ability should be granted for the current user.
|
||||
*
|
||||
* @param string $ability
|
||||
* @param array|mixed $arguments
|
||||
* @return \Illuminate\Auth\Access\Response
|
||||
*
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function authorize($ability, $arguments = [])
|
||||
{
|
||||
$result = $this->raw($ability, $arguments);
|
||||
|
||||
if ($result instanceof Response) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return $result ? $this->allow() : $this->deny();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw result from the authorization callback.
|
||||
*
|
||||
* @param string $ability
|
||||
* @param array|mixed $arguments
|
||||
* @return mixed
|
||||
*/
|
||||
protected function raw($ability, $arguments = [])
|
||||
{
|
||||
if (! $user = $this->resolveUser()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$arguments = Arr::wrap($arguments);
|
||||
|
||||
// First we will call the "before" callbacks for the Gate. If any of these give
|
||||
// back a non-null response, we will immediately return that result in order
|
||||
// to let the developers override all checks for some authorization cases.
|
||||
$result = $this->callBeforeCallbacks(
|
||||
$user, $ability, $arguments
|
||||
);
|
||||
|
||||
if (is_null($result)) {
|
||||
$result = $this->callAuthCallback($user, $ability, $arguments);
|
||||
}
|
||||
|
||||
// After calling the authorization callback, we will call the "after" callbacks
|
||||
// that are registered with the Gate, which allows a developer to do logging
|
||||
// if that is required for this application. Then we'll return the result.
|
||||
$this->callAfterCallbacks(
|
||||
$user, $ability, $arguments, $result
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve and call the appropriate authorization callback.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @param string $ability
|
||||
* @param array $arguments
|
||||
* @return bool
|
||||
*/
|
||||
protected function callAuthCallback($user, $ability, array $arguments)
|
||||
{
|
||||
$callback = $this->resolveAuthCallback($user, $ability, $arguments);
|
||||
|
||||
return $callback($user, ...$arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call all of the before callbacks and return if a result is given.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @param string $ability
|
||||
* @param array $arguments
|
||||
* @return bool|null
|
||||
*/
|
||||
protected function callBeforeCallbacks($user, $ability, array $arguments)
|
||||
{
|
||||
$arguments = array_merge([$user, $ability], [$arguments]);
|
||||
|
||||
foreach ($this->beforeCallbacks as $before) {
|
||||
if (! is_null($result = $before(...$arguments))) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call all of the after callbacks with check result.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @param string $ability
|
||||
* @param array $arguments
|
||||
* @param bool $result
|
||||
* @return void
|
||||
*/
|
||||
protected function callAfterCallbacks($user, $ability, array $arguments, $result)
|
||||
{
|
||||
$arguments = array_merge([$user, $ability, $result], [$arguments]);
|
||||
|
||||
foreach ($this->afterCallbacks as $after) {
|
||||
$after(...$arguments);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the callable for the given ability and arguments.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @param string $ability
|
||||
* @param array $arguments
|
||||
* @return callable
|
||||
*/
|
||||
protected function resolveAuthCallback($user, $ability, array $arguments)
|
||||
{
|
||||
if (isset($arguments[0]) &&
|
||||
! is_null($policy = $this->getPolicyFor($arguments[0])) &&
|
||||
$callback = $this->resolvePolicyCallback($user, $ability, $arguments, $policy)) {
|
||||
return $callback;
|
||||
}
|
||||
|
||||
if (isset($this->abilities[$ability])) {
|
||||
return $this->abilities[$ability];
|
||||
}
|
||||
|
||||
return function () {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a policy instance for a given class.
|
||||
*
|
||||
* @param object|string $class
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPolicyFor($class)
|
||||
{
|
||||
if (is_object($class)) {
|
||||
$class = get_class($class);
|
||||
}
|
||||
|
||||
if (! is_string($class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($this->policies[$class])) {
|
||||
return $this->resolvePolicy($this->policies[$class]);
|
||||
}
|
||||
|
||||
foreach ($this->policies as $expected => $policy) {
|
||||
if (is_subclass_of($class, $expected)) {
|
||||
return $this->resolvePolicy($policy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a policy class instance of the given type.
|
||||
*
|
||||
* @param object|string $class
|
||||
* @return mixed
|
||||
*/
|
||||
public function resolvePolicy($class)
|
||||
{
|
||||
return $this->container->make($class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the callback for a policy check.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @param string $ability
|
||||
* @param array $arguments
|
||||
* @param mixed $policy
|
||||
* @return bool|callable
|
||||
*/
|
||||
protected function resolvePolicyCallback($user, $ability, array $arguments, $policy)
|
||||
{
|
||||
if (! is_callable([$policy, $this->formatAbilityToMethod($ability)])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return function () use ($user, $ability, $arguments, $policy) {
|
||||
// This callback will be responsible for calling the policy's before method and
|
||||
// running this policy method if necessary. This is used to when objects are
|
||||
// mapped to policy objects in the user's configurations or on this class.
|
||||
$result = $this->callPolicyBefore(
|
||||
$policy, $user, $ability, $arguments
|
||||
);
|
||||
|
||||
// When we receive a non-null result from this before method, we will return it
|
||||
// as the "final" results. This will allow developers to override the checks
|
||||
// in this policy to return the result for all rules defined in the class.
|
||||
if (! is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$ability = $this->formatAbilityToMethod($ability);
|
||||
|
||||
// If this first argument is a string, that means they are passing a class name
|
||||
// to the policy. We will remove the first argument from this argument array
|
||||
// because this policy already knows what type of models it can authorize.
|
||||
if (isset($arguments[0]) && is_string($arguments[0])) {
|
||||
array_shift($arguments);
|
||||
}
|
||||
|
||||
return is_callable([$policy, $ability])
|
||||
? $policy->{$ability}($user, ...$arguments)
|
||||
: false;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the "before" method on the given policy, if applicable.
|
||||
*
|
||||
* @param mixed $policy
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @param string $ability
|
||||
* @param array $arguments
|
||||
* @return mixed
|
||||
*/
|
||||
protected function callPolicyBefore($policy, $user, $ability, $arguments)
|
||||
{
|
||||
if (method_exists($policy, 'before')) {
|
||||
return $policy->before($user, $ability, ...$arguments);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the policy ability into a method name.
|
||||
*
|
||||
* @param string $ability
|
||||
* @return string
|
||||
*/
|
||||
protected function formatAbilityToMethod($ability)
|
||||
{
|
||||
return strpos($ability, '-') !== false ? Str::camel($ability) : $ability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a gate instance for the given user.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
|
||||
* @return static
|
||||
*/
|
||||
public function forUser($user)
|
||||
{
|
||||
$callback = function () use ($user) {
|
||||
return $user;
|
||||
};
|
||||
|
||||
return new static(
|
||||
$this->container, $callback, $this->abilities,
|
||||
$this->policies, $this->beforeCallbacks, $this->afterCallbacks
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the user from the user resolver.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function resolveUser()
|
||||
{
|
||||
return call_user_func($this->userResolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the defined abilities.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function abilities()
|
||||
{
|
||||
return $this->abilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the defined policies.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function policies()
|
||||
{
|
||||
return $this->policies;
|
||||
}
|
||||
}
|
||||
@@ -1,312 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Broadcasting;
|
||||
|
||||
use Closure;
|
||||
use Pusher\Pusher;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Broadcasting\Broadcasters\LogBroadcaster;
|
||||
use Illuminate\Broadcasting\Broadcasters\NullBroadcaster;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
||||
use Illuminate\Broadcasting\Broadcasters\RedisBroadcaster;
|
||||
use Illuminate\Broadcasting\Broadcasters\PusherBroadcaster;
|
||||
use Illuminate\Contracts\Broadcasting\Factory as FactoryContract;
|
||||
|
||||
/**
|
||||
* @mixin \Illuminate\Contracts\Broadcasting\Broadcaster
|
||||
*/
|
||||
class BroadcastManager implements FactoryContract
|
||||
{
|
||||
/**
|
||||
* The application instance.
|
||||
*
|
||||
* @var \Illuminate\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The array of resolved broadcast drivers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $drivers = [];
|
||||
|
||||
/**
|
||||
* The registered custom driver creators.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customCreators = [];
|
||||
|
||||
/**
|
||||
* Create a new manager instance.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the routes for handling broadcast authentication and sockets.
|
||||
*
|
||||
* @param array|null $attributes
|
||||
* @return void
|
||||
*/
|
||||
public function routes(array $attributes = null)
|
||||
{
|
||||
if ($this->app->routesAreCached()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$attributes = $attributes ?: ['middleware' => ['web']];
|
||||
|
||||
$this->app['router']->group($attributes, function ($router) {
|
||||
$router->post('/broadcasting/auth', '\\'.BroadcastController::class.'@authenticate');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the socket ID for the given request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request|null $request
|
||||
* @return string|null
|
||||
*/
|
||||
public function socket($request = null)
|
||||
{
|
||||
if (! $request && ! $this->app->bound('request')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$request = $request ?: $this->app['request'];
|
||||
|
||||
return $request->header('X-Socket-ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin broadcasting an event.
|
||||
*
|
||||
* @param mixed|null $event
|
||||
* @return \Illuminate\Broadcasting\PendingBroadcast|void
|
||||
*/
|
||||
public function event($event = null)
|
||||
{
|
||||
return new PendingBroadcast($this->app->make('events'), $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue the given event for broadcast.
|
||||
*
|
||||
* @param mixed $event
|
||||
* @return void
|
||||
*/
|
||||
public function queue($event)
|
||||
{
|
||||
$connection = $event instanceof ShouldBroadcastNow ? 'sync' : null;
|
||||
|
||||
if (is_null($connection) && isset($event->connection)) {
|
||||
$connection = $event->connection;
|
||||
}
|
||||
|
||||
$queue = null;
|
||||
|
||||
if (method_exists($event, 'broadcastQueue')) {
|
||||
$queue = $event->broadcastQueue();
|
||||
} elseif (isset($event->broadcastQueue)) {
|
||||
$queue = $event->broadcastQueue;
|
||||
} elseif (isset($event->queue)) {
|
||||
$queue = $event->queue;
|
||||
}
|
||||
|
||||
$this->app->make('queue')->connection($connection)->pushOn(
|
||||
$queue, new BroadcastEvent(clone $event)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a driver instance.
|
||||
*
|
||||
* @param string $driver
|
||||
* @return mixed
|
||||
*/
|
||||
public function connection($driver = null)
|
||||
{
|
||||
return $this->driver($driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a driver instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function driver($name = null)
|
||||
{
|
||||
$name = $name ?: $this->getDefaultDriver();
|
||||
|
||||
return $this->drivers[$name] = $this->get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to get the connection from the local cache.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Illuminate\Contracts\Broadcasting\Broadcaster
|
||||
*/
|
||||
protected function get($name)
|
||||
{
|
||||
return $this->drivers[$name] ?? $this->resolve($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the given store.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Illuminate\Contracts\Broadcasting\Broadcaster
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function resolve($name)
|
||||
{
|
||||
$config = $this->getConfig($name);
|
||||
|
||||
if (is_null($config)) {
|
||||
throw new InvalidArgumentException("Broadcaster [{$name}] is not defined.");
|
||||
}
|
||||
|
||||
if (isset($this->customCreators[$config['driver']])) {
|
||||
return $this->callCustomCreator($config);
|
||||
}
|
||||
|
||||
$driverMethod = 'create'.ucfirst($config['driver']).'Driver';
|
||||
|
||||
if (! method_exists($this, $driverMethod)) {
|
||||
throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
|
||||
}
|
||||
|
||||
return $this->{$driverMethod}($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a custom driver creator.
|
||||
*
|
||||
* @param array $config
|
||||
* @return mixed
|
||||
*/
|
||||
protected function callCustomCreator(array $config)
|
||||
{
|
||||
return $this->customCreators[$config['driver']]($this->app, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Broadcasting\Broadcaster
|
||||
*/
|
||||
protected function createPusherDriver(array $config)
|
||||
{
|
||||
return new PusherBroadcaster(
|
||||
new Pusher($config['key'], $config['secret'],
|
||||
$config['app_id'], $config['options'] ?? [])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Broadcasting\Broadcaster
|
||||
*/
|
||||
protected function createRedisDriver(array $config)
|
||||
{
|
||||
return new RedisBroadcaster(
|
||||
$this->app->make('redis'), $config['connection'] ?? null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Broadcasting\Broadcaster
|
||||
*/
|
||||
protected function createLogDriver(array $config)
|
||||
{
|
||||
return new LogBroadcaster(
|
||||
$this->app->make(LoggerInterface::class)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Broadcasting\Broadcaster
|
||||
*/
|
||||
protected function createNullDriver(array $config)
|
||||
{
|
||||
return new NullBroadcaster;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection configuration.
|
||||
*
|
||||
* @param string $name
|
||||
* @return array
|
||||
*/
|
||||
protected function getConfig($name)
|
||||
{
|
||||
return $this->app['config']["broadcasting.connections.{$name}"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default driver name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultDriver()
|
||||
{
|
||||
return $this->app['config']['broadcasting.default'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default driver name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultDriver($name)
|
||||
{
|
||||
$this->app['config']['broadcasting.default'] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom driver creator Closure.
|
||||
*
|
||||
* @param string $driver
|
||||
* @param \Closure $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function extend($driver, Closure $callback)
|
||||
{
|
||||
$this->customCreators[$driver] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically call the default driver instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return $this->driver()->$method(...$parameters);
|
||||
}
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Bus;
|
||||
|
||||
use Closure;
|
||||
use RuntimeException;
|
||||
use Illuminate\Pipeline\Pipeline;
|
||||
use Illuminate\Contracts\Queue\Queue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Bus\QueueingDispatcher;
|
||||
|
||||
class Dispatcher implements QueueingDispatcher
|
||||
{
|
||||
/**
|
||||
* The container implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Container\Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* The pipeline instance for the bus.
|
||||
*
|
||||
* @var \Illuminate\Pipeline\Pipeline
|
||||
*/
|
||||
protected $pipeline;
|
||||
|
||||
/**
|
||||
* The pipes to send commands through before dispatching.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $pipes = [];
|
||||
|
||||
/**
|
||||
* The command to handler mapping for non-self-handling events.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $handlers = [];
|
||||
|
||||
/**
|
||||
* The queue resolver callback.
|
||||
*
|
||||
* @var \Closure|null
|
||||
*/
|
||||
protected $queueResolver;
|
||||
|
||||
/**
|
||||
* Create a new command dispatcher instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container $container
|
||||
* @param \Closure|null $queueResolver
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Container $container, Closure $queueResolver = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->queueResolver = $queueResolver;
|
||||
$this->pipeline = new Pipeline($container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return mixed
|
||||
*/
|
||||
public function dispatch($command)
|
||||
{
|
||||
if ($this->queueResolver && $this->commandShouldBeQueued($command)) {
|
||||
return $this->dispatchToQueue($command);
|
||||
}
|
||||
|
||||
return $this->dispatchNow($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler in the current process.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @param mixed $handler
|
||||
* @return mixed
|
||||
*/
|
||||
public function dispatchNow($command, $handler = null)
|
||||
{
|
||||
if ($handler || $handler = $this->getCommandHandler($command)) {
|
||||
$callback = function ($command) use ($handler) {
|
||||
return $handler->handle($command);
|
||||
};
|
||||
} else {
|
||||
$callback = function ($command) {
|
||||
return $this->container->call([$command, 'handle']);
|
||||
};
|
||||
}
|
||||
|
||||
return $this->pipeline->send($command)->through($this->pipes)->then($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given command has a handler.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCommandHandler($command)
|
||||
{
|
||||
return array_key_exists(get_class($command), $this->handlers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the handler for a command.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public function getCommandHandler($command)
|
||||
{
|
||||
if ($this->hasCommandHandler($command)) {
|
||||
return $this->container->make($this->handlers[get_class($command)]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given command should be queued.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return bool
|
||||
*/
|
||||
protected function commandShouldBeQueued($command)
|
||||
{
|
||||
return $command instanceof ShouldQueue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler behind a queue.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function dispatchToQueue($command)
|
||||
{
|
||||
$connection = $command->connection ?? null;
|
||||
|
||||
$queue = call_user_func($this->queueResolver, $connection);
|
||||
|
||||
if (! $queue instanceof Queue) {
|
||||
throw new RuntimeException('Queue resolver did not return a Queue implementation.');
|
||||
}
|
||||
|
||||
if (method_exists($command, 'queue')) {
|
||||
return $command->queue($queue, $command);
|
||||
}
|
||||
|
||||
return $this->pushCommandToQueue($queue, $command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push the command onto the given queue instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Queue\Queue $queue
|
||||
* @param mixed $command
|
||||
* @return mixed
|
||||
*/
|
||||
protected function pushCommandToQueue($queue, $command)
|
||||
{
|
||||
if (isset($command->queue, $command->delay)) {
|
||||
return $queue->laterOn($command->queue, $command->delay, $command);
|
||||
}
|
||||
|
||||
if (isset($command->queue)) {
|
||||
return $queue->pushOn($command->queue, $command);
|
||||
}
|
||||
|
||||
if (isset($command->delay)) {
|
||||
return $queue->later($command->delay, $command);
|
||||
}
|
||||
|
||||
return $queue->push($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the pipes through which commands should be piped before dispatching.
|
||||
*
|
||||
* @param array $pipes
|
||||
* @return $this
|
||||
*/
|
||||
public function pipeThrough(array $pipes)
|
||||
{
|
||||
$this->pipes = $pipes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a command to a handler.
|
||||
*
|
||||
* @param array $map
|
||||
* @return $this
|
||||
*/
|
||||
public function map(array $map)
|
||||
{
|
||||
$this->handlers = array_merge($this->handlers, $map);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,283 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Console;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\ProcessUtils;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Process\PhpExecutableFinder;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Application as SymfonyApplication;
|
||||
use Symfony\Component\Console\Command\Command as SymfonyCommand;
|
||||
use Illuminate\Contracts\Console\Application as ApplicationContract;
|
||||
|
||||
class Application extends SymfonyApplication implements ApplicationContract
|
||||
{
|
||||
/**
|
||||
* The Laravel application instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Container\Container
|
||||
*/
|
||||
protected $laravel;
|
||||
|
||||
/**
|
||||
* The output from the previous command.
|
||||
*
|
||||
* @var \Symfony\Component\Console\Output\BufferedOutput
|
||||
*/
|
||||
protected $lastOutput;
|
||||
|
||||
/**
|
||||
* The console application bootstrappers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $bootstrappers = [];
|
||||
|
||||
/**
|
||||
* The Event Dispatcher.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* Create a new Artisan console application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container $laravel
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $events
|
||||
* @param string $version
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Container $laravel, Dispatcher $events, $version)
|
||||
{
|
||||
parent::__construct('Laravel Framework', $version);
|
||||
|
||||
$this->laravel = $laravel;
|
||||
$this->events = $events;
|
||||
$this->setAutoExit(false);
|
||||
$this->setCatchExceptions(false);
|
||||
|
||||
$this->events->dispatch(new Events\ArtisanStarting($this));
|
||||
|
||||
$this->bootstrap();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run(InputInterface $input = null, OutputInterface $output = null)
|
||||
{
|
||||
$commandName = $this->getCommandName(
|
||||
$input = $input ?: new ArgvInput
|
||||
);
|
||||
|
||||
$this->events->fire(
|
||||
new Events\CommandStarting(
|
||||
$commandName, $input, $output = $output ?: new ConsoleOutput
|
||||
)
|
||||
);
|
||||
|
||||
$exitCode = parent::run($input, $output);
|
||||
|
||||
$this->events->fire(
|
||||
new Events\CommandFinished($commandName, $input, $output, $exitCode)
|
||||
);
|
||||
|
||||
return $exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the proper PHP executable.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function phpBinary()
|
||||
{
|
||||
return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the proper Artisan executable.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function artisanBinary()
|
||||
{
|
||||
return defined('ARTISAN_BINARY') ? ProcessUtils::escapeArgument(ARTISAN_BINARY) : 'artisan';
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given command as a fully-qualified executable command.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function formatCommandString($string)
|
||||
{
|
||||
return sprintf('%s %s %s', static::phpBinary(), static::artisanBinary(), $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a console "starting" bootstrapper.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return void
|
||||
*/
|
||||
public static function starting(Closure $callback)
|
||||
{
|
||||
static::$bootstrappers[] = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap the console application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function bootstrap()
|
||||
{
|
||||
foreach (static::$bootstrappers as $bootstrapper) {
|
||||
$bootstrapper($this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the console application bootstrappers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function forgetBootstrappers()
|
||||
{
|
||||
static::$bootstrappers = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Run an Artisan console command by name.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $parameters
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $outputBuffer
|
||||
* @return int
|
||||
*/
|
||||
public function call($command, array $parameters = [], $outputBuffer = null)
|
||||
{
|
||||
$parameters = collect($parameters)->prepend($command);
|
||||
|
||||
$this->lastOutput = $outputBuffer ?: new BufferedOutput;
|
||||
|
||||
$this->setCatchExceptions(false);
|
||||
|
||||
$result = $this->run(new ArrayInput($parameters->toArray()), $this->lastOutput);
|
||||
|
||||
$this->setCatchExceptions(true);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output for the last run command.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function output()
|
||||
{
|
||||
return $this->lastOutput ? $this->lastOutput->fetch() : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a command to the console.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Command\Command $command
|
||||
* @return \Symfony\Component\Console\Command\Command
|
||||
*/
|
||||
public function add(SymfonyCommand $command)
|
||||
{
|
||||
if ($command instanceof Command) {
|
||||
$command->setLaravel($this->laravel);
|
||||
}
|
||||
|
||||
return $this->addToParent($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the command to the parent instance.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Command\Command $command
|
||||
* @return \Symfony\Component\Console\Command\Command
|
||||
*/
|
||||
protected function addToParent(SymfonyCommand $command)
|
||||
{
|
||||
return parent::add($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a command, resolving through the application.
|
||||
*
|
||||
* @param string $command
|
||||
* @return \Symfony\Component\Console\Command\Command
|
||||
*/
|
||||
public function resolve($command)
|
||||
{
|
||||
return $this->add($this->laravel->make($command));
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve an array of commands through the application.
|
||||
*
|
||||
* @param array|mixed $commands
|
||||
* @return $this
|
||||
*/
|
||||
public function resolveCommands($commands)
|
||||
{
|
||||
$commands = is_array($commands) ? $commands : func_get_args();
|
||||
|
||||
foreach ($commands as $command) {
|
||||
$this->resolve($command);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default input definitions for the applications.
|
||||
*
|
||||
* This is used to add the --env option to every available command.
|
||||
*
|
||||
* @return \Symfony\Component\Console\Input\InputDefinition
|
||||
*/
|
||||
protected function getDefaultInputDefinition()
|
||||
{
|
||||
return tap(parent::getDefaultInputDefinition(), function ($definition) {
|
||||
$definition->addOption($this->getEnvironmentOption());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global environment option for the definition.
|
||||
*
|
||||
* @return \Symfony\Component\Console\Input\InputOption
|
||||
*/
|
||||
protected function getEnvironmentOption()
|
||||
{
|
||||
$message = 'The environment the command should run under';
|
||||
|
||||
return new InputOption('--env', null, InputOption::VALUE_OPTIONAL, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Laravel application instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
public function getLaravel()
|
||||
{
|
||||
return $this->laravel;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Database\Eloquent\Concerns;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Arr;
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Database\Eloquent\Scope;
|
||||
|
||||
trait HasGlobalScopes
|
||||
{
|
||||
/**
|
||||
* Register a new global scope on the model.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Scope|\Closure|string $scope
|
||||
* @param \Closure|null $implementation
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function addGlobalScope($scope, Closure $implementation = null)
|
||||
{
|
||||
if (is_string($scope) && ! is_null($implementation)) {
|
||||
return static::$globalScopes[static::class][$scope] = $implementation;
|
||||
} elseif ($scope instanceof Closure) {
|
||||
return static::$globalScopes[static::class][spl_object_hash($scope)] = $scope;
|
||||
} elseif ($scope instanceof Scope) {
|
||||
return static::$globalScopes[static::class][get_class($scope)] = $scope;
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('Global scope must be an instance of Closure or Scope.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a model has a global scope.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Scope|string $scope
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasGlobalScope($scope)
|
||||
{
|
||||
return ! is_null(static::getGlobalScope($scope));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a global scope registered with the model.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Scope|string $scope
|
||||
* @return \Illuminate\Database\Eloquent\Scope|\Closure|null
|
||||
*/
|
||||
public static function getGlobalScope($scope)
|
||||
{
|
||||
if (is_string($scope)) {
|
||||
return Arr::get(static::$globalScopes, static::class.'.'.$scope);
|
||||
}
|
||||
|
||||
return Arr::get(
|
||||
static::$globalScopes, static::class.'.'.get_class($scope)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global scopes for this class instance.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getGlobalScopes()
|
||||
{
|
||||
return Arr::get(static::$globalScopes, static::class, []);
|
||||
}
|
||||
}
|
||||
@@ -1,310 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Database\Eloquent\Concerns;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||
|
||||
trait QueriesRelationships
|
||||
{
|
||||
/**
|
||||
* Add a relationship count / exists condition to the query.
|
||||
*
|
||||
* @param string $relation
|
||||
* @param string $operator
|
||||
* @param int $count
|
||||
* @param string $boolean
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null)
|
||||
{
|
||||
if (strpos($relation, '.') !== false) {
|
||||
return $this->hasNested($relation, $operator, $count, $boolean, $callback);
|
||||
}
|
||||
|
||||
$relation = $this->getRelationWithoutConstraints($relation);
|
||||
|
||||
// If we only need to check for the existence of the relation, then we can optimize
|
||||
// the subquery to only run a "where exists" clause instead of this full "count"
|
||||
// clause. This will make these queries run much faster compared with a count.
|
||||
$method = $this->canUseExistsForExistenceCheck($operator, $count)
|
||||
? 'getRelationExistenceQuery'
|
||||
: 'getRelationExistenceCountQuery';
|
||||
|
||||
$hasQuery = $relation->{$method}(
|
||||
$relation->getRelated()->newQuery(), $this
|
||||
);
|
||||
|
||||
// Next we will call any given callback as an "anonymous" scope so they can get the
|
||||
// proper logical grouping of the where clauses if needed by this Eloquent query
|
||||
// builder. Then, we will be ready to finalize and return this query instance.
|
||||
if ($callback) {
|
||||
$hasQuery->callScope($callback);
|
||||
}
|
||||
|
||||
return $this->addHasWhere(
|
||||
$hasQuery, $relation, $operator, $count, $boolean
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add nested relationship count / exists conditions to the query.
|
||||
*
|
||||
* Sets up recursive call to whereHas until we finish the nested relation.
|
||||
*
|
||||
* @param string $relations
|
||||
* @param string $operator
|
||||
* @param int $count
|
||||
* @param string $boolean
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
protected function hasNested($relations, $operator = '>=', $count = 1, $boolean = 'and', $callback = null)
|
||||
{
|
||||
$relations = explode('.', $relations);
|
||||
|
||||
$closure = function ($q) use (&$closure, &$relations, $operator, $count, $callback) {
|
||||
// In order to nest "has", we need to add count relation constraints on the
|
||||
// callback Closure. We'll do this by simply passing the Closure its own
|
||||
// reference to itself so it calls itself recursively on each segment.
|
||||
count($relations) > 1
|
||||
? $q->whereHas(array_shift($relations), $closure)
|
||||
: $q->has(array_shift($relations), $operator, $count, 'and', $callback);
|
||||
};
|
||||
|
||||
return $this->has(array_shift($relations), '>=', 1, $boolean, $closure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a relationship count / exists condition to the query with an "or".
|
||||
*
|
||||
* @param string $relation
|
||||
* @param string $operator
|
||||
* @param int $count
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function orHas($relation, $operator = '>=', $count = 1)
|
||||
{
|
||||
return $this->has($relation, $operator, $count, 'or');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a relationship count / exists condition to the query.
|
||||
*
|
||||
* @param string $relation
|
||||
* @param string $boolean
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function doesntHave($relation, $boolean = 'and', Closure $callback = null)
|
||||
{
|
||||
return $this->has($relation, '<', 1, $boolean, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a relationship count / exists condition to the query with an "or".
|
||||
*
|
||||
* @param string $relation
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function orDoesntHave($relation)
|
||||
{
|
||||
return $this->doesntHave($relation, 'or');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a relationship count / exists condition to the query with where clauses.
|
||||
*
|
||||
* @param string $relation
|
||||
* @param \Closure|null $callback
|
||||
* @param string $operator
|
||||
* @param int $count
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function whereHas($relation, Closure $callback = null, $operator = '>=', $count = 1)
|
||||
{
|
||||
return $this->has($relation, $operator, $count, 'and', $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a relationship count / exists condition to the query with where clauses and an "or".
|
||||
*
|
||||
* @param string $relation
|
||||
* @param \Closure $callback
|
||||
* @param string $operator
|
||||
* @param int $count
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function orWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1)
|
||||
{
|
||||
return $this->has($relation, $operator, $count, 'or', $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a relationship count / exists condition to the query with where clauses.
|
||||
*
|
||||
* @param string $relation
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function whereDoesntHave($relation, Closure $callback = null)
|
||||
{
|
||||
return $this->doesntHave($relation, 'and', $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a relationship count / exists condition to the query with where clauses and an "or".
|
||||
*
|
||||
* @param string $relation
|
||||
* @param \Closure $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function orWhereDoesntHave($relation, Closure $callback = null)
|
||||
{
|
||||
return $this->doesntHave($relation, 'or', $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add subselect queries to count the relations.
|
||||
*
|
||||
* @param mixed $relations
|
||||
* @return $this
|
||||
*/
|
||||
public function withCount($relations)
|
||||
{
|
||||
if (empty($relations)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if (is_null($this->query->columns)) {
|
||||
$this->query->select([$this->query->from.'.*']);
|
||||
}
|
||||
|
||||
$relations = is_array($relations) ? $relations : func_get_args();
|
||||
|
||||
foreach ($this->parseWithRelations($relations) as $name => $constraints) {
|
||||
// First we will determine if the name has been aliased using an "as" clause on the name
|
||||
// and if it has we will extract the actual relationship name and the desired name of
|
||||
// the resulting column. This allows multiple counts on the same relationship name.
|
||||
$segments = explode(' ', $name);
|
||||
|
||||
unset($alias);
|
||||
|
||||
if (count($segments) == 3 && Str::lower($segments[1]) == 'as') {
|
||||
list($name, $alias) = [$segments[0], $segments[2]];
|
||||
}
|
||||
|
||||
$relation = $this->getRelationWithoutConstraints($name);
|
||||
|
||||
// Here we will get the relationship count query and prepare to add it to the main query
|
||||
// as a sub-select. First, we'll get the "has" query and use that to get the relation
|
||||
// count query. We will normalize the relation name then append _count as the name.
|
||||
$query = $relation->getRelationExistenceCountQuery(
|
||||
$relation->getRelated()->newQuery(), $this
|
||||
);
|
||||
|
||||
$query->callScope($constraints);
|
||||
|
||||
$query->mergeConstraintsFrom($relation->getQuery());
|
||||
|
||||
// Finally we will add the proper result column alias to the query and run the subselect
|
||||
// statement against the query builder. Then we will return the builder instance back
|
||||
// to the developer for further constraint chaining that needs to take place on it.
|
||||
$column = $alias ?? Str::snake($name.'_count');
|
||||
|
||||
$this->selectSub($query->toBase(), $column);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the "has" condition where clause to the query.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $hasQuery
|
||||
* @param \Illuminate\Database\Eloquent\Relations\Relation $relation
|
||||
* @param string $operator
|
||||
* @param int $count
|
||||
* @param string $boolean
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
protected function addHasWhere(Builder $hasQuery, Relation $relation, $operator, $count, $boolean)
|
||||
{
|
||||
$hasQuery->mergeConstraintsFrom($relation->getQuery());
|
||||
|
||||
return $this->canUseExistsForExistenceCheck($operator, $count)
|
||||
? $this->addWhereExistsQuery($hasQuery->toBase(), $boolean, $operator === '<' && $count === 1)
|
||||
: $this->addWhereCountQuery($hasQuery->toBase(), $operator, $count, $boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge the where constraints from another query to the current query.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $from
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function mergeConstraintsFrom(Builder $from)
|
||||
{
|
||||
$whereBindings = $from->getQuery()->getRawBindings()['where'] ?? [];
|
||||
|
||||
// Here we have some other query that we want to merge the where constraints from. We will
|
||||
// copy over any where constraints on the query as well as remove any global scopes the
|
||||
// query might have removed. Then we will return ourselves with the finished merging.
|
||||
return $this->withoutGlobalScopes(
|
||||
$from->removedScopes()
|
||||
)->mergeWheres(
|
||||
$from->getQuery()->wheres, $whereBindings
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a sub-query count clause to this query.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $query
|
||||
* @param string $operator
|
||||
* @param int $count
|
||||
* @param string $boolean
|
||||
* @return $this
|
||||
*/
|
||||
protected function addWhereCountQuery(QueryBuilder $query, $operator = '>=', $count = 1, $boolean = 'and')
|
||||
{
|
||||
$this->query->addBinding($query->getBindings(), 'where');
|
||||
|
||||
return $this->where(
|
||||
new Expression('('.$query->toSql().')'),
|
||||
$operator,
|
||||
is_numeric($count) ? new Expression($count) : $count,
|
||||
$boolean
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "has relation" base query instance.
|
||||
*
|
||||
* @param string $relation
|
||||
* @return \Illuminate\Database\Eloquent\Relations\Relation
|
||||
*/
|
||||
protected function getRelationWithoutConstraints($relation)
|
||||
{
|
||||
return Relation::noConstraints(function () use ($relation) {
|
||||
return $this->getModel()->{$relation}();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we can run an "exists" query to optimize performance.
|
||||
*
|
||||
* @param string $operator
|
||||
* @param int $count
|
||||
* @return bool
|
||||
*/
|
||||
protected function canUseExistsForExistenceCheck($operator, $count)
|
||||
{
|
||||
return ($operator === '>=' || $operator === '<') && $count === 1;
|
||||
}
|
||||
}
|
||||
@@ -1,385 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Database\Eloquent\Relations;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
/**
|
||||
* @mixin \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
abstract class Relation
|
||||
{
|
||||
use Macroable {
|
||||
__call as macroCall;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Eloquent query builder instance.
|
||||
*
|
||||
* @var \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
protected $query;
|
||||
|
||||
/**
|
||||
* The parent model instance.
|
||||
*
|
||||
* @var \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* The related model instance.
|
||||
*
|
||||
* @var \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
protected $related;
|
||||
|
||||
/**
|
||||
* Indicates if the relation is adding constraints.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $constraints = true;
|
||||
|
||||
/**
|
||||
* An array to map class names to their morph names in database.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $morphMap = [];
|
||||
|
||||
/**
|
||||
* Create a new relation instance.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param \Illuminate\Database\Eloquent\Model $parent
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Builder $query, Model $parent)
|
||||
{
|
||||
$this->query = $query;
|
||||
$this->parent = $parent;
|
||||
$this->related = $query->getModel();
|
||||
|
||||
$this->addConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a callback with constraints disabled on the relation.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public static function noConstraints(Closure $callback)
|
||||
{
|
||||
$previous = static::$constraints;
|
||||
|
||||
static::$constraints = false;
|
||||
|
||||
// When resetting the relation where clause, we want to shift the first element
|
||||
// off of the bindings, leaving only the constraints that the developers put
|
||||
// as "extra" on the relationships, and not original relation constraints.
|
||||
try {
|
||||
return call_user_func($callback);
|
||||
} finally {
|
||||
static::$constraints = $previous;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base constraints on the relation query.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function addConstraints();
|
||||
|
||||
/**
|
||||
* Set the constraints for an eager load of the relation.
|
||||
*
|
||||
* @param array $models
|
||||
* @return void
|
||||
*/
|
||||
abstract public function addEagerConstraints(array $models);
|
||||
|
||||
/**
|
||||
* Initialize the relation on a set of models.
|
||||
*
|
||||
* @param array $models
|
||||
* @param string $relation
|
||||
* @return array
|
||||
*/
|
||||
abstract public function initRelation(array $models, $relation);
|
||||
|
||||
/**
|
||||
* Match the eagerly loaded results to their parents.
|
||||
*
|
||||
* @param array $models
|
||||
* @param \Illuminate\Database\Eloquent\Collection $results
|
||||
* @param string $relation
|
||||
* @return array
|
||||
*/
|
||||
abstract public function match(array $models, Collection $results, $relation);
|
||||
|
||||
/**
|
||||
* Get the results of the relationship.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function getResults();
|
||||
|
||||
/**
|
||||
* Get the relationship for eager loading.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function getEager()
|
||||
{
|
||||
return $this->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the query as a "select" statement.
|
||||
*
|
||||
* @param array $columns
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function get($columns = ['*'])
|
||||
{
|
||||
return $this->query->get($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Touch all of the related models for the relationship.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function touch()
|
||||
{
|
||||
$column = $this->getRelated()->getUpdatedAtColumn();
|
||||
|
||||
$this->rawUpdate([$column => $this->getRelated()->freshTimestampString()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a raw update against the base query.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return int
|
||||
*/
|
||||
public function rawUpdate(array $attributes = [])
|
||||
{
|
||||
return $this->query->withoutGlobalScopes()->update($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the constraints for a relationship count query.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param \Illuminate\Database\Eloquent\Builder $parentQuery
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function getRelationExistenceCountQuery(Builder $query, Builder $parentQuery)
|
||||
{
|
||||
return $this->getRelationExistenceQuery(
|
||||
$query, $parentQuery, new Expression('count(*)')
|
||||
)->setBindings([], 'select');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the constraints for an internal relationship existence query.
|
||||
*
|
||||
* Essentially, these queries compare on column names like whereColumn.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param \Illuminate\Database\Eloquent\Builder $parentQuery
|
||||
* @param array|mixed $columns
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
|
||||
{
|
||||
return $query->select($columns)->whereColumn(
|
||||
$this->getQualifiedParentKeyName(), '=', $this->getExistenceCompareKey()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the primary keys for an array of models.
|
||||
*
|
||||
* @param array $models
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
protected function getKeys(array $models, $key = null)
|
||||
{
|
||||
return collect($models)->map(function ($value) use ($key) {
|
||||
return $key ? $value->getAttribute($key) : $value->getKey();
|
||||
})->values()->unique()->sort()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying query for the relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function getQuery()
|
||||
{
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base query builder driving the Eloquent builder.
|
||||
*
|
||||
* @return \Illuminate\Database\Query\Builder
|
||||
*/
|
||||
public function getBaseQuery()
|
||||
{
|
||||
return $this->query->getQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent model of the relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fully qualified parent key name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQualifiedParentKeyName()
|
||||
{
|
||||
return $this->parent->getQualifiedKeyName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the related model of the relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
public function getRelated()
|
||||
{
|
||||
return $this->related;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the "created at" column.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function createdAt()
|
||||
{
|
||||
return $this->parent->getCreatedAtColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the "updated at" column.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function updatedAt()
|
||||
{
|
||||
return $this->parent->getUpdatedAtColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the related model's "updated at" column.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function relatedUpdatedAt()
|
||||
{
|
||||
return $this->related->getUpdatedAtColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set or get the morph map for polymorphic relations.
|
||||
*
|
||||
* @param array|null $map
|
||||
* @param bool $merge
|
||||
* @return array
|
||||
*/
|
||||
public static function morphMap(array $map = null, $merge = true)
|
||||
{
|
||||
$map = static::buildMorphMapFromModels($map);
|
||||
|
||||
if (is_array($map)) {
|
||||
static::$morphMap = $merge && static::$morphMap
|
||||
? $map + static::$morphMap : $map;
|
||||
}
|
||||
|
||||
return static::$morphMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a table-keyed array from model class names.
|
||||
*
|
||||
* @param string[]|null $models
|
||||
* @return array|null
|
||||
*/
|
||||
protected static function buildMorphMapFromModels(array $models = null)
|
||||
{
|
||||
if (is_null($models) || Arr::isAssoc($models)) {
|
||||
return $models;
|
||||
}
|
||||
|
||||
return array_combine(array_map(function ($model) {
|
||||
return (new $model)->getTable();
|
||||
}, $models), $models);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model associated with a custom polymorphic type.
|
||||
*
|
||||
* @param string $alias
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getMorphedModel($alias)
|
||||
{
|
||||
return array_key_exists($alias, self::$morphMap)
|
||||
? self::$morphMap[$alias]
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic method calls to the relationship.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (static::hasMacro($method)) {
|
||||
return $this->macroCall($method, $parameters);
|
||||
}
|
||||
|
||||
$result = $this->query->{$method}(...$parameters);
|
||||
|
||||
if ($result === $this->query) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Force a clone of the underlying query builder when cloning.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->query = clone $this->query;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,304 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Database\Schema;
|
||||
|
||||
use Closure;
|
||||
use LogicException;
|
||||
use Illuminate\Database\Connection;
|
||||
|
||||
class Builder
|
||||
{
|
||||
/**
|
||||
* The database connection instance.
|
||||
*
|
||||
* @var \Illuminate\Database\Connection
|
||||
*/
|
||||
protected $connection;
|
||||
|
||||
/**
|
||||
* The schema grammar instance.
|
||||
*
|
||||
* @var \Illuminate\Database\Schema\Grammars\Grammar
|
||||
*/
|
||||
protected $grammar;
|
||||
|
||||
/**
|
||||
* The Blueprint resolver callback.
|
||||
*
|
||||
* @var \Closure
|
||||
*/
|
||||
protected $resolver;
|
||||
|
||||
/**
|
||||
* The default string length for migrations.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public static $defaultStringLength = 255;
|
||||
|
||||
/**
|
||||
* Create a new database Schema manager.
|
||||
*
|
||||
* @param \Illuminate\Database\Connection $connection
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Connection $connection)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
$this->grammar = $connection->getSchemaGrammar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default string length for migrations.
|
||||
*
|
||||
* @param int $length
|
||||
* @return void
|
||||
*/
|
||||
public static function defaultStringLength($length)
|
||||
{
|
||||
static::$defaultStringLength = $length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given table exists.
|
||||
*
|
||||
* @param string $table
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTable($table)
|
||||
{
|
||||
$table = $this->connection->getTablePrefix().$table;
|
||||
|
||||
return count($this->connection->select(
|
||||
$this->grammar->compileTableExists(), [$table]
|
||||
)) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given table has a given column.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $column
|
||||
* @return bool
|
||||
*/
|
||||
public function hasColumn($table, $column)
|
||||
{
|
||||
return in_array(
|
||||
strtolower($column), array_map('strtolower', $this->getColumnListing($table))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given table has given columns.
|
||||
*
|
||||
* @param string $table
|
||||
* @param array $columns
|
||||
* @return bool
|
||||
*/
|
||||
public function hasColumns($table, array $columns)
|
||||
{
|
||||
$tableColumns = array_map('strtolower', $this->getColumnListing($table));
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if (! in_array(strtolower($column), $tableColumns)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data type for the given column name.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $column
|
||||
* @return string
|
||||
*/
|
||||
public function getColumnType($table, $column)
|
||||
{
|
||||
$table = $this->connection->getTablePrefix().$table;
|
||||
|
||||
return $this->connection->getDoctrineColumn($table, $column)->getType()->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the column listing for a given table.
|
||||
*
|
||||
* @param string $table
|
||||
* @return array
|
||||
*/
|
||||
public function getColumnListing($table)
|
||||
{
|
||||
$results = $this->connection->select($this->grammar->compileColumnListing(
|
||||
$this->connection->getTablePrefix().$table
|
||||
));
|
||||
|
||||
return $this->connection->getPostProcessor()->processColumnListing($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a table on the schema.
|
||||
*
|
||||
* @param string $table
|
||||
* @param \Closure $callback
|
||||
* @return void
|
||||
*/
|
||||
public function table($table, Closure $callback)
|
||||
{
|
||||
$this->build($this->createBlueprint($table, $callback));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new table on the schema.
|
||||
*
|
||||
* @param string $table
|
||||
* @param \Closure $callback
|
||||
* @return void
|
||||
*/
|
||||
public function create($table, Closure $callback)
|
||||
{
|
||||
$this->build(tap($this->createBlueprint($table), function ($blueprint) use ($callback) {
|
||||
$blueprint->create();
|
||||
|
||||
$callback($blueprint);
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop a table from the schema.
|
||||
*
|
||||
* @param string $table
|
||||
* @return void
|
||||
*/
|
||||
public function drop($table)
|
||||
{
|
||||
$this->build(tap($this->createBlueprint($table), function ($blueprint) {
|
||||
$blueprint->drop();
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop a table from the schema if it exists.
|
||||
*
|
||||
* @param string $table
|
||||
* @return void
|
||||
*/
|
||||
public function dropIfExists($table)
|
||||
{
|
||||
$this->build(tap($this->createBlueprint($table), function ($blueprint) {
|
||||
$blueprint->dropIfExists();
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop all tables from the database.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function dropAllTables()
|
||||
{
|
||||
throw new LogicException('This database driver does not support dropping all tables.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a table on the schema.
|
||||
*
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @return void
|
||||
*/
|
||||
public function rename($from, $to)
|
||||
{
|
||||
$this->build(tap($this->createBlueprint($from), function ($blueprint) use ($to) {
|
||||
$blueprint->rename($to);
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable foreign key constraints.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function enableForeignKeyConstraints()
|
||||
{
|
||||
return $this->connection->statement(
|
||||
$this->grammar->compileEnableForeignKeyConstraints()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable foreign key constraints.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function disableForeignKeyConstraints()
|
||||
{
|
||||
return $this->connection->statement(
|
||||
$this->grammar->compileDisableForeignKeyConstraints()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the blueprint to build / modify the table.
|
||||
*
|
||||
* @param \Illuminate\Database\Schema\Blueprint $blueprint
|
||||
* @return void
|
||||
*/
|
||||
protected function build(Blueprint $blueprint)
|
||||
{
|
||||
$blueprint->build($this->connection, $this->grammar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new command set with a Closure.
|
||||
*
|
||||
* @param string $table
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Schema\Blueprint
|
||||
*/
|
||||
protected function createBlueprint($table, Closure $callback = null)
|
||||
{
|
||||
if (isset($this->resolver)) {
|
||||
return call_user_func($this->resolver, $table, $callback);
|
||||
}
|
||||
|
||||
return new Blueprint($table, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the database connection instance.
|
||||
*
|
||||
* @return \Illuminate\Database\Connection
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the database connection instance.
|
||||
*
|
||||
* @param \Illuminate\Database\Connection $connection
|
||||
* @return $this
|
||||
*/
|
||||
public function setConnection(Connection $connection)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Schema Blueprint resolver callback.
|
||||
*
|
||||
* @param \Closure $resolver
|
||||
* @return void
|
||||
*/
|
||||
public function blueprintResolver(Closure $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
}
|
||||
}
|
||||
@@ -1,238 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Http;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Illuminate\Support\ViewErrorBag;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Illuminate\Session\Store as SessionStore;
|
||||
use Illuminate\Contracts\Support\MessageProvider;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile as SymfonyUploadedFile;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse as BaseRedirectResponse;
|
||||
|
||||
class RedirectResponse extends BaseRedirectResponse
|
||||
{
|
||||
use ResponseTrait, Macroable {
|
||||
Macroable::__call as macroCall;
|
||||
}
|
||||
|
||||
/**
|
||||
* The request instance.
|
||||
*
|
||||
* @var \Illuminate\Http\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* The session store implementation.
|
||||
*
|
||||
* @var \Illuminate\Session\Store
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* Flash a piece of data to the session.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function with($key, $value = null)
|
||||
{
|
||||
$key = is_array($key) ? $key : [$key => $value];
|
||||
|
||||
foreach ($key as $k => $v) {
|
||||
$this->session->flash($k, $v);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add multiple cookies to the response.
|
||||
*
|
||||
* @param array $cookies
|
||||
* @return $this
|
||||
*/
|
||||
public function withCookies(array $cookies)
|
||||
{
|
||||
foreach ($cookies as $cookie) {
|
||||
$this->headers->setCookie($cookie);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash an array of input to the session.
|
||||
*
|
||||
* @param array $input
|
||||
* @return $this
|
||||
*/
|
||||
public function withInput(array $input = null)
|
||||
{
|
||||
$this->session->flashInput($this->removeFilesFromInput(
|
||||
! is_null($input) ? $input : $this->request->input()
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all uploaded files form the given input array.
|
||||
*
|
||||
* @param array $input
|
||||
* @return array
|
||||
*/
|
||||
protected function removeFilesFromInput(array $input)
|
||||
{
|
||||
foreach ($input as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$input[$key] = $this->removeFilesFromInput($value);
|
||||
}
|
||||
|
||||
if ($value instanceof SymfonyUploadedFile) {
|
||||
unset($input[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash an array of input to the session.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function onlyInput()
|
||||
{
|
||||
return $this->withInput($this->request->only(func_get_args()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash an array of input to the session.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function exceptInput()
|
||||
{
|
||||
return $this->withInput($this->request->except(func_get_args()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash a container of errors to the session.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider
|
||||
* @param string $key
|
||||
* @return $this
|
||||
*/
|
||||
public function withErrors($provider, $key = 'default')
|
||||
{
|
||||
$value = $this->parseErrors($provider);
|
||||
|
||||
$errors = $this->session->get('errors', new ViewErrorBag);
|
||||
|
||||
if (! $errors instanceof ViewErrorBag) {
|
||||
$errors = new ViewErrorBag;
|
||||
}
|
||||
|
||||
$this->session->flash(
|
||||
'errors', $errors->put($key, $value)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given errors into an appropriate value.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider
|
||||
* @return \Illuminate\Support\MessageBag
|
||||
*/
|
||||
protected function parseErrors($provider)
|
||||
{
|
||||
if ($provider instanceof MessageProvider) {
|
||||
return $provider->getMessageBag();
|
||||
}
|
||||
|
||||
return new MessageBag((array) $provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the original response content.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function getOriginalContent()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request instance.
|
||||
*
|
||||
* @return \Illuminate\Http\Request|null
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the request instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function setRequest(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the session store implementation.
|
||||
*
|
||||
* @return \Illuminate\Session\Store|null
|
||||
*/
|
||||
public function getSession()
|
||||
{
|
||||
return $this->session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the session store implementation.
|
||||
*
|
||||
* @param \Illuminate\Session\Store $session
|
||||
* @return void
|
||||
*/
|
||||
public function setSession(SessionStore $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically bind flash data in the session.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return $this
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (static::hasMacro($method)) {
|
||||
return $this->macroCall($method, $parameters);
|
||||
}
|
||||
|
||||
if (Str::startsWith($method, 'with')) {
|
||||
return $this->with(Str::snake(substr($method, 4)), $parameters[0]);
|
||||
}
|
||||
|
||||
throw new BadMethodCallException(
|
||||
"Method [$method] does not exist on Redirect."
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,377 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Log;
|
||||
|
||||
use Closure;
|
||||
use RuntimeException;
|
||||
use InvalidArgumentException;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogHandler;
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\ErrorLogHandler;
|
||||
use Monolog\Logger as MonologLogger;
|
||||
use Illuminate\Log\Events\MessageLogged;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Psr\Log\LoggerInterface as PsrLoggerInterface;
|
||||
use Illuminate\Contracts\Logging\Log as LogContract;
|
||||
|
||||
class Writer implements LogContract, PsrLoggerInterface
|
||||
{
|
||||
/**
|
||||
* The Monolog logger instance.
|
||||
*
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $monolog;
|
||||
|
||||
/**
|
||||
* The event dispatcher instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* The Log levels.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $levels = [
|
||||
'debug' => MonologLogger::DEBUG,
|
||||
'info' => MonologLogger::INFO,
|
||||
'notice' => MonologLogger::NOTICE,
|
||||
'warning' => MonologLogger::WARNING,
|
||||
'error' => MonologLogger::ERROR,
|
||||
'critical' => MonologLogger::CRITICAL,
|
||||
'alert' => MonologLogger::ALERT,
|
||||
'emergency' => MonologLogger::EMERGENCY,
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new log writer instance.
|
||||
*
|
||||
* @param \Monolog\Logger $monolog
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher|null $dispatcher
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MonologLogger $monolog, Dispatcher $dispatcher = null)
|
||||
{
|
||||
$this->monolog = $monolog;
|
||||
|
||||
if (isset($dispatcher)) {
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an emergency message to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function emergency($message, array $context = [])
|
||||
{
|
||||
$this->writeLog(__FUNCTION__, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an alert message to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function alert($message, array $context = [])
|
||||
{
|
||||
$this->writeLog(__FUNCTION__, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a critical message to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function critical($message, array $context = [])
|
||||
{
|
||||
$this->writeLog(__FUNCTION__, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an error message to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function error($message, array $context = [])
|
||||
{
|
||||
$this->writeLog(__FUNCTION__, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a warning message to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function warning($message, array $context = [])
|
||||
{
|
||||
$this->writeLog(__FUNCTION__, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a notice to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function notice($message, array $context = [])
|
||||
{
|
||||
$this->writeLog(__FUNCTION__, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an informational message to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function info($message, array $context = [])
|
||||
{
|
||||
$this->writeLog(__FUNCTION__, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a debug message to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function debug($message, array $context = [])
|
||||
{
|
||||
$this->writeLog(__FUNCTION__, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message to the logs.
|
||||
*
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function log($level, $message, array $context = [])
|
||||
{
|
||||
$this->writeLog($level, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically pass log calls into the writer.
|
||||
*
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function write($level, $message, array $context = [])
|
||||
{
|
||||
$this->writeLog($level, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a message to Monolog.
|
||||
*
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
protected function writeLog($level, $message, $context)
|
||||
{
|
||||
$this->fireLogEvent($level, $message = $this->formatMessage($message), $context);
|
||||
|
||||
$this->monolog->{$level}($message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a file log handler.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $level
|
||||
* @return void
|
||||
*/
|
||||
public function useFiles($path, $level = 'debug')
|
||||
{
|
||||
$this->monolog->pushHandler($handler = new StreamHandler($path, $this->parseLevel($level)));
|
||||
|
||||
$handler->setFormatter($this->getDefaultFormatter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a daily file log handler.
|
||||
*
|
||||
* @param string $path
|
||||
* @param int $days
|
||||
* @param string $level
|
||||
* @return void
|
||||
*/
|
||||
public function useDailyFiles($path, $days = 0, $level = 'debug')
|
||||
{
|
||||
$this->monolog->pushHandler(
|
||||
$handler = new RotatingFileHandler($path, $days, $this->parseLevel($level))
|
||||
);
|
||||
|
||||
$handler->setFormatter($this->getDefaultFormatter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a Syslog handler.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $level
|
||||
* @param mixed $facility
|
||||
* @return \Psr\Log\LoggerInterface
|
||||
*/
|
||||
public function useSyslog($name = 'laravel', $level = 'debug', $facility = LOG_USER)
|
||||
{
|
||||
return $this->monolog->pushHandler(new SyslogHandler($name, $facility, $level));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an error_log handler.
|
||||
*
|
||||
* @param string $level
|
||||
* @param int $messageType
|
||||
* @return void
|
||||
*/
|
||||
public function useErrorLog($level = 'debug', $messageType = ErrorLogHandler::OPERATING_SYSTEM)
|
||||
{
|
||||
$this->monolog->pushHandler(
|
||||
new ErrorLogHandler($messageType, $this->parseLevel($level))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new callback handler for when a log event is triggered.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return void
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function listen(Closure $callback)
|
||||
{
|
||||
if (! isset($this->dispatcher)) {
|
||||
throw new RuntimeException('Events dispatcher has not been set.');
|
||||
}
|
||||
|
||||
$this->dispatcher->listen(MessageLogged::class, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires a log event.
|
||||
*
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
protected function fireLogEvent($level, $message, array $context = [])
|
||||
{
|
||||
// If the event dispatcher is set, we will pass along the parameters to the
|
||||
// log listeners. These are useful for building profilers or other tools
|
||||
// that aggregate all of the log messages for a given "request" cycle.
|
||||
if (isset($this->dispatcher)) {
|
||||
$this->dispatcher->dispatch(new MessageLogged($level, $message, $context));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the parameters for the logger.
|
||||
*
|
||||
* @param mixed $message
|
||||
* @return mixed
|
||||
*/
|
||||
protected function formatMessage($message)
|
||||
{
|
||||
if (is_array($message)) {
|
||||
return var_export($message, true);
|
||||
} elseif ($message instanceof Jsonable) {
|
||||
return $message->toJson();
|
||||
} elseif ($message instanceof Arrayable) {
|
||||
return var_export($message->toArray(), true);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the string level into a Monolog constant.
|
||||
*
|
||||
* @param string $level
|
||||
* @return int
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function parseLevel($level)
|
||||
{
|
||||
if (isset($this->levels[$level])) {
|
||||
return $this->levels[$level];
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('Invalid log level.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying Monolog instance.
|
||||
*
|
||||
* @return \Monolog\Logger
|
||||
*/
|
||||
public function getMonolog()
|
||||
{
|
||||
return $this->monolog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a default Monolog formatter instance.
|
||||
*
|
||||
* @return \Monolog\Formatter\LineFormatter
|
||||
*/
|
||||
protected function getDefaultFormatter()
|
||||
{
|
||||
return tap(new LineFormatter(null, null, true, true), function ($formatter) {
|
||||
$formatter->includeStacktraces();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event dispatcher instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
public function getEventDispatcher()
|
||||
{
|
||||
return $this->dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the event dispatcher instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $dispatcher
|
||||
* @return void
|
||||
*/
|
||||
public function setEventDispatcher(Dispatcher $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
}
|
||||
@@ -1,554 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Swift_Mailer;
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Contracts\Mail\Mailer as MailerContract;
|
||||
use Illuminate\Contracts\Queue\Factory as QueueContract;
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
use Illuminate\Contracts\Mail\MailQueue as MailQueueContract;
|
||||
|
||||
class Mailer implements MailerContract, MailQueueContract
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* The view factory instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
protected $views;
|
||||
|
||||
/**
|
||||
* The Swift Mailer instance.
|
||||
*
|
||||
* @var \Swift_Mailer
|
||||
*/
|
||||
protected $swift;
|
||||
|
||||
/**
|
||||
* The event dispatcher instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher|null
|
||||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* The global from address and name.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $from;
|
||||
|
||||
/**
|
||||
* The global reply-to address and name.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $replyTo;
|
||||
|
||||
/**
|
||||
* The global to address and name.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $to;
|
||||
|
||||
/**
|
||||
* The queue implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Queue\Queue
|
||||
*/
|
||||
protected $queue;
|
||||
|
||||
/**
|
||||
* Array of failed recipients.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $failedRecipients = [];
|
||||
|
||||
/**
|
||||
* Create a new Mailer instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\Factory $views
|
||||
* @param \Swift_Mailer $swift
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher|null $events
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Factory $views, Swift_Mailer $swift, Dispatcher $events = null)
|
||||
{
|
||||
$this->views = $views;
|
||||
$this->swift = $swift;
|
||||
$this->events = $events;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global from address and name.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function alwaysFrom($address, $name = null)
|
||||
{
|
||||
$this->from = compact('address', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global reply-to address and name.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function alwaysReplyTo($address, $name = null)
|
||||
{
|
||||
$this->replyTo = compact('address', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global to address and name.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function alwaysTo($address, $name = null)
|
||||
{
|
||||
$this->to = compact('address', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin the process of mailing a mailable class instance.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function to($users)
|
||||
{
|
||||
return (new PendingMail($this))->to($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin the process of mailing a mailable class instance.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function bcc($users)
|
||||
{
|
||||
return (new PendingMail($this))->bcc($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message when only a raw text part.
|
||||
*
|
||||
* @param string $text
|
||||
* @param mixed $callback
|
||||
* @return void
|
||||
*/
|
||||
public function raw($text, $callback)
|
||||
{
|
||||
return $this->send(['raw' => $text], [], $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message when only a plain part.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @param mixed $callback
|
||||
* @return void
|
||||
*/
|
||||
public function plain($view, array $data, $callback)
|
||||
{
|
||||
return $this->send(['text' => $view], $data, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the given message as a view.
|
||||
*
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function render($view, array $data = [])
|
||||
{
|
||||
// First we need to parse the view, which could either be a string or an array
|
||||
// containing both an HTML and plain text versions of the view which should
|
||||
// be used when sending an e-mail. We will extract both of them out here.
|
||||
list($view, $plain, $raw) = $this->parseView($view);
|
||||
|
||||
$data['message'] = $this->createMessage();
|
||||
|
||||
return $this->renderView($view, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message using a view.
|
||||
*
|
||||
* @param string|array|MailableContract $view
|
||||
* @param array $data
|
||||
* @param \Closure|string $callback
|
||||
* @return void
|
||||
*/
|
||||
public function send($view, array $data = [], $callback = null)
|
||||
{
|
||||
if ($view instanceof MailableContract) {
|
||||
return $this->sendMailable($view);
|
||||
}
|
||||
|
||||
// First we need to parse the view, which could either be a string or an array
|
||||
// containing both an HTML and plain text versions of the view which should
|
||||
// be used when sending an e-mail. We will extract both of them out here.
|
||||
list($view, $plain, $raw) = $this->parseView($view);
|
||||
|
||||
$data['message'] = $message = $this->createMessage();
|
||||
|
||||
// Once we have retrieved the view content for the e-mail we will set the body
|
||||
// of this message using the HTML type, which will provide a simple wrapper
|
||||
// to creating view based emails that are able to receive arrays of data.
|
||||
$this->addContent($message, $view, $plain, $raw, $data);
|
||||
|
||||
call_user_func($callback, $message);
|
||||
|
||||
// If a global "to" address has been set, we will set that address on the mail
|
||||
// message. This is primarily useful during local development in which each
|
||||
// message should be delivered into a single mail address for inspection.
|
||||
if (isset($this->to['address'])) {
|
||||
$this->setGlobalTo($message);
|
||||
}
|
||||
|
||||
// Next we will determine if the message should be sent. We give the developer
|
||||
// one final chance to stop this message and then we will send it to all of
|
||||
// its recipients. We will then fire the sent event for the sent message.
|
||||
$swiftMessage = $message->getSwiftMessage();
|
||||
|
||||
if ($this->shouldSendMessage($swiftMessage)) {
|
||||
$this->sendSwiftMessage($swiftMessage);
|
||||
|
||||
$this->dispatchSentEvent($message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given mailable.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
protected function sendMailable(MailableContract $mailable)
|
||||
{
|
||||
return $mailable instanceof ShouldQueue
|
||||
? $mailable->queue($this->queue) : $mailable->send($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given view name or array.
|
||||
*
|
||||
* @param string|array $view
|
||||
* @return array
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function parseView($view)
|
||||
{
|
||||
if (is_string($view)) {
|
||||
return [$view, null, null];
|
||||
}
|
||||
|
||||
// If the given view is an array with numeric keys, we will just assume that
|
||||
// both a "pretty" and "plain" view were provided, so we will return this
|
||||
// array as is, since it should contain both views with numerical keys.
|
||||
if (is_array($view) && isset($view[0])) {
|
||||
return [$view[0], $view[1], null];
|
||||
}
|
||||
|
||||
// If this view is an array but doesn't contain numeric keys, we will assume
|
||||
// the views are being explicitly specified and will extract them via the
|
||||
// named keys instead, allowing the developers to use one or the other.
|
||||
if (is_array($view)) {
|
||||
return [
|
||||
$view['html'] ?? null,
|
||||
$view['text'] ?? null,
|
||||
$view['raw'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('Invalid view.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the content to a given message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @param string $view
|
||||
* @param string $plain
|
||||
* @param string $raw
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function addContent($message, $view, $plain, $raw, $data)
|
||||
{
|
||||
if (isset($view)) {
|
||||
$message->setBody($this->renderView($view, $data), 'text/html');
|
||||
}
|
||||
|
||||
if (isset($plain)) {
|
||||
$method = isset($view) ? 'addPart' : 'setBody';
|
||||
|
||||
$message->$method($this->renderView($plain, $data), 'text/plain');
|
||||
}
|
||||
|
||||
if (isset($raw)) {
|
||||
$method = (isset($view) || isset($plain)) ? 'addPart' : 'setBody';
|
||||
|
||||
$message->$method($raw, 'text/plain');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the given view.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
protected function renderView($view, $data)
|
||||
{
|
||||
return $view instanceof Htmlable
|
||||
? $view->toHtml()
|
||||
: $this->views->make($view, $data)->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global "to" address on the given message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function setGlobalTo($message)
|
||||
{
|
||||
$message->to($this->to['address'], $this->to['name'], true);
|
||||
$message->cc(null, null, true);
|
||||
$message->bcc(null, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending.
|
||||
*
|
||||
* @param string|array|MailableContract $view
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function queue($view, $queue = null)
|
||||
{
|
||||
if (! $view instanceof MailableContract) {
|
||||
throw new InvalidArgumentException('Only mailables may be queued.');
|
||||
}
|
||||
|
||||
return $view->queue(is_null($queue) ? $this->queue : $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending on the given queue.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param string|array $view
|
||||
* @return mixed
|
||||
*/
|
||||
public function onQueue($queue, $view)
|
||||
{
|
||||
return $this->queue($view, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending on the given queue.
|
||||
*
|
||||
* This method didn't match rest of framework's "onQueue" phrasing. Added "onQueue".
|
||||
*
|
||||
* @param string $queue
|
||||
* @param string|array $view
|
||||
* @return mixed
|
||||
*/
|
||||
public function queueOn($queue, $view)
|
||||
{
|
||||
return $this->onQueue($queue, $view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending after (n) seconds.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param string|array|MailableContract $view
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function later($delay, $view, $queue = null)
|
||||
{
|
||||
if (! $view instanceof MailableContract) {
|
||||
throw new InvalidArgumentException('Only mailables may be queued.');
|
||||
}
|
||||
|
||||
return $view->later($delay, is_null($queue) ? $this->queue : $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending after (n) seconds on the given queue.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param string|array $view
|
||||
* @return mixed
|
||||
*/
|
||||
public function laterOn($queue, $delay, $view)
|
||||
{
|
||||
return $this->later($delay, $view, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return \Illuminate\Mail\Message
|
||||
*/
|
||||
protected function createMessage()
|
||||
{
|
||||
$message = new Message($this->swift->createMessage('message'));
|
||||
|
||||
// If a global from address has been specified we will set it on every message
|
||||
// instance so the developer does not have to repeat themselves every time
|
||||
// they create a new message. We'll just go ahead and push this address.
|
||||
if (! empty($this->from['address'])) {
|
||||
$message->from($this->from['address'], $this->from['name']);
|
||||
}
|
||||
|
||||
// When a global reply address was specified we will set this on every message
|
||||
// instance so the developer does not have to repeat themselves every time
|
||||
// they create a new message. We will just go ahead and push this address.
|
||||
if (! empty($this->replyTo['address'])) {
|
||||
$message->replyTo($this->replyTo['address'], $this->replyTo['name']);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Swift Message instance.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function sendSwiftMessage($message)
|
||||
{
|
||||
try {
|
||||
return $this->swift->send($message, $this->failedRecipients);
|
||||
} finally {
|
||||
$this->forceReconnection();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the message can be sent.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldSendMessage($message)
|
||||
{
|
||||
if (! $this->events) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->events->until(
|
||||
new Events\MessageSending($message)
|
||||
) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch the message sent event.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function dispatchSentEvent($message)
|
||||
{
|
||||
if ($this->events) {
|
||||
$this->events->dispatch(
|
||||
new Events\MessageSent($message->getSwiftMessage())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Force the transport to re-connect.
|
||||
*
|
||||
* This will prevent errors in daemon queue situations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function forceReconnection()
|
||||
{
|
||||
$this->getSwiftMailer()->getTransport()->stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view factory instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function getViewFactory()
|
||||
{
|
||||
return $this->views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Swift Mailer instance.
|
||||
*
|
||||
* @return \Swift_Mailer
|
||||
*/
|
||||
public function getSwiftMailer()
|
||||
{
|
||||
return $this->swift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of failed recipients.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function failures()
|
||||
{
|
||||
return $this->failedRecipients;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Swift Mailer instance.
|
||||
*
|
||||
* @param \Swift_Mailer $swift
|
||||
* @return void
|
||||
*/
|
||||
public function setSwiftMailer($swift)
|
||||
{
|
||||
$this->swift = $swift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the queue manager instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Queue\Factory $queue
|
||||
* @return $this
|
||||
*/
|
||||
public function setQueue(QueueContract $queue)
|
||||
{
|
||||
$this->queue = $queue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Notifications;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Support\Manager;
|
||||
use Nexmo\Client as NexmoClient;
|
||||
use GuzzleHttp\Client as HttpClient;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Bus\Dispatcher as Bus;
|
||||
use Nexmo\Client\Credentials\Basic as NexmoCredentials;
|
||||
use Illuminate\Contracts\Notifications\Factory as FactoryContract;
|
||||
use Illuminate\Contracts\Notifications\Dispatcher as DispatcherContract;
|
||||
|
||||
class ChannelManager extends Manager implements DispatcherContract, FactoryContract
|
||||
{
|
||||
/**
|
||||
* The default channel used to deliver messages.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $defaultChannel = 'mail';
|
||||
|
||||
/**
|
||||
* Send the given notification to the given notifiable entities.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|array|mixed $notifiables
|
||||
* @param mixed $notification
|
||||
* @return void
|
||||
*/
|
||||
public function send($notifiables, $notification)
|
||||
{
|
||||
return (new NotificationSender(
|
||||
$this, $this->app->make(Bus::class), $this->app->make(Dispatcher::class))
|
||||
)->send($notifiables, $notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given notification immediately.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|array|mixed $notifiables
|
||||
* @param mixed $notification
|
||||
* @param array|null $channels
|
||||
* @return void
|
||||
*/
|
||||
public function sendNow($notifiables, $notification, array $channels = null)
|
||||
{
|
||||
return (new NotificationSender(
|
||||
$this, $this->app->make(Bus::class), $this->app->make(Dispatcher::class))
|
||||
)->sendNow($notifiables, $notification, $channels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a channel instance.
|
||||
*
|
||||
* @param string|null $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function channel($name = null)
|
||||
{
|
||||
return $this->driver($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the database driver.
|
||||
*
|
||||
* @return \Illuminate\Notifications\Channels\DatabaseChannel
|
||||
*/
|
||||
protected function createDatabaseDriver()
|
||||
{
|
||||
return $this->app->make(Channels\DatabaseChannel::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the broadcast driver.
|
||||
*
|
||||
* @return \Illuminate\Notifications\Channels\BroadcastChannel
|
||||
*/
|
||||
protected function createBroadcastDriver()
|
||||
{
|
||||
return $this->app->make(Channels\BroadcastChannel::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the mail driver.
|
||||
*
|
||||
* @return \Illuminate\Notifications\Channels\MailChannel
|
||||
*/
|
||||
protected function createMailDriver()
|
||||
{
|
||||
return $this->app->make(Channels\MailChannel::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Nexmo driver.
|
||||
*
|
||||
* @return \Illuminate\Notifications\Channels\NexmoSmsChannel
|
||||
*/
|
||||
protected function createNexmoDriver()
|
||||
{
|
||||
return new Channels\NexmoSmsChannel(
|
||||
new NexmoClient(new NexmoCredentials(
|
||||
$this->app['config']['services.nexmo.key'],
|
||||
$this->app['config']['services.nexmo.secret']
|
||||
)),
|
||||
$this->app['config']['services.nexmo.sms_from']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Slack driver.
|
||||
*
|
||||
* @return \Illuminate\Notifications\Channels\SlackWebhookChannel
|
||||
*/
|
||||
protected function createSlackDriver()
|
||||
{
|
||||
return new Channels\SlackWebhookChannel(new HttpClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new driver instance.
|
||||
*
|
||||
* @param string $driver
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function createDriver($driver)
|
||||
{
|
||||
try {
|
||||
return parent::createDriver($driver);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
if (class_exists($driver)) {
|
||||
return $this->app->make($driver);
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default channel driver name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultDriver()
|
||||
{
|
||||
return $this->defaultChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default channel driver name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function deliversVia()
|
||||
{
|
||||
return $this->getDefaultDriver();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default channel driver name.
|
||||
*
|
||||
* @param string $channel
|
||||
* @return void
|
||||
*/
|
||||
public function deliverVia($channel)
|
||||
{
|
||||
$this->defaultChannel = $channel;
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Notifications;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Database\Eloquent\Collection as ModelCollection;
|
||||
|
||||
class NotificationSender
|
||||
{
|
||||
/**
|
||||
* The notification manager instance.
|
||||
*
|
||||
* @var \Illuminate\Notifications\ChannelManager
|
||||
*/
|
||||
protected $manager;
|
||||
|
||||
/**
|
||||
* The Bus dispatcher instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Bus\Dispatcher
|
||||
*/
|
||||
protected $bus;
|
||||
|
||||
/**
|
||||
* The event dispatcher.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* Create a new notification sender instance.
|
||||
*
|
||||
* @param \Illuminate\Notifications\ChannelManager $manager
|
||||
* @param \Illuminate\Contracts\Bus\Dispatcher $bus
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $events
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($manager, $bus, $events)
|
||||
{
|
||||
$this->bus = $bus;
|
||||
$this->events = $events;
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given notification to the given notifiable entities.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|array|mixed $notifiables
|
||||
* @param mixed $notification
|
||||
* @return void
|
||||
*/
|
||||
public function send($notifiables, $notification)
|
||||
{
|
||||
$notifiables = $this->formatNotifiables($notifiables);
|
||||
|
||||
if ($notification instanceof ShouldQueue) {
|
||||
return $this->queueNotification($notifiables, $notification);
|
||||
}
|
||||
|
||||
return $this->sendNow($notifiables, $notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given notification immediately.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|array|mixed $notifiables
|
||||
* @param mixed $notification
|
||||
* @param array $channels
|
||||
* @return void
|
||||
*/
|
||||
public function sendNow($notifiables, $notification, array $channels = null)
|
||||
{
|
||||
$notifiables = $this->formatNotifiables($notifiables);
|
||||
|
||||
$original = clone $notification;
|
||||
|
||||
foreach ($notifiables as $notifiable) {
|
||||
if (empty($viaChannels = $channels ?: $notification->via($notifiable))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$notificationId = Uuid::uuid4()->toString();
|
||||
|
||||
foreach ((array) $viaChannels as $channel) {
|
||||
$this->sendToNotifiable($notifiable, $notificationId, clone $original, $channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given notification to the given notifiable via a channel.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param string $id
|
||||
* @param mixed $notification
|
||||
* @param string $channel
|
||||
* @return void
|
||||
*/
|
||||
protected function sendToNotifiable($notifiable, $id, $notification, $channel)
|
||||
{
|
||||
if (! $notification->id) {
|
||||
$notification->id = $id;
|
||||
}
|
||||
|
||||
if (! $this->shouldSendNotification($notifiable, $notification, $channel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$response = $this->manager->driver($channel)->send($notifiable, $notification);
|
||||
|
||||
$this->events->dispatch(
|
||||
new Events\NotificationSent($notifiable, $notification, $channel, $response)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the notification can be sent.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param mixed $notification
|
||||
* @param string $channel
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldSendNotification($notifiable, $notification, $channel)
|
||||
{
|
||||
return $this->events->until(
|
||||
new Events\NotificationSending($notifiable, $notification, $channel)
|
||||
) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue the given notification instances.
|
||||
*
|
||||
* @param mixed $notifiables
|
||||
* @param array[\Illuminate\Notifications\Channels\Notification] $notification
|
||||
* @return void
|
||||
*/
|
||||
protected function queueNotification($notifiables, $notification)
|
||||
{
|
||||
$notifiables = $this->formatNotifiables($notifiables);
|
||||
|
||||
$original = clone $notification;
|
||||
|
||||
foreach ($notifiables as $notifiable) {
|
||||
$notificationId = Uuid::uuid4()->toString();
|
||||
|
||||
foreach ($original->via($notifiable) as $channel) {
|
||||
$notification = clone $original;
|
||||
|
||||
$notification->id = $notificationId;
|
||||
|
||||
$this->bus->dispatch(
|
||||
(new SendQueuedNotifications($notifiable, $notification, [$channel]))
|
||||
->onConnection($notification->connection)
|
||||
->onQueue($notification->queue)
|
||||
->delay($notification->delay)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the notifiables into a Collection / array if necessary.
|
||||
*
|
||||
* @param mixed $notifiables
|
||||
* @return \Illuminate\Database\Eloquent\Collection|array
|
||||
*/
|
||||
protected function formatNotifiables($notifiables)
|
||||
{
|
||||
if (! $notifiables instanceof Collection && ! is_array($notifiables)) {
|
||||
return $notifiables instanceof Model
|
||||
? new ModelCollection([$notifiables]) : [$notifiables];
|
||||
}
|
||||
|
||||
return $notifiables;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Notifications;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Contracts\Notifications\Dispatcher;
|
||||
|
||||
trait RoutesNotifications
|
||||
{
|
||||
/**
|
||||
* Send the given notification.
|
||||
*
|
||||
* @param mixed $instance
|
||||
* @return void
|
||||
*/
|
||||
public function notify($instance)
|
||||
{
|
||||
app(Dispatcher::class)->send($this, $instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given notification immediately.
|
||||
*
|
||||
* @param mixed $instance
|
||||
* @param array|null $channels
|
||||
* @return void
|
||||
*/
|
||||
public function notifyNow($instance, array $channels = null)
|
||||
{
|
||||
app(Dispatcher::class)->sendNow($this, $instance, $channels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification routing information for the given driver.
|
||||
*
|
||||
* @param string $driver
|
||||
* @return mixed
|
||||
*/
|
||||
public function routeNotificationFor($driver)
|
||||
{
|
||||
if (method_exists($this, $method = 'routeNotificationFor'.Str::studly($driver))) {
|
||||
return $this->{$method}();
|
||||
}
|
||||
|
||||
switch ($driver) {
|
||||
case 'database':
|
||||
return $this->notifications();
|
||||
case 'mail':
|
||||
return $this->email;
|
||||
case 'nexmo':
|
||||
return $this->phone_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class SendQueuedNotifications implements ShouldQueue
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* The notifiable entities that should receive the notification.
|
||||
*
|
||||
* @var \Illuminate\Support\Collection
|
||||
*/
|
||||
public $notifiables;
|
||||
|
||||
/**
|
||||
* The notification to be sent.
|
||||
*
|
||||
* @var \Illuminate\Notifications\Notification
|
||||
*/
|
||||
public $notification;
|
||||
|
||||
/**
|
||||
* All of the channels to send the notification too.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $channels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $notifiables
|
||||
* @param \Illuminate\Notifications\Notification $notification
|
||||
* @param array $channels
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($notifiables, $notification, array $channels = null)
|
||||
{
|
||||
$this->channels = $channels;
|
||||
$this->notifiables = $notifiables;
|
||||
$this->notification = $notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the notifications.
|
||||
*
|
||||
* @param \Illuminate\Notifications\ChannelManager $manager
|
||||
* @return void
|
||||
*/
|
||||
public function handle(ChannelManager $manager)
|
||||
{
|
||||
$manager->sendNow($this->notifiables, $this->notification, $this->channels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the display name for the queued job.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function displayName()
|
||||
{
|
||||
return get_class($this->notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the failed method on the notification instance.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
public function failed($e)
|
||||
{
|
||||
if (method_exists($this->notification, 'failed')) {
|
||||
$this->notification->failed($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the instance for cloning.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->notifiables = clone $this->notifiables;
|
||||
$this->notification = clone $this->notification;
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Pipeline;
|
||||
|
||||
use Closure;
|
||||
use RuntimeException;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Pipeline\Pipeline as PipelineContract;
|
||||
|
||||
class Pipeline implements PipelineContract
|
||||
{
|
||||
/**
|
||||
* The container implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Container\Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* The object being passed through the pipeline.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $passable;
|
||||
|
||||
/**
|
||||
* The array of class pipes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $pipes = [];
|
||||
|
||||
/**
|
||||
* The method to call on each pipe.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $method = 'handle';
|
||||
|
||||
/**
|
||||
* Create a new class instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container|null $container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Container $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object being sent through the pipeline.
|
||||
*
|
||||
* @param mixed $passable
|
||||
* @return $this
|
||||
*/
|
||||
public function send($passable)
|
||||
{
|
||||
$this->passable = $passable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the array of pipes.
|
||||
*
|
||||
* @param array|mixed $pipes
|
||||
* @return $this
|
||||
*/
|
||||
public function through($pipes)
|
||||
{
|
||||
$this->pipes = is_array($pipes) ? $pipes : func_get_args();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the method to call on the pipes.
|
||||
*
|
||||
* @param string $method
|
||||
* @return $this
|
||||
*/
|
||||
public function via($method)
|
||||
{
|
||||
$this->method = $method;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the pipeline with a final destination callback.
|
||||
*
|
||||
* @param \Closure $destination
|
||||
* @return mixed
|
||||
*/
|
||||
public function then(Closure $destination)
|
||||
{
|
||||
$pipeline = array_reduce(
|
||||
array_reverse($this->pipes), $this->carry(), $this->prepareDestination($destination)
|
||||
);
|
||||
|
||||
return $pipeline($this->passable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the final piece of the Closure onion.
|
||||
*
|
||||
* @param \Closure $destination
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function prepareDestination(Closure $destination)
|
||||
{
|
||||
return function ($passable) use ($destination) {
|
||||
return $destination($passable);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Closure that represents a slice of the application onion.
|
||||
*
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function carry()
|
||||
{
|
||||
return function ($stack, $pipe) {
|
||||
return function ($passable) use ($stack, $pipe) {
|
||||
if (is_callable($pipe)) {
|
||||
// If the pipe is an instance of a Closure, we will just call it directly but
|
||||
// otherwise we'll resolve the pipes out of the container and call it with
|
||||
// the appropriate method and arguments, returning the results back out.
|
||||
return $pipe($passable, $stack);
|
||||
} elseif (! is_object($pipe)) {
|
||||
list($name, $parameters) = $this->parsePipeString($pipe);
|
||||
|
||||
// If the pipe is a string we will parse the string and resolve the class out
|
||||
// of the dependency injection container. We can then build a callable and
|
||||
// execute the pipe function giving in the parameters that are required.
|
||||
$pipe = $this->getContainer()->make($name);
|
||||
|
||||
$parameters = array_merge([$passable, $stack], $parameters);
|
||||
} else {
|
||||
// If the pipe is already an object we'll just make a callable and pass it to
|
||||
// the pipe as-is. There is no need to do any extra parsing and formatting
|
||||
// since the object we're given was already a fully instantiated object.
|
||||
$parameters = [$passable, $stack];
|
||||
}
|
||||
|
||||
return method_exists($pipe, $this->method)
|
||||
? $pipe->{$this->method}(...$parameters)
|
||||
: $pipe(...$parameters);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse full pipe string to get name and parameters.
|
||||
*
|
||||
* @param string $pipe
|
||||
* @return array
|
||||
*/
|
||||
protected function parsePipeString($pipe)
|
||||
{
|
||||
list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []);
|
||||
|
||||
if (is_string($parameters)) {
|
||||
$parameters = explode(',', $parameters);
|
||||
}
|
||||
|
||||
return [$name, $parameters];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the container instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Container\Container
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected function getContainer()
|
||||
{
|
||||
if (! $this->container) {
|
||||
throw new RuntimeException('A container instance has not been passed to the Pipeline.');
|
||||
}
|
||||
|
||||
return $this->container;
|
||||
}
|
||||
}
|
||||
@@ -1,283 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Validation;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Illuminate\Contracts\Validation\Factory as FactoryContract;
|
||||
|
||||
class Factory implements FactoryContract
|
||||
{
|
||||
/**
|
||||
* The Translator implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Translation\Translator
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
/**
|
||||
* The Presence Verifier implementation.
|
||||
*
|
||||
* @var \Illuminate\Validation\PresenceVerifierInterface
|
||||
*/
|
||||
protected $verifier;
|
||||
|
||||
/**
|
||||
* The IoC container instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Container\Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* All of the custom validator extensions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $extensions = [];
|
||||
|
||||
/**
|
||||
* All of the custom implicit validator extensions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $implicitExtensions = [];
|
||||
|
||||
/**
|
||||
* All of the custom dependent validator extensions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dependentExtensions = [];
|
||||
|
||||
/**
|
||||
* All of the custom validator message replacers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $replacers = [];
|
||||
|
||||
/**
|
||||
* All of the fallback messages for custom rules.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fallbackMessages = [];
|
||||
|
||||
/**
|
||||
* The Validator resolver instance.
|
||||
*
|
||||
* @var Closure
|
||||
*/
|
||||
protected $resolver;
|
||||
|
||||
/**
|
||||
* Create a new Validator factory instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Translation\Translator $translator
|
||||
* @param \Illuminate\Contracts\Container\Container $container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Translator $translator, Container $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Validator instance.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $rules
|
||||
* @param array $messages
|
||||
* @param array $customAttributes
|
||||
* @return \Illuminate\Validation\Validator
|
||||
*/
|
||||
public function make(array $data, array $rules, array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
// The presence verifier is responsible for checking the unique and exists data
|
||||
// for the validator. It is behind an interface so that multiple versions of
|
||||
// it may be written besides database. We'll inject it into the validator.
|
||||
$validator = $this->resolve(
|
||||
$data, $rules, $messages, $customAttributes
|
||||
);
|
||||
|
||||
if (! is_null($this->verifier)) {
|
||||
$validator->setPresenceVerifier($this->verifier);
|
||||
}
|
||||
|
||||
// Next we'll set the IoC container instance of the validator, which is used to
|
||||
// resolve out class based validator extensions. If it is not set then these
|
||||
// types of extensions will not be possible on these validation instances.
|
||||
if (! is_null($this->container)) {
|
||||
$validator->setContainer($this->container);
|
||||
}
|
||||
|
||||
$this->addExtensions($validator);
|
||||
|
||||
return $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the given data against the provided rules.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $rules
|
||||
* @param array $messages
|
||||
* @param array $customAttributes
|
||||
* @return void
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function validate(array $data, array $rules, array $messages = [], array $customAttributes = [])
|
||||
{
|
||||
$this->make($data, $rules, $messages, $customAttributes)->validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a new Validator instance.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $rules
|
||||
* @param array $messages
|
||||
* @param array $customAttributes
|
||||
* @return \Illuminate\Validation\Validator
|
||||
*/
|
||||
protected function resolve(array $data, array $rules, array $messages, array $customAttributes)
|
||||
{
|
||||
if (is_null($this->resolver)) {
|
||||
return new Validator($this->translator, $data, $rules, $messages, $customAttributes);
|
||||
}
|
||||
|
||||
return call_user_func($this->resolver, $this->translator, $data, $rules, $messages, $customAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the extensions to a validator instance.
|
||||
*
|
||||
* @param \Illuminate\Validation\Validator $validator
|
||||
* @return void
|
||||
*/
|
||||
protected function addExtensions(Validator $validator)
|
||||
{
|
||||
$validator->addExtensions($this->extensions);
|
||||
|
||||
// Next, we will add the implicit extensions, which are similar to the required
|
||||
// and accepted rule in that they are run even if the attributes is not in a
|
||||
// array of data that is given to a validator instances via instantiation.
|
||||
$validator->addImplicitExtensions($this->implicitExtensions);
|
||||
|
||||
$validator->addDependentExtensions($this->dependentExtensions);
|
||||
|
||||
$validator->addReplacers($this->replacers);
|
||||
|
||||
$validator->setFallbackMessages($this->fallbackMessages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom validator extension.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param \Closure|string $extension
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
public function extend($rule, $extension, $message = null)
|
||||
{
|
||||
$this->extensions[$rule] = $extension;
|
||||
|
||||
if ($message) {
|
||||
$this->fallbackMessages[Str::snake($rule)] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom implicit validator extension.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param \Closure|string $extension
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
public function extendImplicit($rule, $extension, $message = null)
|
||||
{
|
||||
$this->implicitExtensions[$rule] = $extension;
|
||||
|
||||
if ($message) {
|
||||
$this->fallbackMessages[Str::snake($rule)] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom dependent validator extension.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param \Closure|string $extension
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
public function extendDependent($rule, $extension, $message = null)
|
||||
{
|
||||
$this->dependentExtensions[$rule] = $extension;
|
||||
|
||||
if ($message) {
|
||||
$this->fallbackMessages[Str::snake($rule)] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom validator message replacer.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param \Closure|string $replacer
|
||||
* @return void
|
||||
*/
|
||||
public function replacer($rule, $replacer)
|
||||
{
|
||||
$this->replacers[$rule] = $replacer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Validator instance resolver.
|
||||
*
|
||||
* @param \Closure $resolver
|
||||
* @return void
|
||||
*/
|
||||
public function resolver(Closure $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Translator implementation.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Translation\Translator
|
||||
*/
|
||||
public function getTranslator()
|
||||
{
|
||||
return $this->translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Presence Verifier implementation.
|
||||
*
|
||||
* @return \Illuminate\Validation\PresenceVerifierInterface
|
||||
*/
|
||||
public function getPresenceVerifier()
|
||||
{
|
||||
return $this->verifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Presence Verifier implementation.
|
||||
*
|
||||
* @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier
|
||||
* @return void
|
||||
*/
|
||||
public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier)
|
||||
{
|
||||
$this->verifier = $presenceVerifier;
|
||||
}
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Validation;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rules\Exists;
|
||||
use Illuminate\Validation\Rules\Unique;
|
||||
use Illuminate\Contracts\Validation\Rule as RuleContract;
|
||||
|
||||
class ValidationRuleParser
|
||||
{
|
||||
/**
|
||||
* The data being validated.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* The implicit attributes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $implicitAttributes = [];
|
||||
|
||||
/**
|
||||
* Create a new validation rule parser.
|
||||
*
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the human-friendly rules into a full rules array for the validator.
|
||||
*
|
||||
* @param array $rules
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function explode($rules)
|
||||
{
|
||||
$this->implicitAttributes = [];
|
||||
|
||||
$rules = $this->explodeRules($rules);
|
||||
|
||||
return (object) [
|
||||
'rules' => $rules,
|
||||
'implicitAttributes' => $this->implicitAttributes,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Explode the rules into an array of explicit rules.
|
||||
*
|
||||
* @param array $rules
|
||||
* @return array
|
||||
*/
|
||||
protected function explodeRules($rules)
|
||||
{
|
||||
foreach ($rules as $key => $rule) {
|
||||
if (Str::contains($key, '*')) {
|
||||
$rules = $this->explodeWildcardRules($rules, $key, [$rule]);
|
||||
|
||||
unset($rules[$key]);
|
||||
} else {
|
||||
$rules[$key] = $this->explodeExplicitRule($rule);
|
||||
}
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Explode the explicit rule into an array if necessary.
|
||||
*
|
||||
* @param mixed $rule
|
||||
* @return array
|
||||
*/
|
||||
protected function explodeExplicitRule($rule)
|
||||
{
|
||||
if (is_string($rule)) {
|
||||
return explode('|', $rule);
|
||||
} elseif (is_object($rule)) {
|
||||
return [$this->prepareRule($rule)];
|
||||
}
|
||||
|
||||
return array_map([$this, 'prepareRule'], $rule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the given rule for the Validator.
|
||||
*
|
||||
* @param mixed $rule
|
||||
* @return mixed
|
||||
*/
|
||||
protected function prepareRule($rule)
|
||||
{
|
||||
if ($rule instanceof Closure) {
|
||||
$rule = new ClosureValidationRule($rule);
|
||||
}
|
||||
|
||||
if (! is_object($rule) ||
|
||||
$rule instanceof RuleContract ||
|
||||
($rule instanceof Exists && $rule->queryCallbacks()) ||
|
||||
($rule instanceof Unique && $rule->queryCallbacks())) {
|
||||
return $rule;
|
||||
}
|
||||
|
||||
return (string) $rule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a set of rules that apply to each element in an array attribute.
|
||||
*
|
||||
* @param array $results
|
||||
* @param string $attribute
|
||||
* @param string|array $rules
|
||||
* @return array
|
||||
*/
|
||||
protected function explodeWildcardRules($results, $attribute, $rules)
|
||||
{
|
||||
$pattern = str_replace('\*', '[^\.]*', preg_quote($attribute));
|
||||
|
||||
$data = ValidationData::initializeAndGatherData($attribute, $this->data);
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (Str::startsWith($key, $attribute) || (bool) preg_match('/^'.$pattern.'\z/', $key)) {
|
||||
foreach ((array) $rules as $rule) {
|
||||
$this->implicitAttributes[$attribute][] = $key;
|
||||
|
||||
$results = $this->mergeRules($results, $key, $rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge additional rules into a given attribute(s).
|
||||
*
|
||||
* @param array $results
|
||||
* @param string|array $attribute
|
||||
* @param string|array $rules
|
||||
* @return array
|
||||
*/
|
||||
public function mergeRules($results, $attribute, $rules = [])
|
||||
{
|
||||
if (is_array($attribute)) {
|
||||
foreach ((array) $attribute as $innerAttribute => $innerRules) {
|
||||
$results = $this->mergeRulesForAttribute($results, $innerAttribute, $innerRules);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
return $this->mergeRulesForAttribute(
|
||||
$results, $attribute, $rules
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge additional rules into a given attribute.
|
||||
*
|
||||
* @param array $results
|
||||
* @param string $attribute
|
||||
* @param string|array $rules
|
||||
* @return array
|
||||
*/
|
||||
protected function mergeRulesForAttribute($results, $attribute, $rules)
|
||||
{
|
||||
$merge = head($this->explodeRules([$rules]));
|
||||
|
||||
$results[$attribute] = array_merge(
|
||||
isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute]) : [], $merge
|
||||
);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the rule name and parameters from a rule.
|
||||
*
|
||||
* @param array|string $rules
|
||||
* @return array
|
||||
*/
|
||||
public static function parse($rules)
|
||||
{
|
||||
if ($rules instanceof RuleContract) {
|
||||
return [$rules, []];
|
||||
}
|
||||
|
||||
if (is_array($rules)) {
|
||||
$rules = static::parseArrayRule($rules);
|
||||
} else {
|
||||
$rules = static::parseStringRule($rules);
|
||||
}
|
||||
|
||||
$rules[0] = static::normalizeRule($rules[0]);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an array based rule.
|
||||
*
|
||||
* @param array $rules
|
||||
* @return array
|
||||
*/
|
||||
protected static function parseArrayRule(array $rules)
|
||||
{
|
||||
return [Str::studly(trim(Arr::get($rules, 0))), array_slice($rules, 1)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a string based rule.
|
||||
*
|
||||
* @param string $rules
|
||||
* @return array
|
||||
*/
|
||||
protected static function parseStringRule($rules)
|
||||
{
|
||||
$parameters = [];
|
||||
|
||||
// The format for specifying validation rules and parameters follows an
|
||||
// easy {rule}:{parameters} formatting convention. For instance the
|
||||
// rule "Max:3" states that the value may only be three letters.
|
||||
if (strpos($rules, ':') !== false) {
|
||||
list($rules, $parameter) = explode(':', $rules, 2);
|
||||
|
||||
$parameters = static::parseParameters($rules, $parameter);
|
||||
}
|
||||
|
||||
return [Str::studly(trim($rules)), $parameters];
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a parameter list.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param string $parameter
|
||||
* @return array
|
||||
*/
|
||||
protected static function parseParameters($rule, $parameter)
|
||||
{
|
||||
if (strtolower($rule) == 'regex') {
|
||||
return [$parameter];
|
||||
}
|
||||
|
||||
return str_getcsv($parameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes a rule so that we can accept short types.
|
||||
*
|
||||
* @param string $rule
|
||||
* @return string
|
||||
*/
|
||||
protected static function normalizeRule($rule)
|
||||
{
|
||||
switch ($rule) {
|
||||
case 'Int':
|
||||
return 'Integer';
|
||||
case 'Bool':
|
||||
return 'Boolean';
|
||||
default:
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\View;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class FileViewFinder implements ViewFinderInterface
|
||||
{
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* The array of active view paths.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $paths;
|
||||
|
||||
/**
|
||||
* The array of views that have been located.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $views = [];
|
||||
|
||||
/**
|
||||
* The namespace to file path hints.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hints = [];
|
||||
|
||||
/**
|
||||
* Register a view extension with the finder.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $extensions = ['blade.php', 'php', 'css'];
|
||||
|
||||
/**
|
||||
* Create a new file view loader instance.
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @param array $paths
|
||||
* @param array $extensions
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Filesystem $files, array $paths, array $extensions = null)
|
||||
{
|
||||
$this->files = $files;
|
||||
$this->paths = $paths;
|
||||
|
||||
if (isset($extensions)) {
|
||||
$this->extensions = $extensions;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fully qualified location of the view.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
public function find($name)
|
||||
{
|
||||
if (isset($this->views[$name])) {
|
||||
return $this->views[$name];
|
||||
}
|
||||
|
||||
if ($this->hasHintInformation($name = trim($name))) {
|
||||
return $this->views[$name] = $this->findNamespacedView($name);
|
||||
}
|
||||
|
||||
return $this->views[$name] = $this->findInPaths($name, $this->paths);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to a template with a named path.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function findNamespacedView($name)
|
||||
{
|
||||
list($namespace, $view) = $this->parseNamespaceSegments($name);
|
||||
|
||||
return $this->findInPaths($view, $this->hints[$namespace]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the segments of a template with a named path.
|
||||
*
|
||||
* @param string $name
|
||||
* @return array
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function parseNamespaceSegments($name)
|
||||
{
|
||||
$segments = explode(static::HINT_PATH_DELIMITER, $name);
|
||||
|
||||
if (count($segments) != 2) {
|
||||
throw new InvalidArgumentException("View [$name] has an invalid name.");
|
||||
}
|
||||
|
||||
if (! isset($this->hints[$segments[0]])) {
|
||||
throw new InvalidArgumentException("No hint path defined for [{$segments[0]}].");
|
||||
}
|
||||
|
||||
return $segments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the given view in the list of paths.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $paths
|
||||
* @return string
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function findInPaths($name, $paths)
|
||||
{
|
||||
foreach ((array) $paths as $path) {
|
||||
foreach ($this->getPossibleViewFiles($name) as $file) {
|
||||
if ($this->files->exists($viewPath = $path.'/'.$file)) {
|
||||
return $viewPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException("View [$name] not found.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of possible view files.
|
||||
*
|
||||
* @param string $name
|
||||
* @return array
|
||||
*/
|
||||
protected function getPossibleViewFiles($name)
|
||||
{
|
||||
return array_map(function ($extension) use ($name) {
|
||||
return str_replace('.', '/', $name).'.'.$extension;
|
||||
}, $this->extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a location to the finder.
|
||||
*
|
||||
* @param string $location
|
||||
* @return void
|
||||
*/
|
||||
public function addLocation($location)
|
||||
{
|
||||
$this->paths[] = $location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend a location to the finder.
|
||||
*
|
||||
* @param string $location
|
||||
* @return void
|
||||
*/
|
||||
public function prependLocation($location)
|
||||
{
|
||||
array_unshift($this->paths, $location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a namespace hint to the finder.
|
||||
*
|
||||
* @param string $namespace
|
||||
* @param string|array $hints
|
||||
* @return void
|
||||
*/
|
||||
public function addNamespace($namespace, $hints)
|
||||
{
|
||||
$hints = (array) $hints;
|
||||
|
||||
if (isset($this->hints[$namespace])) {
|
||||
$hints = array_merge($this->hints[$namespace], $hints);
|
||||
}
|
||||
|
||||
$this->hints[$namespace] = $hints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend a namespace hint to the finder.
|
||||
*
|
||||
* @param string $namespace
|
||||
* @param string|array $hints
|
||||
* @return void
|
||||
*/
|
||||
public function prependNamespace($namespace, $hints)
|
||||
{
|
||||
$hints = (array) $hints;
|
||||
|
||||
if (isset($this->hints[$namespace])) {
|
||||
$hints = array_merge($hints, $this->hints[$namespace]);
|
||||
}
|
||||
|
||||
$this->hints[$namespace] = $hints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the namespace hints for the given namespace.
|
||||
*
|
||||
* @param string $namespace
|
||||
* @param string|array $hints
|
||||
* @return void
|
||||
*/
|
||||
public function replaceNamespace($namespace, $hints)
|
||||
{
|
||||
$this->hints[$namespace] = (array) $hints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an extension with the view finder.
|
||||
*
|
||||
* @param string $extension
|
||||
* @return void
|
||||
*/
|
||||
public function addExtension($extension)
|
||||
{
|
||||
if (($index = array_search($extension, $this->extensions)) !== false) {
|
||||
unset($this->extensions[$index]);
|
||||
}
|
||||
|
||||
array_unshift($this->extensions, $extension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not the view name has any hint information.
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHintInformation($name)
|
||||
{
|
||||
return strpos($name, static::HINT_PATH_DELIMITER) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the cache of located views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function flush()
|
||||
{
|
||||
$this->views = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filesystem instance.
|
||||
*
|
||||
* @return \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
public function getFilesystem()
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the active view paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPaths()
|
||||
{
|
||||
return $this->paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the namespace to file path hints.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getHints()
|
||||
{
|
||||
return $this->hints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get registered extensions.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getExtensions()
|
||||
{
|
||||
return $this->extensions;
|
||||
}
|
||||
}
|
||||
409
vendor/league/flysystem/src/Filesystem.php
vendored
409
vendor/league/flysystem/src/Filesystem.php
vendored
@@ -1,409 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace League\Flysystem;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use League\Flysystem\Adapter\CanOverwriteFiles;
|
||||
use League\Flysystem\Plugin\PluggableTrait;
|
||||
use League\Flysystem\Util\ContentListingFormatter;
|
||||
|
||||
/**
|
||||
* @method void emptyDir(string $dirname)
|
||||
* @method array|false getWithMetadata(string $path, string[] $metadata)
|
||||
* @method bool forceCopy(string $path, string $newpath)
|
||||
* @method bool forceRename(string $path, string $newpath)
|
||||
* @method array listFiles(string $path = '', boolean $recursive = false)
|
||||
* @method string[] listPaths(string $path = '', boolean $recursive = false)
|
||||
* @method array listWith(string[] $keys = [], $directory = '', $recursive = false)
|
||||
*/
|
||||
class Filesystem implements FilesystemInterface
|
||||
{
|
||||
use PluggableTrait;
|
||||
use ConfigAwareTrait;
|
||||
|
||||
/**
|
||||
* @var AdapterInterface
|
||||
*/
|
||||
protected $adapter;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param AdapterInterface $adapter
|
||||
* @param Config|array $config
|
||||
*/
|
||||
public function __construct(AdapterInterface $adapter, $config = null)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
$this->setConfig($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Adapter.
|
||||
*
|
||||
* @return AdapterInterface adapter
|
||||
*/
|
||||
public function getAdapter()
|
||||
{
|
||||
return $this->adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function has($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
|
||||
return strlen($path) === 0 ? false : (bool) $this->getAdapter()->has($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function write($path, $contents, array $config = [])
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertAbsent($path);
|
||||
$config = $this->prepareConfig($config);
|
||||
|
||||
return (bool) $this->getAdapter()->write($path, $contents, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function writeStream($path, $resource, array $config = [])
|
||||
{
|
||||
if ( ! is_resource($resource) || get_resource_type($resource) !== 'stream') {
|
||||
throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.');
|
||||
}
|
||||
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertAbsent($path);
|
||||
$config = $this->prepareConfig($config);
|
||||
|
||||
Util::rewindStream($resource);
|
||||
|
||||
return (bool) $this->getAdapter()->writeStream($path, $resource, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function put($path, $contents, array $config = [])
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$config = $this->prepareConfig($config);
|
||||
|
||||
if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) {
|
||||
return (bool) $this->getAdapter()->update($path, $contents, $config);
|
||||
}
|
||||
|
||||
return (bool) $this->getAdapter()->write($path, $contents, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function putStream($path, $resource, array $config = [])
|
||||
{
|
||||
if ( ! is_resource($resource) || get_resource_type($resource) !== 'stream') {
|
||||
throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.');
|
||||
}
|
||||
|
||||
$path = Util::normalizePath($path);
|
||||
$config = $this->prepareConfig($config);
|
||||
Util::rewindStream($resource);
|
||||
|
||||
if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) {
|
||||
return (bool) $this->getAdapter()->updateStream($path, $resource, $config);
|
||||
}
|
||||
|
||||
return (bool) $this->getAdapter()->writeStream($path, $resource, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function readAndDelete($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
$contents = $this->read($path);
|
||||
|
||||
if ($contents === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->delete($path);
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function update($path, $contents, array $config = [])
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$config = $this->prepareConfig($config);
|
||||
|
||||
$this->assertPresent($path);
|
||||
|
||||
return (bool) $this->getAdapter()->update($path, $contents, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function updateStream($path, $resource, array $config = [])
|
||||
{
|
||||
if ( ! is_resource($resource) || get_resource_type($resource) !== 'stream') {
|
||||
throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.');
|
||||
}
|
||||
|
||||
$path = Util::normalizePath($path);
|
||||
$config = $this->prepareConfig($config);
|
||||
$this->assertPresent($path);
|
||||
Util::rewindStream($resource);
|
||||
|
||||
return (bool) $this->getAdapter()->updateStream($path, $resource, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function read($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
if ( ! ($object = $this->getAdapter()->read($path))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $object['contents'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function readStream($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
if ( ! $object = $this->getAdapter()->readStream($path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $object['stream'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rename($path, $newpath)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$newpath = Util::normalizePath($newpath);
|
||||
$this->assertPresent($path);
|
||||
$this->assertAbsent($newpath);
|
||||
|
||||
return (bool) $this->getAdapter()->rename($path, $newpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function copy($path, $newpath)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$newpath = Util::normalizePath($newpath);
|
||||
$this->assertPresent($path);
|
||||
$this->assertAbsent($newpath);
|
||||
|
||||
return $this->getAdapter()->copy($path, $newpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function delete($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
return $this->getAdapter()->delete($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function deleteDir($dirname)
|
||||
{
|
||||
$dirname = Util::normalizePath($dirname);
|
||||
|
||||
if ($dirname === '') {
|
||||
throw new RootViolationException('Root directories can not be deleted.');
|
||||
}
|
||||
|
||||
return (bool) $this->getAdapter()->deleteDir($dirname);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function createDir($dirname, array $config = [])
|
||||
{
|
||||
$dirname = Util::normalizePath($dirname);
|
||||
$config = $this->prepareConfig($config);
|
||||
|
||||
return (bool) $this->getAdapter()->createDir($dirname, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function listContents($directory = '', $recursive = false)
|
||||
{
|
||||
$directory = Util::normalizePath($directory);
|
||||
$contents = $this->getAdapter()->listContents($directory, $recursive);
|
||||
|
||||
return (new ContentListingFormatter($directory, $recursive, $this->config->get('case_sensitive', true)))
|
||||
->formatListing($contents);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getMimetype($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
if (( ! $object = $this->getAdapter()->getMimetype($path)) || ! array_key_exists('mimetype', $object)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $object['mimetype'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getTimestamp($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
if (( ! $object = $this->getAdapter()->getTimestamp($path)) || ! array_key_exists('timestamp', $object)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (int) $object['timestamp'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getVisibility($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
if (( ! $object = $this->getAdapter()->getVisibility($path)) || ! array_key_exists('visibility', $object)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $object['visibility'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getSize($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
if (( ! $object = $this->getAdapter()->getSize($path)) || ! array_key_exists('size', $object)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (int) $object['size'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function setVisibility($path, $visibility)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
return (bool) $this->getAdapter()->setVisibility($path, $visibility);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getMetadata($path)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
$this->assertPresent($path);
|
||||
|
||||
return $this->getAdapter()->getMetadata($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function get($path, Handler $handler = null)
|
||||
{
|
||||
$path = Util::normalizePath($path);
|
||||
|
||||
if ( ! $handler) {
|
||||
$metadata = $this->getMetadata($path);
|
||||
$handler = ($metadata && $metadata['type'] === 'file') ? new File($this, $path) : new Directory($this, $path);
|
||||
}
|
||||
|
||||
$handler->setPath($path);
|
||||
$handler->setFilesystem($this);
|
||||
|
||||
return $handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert a file is present.
|
||||
*
|
||||
* @param string $path path to file
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertPresent($path)
|
||||
{
|
||||
if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) {
|
||||
throw new FileNotFoundException($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert a file is absent.
|
||||
*
|
||||
* @param string $path path to file
|
||||
*
|
||||
* @throws FileExistsException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertAbsent($path)
|
||||
{
|
||||
if ($this->config->get('disable_asserts', false) === false && $this->has($path)) {
|
||||
throw new FileExistsException($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
284
vendor/league/flysystem/src/FilesystemInterface.php
vendored
284
vendor/league/flysystem/src/FilesystemInterface.php
vendored
@@ -1,284 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace League\Flysystem;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
interface FilesystemInterface
|
||||
{
|
||||
/**
|
||||
* Check whether a file exists.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has($path);
|
||||
|
||||
/**
|
||||
* Read a file.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return string|false The file contents or false on failure.
|
||||
*/
|
||||
public function read($path);
|
||||
|
||||
/**
|
||||
* Retrieves a read-stream for a path.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return resource|false The path resource or false on failure.
|
||||
*/
|
||||
public function readStream($path);
|
||||
|
||||
/**
|
||||
* List contents of a directory.
|
||||
*
|
||||
* @param string $directory The directory to list.
|
||||
* @param bool $recursive Whether to list recursively.
|
||||
*
|
||||
* @return array A list of file metadata.
|
||||
*/
|
||||
public function listContents($directory = '', $recursive = false);
|
||||
|
||||
/**
|
||||
* Get a file's metadata.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return array|false The file metadata or false on failure.
|
||||
*/
|
||||
public function getMetadata($path);
|
||||
|
||||
/**
|
||||
* Get a file's size.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return int|false The file size or false on failure.
|
||||
*/
|
||||
public function getSize($path);
|
||||
|
||||
/**
|
||||
* Get a file's mime-type.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return string|false The file mime-type or false on failure.
|
||||
*/
|
||||
public function getMimetype($path);
|
||||
|
||||
/**
|
||||
* Get a file's timestamp.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return int|false The timestamp or false on failure.
|
||||
*/
|
||||
public function getTimestamp($path);
|
||||
|
||||
/**
|
||||
* Get a file's visibility.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return string|false The visibility (public|private) or false on failure.
|
||||
*/
|
||||
public function getVisibility($path);
|
||||
|
||||
/**
|
||||
* Write a new file.
|
||||
*
|
||||
* @param string $path The path of the new file.
|
||||
* @param string $contents The file contents.
|
||||
* @param array $config An optional configuration array.
|
||||
*
|
||||
* @throws FileExistsException
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function write($path, $contents, array $config = []);
|
||||
|
||||
/**
|
||||
* Write a new file using a stream.
|
||||
*
|
||||
* @param string $path The path of the new file.
|
||||
* @param resource $resource The file handle.
|
||||
* @param array $config An optional configuration array.
|
||||
*
|
||||
* @throws InvalidArgumentException If $resource is not a file handle.
|
||||
* @throws FileExistsException
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function writeStream($path, $resource, array $config = []);
|
||||
|
||||
/**
|
||||
* Update an existing file.
|
||||
*
|
||||
* @param string $path The path of the existing file.
|
||||
* @param string $contents The file contents.
|
||||
* @param array $config An optional configuration array.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function update($path, $contents, array $config = []);
|
||||
|
||||
/**
|
||||
* Update an existing file using a stream.
|
||||
*
|
||||
* @param string $path The path of the existing file.
|
||||
* @param resource $resource The file handle.
|
||||
* @param array $config An optional configuration array.
|
||||
*
|
||||
* @throws InvalidArgumentException If $resource is not a file handle.
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function updateStream($path, $resource, array $config = []);
|
||||
|
||||
/**
|
||||
* Rename a file.
|
||||
*
|
||||
* @param string $path Path to the existing file.
|
||||
* @param string $newpath The new path of the file.
|
||||
*
|
||||
* @throws FileExistsException Thrown if $newpath exists.
|
||||
* @throws FileNotFoundException Thrown if $path does not exist.
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function rename($path, $newpath);
|
||||
|
||||
/**
|
||||
* Copy a file.
|
||||
*
|
||||
* @param string $path Path to the existing file.
|
||||
* @param string $newpath The new path of the file.
|
||||
*
|
||||
* @throws FileExistsException Thrown if $newpath exists.
|
||||
* @throws FileNotFoundException Thrown if $path does not exist.
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function copy($path, $newpath);
|
||||
|
||||
/**
|
||||
* Delete a file.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function delete($path);
|
||||
|
||||
/**
|
||||
* Delete a directory.
|
||||
*
|
||||
* @param string $dirname
|
||||
*
|
||||
* @throws RootViolationException Thrown if $dirname is empty.
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function deleteDir($dirname);
|
||||
|
||||
/**
|
||||
* Create a directory.
|
||||
*
|
||||
* @param string $dirname The name of the new directory.
|
||||
* @param array $config An optional configuration array.
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function createDir($dirname, array $config = []);
|
||||
|
||||
/**
|
||||
* Set the visibility for a file.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
* @param string $visibility One of 'public' or 'private'.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function setVisibility($path, $visibility);
|
||||
|
||||
/**
|
||||
* Create a file or update if exists.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
* @param string $contents The file contents.
|
||||
* @param array $config An optional configuration array.
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function put($path, $contents, array $config = []);
|
||||
|
||||
/**
|
||||
* Create a file or update if exists.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
* @param resource $resource The file handle.
|
||||
* @param array $config An optional configuration array.
|
||||
*
|
||||
* @throws InvalidArgumentException Thrown if $resource is not a resource.
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function putStream($path, $resource, array $config = []);
|
||||
|
||||
/**
|
||||
* Read and delete a file.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return string|false The file contents, or false on failure.
|
||||
*/
|
||||
public function readAndDelete($path);
|
||||
|
||||
/**
|
||||
* Get a file/directory handler.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
* @param Handler $handler An optional existing handler to populate.
|
||||
*
|
||||
* @return Handler Either a file or directory handler.
|
||||
*/
|
||||
public function get($path, Handler $handler = null);
|
||||
|
||||
/**
|
||||
* Register a plugin.
|
||||
*
|
||||
* @param PluginInterface $plugin The plugin to register.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addPlugin(PluginInterface $plugin);
|
||||
}
|
||||
275
vendor/mews/purifier/src/Purifier.php
vendored
275
vendor/mews/purifier/src/Purifier.php
vendored
@@ -1,275 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Mews\Purifier;
|
||||
|
||||
/**
|
||||
* Laravel 5 HTMLPurifier package
|
||||
*
|
||||
* @copyright Copyright (c) 2015 MeWebStudio
|
||||
* @version 2.0.0
|
||||
* @author Muharrem ERİN
|
||||
* @contact me@mewebstudio.com
|
||||
* @web http://www.mewebstudio.com
|
||||
* @date 2014-04-02
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
use Exception;
|
||||
use HTMLPurifier;
|
||||
use HTMLPurifier_Config;
|
||||
use HTMLPurifier_HTMLDefinition;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class Purifier
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* @var Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var HTMLPurifier
|
||||
*/
|
||||
protected $purifier;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Filesystem $files
|
||||
* @param Repository $config
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(Filesystem $files, Repository $config)
|
||||
{
|
||||
$this->files = $files;
|
||||
$this->config = $config;
|
||||
|
||||
$this->setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private function setUp()
|
||||
{
|
||||
if (!$this->config->has('purifier')) {
|
||||
throw new Exception('Configuration parameters not loaded!');
|
||||
}
|
||||
|
||||
$this->checkCacheDirectory();
|
||||
|
||||
// Create a new configuration object
|
||||
$config = $this->getConfig();
|
||||
|
||||
// Create HTMLPurifier object
|
||||
$this->purifier = new HTMLPurifier($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a custom definition
|
||||
*
|
||||
* @see http://htmlpurifier.org/docs/enduser-customize.html
|
||||
* @param array $definitionConfig
|
||||
* @param HTMLPurifier_Config $configObject Defaults to using default config
|
||||
*
|
||||
* @return HTMLPurifier_Config $configObject
|
||||
*/
|
||||
private function addCustomDefinition(array $definitionConfig, HTMLPurifier_Config $configObject = null)
|
||||
{
|
||||
if (!$configObject) {
|
||||
$configObject = HTMLPurifier_Config::createDefault();
|
||||
$configObject->loadArray($this->getConfig());
|
||||
}
|
||||
|
||||
// Setup the custom definition
|
||||
$configObject->set('HTML.DefinitionID', $definitionConfig['id']);
|
||||
$configObject->set('HTML.DefinitionRev', $definitionConfig['rev']);
|
||||
|
||||
// Enable debug mode
|
||||
if (!isset($definitionConfig['debug']) || $definitionConfig['debug']) {
|
||||
$configObject->set('Cache.DefinitionImpl', null);
|
||||
}
|
||||
|
||||
// Start configuring the definition
|
||||
if ($def = $configObject->maybeGetRawHTMLDefinition()) {
|
||||
// Create the definition attributes
|
||||
if (!empty($definitionConfig['attributes'])) {
|
||||
$this->addCustomAttributes($definitionConfig['attributes'], $def);
|
||||
}
|
||||
|
||||
// Create the definition elements
|
||||
if (!empty($definitionConfig['elements'])) {
|
||||
$this->addCustomElements($definitionConfig['elements'], $def);
|
||||
}
|
||||
}
|
||||
|
||||
return $configObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add provided attributes to the provided definition
|
||||
*
|
||||
* @param array $attributes
|
||||
* @param HTMLPurifier_HTMLDefinition $definition
|
||||
*
|
||||
* @return HTMLPurifier_HTMLDefinition $definition
|
||||
*/
|
||||
private function addCustomAttributes(array $attributes, HTMLPurifier_HTMLDefinition $definition)
|
||||
{
|
||||
foreach ($attributes as $attribute) {
|
||||
// Get configuration of attribute
|
||||
$required = !empty($attribute[3]) ? true : false;
|
||||
$onElement = $attribute[0];
|
||||
$attrName = $required ? $attribute[1] . '*' : $attribute[1];
|
||||
$validValues = $attribute[2];
|
||||
|
||||
$definition->addAttribute($onElement, $attrName, $validValues);
|
||||
}
|
||||
|
||||
return $definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add provided elements to the provided definition
|
||||
*
|
||||
* @param array $elements
|
||||
* @param HTMLPurifier_HTMLDefinition $definition
|
||||
*
|
||||
* @return HTMLPurifier_HTMLDefinition $definition
|
||||
*/
|
||||
private function addCustomElements(array $elements, HTMLPurifier_HTMLDefinition $definition)
|
||||
{
|
||||
foreach ($elements as $element) {
|
||||
// Get configuration of element
|
||||
$name = $element[0];
|
||||
$contentSet = $element[1];
|
||||
$allowedChildren = $element[2];
|
||||
$attributeCollection = $element[3];
|
||||
$attributes = isset($element[4]) ? $element[4] : null;
|
||||
|
||||
if (!empty($attributes)) {
|
||||
$definition->addElement($name, $contentSet, $allowedChildren, $attributeCollection, $attributes);
|
||||
} else {
|
||||
$definition->addElement($name, $contentSet, $allowedChildren, $attributeCollection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check/Create cache directory
|
||||
*/
|
||||
private function checkCacheDirectory()
|
||||
{
|
||||
$cachePath = $this->config->get('purifier.cachePath');
|
||||
|
||||
if ($cachePath) {
|
||||
if (!$this->files->isDirectory($cachePath)) {
|
||||
$this->files->makeDirectory($cachePath, $this->config->get('purifier.cacheFileMode', 0755),true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $config
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
protected function getConfig($config = null)
|
||||
{
|
||||
// Create a new configuration object
|
||||
$configObject = HTMLPurifier_Config::createDefault();
|
||||
|
||||
// Allow configuration to be modified
|
||||
if (! $this->config->get('purifier.finalize')) {
|
||||
$configObject->autoFinalize = false;
|
||||
}
|
||||
|
||||
// Set default config
|
||||
$defaultConfig = [];
|
||||
$defaultConfig['Core.Encoding'] = $this->config->get('purifier.encoding');
|
||||
$defaultConfig['Cache.SerializerPath'] = $this->config->get('purifier.cachePath');
|
||||
$defaultConfig['Cache.SerializerPermissions'] = $this->config->get('purifier.cacheFileMode', 0755);
|
||||
|
||||
if (! $config) {
|
||||
$config = $this->config->get('purifier.settings.default');
|
||||
} elseif (is_string($config)) {
|
||||
$config = $this->config->get('purifier.settings.' . $config);
|
||||
}
|
||||
|
||||
if (! is_array($config)) {
|
||||
$config = [];
|
||||
}
|
||||
|
||||
// Merge configurations
|
||||
$config = $defaultConfig + $config;
|
||||
|
||||
// Load to Purifier config
|
||||
$configObject->loadArray($config);
|
||||
|
||||
// Load custom definition if set
|
||||
if ($definitionConfig = $this->config->get('purifier.settings.custom_definition')) {
|
||||
$this->addCustomDefinition($definitionConfig, $configObject);
|
||||
}
|
||||
|
||||
// Load custom elements if set
|
||||
if ($elements = $this->config->get('purifier.settings.custom_elements')) {
|
||||
if ($def = $configObject->maybeGetRawHTMLDefinition()) {
|
||||
$this->addCustomElements($elements, $def);
|
||||
}
|
||||
}
|
||||
|
||||
// Load custom attributes if set
|
||||
if ($attributes = $this->config->get('purifier.settings.custom_attributes')) {
|
||||
if ($def = $configObject->maybeGetRawHTMLDefinition()) {
|
||||
$this->addCustomAttributes($attributes, $def);
|
||||
}
|
||||
}
|
||||
|
||||
return $configObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dirty
|
||||
* @param null $config
|
||||
* @param \Closure|null $postCreateConfigHook
|
||||
* @return mixed
|
||||
*/
|
||||
public function clean($dirty, $config = null, \Closure $postCreateConfigHook = null)
|
||||
{
|
||||
if (is_array($dirty)) {
|
||||
return array_map(function ($item) use ($config) {
|
||||
return $this->clean($item, $config);
|
||||
}, $dirty);
|
||||
}
|
||||
|
||||
$configObject = null;
|
||||
if ($config !== null) {
|
||||
$configObject = $this->getConfig($config);
|
||||
|
||||
if ($postCreateConfigHook !== null) {
|
||||
$postCreateConfigHook->call($this, $configObject);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->purifier->purify($dirty, $configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTMLPurifier instance.
|
||||
*
|
||||
* @return \HTMLPurifier
|
||||
*/
|
||||
public function getInstance()
|
||||
{
|
||||
return $this->purifier;
|
||||
}
|
||||
}
|
||||
@@ -1,389 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Cron;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeZone;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* CRON expression parser that can determine whether or not a CRON expression is
|
||||
* due to run, the next run date and previous run date of a CRON expression.
|
||||
* The determinations made by this class are accurate if checked run once per
|
||||
* minute (seconds are dropped from date time comparisons).
|
||||
*
|
||||
* Schedule parts must map to:
|
||||
* minute [0-59], hour [0-23], day of month, month [1-12|JAN-DEC], day of week
|
||||
* [1-7|MON-SUN], and an optional year.
|
||||
*
|
||||
* @link http://en.wikipedia.org/wiki/Cron
|
||||
*/
|
||||
class CronExpression
|
||||
{
|
||||
const MINUTE = 0;
|
||||
const HOUR = 1;
|
||||
const DAY = 2;
|
||||
const MONTH = 3;
|
||||
const WEEKDAY = 4;
|
||||
const YEAR = 5;
|
||||
|
||||
/**
|
||||
* @var array CRON expression parts
|
||||
*/
|
||||
private $cronParts;
|
||||
|
||||
/**
|
||||
* @var FieldFactory CRON field factory
|
||||
*/
|
||||
private $fieldFactory;
|
||||
|
||||
/**
|
||||
* @var int Max iteration count when searching for next run date
|
||||
*/
|
||||
private $maxIterationCount = 1000;
|
||||
|
||||
/**
|
||||
* @var array Order in which to test of cron parts
|
||||
*/
|
||||
private static $order = array(self::YEAR, self::MONTH, self::DAY, self::WEEKDAY, self::HOUR, self::MINUTE);
|
||||
|
||||
/**
|
||||
* Factory method to create a new CronExpression.
|
||||
*
|
||||
* @param string $expression The CRON expression to create. There are
|
||||
* several special predefined values which can be used to substitute the
|
||||
* CRON expression:
|
||||
*
|
||||
* `@yearly`, `@annually` - Run once a year, midnight, Jan. 1 - 0 0 1 1 *
|
||||
* `@monthly` - Run once a month, midnight, first of month - 0 0 1 * *
|
||||
* `@weekly` - Run once a week, midnight on Sun - 0 0 * * 0
|
||||
* `@daily` - Run once a day, midnight - 0 0 * * *
|
||||
* `@hourly` - Run once an hour, first minute - 0 * * * *
|
||||
* @param FieldFactory $fieldFactory Field factory to use
|
||||
*
|
||||
* @return CronExpression
|
||||
*/
|
||||
public static function factory($expression, FieldFactory $fieldFactory = null)
|
||||
{
|
||||
$mappings = array(
|
||||
'@yearly' => '0 0 1 1 *',
|
||||
'@annually' => '0 0 1 1 *',
|
||||
'@monthly' => '0 0 1 * *',
|
||||
'@weekly' => '0 0 * * 0',
|
||||
'@daily' => '0 0 * * *',
|
||||
'@hourly' => '0 * * * *'
|
||||
);
|
||||
|
||||
if (isset($mappings[$expression])) {
|
||||
$expression = $mappings[$expression];
|
||||
}
|
||||
|
||||
return new static($expression, $fieldFactory ?: new FieldFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a CronExpression.
|
||||
*
|
||||
* @param string $expression The CRON expression to validate.
|
||||
*
|
||||
* @return bool True if a valid CRON expression was passed. False if not.
|
||||
* @see \Cron\CronExpression::factory
|
||||
*/
|
||||
public static function isValidExpression($expression)
|
||||
{
|
||||
try {
|
||||
self::factory($expression);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a CRON expression
|
||||
*
|
||||
* @param string $expression CRON expression (e.g. '8 * * * *')
|
||||
* @param FieldFactory $fieldFactory Factory to create cron fields
|
||||
*/
|
||||
public function __construct($expression, FieldFactory $fieldFactory)
|
||||
{
|
||||
$this->fieldFactory = $fieldFactory;
|
||||
$this->setExpression($expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set or change the CRON expression
|
||||
*
|
||||
* @param string $value CRON expression (e.g. 8 * * * *)
|
||||
*
|
||||
* @return CronExpression
|
||||
* @throws \InvalidArgumentException if not a valid CRON expression
|
||||
*/
|
||||
public function setExpression($value)
|
||||
{
|
||||
$this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY);
|
||||
if (count($this->cronParts) < 5) {
|
||||
throw new InvalidArgumentException(
|
||||
$value . ' is not a valid CRON expression'
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($this->cronParts as $position => $part) {
|
||||
$this->setPart($position, $part);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set part of the CRON expression
|
||||
*
|
||||
* @param int $position The position of the CRON expression to set
|
||||
* @param string $value The value to set
|
||||
*
|
||||
* @return CronExpression
|
||||
* @throws \InvalidArgumentException if the value is not valid for the part
|
||||
*/
|
||||
public function setPart($position, $value)
|
||||
{
|
||||
if (!$this->fieldFactory->getField($position)->validate($value)) {
|
||||
throw new InvalidArgumentException(
|
||||
'Invalid CRON field value ' . $value . ' at position ' . $position
|
||||
);
|
||||
}
|
||||
|
||||
$this->cronParts[$position] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set max iteration count for searching next run dates
|
||||
*
|
||||
* @param int $maxIterationCount Max iteration count when searching for next run date
|
||||
*
|
||||
* @return CronExpression
|
||||
*/
|
||||
public function setMaxIterationCount($maxIterationCount)
|
||||
{
|
||||
$this->maxIterationCount = $maxIterationCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a next run date relative to the current date or a specific date
|
||||
*
|
||||
* @param string|\DateTime $currentTime Relative calculation date
|
||||
* @param int $nth Number of matches to skip before returning a
|
||||
* matching next run date. 0, the default, will return the current
|
||||
* date and time if the next run date falls on the current date and
|
||||
* time. Setting this value to 1 will skip the first match and go to
|
||||
* the second match. Setting this value to 2 will skip the first 2
|
||||
* matches and so on.
|
||||
* @param bool $allowCurrentDate Set to TRUE to return the current date if
|
||||
* it matches the cron expression.
|
||||
*
|
||||
* @return \DateTime
|
||||
* @throws \RuntimeException on too many iterations
|
||||
*/
|
||||
public function getNextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false)
|
||||
{
|
||||
return $this->getRunDate($currentTime, $nth, false, $allowCurrentDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a previous run date relative to the current date or a specific date
|
||||
*
|
||||
* @param string|\DateTime $currentTime Relative calculation date
|
||||
* @param int $nth Number of matches to skip before returning
|
||||
* @param bool $allowCurrentDate Set to TRUE to return the
|
||||
* current date if it matches the cron expression
|
||||
*
|
||||
* @return \DateTime
|
||||
* @throws \RuntimeException on too many iterations
|
||||
* @see \Cron\CronExpression::getNextRunDate
|
||||
*/
|
||||
public function getPreviousRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false)
|
||||
{
|
||||
return $this->getRunDate($currentTime, $nth, true, $allowCurrentDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get multiple run dates starting at the current date or a specific date
|
||||
*
|
||||
* @param int $total Set the total number of dates to calculate
|
||||
* @param string|\DateTime $currentTime Relative calculation date
|
||||
* @param bool $invert Set to TRUE to retrieve previous dates
|
||||
* @param bool $allowCurrentDate Set to TRUE to return the
|
||||
* current date if it matches the cron expression
|
||||
*
|
||||
* @return array Returns an array of run dates
|
||||
*/
|
||||
public function getMultipleRunDates($total, $currentTime = 'now', $invert = false, $allowCurrentDate = false)
|
||||
{
|
||||
$matches = array();
|
||||
for ($i = 0; $i < max(0, $total); $i++) {
|
||||
try {
|
||||
$matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate);
|
||||
} catch (RuntimeException $e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all or part of the CRON expression
|
||||
*
|
||||
* @param string $part Specify the part to retrieve or NULL to get the full
|
||||
* cron schedule string.
|
||||
*
|
||||
* @return string|null Returns the CRON expression, a part of the
|
||||
* CRON expression, or NULL if the part was specified but not found
|
||||
*/
|
||||
public function getExpression($part = null)
|
||||
{
|
||||
if (null === $part) {
|
||||
return implode(' ', $this->cronParts);
|
||||
} elseif (array_key_exists($part, $this->cronParts)) {
|
||||
return $this->cronParts[$part];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to output the full expression.
|
||||
*
|
||||
* @return string Full CRON expression
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the cron is due to run based on the current date or a
|
||||
* specific date. This method assumes that the current number of
|
||||
* seconds are irrelevant, and should be called once per minute.
|
||||
*
|
||||
* @param string|\DateTime $currentTime Relative calculation date
|
||||
*
|
||||
* @return bool Returns TRUE if the cron is due to run or FALSE if not
|
||||
*/
|
||||
public function isDue($currentTime = 'now')
|
||||
{
|
||||
if ('now' === $currentTime) {
|
||||
$currentDate = date('Y-m-d H:i');
|
||||
$currentTime = strtotime($currentDate);
|
||||
} elseif ($currentTime instanceof DateTime) {
|
||||
$currentDate = clone $currentTime;
|
||||
// Ensure time in 'current' timezone is used
|
||||
$currentDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$currentDate = $currentDate->format('Y-m-d H:i');
|
||||
$currentTime = strtotime($currentDate);
|
||||
} elseif ($currentTime instanceof DateTimeImmutable) {
|
||||
$currentDate = DateTime::createFromFormat('U', $currentTime->format('U'));
|
||||
$currentDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
$currentDate = $currentDate->format('Y-m-d H:i');
|
||||
$currentTime = strtotime($currentDate);
|
||||
} else {
|
||||
$currentTime = new DateTime($currentTime);
|
||||
$currentTime->setTime($currentTime->format('H'), $currentTime->format('i'), 0);
|
||||
$currentDate = $currentTime->format('Y-m-d H:i');
|
||||
$currentTime = $currentTime->getTimeStamp();
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->getNextRunDate($currentDate, 0, true)->getTimestamp() == $currentTime;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next or previous run date of the expression relative to a date
|
||||
*
|
||||
* @param string|\DateTime $currentTime Relative calculation date
|
||||
* @param int $nth Number of matches to skip before returning
|
||||
* @param bool $invert Set to TRUE to go backwards in time
|
||||
* @param bool $allowCurrentDate Set to TRUE to return the
|
||||
* current date if it matches the cron expression
|
||||
*
|
||||
* @return \DateTime
|
||||
* @throws \RuntimeException on too many iterations
|
||||
*/
|
||||
protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false)
|
||||
{
|
||||
if ($currentTime instanceof DateTime) {
|
||||
$currentDate = clone $currentTime;
|
||||
} elseif ($currentTime instanceof DateTimeImmutable) {
|
||||
$currentDate = DateTime::createFromFormat('U', $currentTime->format('U'));
|
||||
$currentDate->setTimezone($currentTime->getTimezone());
|
||||
} else {
|
||||
$currentDate = new DateTime($currentTime ?: 'now');
|
||||
$currentDate->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
}
|
||||
|
||||
$currentDate->setTime($currentDate->format('H'), $currentDate->format('i'), 0);
|
||||
$nextRun = clone $currentDate;
|
||||
$nth = (int) $nth;
|
||||
|
||||
// We don't have to satisfy * or null fields
|
||||
$parts = array();
|
||||
$fields = array();
|
||||
foreach (self::$order as $position) {
|
||||
$part = $this->getExpression($position);
|
||||
if (null === $part || '*' === $part) {
|
||||
continue;
|
||||
}
|
||||
$parts[$position] = $part;
|
||||
$fields[$position] = $this->fieldFactory->getField($position);
|
||||
}
|
||||
|
||||
// Set a hard limit to bail on an impossible date
|
||||
for ($i = 0; $i < $this->maxIterationCount; $i++) {
|
||||
|
||||
foreach ($parts as $position => $part) {
|
||||
$satisfied = false;
|
||||
// Get the field object used to validate this part
|
||||
$field = $fields[$position];
|
||||
// Check if this is singular or a list
|
||||
if (strpos($part, ',') === false) {
|
||||
$satisfied = $field->isSatisfiedBy($nextRun, $part);
|
||||
} else {
|
||||
foreach (array_map('trim', explode(',', $part)) as $listPart) {
|
||||
if ($field->isSatisfiedBy($nextRun, $listPart)) {
|
||||
$satisfied = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the field is not satisfied, then start over
|
||||
if (!$satisfied) {
|
||||
$field->increment($nextRun, $invert, $part);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip this match if needed
|
||||
if ((!$allowCurrentDate && $nextRun == $currentDate) || --$nth > -1) {
|
||||
$this->fieldFactory->getField(0)->increment($nextRun, $invert, isset($parts[0]) ? $parts[0] : null);
|
||||
continue;
|
||||
}
|
||||
|
||||
return $nextRun;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
throw new RuntimeException('Impossible CRON expression');
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
}
|
||||
143
vendor/nesbot/carbon/src/Carbon/Translator.php
vendored
143
vendor/nesbot/carbon/src/Carbon/Translator.php
vendored
@@ -1,143 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Carbon;
|
||||
|
||||
use Symfony\Component\Translation;
|
||||
|
||||
class Translator extends Translation\Translator
|
||||
{
|
||||
/**
|
||||
* Singleton for Translator.
|
||||
*
|
||||
* @var static
|
||||
*/
|
||||
protected static $singleton;
|
||||
|
||||
/**
|
||||
* List of custom localized messages.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $messages = array();
|
||||
|
||||
/**
|
||||
* Return a singleton instance of Translator.
|
||||
*
|
||||
* @param string|null $locale optional initial locale ("en" - english by default)
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function get($locale = null)
|
||||
{
|
||||
if (static::$singleton === null) {
|
||||
static::$singleton = new static($locale ?: 'en');
|
||||
}
|
||||
|
||||
return static::$singleton;
|
||||
}
|
||||
|
||||
public function __construct($locale, Translation\Formatter\MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false)
|
||||
{
|
||||
$this->addLoader('array', new Translation\Loader\ArrayLoader());
|
||||
parent::__construct($locale, $formatter, $cacheDir, $debug);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset messages of a locale (all locale if no locale passed).
|
||||
* Remove custom messages and reload initial messages from matching
|
||||
* file in Lang directory.
|
||||
*
|
||||
* @param string|null $locale
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resetMessages($locale = null)
|
||||
{
|
||||
if ($locale === null) {
|
||||
static::$messages = array();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) {
|
||||
static::$messages[$locale] = require $filename;
|
||||
$this->addResource('array', static::$messages[$locale], $locale);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init messages language from matching file in Lang directory.
|
||||
*
|
||||
* @param string $locale
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function loadMessagesFromFile($locale)
|
||||
{
|
||||
if (isset(static::$messages[$locale])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->resetMessages($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set messages of a locale and take file first if present.
|
||||
*
|
||||
* @param string $locale
|
||||
* @param array $messages
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMessages($locale, $messages)
|
||||
{
|
||||
$this->loadMessagesFromFile($locale);
|
||||
$this->addResource('array', $messages, $locale);
|
||||
static::$messages[$locale] = array_merge(
|
||||
isset(static::$messages[$locale]) ? static::$messages[$locale] : array(),
|
||||
$messages
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messages of a locale, if none given, return all the
|
||||
* languages.
|
||||
*
|
||||
* @param string|null $locale
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMessages($locale = null)
|
||||
{
|
||||
return $locale === null ? static::$messages : static::$messages[$locale];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current translator locale and indicate if the source locale file exists
|
||||
*
|
||||
* @param string $locale locale ex. en
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$locale = preg_replace_callback('/[-_]([a-z]{2,})/', function ($matches) {
|
||||
// _2-letters is a region, _3+-letters is a variant
|
||||
return '_'.call_user_func(strlen($matches[1]) > 2 ? 'ucfirst' : 'strtoupper', $matches[1]);
|
||||
}, strtolower($locale));
|
||||
|
||||
if ($this->loadMessagesFromFile($locale)) {
|
||||
parent::setLocale($locale);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
315
vendor/ramsey/uuid/src/UuidFactory.php
vendored
315
vendor/ramsey/uuid/src/UuidFactory.php
vendored
@@ -1,315 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the ramsey/uuid library
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
||||
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
||||
* @link https://github.com/ramsey/uuid GitHub
|
||||
*/
|
||||
|
||||
namespace Ramsey\Uuid;
|
||||
|
||||
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
||||
use Ramsey\Uuid\Exception\InvalidUuidStringException;
|
||||
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
||||
use Ramsey\Uuid\Generator\RandomGeneratorInterface;
|
||||
use Ramsey\Uuid\Generator\TimeGeneratorInterface;
|
||||
use Ramsey\Uuid\Codec\CodecInterface;
|
||||
use Ramsey\Uuid\Builder\UuidBuilderInterface;
|
||||
|
||||
class UuidFactory implements UuidFactoryInterface
|
||||
{
|
||||
/**
|
||||
* @var CodecInterface
|
||||
*/
|
||||
private $codec = null;
|
||||
|
||||
/**
|
||||
* @var NodeProviderInterface
|
||||
*/
|
||||
private $nodeProvider = null;
|
||||
|
||||
/**
|
||||
* @var NumberConverterInterface
|
||||
*/
|
||||
private $numberConverter = null;
|
||||
|
||||
/**
|
||||
* @var RandomGeneratorInterface
|
||||
*/
|
||||
private $randomGenerator = null;
|
||||
|
||||
/**
|
||||
* @var TimeGeneratorInterface
|
||||
*/
|
||||
private $timeGenerator = null;
|
||||
|
||||
/**
|
||||
* @var UuidBuilderInterface
|
||||
*/
|
||||
private $uuidBuilder = null;
|
||||
|
||||
/**
|
||||
* Constructs a `UuidFactory` for creating `Ramsey\Uuid\UuidInterface` instances
|
||||
*
|
||||
* @param FeatureSet $features A set of features for use when creating UUIDs
|
||||
*/
|
||||
public function __construct(FeatureSet $features = null)
|
||||
{
|
||||
$features = $features ?: new FeatureSet();
|
||||
|
||||
$this->codec = $features->getCodec();
|
||||
$this->nodeProvider = $features->getNodeProvider();
|
||||
$this->numberConverter = $features->getNumberConverter();
|
||||
$this->randomGenerator = $features->getRandomGenerator();
|
||||
$this->timeGenerator = $features->getTimeGenerator();
|
||||
$this->uuidBuilder = $features->getBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the UUID coder-decoder used by this factory
|
||||
*
|
||||
* @return CodecInterface
|
||||
*/
|
||||
public function getCodec()
|
||||
{
|
||||
return $this->codec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the UUID coder-decoder used by this factory
|
||||
*
|
||||
* @param CodecInterface $codec
|
||||
*/
|
||||
public function setCodec(CodecInterface $codec)
|
||||
{
|
||||
$this->codec = $codec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the system node ID provider used by this factory
|
||||
*
|
||||
* @return NodeProviderInterface
|
||||
*/
|
||||
public function getNodeProvider()
|
||||
{
|
||||
return $this->nodeProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the random UUID generator used by this factory
|
||||
*
|
||||
* @return RandomGeneratorInterface
|
||||
*/
|
||||
public function getRandomGenerator()
|
||||
{
|
||||
return $this->randomGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time-based UUID generator used by this factory
|
||||
*
|
||||
* @return TimeGeneratorInterface
|
||||
*/
|
||||
public function getTimeGenerator()
|
||||
{
|
||||
return $this->timeGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time-based UUID generator this factory will use to generate version 1 UUIDs
|
||||
*
|
||||
* @param TimeGeneratorInterface $generator
|
||||
*/
|
||||
public function setTimeGenerator(TimeGeneratorInterface $generator)
|
||||
{
|
||||
$this->timeGenerator = $generator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number converter used by this factory
|
||||
*
|
||||
* @return NumberConverterInterface
|
||||
*/
|
||||
public function getNumberConverter()
|
||||
{
|
||||
return $this->numberConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the random UUID generator this factory will use to generate version 4 UUIDs
|
||||
*
|
||||
* @param RandomGeneratorInterface $generator
|
||||
*/
|
||||
public function setRandomGenerator(RandomGeneratorInterface $generator)
|
||||
{
|
||||
$this->randomGenerator = $generator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number converter this factory will use
|
||||
*
|
||||
* @param NumberConverterInterface $converter
|
||||
*/
|
||||
public function setNumberConverter(NumberConverterInterface $converter)
|
||||
{
|
||||
$this->numberConverter = $converter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the UUID builder this factory uses when creating `Uuid` instances
|
||||
*
|
||||
* @return UuidBuilderInterface $builder
|
||||
*/
|
||||
public function getUuidBuilder()
|
||||
{
|
||||
return $this->uuidBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the UUID builder this factory will use when creating `Uuid` instances
|
||||
*
|
||||
* @param UuidBuilderInterface $builder
|
||||
*/
|
||||
public function setUuidBuilder(UuidBuilderInterface $builder)
|
||||
{
|
||||
$this->uuidBuilder = $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function fromBytes($bytes)
|
||||
{
|
||||
return $this->codec->decodeBytes($bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function fromString($uuid)
|
||||
{
|
||||
$uuid = strtolower($uuid);
|
||||
return $this->codec->decode($uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function fromInteger($integer)
|
||||
{
|
||||
$hex = $this->numberConverter->toHex($integer);
|
||||
$hex = str_pad($hex, 32, '0', STR_PAD_LEFT);
|
||||
|
||||
return $this->fromString($hex);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function uuid1($node = null, $clockSeq = null)
|
||||
{
|
||||
$bytes = $this->timeGenerator->generate($node, $clockSeq);
|
||||
$hex = bin2hex($bytes);
|
||||
|
||||
return $this->uuidFromHashedName($hex, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function uuid3($ns, $name)
|
||||
{
|
||||
return $this->uuidFromNsAndName($ns, $name, 3, 'md5');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function uuid4()
|
||||
{
|
||||
$bytes = $this->randomGenerator->generate(16);
|
||||
|
||||
// When converting the bytes to hex, it turns into a 32-character
|
||||
// hexadecimal string that looks a lot like an MD5 hash, so at this
|
||||
// point, we can just pass it to uuidFromHashedName.
|
||||
$hex = bin2hex($bytes);
|
||||
|
||||
return $this->uuidFromHashedName($hex, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function uuid5($ns, $name)
|
||||
{
|
||||
return $this->uuidFromNsAndName($ns, $name, 5, 'sha1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a `Uuid`
|
||||
*
|
||||
* Uses the configured builder and codec and the provided array of hexadecimal
|
||||
* value UUID fields to construct a `Uuid` object.
|
||||
*
|
||||
* @param array $fields An array of fields from which to construct a UUID;
|
||||
* see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
|
||||
* @return UuidInterface
|
||||
*/
|
||||
public function uuid(array $fields)
|
||||
{
|
||||
return $this->uuidBuilder->build($this->codec, $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version 3 or 5 namespaced `Uuid`
|
||||
*
|
||||
* @param string|UuidInterface $ns The UUID namespace to use
|
||||
* @param string $name The string to hash together with the namespace
|
||||
* @param int $version The version of UUID to create (3 or 5)
|
||||
* @param string $hashFunction The hash function to use when hashing together
|
||||
* the namespace and name
|
||||
* @return UuidInterface
|
||||
* @throws InvalidUuidStringException
|
||||
*/
|
||||
protected function uuidFromNsAndName($ns, $name, $version, $hashFunction)
|
||||
{
|
||||
if (!($ns instanceof UuidInterface)) {
|
||||
$ns = $this->codec->decode($ns);
|
||||
}
|
||||
|
||||
$hash = call_user_func($hashFunction, ($ns->getBytes() . $name));
|
||||
|
||||
return $this->uuidFromHashedName($hash, $version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a `Uuid` created from `$hash` with the version field set to `$version`
|
||||
* and the variant field set for RFC 4122
|
||||
*
|
||||
* @param string $hash The hash to use when creating the UUID
|
||||
* @param int $version The UUID version to set for this hash (1, 3, 4, or 5)
|
||||
* @return UuidInterface
|
||||
*/
|
||||
protected function uuidFromHashedName($hash, $version)
|
||||
{
|
||||
$timeHi = BinaryUtils::applyVersion(substr($hash, 12, 4), $version);
|
||||
$clockSeqHi = BinaryUtils::applyVariant(hexdec(substr($hash, 16, 2)));
|
||||
|
||||
$fields = [
|
||||
'time_low' => substr($hash, 0, 8),
|
||||
'time_mid' => substr($hash, 8, 4),
|
||||
'time_hi_and_version' => str_pad(dechex($timeHi), 4, '0', STR_PAD_LEFT),
|
||||
'clock_seq_hi_and_reserved' => str_pad(dechex($clockSeqHi), 2, '0', STR_PAD_LEFT),
|
||||
'clock_seq_low' => substr($hash, 18, 2),
|
||||
'node' => substr($hash, 20, 12),
|
||||
];
|
||||
|
||||
return $this->uuid($fields);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Attachment class for attaching files to a {@link Swift_Mime_SimpleMessage}.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Attachment extends Swift_Mime_Attachment
|
||||
{
|
||||
/**
|
||||
* Create a new Attachment.
|
||||
*
|
||||
* Details may be optionally provided to the constructor.
|
||||
*
|
||||
* @param string|Swift_OutputByteStream $data
|
||||
* @param string $filename
|
||||
* @param string $contentType
|
||||
*/
|
||||
public function __construct($data = null, $filename = null, $contentType = null)
|
||||
{
|
||||
call_user_func_array(
|
||||
[$this, 'Swift_Mime_Attachment::__construct'],
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->createDependenciesFor('mime.attachment')
|
||||
);
|
||||
|
||||
$this->setBody($data, $contentType);
|
||||
$this->setFilename($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Attachment from a filesystem path.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $contentType optional
|
||||
*
|
||||
* @return Swift_Mime_Attachment
|
||||
*/
|
||||
public static function fromPath($path, $contentType = null)
|
||||
{
|
||||
return (new self())->setFile(
|
||||
new Swift_ByteStream_FileByteStream($path),
|
||||
$contentType
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,300 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles Quoted Printable (QP) Encoding in Swift Mailer.
|
||||
*
|
||||
* Possibly the most accurate RFC 2045 QP implementation found in PHP.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
{
|
||||
/**
|
||||
* The CharacterStream used for reading characters (as opposed to bytes).
|
||||
*
|
||||
* @var Swift_CharacterStream
|
||||
*/
|
||||
protected $charStream;
|
||||
|
||||
/**
|
||||
* A filter used if input should be canonicalized.
|
||||
*
|
||||
* @var Swift_StreamFilter
|
||||
*/
|
||||
protected $filter;
|
||||
|
||||
/**
|
||||
* Pre-computed QP for HUGE optimization.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $qpMap = [
|
||||
0 => '=00', 1 => '=01', 2 => '=02', 3 => '=03', 4 => '=04',
|
||||
5 => '=05', 6 => '=06', 7 => '=07', 8 => '=08', 9 => '=09',
|
||||
10 => '=0A', 11 => '=0B', 12 => '=0C', 13 => '=0D', 14 => '=0E',
|
||||
15 => '=0F', 16 => '=10', 17 => '=11', 18 => '=12', 19 => '=13',
|
||||
20 => '=14', 21 => '=15', 22 => '=16', 23 => '=17', 24 => '=18',
|
||||
25 => '=19', 26 => '=1A', 27 => '=1B', 28 => '=1C', 29 => '=1D',
|
||||
30 => '=1E', 31 => '=1F', 32 => '=20', 33 => '=21', 34 => '=22',
|
||||
35 => '=23', 36 => '=24', 37 => '=25', 38 => '=26', 39 => '=27',
|
||||
40 => '=28', 41 => '=29', 42 => '=2A', 43 => '=2B', 44 => '=2C',
|
||||
45 => '=2D', 46 => '=2E', 47 => '=2F', 48 => '=30', 49 => '=31',
|
||||
50 => '=32', 51 => '=33', 52 => '=34', 53 => '=35', 54 => '=36',
|
||||
55 => '=37', 56 => '=38', 57 => '=39', 58 => '=3A', 59 => '=3B',
|
||||
60 => '=3C', 61 => '=3D', 62 => '=3E', 63 => '=3F', 64 => '=40',
|
||||
65 => '=41', 66 => '=42', 67 => '=43', 68 => '=44', 69 => '=45',
|
||||
70 => '=46', 71 => '=47', 72 => '=48', 73 => '=49', 74 => '=4A',
|
||||
75 => '=4B', 76 => '=4C', 77 => '=4D', 78 => '=4E', 79 => '=4F',
|
||||
80 => '=50', 81 => '=51', 82 => '=52', 83 => '=53', 84 => '=54',
|
||||
85 => '=55', 86 => '=56', 87 => '=57', 88 => '=58', 89 => '=59',
|
||||
90 => '=5A', 91 => '=5B', 92 => '=5C', 93 => '=5D', 94 => '=5E',
|
||||
95 => '=5F', 96 => '=60', 97 => '=61', 98 => '=62', 99 => '=63',
|
||||
100 => '=64', 101 => '=65', 102 => '=66', 103 => '=67', 104 => '=68',
|
||||
105 => '=69', 106 => '=6A', 107 => '=6B', 108 => '=6C', 109 => '=6D',
|
||||
110 => '=6E', 111 => '=6F', 112 => '=70', 113 => '=71', 114 => '=72',
|
||||
115 => '=73', 116 => '=74', 117 => '=75', 118 => '=76', 119 => '=77',
|
||||
120 => '=78', 121 => '=79', 122 => '=7A', 123 => '=7B', 124 => '=7C',
|
||||
125 => '=7D', 126 => '=7E', 127 => '=7F', 128 => '=80', 129 => '=81',
|
||||
130 => '=82', 131 => '=83', 132 => '=84', 133 => '=85', 134 => '=86',
|
||||
135 => '=87', 136 => '=88', 137 => '=89', 138 => '=8A', 139 => '=8B',
|
||||
140 => '=8C', 141 => '=8D', 142 => '=8E', 143 => '=8F', 144 => '=90',
|
||||
145 => '=91', 146 => '=92', 147 => '=93', 148 => '=94', 149 => '=95',
|
||||
150 => '=96', 151 => '=97', 152 => '=98', 153 => '=99', 154 => '=9A',
|
||||
155 => '=9B', 156 => '=9C', 157 => '=9D', 158 => '=9E', 159 => '=9F',
|
||||
160 => '=A0', 161 => '=A1', 162 => '=A2', 163 => '=A3', 164 => '=A4',
|
||||
165 => '=A5', 166 => '=A6', 167 => '=A7', 168 => '=A8', 169 => '=A9',
|
||||
170 => '=AA', 171 => '=AB', 172 => '=AC', 173 => '=AD', 174 => '=AE',
|
||||
175 => '=AF', 176 => '=B0', 177 => '=B1', 178 => '=B2', 179 => '=B3',
|
||||
180 => '=B4', 181 => '=B5', 182 => '=B6', 183 => '=B7', 184 => '=B8',
|
||||
185 => '=B9', 186 => '=BA', 187 => '=BB', 188 => '=BC', 189 => '=BD',
|
||||
190 => '=BE', 191 => '=BF', 192 => '=C0', 193 => '=C1', 194 => '=C2',
|
||||
195 => '=C3', 196 => '=C4', 197 => '=C5', 198 => '=C6', 199 => '=C7',
|
||||
200 => '=C8', 201 => '=C9', 202 => '=CA', 203 => '=CB', 204 => '=CC',
|
||||
205 => '=CD', 206 => '=CE', 207 => '=CF', 208 => '=D0', 209 => '=D1',
|
||||
210 => '=D2', 211 => '=D3', 212 => '=D4', 213 => '=D5', 214 => '=D6',
|
||||
215 => '=D7', 216 => '=D8', 217 => '=D9', 218 => '=DA', 219 => '=DB',
|
||||
220 => '=DC', 221 => '=DD', 222 => '=DE', 223 => '=DF', 224 => '=E0',
|
||||
225 => '=E1', 226 => '=E2', 227 => '=E3', 228 => '=E4', 229 => '=E5',
|
||||
230 => '=E6', 231 => '=E7', 232 => '=E8', 233 => '=E9', 234 => '=EA',
|
||||
235 => '=EB', 236 => '=EC', 237 => '=ED', 238 => '=EE', 239 => '=EF',
|
||||
240 => '=F0', 241 => '=F1', 242 => '=F2', 243 => '=F3', 244 => '=F4',
|
||||
245 => '=F5', 246 => '=F6', 247 => '=F7', 248 => '=F8', 249 => '=F9',
|
||||
250 => '=FA', 251 => '=FB', 252 => '=FC', 253 => '=FD', 254 => '=FE',
|
||||
255 => '=FF',
|
||||
];
|
||||
|
||||
protected static $safeMapShare = [];
|
||||
|
||||
/**
|
||||
* A map of non-encoded ascii characters.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $safeMap = [];
|
||||
|
||||
/**
|
||||
* Creates a new QpEncoder for the given CharacterStream.
|
||||
*
|
||||
* @param Swift_CharacterStream $charStream to use for reading characters
|
||||
* @param Swift_StreamFilter $filter if input should be canonicalized
|
||||
*/
|
||||
public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null)
|
||||
{
|
||||
$this->charStream = $charStream;
|
||||
if (!isset(self::$safeMapShare[$this->getSafeMapShareId()])) {
|
||||
$this->initSafeMap();
|
||||
self::$safeMapShare[$this->getSafeMapShareId()] = $this->safeMap;
|
||||
} else {
|
||||
$this->safeMap = self::$safeMapShare[$this->getSafeMapShareId()];
|
||||
}
|
||||
$this->filter = $filter;
|
||||
}
|
||||
|
||||
public function __sleep()
|
||||
{
|
||||
return ['charStream', 'filter'];
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
if (!isset(self::$safeMapShare[$this->getSafeMapShareId()])) {
|
||||
$this->initSafeMap();
|
||||
self::$safeMapShare[$this->getSafeMapShareId()] = $this->safeMap;
|
||||
} else {
|
||||
$this->safeMap = self::$safeMapShare[$this->getSafeMapShareId()];
|
||||
}
|
||||
}
|
||||
|
||||
protected function getSafeMapShareId()
|
||||
{
|
||||
return get_class($this);
|
||||
}
|
||||
|
||||
protected function initSafeMap()
|
||||
{
|
||||
foreach (array_merge(
|
||||
[0x09, 0x20], range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) {
|
||||
$this->safeMap[$byte] = chr($byte);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes an unencoded string and produces a QP encoded string from it.
|
||||
*
|
||||
* QP encoded strings have a maximum line length of 76 characters.
|
||||
* If the first line needs to be shorter, indicate the difference with
|
||||
* $firstLineOffset.
|
||||
*
|
||||
* @param string $string to encode
|
||||
* @param int $firstLineOffset optional
|
||||
* @param int $maxLineLength optional 0 indicates the default of 76 chars
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
|
||||
{
|
||||
if ($maxLineLength > 76 || $maxLineLength <= 0) {
|
||||
$maxLineLength = 76;
|
||||
}
|
||||
|
||||
$thisLineLength = $maxLineLength - $firstLineOffset;
|
||||
|
||||
$lines = [];
|
||||
$lNo = 0;
|
||||
$lines[$lNo] = '';
|
||||
$currentLine = &$lines[$lNo++];
|
||||
$size = $lineLen = 0;
|
||||
|
||||
$this->charStream->flushContents();
|
||||
$this->charStream->importString($string);
|
||||
|
||||
// Fetching more than 4 chars at one is slower, as is fetching fewer bytes
|
||||
// Conveniently 4 chars is the UTF-8 safe number since UTF-8 has up to 6
|
||||
// bytes per char and (6 * 4 * 3 = 72 chars per line) * =NN is 3 bytes
|
||||
while (false !== $bytes = $this->nextSequence()) {
|
||||
// If we're filtering the input
|
||||
if (isset($this->filter)) {
|
||||
// If we can't filter because we need more bytes
|
||||
while ($this->filter->shouldBuffer($bytes)) {
|
||||
// Then collect bytes into the buffer
|
||||
if (false === $moreBytes = $this->nextSequence(1)) {
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($moreBytes as $b) {
|
||||
$bytes[] = $b;
|
||||
}
|
||||
}
|
||||
// And filter them
|
||||
$bytes = $this->filter->filter($bytes);
|
||||
}
|
||||
|
||||
$enc = $this->encodeByteSequence($bytes, $size);
|
||||
|
||||
$i = strpos($enc, '=0D=0A');
|
||||
$newLineLength = $lineLen + (false === $i ? $size : $i);
|
||||
|
||||
if ($currentLine && $newLineLength >= $thisLineLength) {
|
||||
$lines[$lNo] = '';
|
||||
$currentLine = &$lines[$lNo++];
|
||||
$thisLineLength = $maxLineLength;
|
||||
$lineLen = 0;
|
||||
}
|
||||
|
||||
$currentLine .= $enc;
|
||||
|
||||
if (false === $i) {
|
||||
$lineLen += $size;
|
||||
} else {
|
||||
// 6 is the length of '=0D=0A'.
|
||||
$lineLen = $size - strrpos($enc, '=0D=0A') - 6;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->standardize(implode("=\r\n", $lines));
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the charset used.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function charsetChanged($charset)
|
||||
{
|
||||
$this->charStream->setCharacterSet($charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the given byte array into a verbatim QP form.
|
||||
*
|
||||
* @param int[] $bytes
|
||||
* @param int $size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function encodeByteSequence(array $bytes, &$size)
|
||||
{
|
||||
$ret = '';
|
||||
$size = 0;
|
||||
foreach ($bytes as $b) {
|
||||
if (isset($this->safeMap[$b])) {
|
||||
$ret .= $this->safeMap[$b];
|
||||
++$size;
|
||||
} else {
|
||||
$ret .= self::$qpMap[$b];
|
||||
$size += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next sequence of bytes to read from the char stream.
|
||||
*
|
||||
* @param int $size number of bytes to read
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
protected function nextSequence($size = 4)
|
||||
{
|
||||
return $this->charStream->readBytes($size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure CRLF is correct and HT/SPACE are in valid places.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function standardize($string)
|
||||
{
|
||||
$string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'],
|
||||
["=09\r\n", "=20\r\n", "\r\n"], $string
|
||||
);
|
||||
switch ($end = ord(substr($string, -1))) {
|
||||
case 0x09:
|
||||
case 0x20:
|
||||
$string = substr_replace($string, self::$qpMap[$end], -1);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a deep copy of object.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->charStream = clone $this->charStream;
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides a mechanism for storing data using two keys.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
interface Swift_KeyCache
|
||||
{
|
||||
/** Mode for replacing existing cached data */
|
||||
const MODE_WRITE = 1;
|
||||
|
||||
/** Mode for appending data to the end of existing cached data */
|
||||
const MODE_APPEND = 2;
|
||||
|
||||
/**
|
||||
* Set a string into the cache under $itemKey for the namespace $nsKey.
|
||||
*
|
||||
* @see MODE_WRITE, MODE_APPEND
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param string $string
|
||||
* @param int $mode
|
||||
*/
|
||||
public function setString($nsKey, $itemKey, $string, $mode);
|
||||
|
||||
/**
|
||||
* Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
|
||||
*
|
||||
* @see MODE_WRITE, MODE_APPEND
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_OutputByteStream $os
|
||||
* @param int $mode
|
||||
*/
|
||||
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode);
|
||||
|
||||
/**
|
||||
* Provides a ByteStream which when written to, writes data to $itemKey.
|
||||
*
|
||||
* NOTE: The stream will always write in append mode.
|
||||
* If the optional third parameter is passed all writes will go through $is.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_InputByteStream $is optional input stream
|
||||
*
|
||||
* @return Swift_InputByteStream
|
||||
*/
|
||||
public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $is = null);
|
||||
|
||||
/**
|
||||
* Get data back out of the cache as a string.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getString($nsKey, $itemKey);
|
||||
|
||||
/**
|
||||
* Get data back out of the cache as a ByteStream.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_InputByteStream $is stream to write the data to
|
||||
*/
|
||||
public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is);
|
||||
|
||||
/**
|
||||
* Check if the given $itemKey exists in the namespace $nsKey.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasKey($nsKey, $itemKey);
|
||||
|
||||
/**
|
||||
* Clear data for $itemKey in the namespace $nsKey if it exists.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*/
|
||||
public function clearKey($nsKey, $itemKey);
|
||||
|
||||
/**
|
||||
* Clear all data in the namespace $nsKey if it exists.
|
||||
*
|
||||
* @param string $nsKey
|
||||
*/
|
||||
public function clearAll($nsKey);
|
||||
}
|
||||
@@ -1,295 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A KeyCache which streams to and from disk.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
{
|
||||
/** Signal to place pointer at start of file */
|
||||
const POSITION_START = 0;
|
||||
|
||||
/** Signal to place pointer at end of file */
|
||||
const POSITION_END = 1;
|
||||
|
||||
/** Signal to leave pointer in whatever position it currently is */
|
||||
const POSITION_CURRENT = 2;
|
||||
|
||||
/**
|
||||
* An InputStream for cloning.
|
||||
*
|
||||
* @var Swift_KeyCache_KeyCacheInputStream
|
||||
*/
|
||||
private $stream;
|
||||
|
||||
/**
|
||||
* A path to write to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* Stored keys.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $keys = [];
|
||||
|
||||
/**
|
||||
* Create a new DiskKeyCache with the given $stream for cloning to make
|
||||
* InputByteStreams, and the given $path to save to.
|
||||
*
|
||||
* @param string $path to save to
|
||||
*/
|
||||
public function __construct(Swift_KeyCache_KeyCacheInputStream $stream, $path)
|
||||
{
|
||||
$this->stream = $stream;
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a string into the cache under $itemKey for the namespace $nsKey.
|
||||
*
|
||||
* @see MODE_WRITE, MODE_APPEND
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param string $string
|
||||
* @param int $mode
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*/
|
||||
public function setString($nsKey, $itemKey, $string, $mode)
|
||||
{
|
||||
$this->prepareCache($nsKey);
|
||||
switch ($mode) {
|
||||
case self::MODE_WRITE:
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
|
||||
break;
|
||||
case self::MODE_APPEND:
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
|
||||
break;
|
||||
default:
|
||||
throw new Swift_SwiftException(
|
||||
'Invalid mode ['.$mode.'] used to set nsKey='.
|
||||
$nsKey.', itemKey='.$itemKey
|
||||
);
|
||||
break;
|
||||
}
|
||||
fwrite($fp, $string);
|
||||
$this->freeHandle($nsKey, $itemKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a ByteStream into the cache under $itemKey for the namespace $nsKey.
|
||||
*
|
||||
* @see MODE_WRITE, MODE_APPEND
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param int $mode
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*/
|
||||
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
|
||||
{
|
||||
$this->prepareCache($nsKey);
|
||||
switch ($mode) {
|
||||
case self::MODE_WRITE:
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
|
||||
break;
|
||||
case self::MODE_APPEND:
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
|
||||
break;
|
||||
default:
|
||||
throw new Swift_SwiftException(
|
||||
'Invalid mode ['.$mode.'] used to set nsKey='.
|
||||
$nsKey.', itemKey='.$itemKey
|
||||
);
|
||||
break;
|
||||
}
|
||||
while (false !== $bytes = $os->read(8192)) {
|
||||
fwrite($fp, $bytes);
|
||||
}
|
||||
$this->freeHandle($nsKey, $itemKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a ByteStream which when written to, writes data to $itemKey.
|
||||
*
|
||||
* NOTE: The stream will always write in append mode.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*
|
||||
* @return Swift_InputByteStream
|
||||
*/
|
||||
public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null)
|
||||
{
|
||||
$is = clone $this->stream;
|
||||
$is->setKeyCache($this);
|
||||
$is->setNsKey($nsKey);
|
||||
$is->setItemKey($itemKey);
|
||||
if (isset($writeThrough)) {
|
||||
$is->setWriteThroughStream($writeThrough);
|
||||
}
|
||||
|
||||
return $is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data back out of the cache as a string.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getString($nsKey, $itemKey)
|
||||
{
|
||||
$this->prepareCache($nsKey);
|
||||
if ($this->hasKey($nsKey, $itemKey)) {
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
|
||||
$str = '';
|
||||
while (!feof($fp) && false !== $bytes = fread($fp, 8192)) {
|
||||
$str .= $bytes;
|
||||
}
|
||||
$this->freeHandle($nsKey, $itemKey);
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data back out of the cache as a ByteStream.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_InputByteStream $is to write the data to
|
||||
*/
|
||||
public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is)
|
||||
{
|
||||
if ($this->hasKey($nsKey, $itemKey)) {
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
|
||||
while (!feof($fp) && false !== $bytes = fread($fp, 8192)) {
|
||||
$is->write($bytes);
|
||||
}
|
||||
$this->freeHandle($nsKey, $itemKey);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given $itemKey exists in the namespace $nsKey.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasKey($nsKey, $itemKey)
|
||||
{
|
||||
return is_file($this->path.'/'.$nsKey.'/'.$itemKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear data for $itemKey in the namespace $nsKey if it exists.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*/
|
||||
public function clearKey($nsKey, $itemKey)
|
||||
{
|
||||
if ($this->hasKey($nsKey, $itemKey)) {
|
||||
$this->freeHandle($nsKey, $itemKey);
|
||||
unlink($this->path.'/'.$nsKey.'/'.$itemKey);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all data in the namespace $nsKey if it exists.
|
||||
*
|
||||
* @param string $nsKey
|
||||
*/
|
||||
public function clearAll($nsKey)
|
||||
{
|
||||
if (array_key_exists($nsKey, $this->keys)) {
|
||||
foreach ($this->keys[$nsKey] as $itemKey => $null) {
|
||||
$this->clearKey($nsKey, $itemKey);
|
||||
}
|
||||
if (is_dir($this->path.'/'.$nsKey)) {
|
||||
rmdir($this->path.'/'.$nsKey);
|
||||
}
|
||||
unset($this->keys[$nsKey]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the namespace of $nsKey if needed.
|
||||
*
|
||||
* @param string $nsKey
|
||||
*/
|
||||
private function prepareCache($nsKey)
|
||||
{
|
||||
$cacheDir = $this->path.'/'.$nsKey;
|
||||
if (!is_dir($cacheDir)) {
|
||||
if (!mkdir($cacheDir)) {
|
||||
throw new Swift_IoException('Failed to create cache directory '.$cacheDir);
|
||||
}
|
||||
$this->keys[$nsKey] = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a file handle on the cache item.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param int $position
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
private function getHandle($nsKey, $itemKey, $position)
|
||||
{
|
||||
if (!isset($this->keys[$nsKey][$itemKey])) {
|
||||
$openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b';
|
||||
$fp = fopen($this->path.'/'.$nsKey.'/'.$itemKey, $openMode);
|
||||
$this->keys[$nsKey][$itemKey] = $fp;
|
||||
}
|
||||
if (self::POSITION_START == $position) {
|
||||
fseek($this->keys[$nsKey][$itemKey], 0, SEEK_SET);
|
||||
} elseif (self::POSITION_END == $position) {
|
||||
fseek($this->keys[$nsKey][$itemKey], 0, SEEK_END);
|
||||
}
|
||||
|
||||
return $this->keys[$nsKey][$itemKey];
|
||||
}
|
||||
|
||||
private function freeHandle($nsKey, $itemKey)
|
||||
{
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_CURRENT);
|
||||
fclose($fp);
|
||||
$this->keys[$nsKey][$itemKey] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
foreach ($this->keys as $nsKey => $null) {
|
||||
$this->clearAll($nsKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Writes data to a KeyCache using a stream.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCacheInputStream
|
||||
{
|
||||
/** The KeyCache being written to */
|
||||
private $keyCache;
|
||||
|
||||
/** The nsKey of the KeyCache being written to */
|
||||
private $nsKey;
|
||||
|
||||
/** The itemKey of the KeyCache being written to */
|
||||
private $itemKey;
|
||||
|
||||
/** A stream to write through on each write() */
|
||||
private $writeThrough = null;
|
||||
|
||||
/**
|
||||
* Set the KeyCache to wrap.
|
||||
*/
|
||||
public function setKeyCache(Swift_KeyCache $keyCache)
|
||||
{
|
||||
$this->keyCache = $keyCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a stream to write through for each write().
|
||||
*/
|
||||
public function setWriteThroughStream(Swift_InputByteStream $is)
|
||||
{
|
||||
$this->writeThrough = $is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes $bytes to the end of the stream.
|
||||
*
|
||||
* @param string $bytes
|
||||
* @param Swift_InputByteStream $is optional
|
||||
*/
|
||||
public function write($bytes, Swift_InputByteStream $is = null)
|
||||
{
|
||||
$this->keyCache->setString(
|
||||
$this->nsKey, $this->itemKey, $bytes, Swift_KeyCache::MODE_APPEND
|
||||
);
|
||||
if (isset($is)) {
|
||||
$is->write($bytes);
|
||||
}
|
||||
if (isset($this->writeThrough)) {
|
||||
$this->writeThrough->write($bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
*/
|
||||
public function bind(Swift_InputByteStream $is)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
*/
|
||||
public function unbind(Swift_InputByteStream $is)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the contents of the stream (empty it) and set the internal pointer
|
||||
* to the beginning.
|
||||
*/
|
||||
public function flushBuffers()
|
||||
{
|
||||
$this->keyCache->clearKey($this->nsKey, $this->itemKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the nsKey which will be written to.
|
||||
*
|
||||
* @param string $nsKey
|
||||
*/
|
||||
public function setNsKey($nsKey)
|
||||
{
|
||||
$this->nsKey = $nsKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the itemKey which will be written to.
|
||||
*
|
||||
* @param string $itemKey
|
||||
*/
|
||||
public function setItemKey($itemKey)
|
||||
{
|
||||
$this->itemKey = $itemKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Any implementation should be cloneable, allowing the clone to access a
|
||||
* separate $nsKey and $itemKey.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->writeThrough = null;
|
||||
}
|
||||
}
|
||||
@@ -1,279 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Message class for building emails.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Message extends Swift_Mime_SimpleMessage
|
||||
{
|
||||
/**
|
||||
* @var Swift_Signers_HeaderSigner[]
|
||||
*/
|
||||
private $headerSigners = [];
|
||||
|
||||
/**
|
||||
* @var Swift_Signers_BodySigner[]
|
||||
*/
|
||||
private $bodySigners = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $savedMessage = [];
|
||||
|
||||
/**
|
||||
* Create a new Message.
|
||||
*
|
||||
* Details may be optionally passed into the constructor.
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string $body
|
||||
* @param string $contentType
|
||||
* @param string $charset
|
||||
*/
|
||||
public function __construct($subject = null, $body = null, $contentType = null, $charset = null)
|
||||
{
|
||||
call_user_func_array(
|
||||
[$this, 'Swift_Mime_SimpleMessage::__construct'],
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->createDependenciesFor('mime.message')
|
||||
);
|
||||
|
||||
if (!isset($charset)) {
|
||||
$charset = Swift_DependencyContainer::getInstance()
|
||||
->lookup('properties.charset');
|
||||
}
|
||||
$this->setSubject($subject);
|
||||
$this->setBody($body);
|
||||
$this->setCharset($charset);
|
||||
if ($contentType) {
|
||||
$this->setContentType($contentType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a MimePart to this Message.
|
||||
*
|
||||
* @param string|Swift_OutputByteStream $body
|
||||
* @param string $contentType
|
||||
* @param string $charset
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addPart($body, $contentType = null, $charset = null)
|
||||
{
|
||||
return $this->attach((new Swift_MimePart($body, $contentType, $charset))->setEncoder($this->getEncoder()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a new signature handler to the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function attachSigner(Swift_Signer $signer)
|
||||
{
|
||||
if ($signer instanceof Swift_Signers_HeaderSigner) {
|
||||
$this->headerSigners[] = $signer;
|
||||
} elseif ($signer instanceof Swift_Signers_BodySigner) {
|
||||
$this->bodySigners[] = $signer;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach a signature handler from a message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function detachSigner(Swift_Signer $signer)
|
||||
{
|
||||
if ($signer instanceof Swift_Signers_HeaderSigner) {
|
||||
foreach ($this->headerSigners as $k => $headerSigner) {
|
||||
if ($headerSigner === $signer) {
|
||||
unset($this->headerSigners[$k]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
} elseif ($signer instanceof Swift_Signers_BodySigner) {
|
||||
foreach ($this->bodySigners as $k => $bodySigner) {
|
||||
if ($bodySigner === $signer) {
|
||||
unset($this->bodySigners[$k]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all signature handlers attached to the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function clearSigners()
|
||||
{
|
||||
$this->headerSigners = [];
|
||||
$this->bodySigners = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this message as a complete string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
if (empty($this->headerSigners) && empty($this->bodySigners)) {
|
||||
return parent::toString();
|
||||
}
|
||||
|
||||
$this->saveMessage();
|
||||
|
||||
$this->doSign();
|
||||
|
||||
$string = parent::toString();
|
||||
|
||||
$this->restoreMessage();
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write this message to a {@link Swift_InputByteStream}.
|
||||
*/
|
||||
public function toByteStream(Swift_InputByteStream $is)
|
||||
{
|
||||
if (empty($this->headerSigners) && empty($this->bodySigners)) {
|
||||
parent::toByteStream($is);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->saveMessage();
|
||||
|
||||
$this->doSign();
|
||||
|
||||
parent::toByteStream($is);
|
||||
|
||||
$this->restoreMessage();
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.message');
|
||||
}
|
||||
|
||||
/**
|
||||
* loops through signers and apply the signatures.
|
||||
*/
|
||||
protected function doSign()
|
||||
{
|
||||
foreach ($this->bodySigners as $signer) {
|
||||
$altered = $signer->getAlteredHeaders();
|
||||
$this->saveHeaders($altered);
|
||||
$signer->signMessage($this);
|
||||
}
|
||||
|
||||
foreach ($this->headerSigners as $signer) {
|
||||
$altered = $signer->getAlteredHeaders();
|
||||
$this->saveHeaders($altered);
|
||||
$signer->reset();
|
||||
|
||||
$signer->setHeaders($this->getHeaders());
|
||||
|
||||
$signer->startBody();
|
||||
$this->bodyToByteStream($signer);
|
||||
$signer->endBody();
|
||||
|
||||
$signer->addSignature($this->getHeaders());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* save the message before any signature is applied.
|
||||
*/
|
||||
protected function saveMessage()
|
||||
{
|
||||
$this->savedMessage = ['headers' => []];
|
||||
$this->savedMessage['body'] = $this->getBody();
|
||||
$this->savedMessage['children'] = $this->getChildren();
|
||||
if (count($this->savedMessage['children']) > 0 && '' != $this->getBody()) {
|
||||
$this->setChildren(array_merge([$this->becomeMimePart()], $this->savedMessage['children']));
|
||||
$this->setBody('');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* save the original headers.
|
||||
*/
|
||||
protected function saveHeaders(array $altered)
|
||||
{
|
||||
foreach ($altered as $head) {
|
||||
$lc = strtolower($head);
|
||||
|
||||
if (!isset($this->savedMessage['headers'][$lc])) {
|
||||
$this->savedMessage['headers'][$lc] = $this->getHeaders()->getAll($head);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove or restore altered headers.
|
||||
*/
|
||||
protected function restoreHeaders()
|
||||
{
|
||||
foreach ($this->savedMessage['headers'] as $name => $savedValue) {
|
||||
$headers = $this->getHeaders()->getAll($name);
|
||||
|
||||
foreach ($headers as $key => $value) {
|
||||
if (!isset($savedValue[$key])) {
|
||||
$this->getHeaders()->remove($name, $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore message body.
|
||||
*/
|
||||
protected function restoreMessage()
|
||||
{
|
||||
$this->setBody($this->savedMessage['body']);
|
||||
$this->setChildren($this->savedMessage['children']);
|
||||
|
||||
$this->restoreHeaders();
|
||||
$this->savedMessage = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone Message Signers.
|
||||
*
|
||||
* @see Swift_Mime_SimpleMimeEntity::__clone()
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
parent::__clone();
|
||||
foreach ($this->bodySigners as $key => $bodySigner) {
|
||||
$this->bodySigners[$key] = clone $bodySigner;
|
||||
}
|
||||
|
||||
foreach ($this->headerSigners as $key => $headerSigner) {
|
||||
$this->headerSigners[$key] = clone $headerSigner;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles Base 64 Transfer Encoding in Swift Mailer.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base64Encoder implements Swift_Mime_ContentEncoder
|
||||
{
|
||||
/**
|
||||
* Encode stream $in to stream $out.
|
||||
*
|
||||
* @param int $firstLineOffset
|
||||
*/
|
||||
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
|
||||
{
|
||||
if (0 >= $maxLineLength || 76 < $maxLineLength) {
|
||||
$maxLineLength = 76;
|
||||
}
|
||||
|
||||
$remainder = 0;
|
||||
$base64ReadBufferRemainderBytes = null;
|
||||
|
||||
// To reduce memory usage, the output buffer is streamed to the input buffer like so:
|
||||
// Output Stream => base64encode => wrap line length => Input Stream
|
||||
// HOWEVER it's important to note that base64_encode() should only be passed whole triplets of data (except for the final chunk of data)
|
||||
// otherwise it will assume the input data has *ended* and it will incorrectly pad/terminate the base64 data mid-stream.
|
||||
// We use $base64ReadBufferRemainderBytes to carry over 1-2 "remainder" bytes from the each chunk from OutputStream and pre-pend those onto the
|
||||
// chunk of bytes read in the next iteration.
|
||||
// When the OutputStream is empty, we must flush any remainder bytes.
|
||||
while (true) {
|
||||
$readBytes = $os->read(8192);
|
||||
$atEOF = (false === $readBytes);
|
||||
|
||||
if ($atEOF) {
|
||||
$streamTheseBytes = $base64ReadBufferRemainderBytes;
|
||||
} else {
|
||||
$streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes;
|
||||
}
|
||||
$base64ReadBufferRemainderBytes = null;
|
||||
$bytesLength = strlen($streamTheseBytes);
|
||||
|
||||
if (0 === $bytesLength) { // no data left to encode
|
||||
break;
|
||||
}
|
||||
|
||||
// if we're not on the last block of the ouput stream, make sure $streamTheseBytes ends with a complete triplet of data
|
||||
// and carry over remainder 1-2 bytes to the next loop iteration
|
||||
if (!$atEOF) {
|
||||
$excessBytes = $bytesLength % 3;
|
||||
if (0 !== $excessBytes) {
|
||||
$base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes);
|
||||
$streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes);
|
||||
}
|
||||
}
|
||||
|
||||
$encoded = base64_encode($streamTheseBytes);
|
||||
$encodedTransformed = '';
|
||||
$thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset;
|
||||
|
||||
while ($thisMaxLineLength < strlen($encoded)) {
|
||||
$encodedTransformed .= substr($encoded, 0, $thisMaxLineLength)."\r\n";
|
||||
$firstLineOffset = 0;
|
||||
$encoded = substr($encoded, $thisMaxLineLength);
|
||||
$thisMaxLineLength = $maxLineLength;
|
||||
$remainder = 0;
|
||||
}
|
||||
|
||||
if (0 < $remainingLength = strlen($encoded)) {
|
||||
$remainder += $remainingLength;
|
||||
$encodedTransformed .= $encoded;
|
||||
$encoded = null;
|
||||
}
|
||||
|
||||
$is->write($encodedTransformed);
|
||||
|
||||
if ($atEOF) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this encoding scheme.
|
||||
* Returns the string 'base64'.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'base64';
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_ContentEncoder
|
||||
{
|
||||
protected $dotEscape;
|
||||
|
||||
/**
|
||||
* Creates a new QpContentEncoder for the given CharacterStream.
|
||||
*
|
||||
* @param Swift_CharacterStream $charStream to use for reading characters
|
||||
* @param Swift_StreamFilter $filter if canonicalization should occur
|
||||
* @param bool $dotEscape if dot stuffing workaround must be enabled
|
||||
*/
|
||||
public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null, $dotEscape = false)
|
||||
{
|
||||
$this->dotEscape = $dotEscape;
|
||||
parent::__construct($charStream, $filter);
|
||||
}
|
||||
|
||||
public function __sleep()
|
||||
{
|
||||
return ['charStream', 'filter', 'dotEscape'];
|
||||
}
|
||||
|
||||
protected function getSafeMapShareId()
|
||||
{
|
||||
return get_class($this).($this->dotEscape ? '.dotEscape' : '');
|
||||
}
|
||||
|
||||
protected function initSafeMap()
|
||||
{
|
||||
parent::initSafeMap();
|
||||
if ($this->dotEscape) {
|
||||
/* Encode . as =2e for buggy remote servers */
|
||||
unset($this->safeMap[0x2e]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode stream $in to stream $out.
|
||||
*
|
||||
* QP encoded strings have a maximum line length of 76 characters.
|
||||
* If the first line needs to be shorter, indicate the difference with
|
||||
* $firstLineOffset.
|
||||
*
|
||||
* @param Swift_OutputByteStream $os output stream
|
||||
* @param Swift_InputByteStream $is input stream
|
||||
* @param int $firstLineOffset
|
||||
* @param int $maxLineLength
|
||||
*/
|
||||
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
|
||||
{
|
||||
if ($maxLineLength > 76 || $maxLineLength <= 0) {
|
||||
$maxLineLength = 76;
|
||||
}
|
||||
|
||||
$thisLineLength = $maxLineLength - $firstLineOffset;
|
||||
|
||||
$this->charStream->flushContents();
|
||||
$this->charStream->importByteStream($os);
|
||||
|
||||
$currentLine = '';
|
||||
$prepend = '';
|
||||
$size = $lineLen = 0;
|
||||
|
||||
while (false !== $bytes = $this->nextSequence()) {
|
||||
// If we're filtering the input
|
||||
if (isset($this->filter)) {
|
||||
// If we can't filter because we need more bytes
|
||||
while ($this->filter->shouldBuffer($bytes)) {
|
||||
// Then collect bytes into the buffer
|
||||
if (false === $moreBytes = $this->nextSequence(1)) {
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($moreBytes as $b) {
|
||||
$bytes[] = $b;
|
||||
}
|
||||
}
|
||||
// And filter them
|
||||
$bytes = $this->filter->filter($bytes);
|
||||
}
|
||||
|
||||
$enc = $this->encodeByteSequence($bytes, $size);
|
||||
|
||||
$i = strpos($enc, '=0D=0A');
|
||||
$newLineLength = $lineLen + (false === $i ? $size : $i);
|
||||
|
||||
if ($currentLine && $newLineLength >= $thisLineLength) {
|
||||
$is->write($prepend.$this->standardize($currentLine));
|
||||
$currentLine = '';
|
||||
$prepend = "=\r\n";
|
||||
$thisLineLength = $maxLineLength;
|
||||
$lineLen = 0;
|
||||
}
|
||||
|
||||
$currentLine .= $enc;
|
||||
|
||||
if (false === $i) {
|
||||
$lineLen += $size;
|
||||
} else {
|
||||
// 6 is the length of '=0D=0A'.
|
||||
$lineLen = $size - strrpos($enc, '=0D=0A') - 6;
|
||||
}
|
||||
}
|
||||
if (strlen($currentLine)) {
|
||||
$is->write($prepend.$this->standardize($currentLine));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this encoding scheme.
|
||||
* Returns the string 'quoted-printable'.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'quoted-printable';
|
||||
}
|
||||
}
|
||||
@@ -1,476 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An abstract base MIME Header.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
|
||||
{
|
||||
const PHRASE_PATTERN = '(?:(?:(?:(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]+(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?)|(?:(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?"((?:(?:[ \t]*(?:\r\n))?[ \t])?(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21\x23-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])))*(?:(?:[ \t]*(?:\r\n))?[ \t])?"(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?))+?)';
|
||||
|
||||
/**
|
||||
* The name of this Header.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* The Encoder used to encode this Header.
|
||||
*
|
||||
* @var Swift_Encoder
|
||||
*/
|
||||
private $encoder;
|
||||
|
||||
/**
|
||||
* The maximum length of a line in the header.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $lineLength = 78;
|
||||
|
||||
/**
|
||||
* The language used in this Header.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $lang;
|
||||
|
||||
/**
|
||||
* The character set of the text in this Header.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $charset = 'utf-8';
|
||||
|
||||
/**
|
||||
* The value of this Header, cached.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cachedValue = null;
|
||||
|
||||
/**
|
||||
* Set the character set used in this Header.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
$this->clearCachedValueIf($charset != $this->charset);
|
||||
$this->charset = $charset;
|
||||
if (isset($this->encoder)) {
|
||||
$this->encoder->charsetChanged($charset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the character set used in this Header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCharset()
|
||||
{
|
||||
return $this->charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the language used in this Header.
|
||||
*
|
||||
* For example, for US English, 'en-us'.
|
||||
* This can be unspecified.
|
||||
*
|
||||
* @param string $lang
|
||||
*/
|
||||
public function setLanguage($lang)
|
||||
{
|
||||
$this->clearCachedValueIf($this->lang != $lang);
|
||||
$this->lang = $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the language used in this Header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLanguage()
|
||||
{
|
||||
return $this->lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the encoder used for encoding the header.
|
||||
*/
|
||||
public function setEncoder(Swift_Mime_HeaderEncoder $encoder)
|
||||
{
|
||||
$this->encoder = $encoder;
|
||||
$this->setCachedValue(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the encoder used for encoding this Header.
|
||||
*
|
||||
* @return Swift_Mime_HeaderEncoder
|
||||
*/
|
||||
public function getEncoder()
|
||||
{
|
||||
return $this->encoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this header (e.g. charset).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFieldName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum length of lines in the header (excluding EOL).
|
||||
*
|
||||
* @param int $lineLength
|
||||
*/
|
||||
public function setMaxLineLength($lineLength)
|
||||
{
|
||||
$this->clearCachedValueIf($this->lineLength != $lineLength);
|
||||
$this->lineLength = $lineLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum permitted length of lines in this Header.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxLineLength()
|
||||
{
|
||||
return $this->lineLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this Header rendered as a RFC 2822 compliant string.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return $this->tokensToString($this->toTokens());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @see toString()
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of this Header field.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
protected function setFieldName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces a compliant, formatted RFC 2822 'phrase' based on the string given.
|
||||
*
|
||||
* @param string $string as displayed
|
||||
* @param string $charset of the text
|
||||
* @param bool $shorten the first line to make remove for header name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function createPhrase(Swift_Mime_Header $header, $string, $charset, Swift_Mime_HeaderEncoder $encoder = null, $shorten = false)
|
||||
{
|
||||
// Treat token as exactly what was given
|
||||
$phraseStr = $string;
|
||||
// If it's not valid
|
||||
|
||||
if (!preg_match('/^'.self::PHRASE_PATTERN.'$/D', $phraseStr)) {
|
||||
// .. but it is just ascii text, try escaping some characters
|
||||
// and make it a quoted-string
|
||||
if (preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $phraseStr)) {
|
||||
$phraseStr = $this->escapeSpecials($phraseStr, ['"']);
|
||||
$phraseStr = '"'.$phraseStr.'"';
|
||||
} else {
|
||||
// ... otherwise it needs encoding
|
||||
// Determine space remaining on line if first line
|
||||
if ($shorten) {
|
||||
$usedLength = strlen($header->getFieldName().': ');
|
||||
} else {
|
||||
$usedLength = 0;
|
||||
}
|
||||
$phraseStr = $this->encodeWords($header, $string, $usedLength);
|
||||
}
|
||||
}
|
||||
|
||||
return $phraseStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape special characters in a string (convert to quoted-pairs).
|
||||
*
|
||||
* @param string $token
|
||||
* @param string[] $include additional chars to escape
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function escapeSpecials($token, $include = [])
|
||||
{
|
||||
foreach (array_merge(['\\'], $include) as $char) {
|
||||
$token = str_replace($char, '\\'.$char, $token);
|
||||
}
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode needed word tokens within a string of input.
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $usedLength optional
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function encodeWords(Swift_Mime_Header $header, $input, $usedLength = -1)
|
||||
{
|
||||
$value = '';
|
||||
|
||||
$tokens = $this->getEncodableWordTokens($input);
|
||||
|
||||
foreach ($tokens as $token) {
|
||||
// See RFC 2822, Sect 2.2 (really 2.2 ??)
|
||||
if ($this->tokenNeedsEncoding($token)) {
|
||||
// Don't encode starting WSP
|
||||
$firstChar = substr($token, 0, 1);
|
||||
switch ($firstChar) {
|
||||
case ' ':
|
||||
case "\t":
|
||||
$value .= $firstChar;
|
||||
$token = substr($token, 1);
|
||||
}
|
||||
|
||||
if (-1 == $usedLength) {
|
||||
$usedLength = strlen($header->getFieldName().': ') + strlen($value);
|
||||
}
|
||||
$value .= $this->getTokenAsEncodedWord($token, $usedLength);
|
||||
|
||||
$header->setMaxLineLength(76); // Forcefully override
|
||||
} else {
|
||||
$value .= $token;
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a token needs to be encoded or not.
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function tokenNeedsEncoding($token)
|
||||
{
|
||||
return preg_match('~[\x00-\x08\x10-\x19\x7F-\xFF\r\n]~', $token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits a string into tokens in blocks of words which can be encoded quickly.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
protected function getEncodableWordTokens($string)
|
||||
{
|
||||
$tokens = [];
|
||||
|
||||
$encodedToken = '';
|
||||
// Split at all whitespace boundaries
|
||||
foreach (preg_split('~(?=[\t ])~', $string) as $token) {
|
||||
if ($this->tokenNeedsEncoding($token)) {
|
||||
$encodedToken .= $token;
|
||||
} else {
|
||||
if (strlen($encodedToken) > 0) {
|
||||
$tokens[] = $encodedToken;
|
||||
$encodedToken = '';
|
||||
}
|
||||
$tokens[] = $token;
|
||||
}
|
||||
}
|
||||
if (strlen($encodedToken)) {
|
||||
$tokens[] = $encodedToken;
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a token as an encoded word for safe insertion into headers.
|
||||
*
|
||||
* @param string $token token to encode
|
||||
* @param int $firstLineOffset optional
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getTokenAsEncodedWord($token, $firstLineOffset = 0)
|
||||
{
|
||||
// Adjust $firstLineOffset to account for space needed for syntax
|
||||
$charsetDecl = $this->charset;
|
||||
if (isset($this->lang)) {
|
||||
$charsetDecl .= '*'.$this->lang;
|
||||
}
|
||||
$encodingWrapperLength = strlen(
|
||||
'=?'.$charsetDecl.'?'.$this->encoder->getName().'??='
|
||||
);
|
||||
|
||||
if ($firstLineOffset >= 75) {
|
||||
//Does this logic need to be here?
|
||||
$firstLineOffset = 0;
|
||||
}
|
||||
|
||||
$encodedTextLines = explode("\r\n",
|
||||
$this->encoder->encodeString(
|
||||
$token, $firstLineOffset, 75 - $encodingWrapperLength, $this->charset
|
||||
)
|
||||
);
|
||||
|
||||
if ('iso-2022-jp' !== strtolower($this->charset)) {
|
||||
// special encoding for iso-2022-jp using mb_encode_mimeheader
|
||||
foreach ($encodedTextLines as $lineNum => $line) {
|
||||
$encodedTextLines[$lineNum] = '=?'.$charsetDecl.
|
||||
'?'.$this->encoder->getName().
|
||||
'?'.$line.'?=';
|
||||
}
|
||||
}
|
||||
|
||||
return implode("\r\n ", $encodedTextLines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates tokens from the given string which include CRLF as individual tokens.
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
protected function generateTokenLines($token)
|
||||
{
|
||||
return preg_split('~(\r\n)~', $token, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value into the cache.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
protected function setCachedValue($value)
|
||||
{
|
||||
$this->cachedValue = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value in the cache.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getCachedValue()
|
||||
{
|
||||
return $this->cachedValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cached value if $condition is met.
|
||||
*
|
||||
* @param bool $condition
|
||||
*/
|
||||
protected function clearCachedValueIf($condition)
|
||||
{
|
||||
if ($condition) {
|
||||
$this->setCachedValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a list of all tokens in the final header.
|
||||
*
|
||||
* @param string $string The string to tokenize
|
||||
*
|
||||
* @return array An array of tokens as strings
|
||||
*/
|
||||
protected function toTokens($string = null)
|
||||
{
|
||||
if (null === $string) {
|
||||
$string = $this->getFieldBody();
|
||||
}
|
||||
|
||||
$tokens = [];
|
||||
|
||||
// Generate atoms; split at all invisible boundaries followed by WSP
|
||||
foreach (preg_split('~(?=[ \t])~', $string) as $token) {
|
||||
$newTokens = $this->generateTokenLines($token);
|
||||
foreach ($newTokens as $newToken) {
|
||||
$tokens[] = $newToken;
|
||||
}
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes an array of tokens which appear in the header and turns them into
|
||||
* an RFC 2822 compliant string, adding FWSP where needed.
|
||||
*
|
||||
* @param string[] $tokens
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function tokensToString(array $tokens)
|
||||
{
|
||||
$lineCount = 0;
|
||||
$headerLines = [];
|
||||
$headerLines[] = $this->name.': ';
|
||||
$currentLine = &$headerLines[$lineCount++];
|
||||
|
||||
// Build all tokens back into compliant header
|
||||
foreach ($tokens as $i => $token) {
|
||||
// Line longer than specified maximum or token was just a new line
|
||||
if (("\r\n" == $token) ||
|
||||
($i > 0 && strlen($currentLine.$token) > $this->lineLength)
|
||||
&& 0 < strlen($currentLine)) {
|
||||
$headerLines[] = '';
|
||||
$currentLine = &$headerLines[$lineCount++];
|
||||
}
|
||||
|
||||
// Append token to the line
|
||||
if ("\r\n" != $token) {
|
||||
$currentLine .= $token;
|
||||
}
|
||||
}
|
||||
|
||||
// Implode with FWS (RFC 2822, 2.2.3)
|
||||
return implode("\r\n", $headerLines)."\r\n";
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Egulias\EmailValidator\EmailValidator;
|
||||
use Egulias\EmailValidator\Validation\RFCValidation;
|
||||
|
||||
/**
|
||||
* An ID MIME Header for something like Message-ID or Content-ID.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_AbstractHeader
|
||||
{
|
||||
/**
|
||||
* The IDs used in the value of this Header.
|
||||
*
|
||||
* This may hold multiple IDs or just a single ID.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $ids = [];
|
||||
|
||||
/**
|
||||
* The strict EmailValidator.
|
||||
*
|
||||
* @var EmailValidator
|
||||
*/
|
||||
private $emailValidator;
|
||||
|
||||
private $addressEncoder;
|
||||
|
||||
/**
|
||||
* Creates a new IdentificationHeader with the given $name and $id.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
|
||||
{
|
||||
$this->setFieldName($name);
|
||||
$this->emailValidator = $emailValidator;
|
||||
$this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of Header that this instance represents.
|
||||
*
|
||||
* @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX
|
||||
* @see TYPE_DATE, TYPE_ID, TYPE_PATH
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getFieldType()
|
||||
{
|
||||
return self::TYPE_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the model for the field body.
|
||||
*
|
||||
* This method takes a string ID, or an array of IDs.
|
||||
*
|
||||
* @param mixed $model
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*/
|
||||
public function setFieldBodyModel($model)
|
||||
{
|
||||
$this->setId($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model for the field body.
|
||||
*
|
||||
* This method returns an array of IDs
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFieldBodyModel()
|
||||
{
|
||||
return $this->getIds();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ID used in the value of this header.
|
||||
*
|
||||
* @param string|array $id
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->setIds(is_array($id) ? $id : [$id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID used in the value of this Header.
|
||||
*
|
||||
* If multiple IDs are set only the first is returned.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
if (count($this->ids) > 0) {
|
||||
return $this->ids[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a collection of IDs to use in the value of this Header.
|
||||
*
|
||||
* @param string[] $ids
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*/
|
||||
public function setIds(array $ids)
|
||||
{
|
||||
$actualIds = [];
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$this->assertValidId($id);
|
||||
$actualIds[] = $id;
|
||||
}
|
||||
|
||||
$this->clearCachedValueIf($this->ids != $actualIds);
|
||||
$this->ids = $actualIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of IDs used in this Header.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getIds()
|
||||
{
|
||||
return $this->ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string value of the body in this Header.
|
||||
*
|
||||
* This is not necessarily RFC 2822 compliant since folding white space will
|
||||
* not be added at this stage (see {@see toString()} for that).
|
||||
*
|
||||
* @see toString()
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFieldBody()
|
||||
{
|
||||
if (!$this->getCachedValue()) {
|
||||
$angleAddrs = [];
|
||||
|
||||
foreach ($this->ids as $id) {
|
||||
$angleAddrs[] = '<'.$this->addressEncoder->encodeString($id).'>';
|
||||
}
|
||||
|
||||
$this->setCachedValue(implode(' ', $angleAddrs));
|
||||
}
|
||||
|
||||
return $this->getCachedValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an Exception if the id passed does not comply with RFC 2822.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*/
|
||||
private function assertValidId($id)
|
||||
{
|
||||
if (!$this->emailValidator->isValid($id, new RFCValidation())) {
|
||||
throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,360 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Egulias\EmailValidator\EmailValidator;
|
||||
use Egulias\EmailValidator\Validation\RFCValidation;
|
||||
|
||||
/**
|
||||
* A Mailbox Address MIME Header for something like From or Sender.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
|
||||
{
|
||||
/**
|
||||
* The mailboxes used in this Header.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $mailboxes = [];
|
||||
|
||||
/**
|
||||
* The strict EmailValidator.
|
||||
*
|
||||
* @var EmailValidator
|
||||
*/
|
||||
private $emailValidator;
|
||||
|
||||
private $addressEncoder;
|
||||
|
||||
/**
|
||||
* Creates a new MailboxHeader with $name.
|
||||
*
|
||||
* @param string $name of Header
|
||||
*/
|
||||
public function __construct($name, Swift_Mime_HeaderEncoder $encoder, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
|
||||
{
|
||||
$this->setFieldName($name);
|
||||
$this->setEncoder($encoder);
|
||||
$this->emailValidator = $emailValidator;
|
||||
$this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of Header that this instance represents.
|
||||
*
|
||||
* @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX
|
||||
* @see TYPE_DATE, TYPE_ID, TYPE_PATH
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getFieldType()
|
||||
{
|
||||
return self::TYPE_MAILBOX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the model for the field body.
|
||||
*
|
||||
* This method takes a string, or an array of addresses.
|
||||
*
|
||||
* @param mixed $model
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*/
|
||||
public function setFieldBodyModel($model)
|
||||
{
|
||||
$this->setNameAddresses($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model for the field body.
|
||||
*
|
||||
* This method returns an associative array like {@link getNameAddresses()}
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFieldBodyModel()
|
||||
{
|
||||
return $this->getNameAddresses();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a list of mailboxes to be shown in this Header.
|
||||
*
|
||||
* The mailboxes can be a simple array of addresses, or an array of
|
||||
* key=>value pairs where (email => personalName).
|
||||
* Example:
|
||||
* <code>
|
||||
* <?php
|
||||
* //Sets two mailboxes in the Header, one with a personal name
|
||||
* $header->setNameAddresses(array(
|
||||
* 'chris@swiftmailer.org' => 'Chris Corbyn',
|
||||
* 'mark@swiftmailer.org' //No associated personal name
|
||||
* ));
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @see __construct()
|
||||
* @see setAddresses()
|
||||
* @see setValue()
|
||||
*
|
||||
* @param string|string[] $mailboxes
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*/
|
||||
public function setNameAddresses($mailboxes)
|
||||
{
|
||||
$this->mailboxes = $this->normalizeMailboxes((array) $mailboxes);
|
||||
$this->setCachedValue(null); //Clear any cached value
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full mailbox list of this Header as an array of valid RFC 2822 strings.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* <?php
|
||||
* $header = new Swift_Mime_Headers_MailboxHeader('From',
|
||||
* array('chris@swiftmailer.org' => 'Chris Corbyn',
|
||||
* 'mark@swiftmailer.org' => 'Mark Corbyn')
|
||||
* );
|
||||
* print_r($header->getNameAddressStrings());
|
||||
* // array (
|
||||
* // 0 => Chris Corbyn <chris@swiftmailer.org>,
|
||||
* // 1 => Mark Corbyn <mark@swiftmailer.org>
|
||||
* // )
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @see getNameAddresses()
|
||||
* @see toString()
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getNameAddressStrings()
|
||||
{
|
||||
return $this->createNameAddressStrings($this->getNameAddresses());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all mailboxes in this Header as key=>value pairs.
|
||||
*
|
||||
* The key is the address and the value is the name (or null if none set).
|
||||
* Example:
|
||||
* <code>
|
||||
* <?php
|
||||
* $header = new Swift_Mime_Headers_MailboxHeader('From',
|
||||
* array('chris@swiftmailer.org' => 'Chris Corbyn',
|
||||
* 'mark@swiftmailer.org' => 'Mark Corbyn')
|
||||
* );
|
||||
* print_r($header->getNameAddresses());
|
||||
* // array (
|
||||
* // chris@swiftmailer.org => Chris Corbyn,
|
||||
* // mark@swiftmailer.org => Mark Corbyn
|
||||
* // )
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @see getAddresses()
|
||||
* @see getNameAddressStrings()
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getNameAddresses()
|
||||
{
|
||||
return $this->mailboxes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes this Header represent a list of plain email addresses with no names.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* <?php
|
||||
* //Sets three email addresses as the Header data
|
||||
* $header->setAddresses(
|
||||
* array('one@domain.tld', 'two@domain.tld', 'three@domain.tld')
|
||||
* );
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @see setNameAddresses()
|
||||
* @see setValue()
|
||||
*
|
||||
* @param string[] $addresses
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*/
|
||||
public function setAddresses($addresses)
|
||||
{
|
||||
$this->setNameAddresses(array_values((array) $addresses));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all email addresses in this Header.
|
||||
*
|
||||
* @see getNameAddresses()
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getAddresses()
|
||||
{
|
||||
return array_keys($this->mailboxes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove one or more addresses from this Header.
|
||||
*
|
||||
* @param string|string[] $addresses
|
||||
*/
|
||||
public function removeAddresses($addresses)
|
||||
{
|
||||
$this->setCachedValue(null);
|
||||
foreach ((array) $addresses as $address) {
|
||||
unset($this->mailboxes[$address]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string value of the body in this Header.
|
||||
*
|
||||
* This is not necessarily RFC 2822 compliant since folding white space will
|
||||
* not be added at this stage (see {@link toString()} for that).
|
||||
*
|
||||
* @see toString()
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFieldBody()
|
||||
{
|
||||
// Compute the string value of the header only if needed
|
||||
if (null === $this->getCachedValue()) {
|
||||
$this->setCachedValue($this->createMailboxListString($this->mailboxes));
|
||||
}
|
||||
|
||||
return $this->getCachedValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes a user-input list of mailboxes into consistent key=>value pairs.
|
||||
*
|
||||
* @param string[] $mailboxes
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
protected function normalizeMailboxes(array $mailboxes)
|
||||
{
|
||||
$actualMailboxes = [];
|
||||
|
||||
foreach ($mailboxes as $key => $value) {
|
||||
if (is_string($key)) {
|
||||
//key is email addr
|
||||
$address = $key;
|
||||
$name = $value;
|
||||
} else {
|
||||
$address = $value;
|
||||
$name = null;
|
||||
}
|
||||
$this->assertValidAddress($address);
|
||||
$actualMailboxes[$address] = $name;
|
||||
}
|
||||
|
||||
return $actualMailboxes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces a compliant, formatted display-name based on the string given.
|
||||
*
|
||||
* @param string $displayName as displayed
|
||||
* @param bool $shorten the first line to make remove for header name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function createDisplayNameString($displayName, $shorten = false)
|
||||
{
|
||||
return $this->createPhrase($this, $displayName, $this->getCharset(), $this->getEncoder(), $shorten);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string form of all the mailboxes in the passed array.
|
||||
*
|
||||
* @param string[] $mailboxes
|
||||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function createMailboxListString(array $mailboxes)
|
||||
{
|
||||
return implode(', ', $this->createNameAddressStrings($mailboxes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Redefine the encoding requirements for mailboxes.
|
||||
*
|
||||
* All "specials" must be encoded as the full header value will not be quoted
|
||||
*
|
||||
* @see RFC 2822 3.2.1
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function tokenNeedsEncoding($token)
|
||||
{
|
||||
return preg_match('/[()<>\[\]:;@\,."]/', $token) || parent::tokenNeedsEncoding($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of strings conforming the the name-addr spec of RFC 2822.
|
||||
*
|
||||
* @param string[] $mailboxes
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
private function createNameAddressStrings(array $mailboxes)
|
||||
{
|
||||
$strings = [];
|
||||
|
||||
foreach ($mailboxes as $email => $name) {
|
||||
$mailboxStr = $this->addressEncoder->encodeString($email);
|
||||
if (null !== $name) {
|
||||
$nameStr = $this->createDisplayNameString($name, empty($strings));
|
||||
$mailboxStr = $nameStr.' <'.$mailboxStr.'>';
|
||||
}
|
||||
$strings[] = $mailboxStr;
|
||||
}
|
||||
|
||||
return $strings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an Exception if the address passed does not comply with RFC 2822.
|
||||
*
|
||||
* @param string $address
|
||||
*
|
||||
* @throws Swift_RfcComplianceException If invalid.
|
||||
*/
|
||||
private function assertValidAddress($address)
|
||||
{
|
||||
if (!$this->emailValidator->isValid($address, new RFCValidation())) {
|
||||
throw new Swift_RfcComplianceException(
|
||||
'Address in mailbox given ['.$address.'] does not comply with RFC 2822, 3.6.2.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,255 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An abstract base MIME Header.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_UnstructuredHeader
|
||||
{
|
||||
/**
|
||||
* RFC 2231's definition of a token.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const TOKEN_REGEX = '(?:[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+)';
|
||||
|
||||
/**
|
||||
* The Encoder used to encode the parameters.
|
||||
*
|
||||
* @var Swift_Encoder
|
||||
*/
|
||||
private $paramEncoder;
|
||||
|
||||
/**
|
||||
* The parameters as an associative array.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $params = [];
|
||||
|
||||
/**
|
||||
* Creates a new ParameterizedHeader with $name.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder = null)
|
||||
{
|
||||
parent::__construct($name, $encoder);
|
||||
$this->paramEncoder = $paramEncoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of Header that this instance represents.
|
||||
*
|
||||
* @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX
|
||||
* @see TYPE_DATE, TYPE_ID, TYPE_PATH
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getFieldType()
|
||||
{
|
||||
return self::TYPE_PARAMETERIZED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the character set used in this Header.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
parent::setCharset($charset);
|
||||
if (isset($this->paramEncoder)) {
|
||||
$this->paramEncoder->charsetChanged($charset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $parameter.
|
||||
*
|
||||
* @param string $parameter
|
||||
* @param string $value
|
||||
*/
|
||||
public function setParameter($parameter, $value)
|
||||
{
|
||||
$this->setParameters(array_merge($this->getParameters(), [$parameter => $value]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of $parameter.
|
||||
*
|
||||
* @param string $parameter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getParameter($parameter)
|
||||
{
|
||||
$params = $this->getParameters();
|
||||
|
||||
return $params[$parameter] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an associative array of parameter names mapped to values.
|
||||
*
|
||||
* @param string[] $parameters
|
||||
*/
|
||||
public function setParameters(array $parameters)
|
||||
{
|
||||
$this->clearCachedValueIf($this->params != $parameters);
|
||||
$this->params = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associative array of parameter names mapped to values.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getParameters()
|
||||
{
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of this header prepared for rendering.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFieldBody() //TODO: Check caching here
|
||||
{
|
||||
$body = parent::getFieldBody();
|
||||
foreach ($this->params as $name => $value) {
|
||||
if (null !== $value) {
|
||||
// Add the parameter
|
||||
$body .= '; '.$this->createParameter($name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a list of all tokens in the final header.
|
||||
*
|
||||
* This doesn't need to be overridden in theory, but it is for implementation
|
||||
* reasons to prevent potential breakage of attributes.
|
||||
*
|
||||
* @param string $string The string to tokenize
|
||||
*
|
||||
* @return array An array of tokens as strings
|
||||
*/
|
||||
protected function toTokens($string = null)
|
||||
{
|
||||
$tokens = parent::toTokens(parent::getFieldBody());
|
||||
|
||||
// Try creating any parameters
|
||||
foreach ($this->params as $name => $value) {
|
||||
if (null !== $value) {
|
||||
// Add the semi-colon separator
|
||||
$tokens[count($tokens) - 1] .= ';';
|
||||
$tokens = array_merge($tokens, $this->generateTokenLines(
|
||||
' '.$this->createParameter($name, $value)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a RFC 2047 compliant header parameter from the $name and $value.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function createParameter($name, $value)
|
||||
{
|
||||
$origValue = $value;
|
||||
|
||||
$encoded = false;
|
||||
// Allow room for parameter name, indices, "=" and DQUOTEs
|
||||
$maxValueLength = $this->getMaxLineLength() - strlen($name.'=*N"";') - 1;
|
||||
$firstLineOffset = 0;
|
||||
|
||||
// If it's not already a valid parameter value...
|
||||
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
|
||||
// TODO: text, or something else??
|
||||
// ... and it's not ascii
|
||||
if (!preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $value)) {
|
||||
$encoded = true;
|
||||
// Allow space for the indices, charset and language
|
||||
$maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*="";') - 1;
|
||||
$firstLineOffset = strlen(
|
||||
$this->getCharset()."'".$this->getLanguage()."'"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Encode if we need to
|
||||
if ($encoded || strlen($value) > $maxValueLength) {
|
||||
if (isset($this->paramEncoder)) {
|
||||
$value = $this->paramEncoder->encodeString(
|
||||
$origValue, $firstLineOffset, $maxValueLength, $this->getCharset()
|
||||
);
|
||||
} else {
|
||||
// We have to go against RFC 2183/2231 in some areas for interoperability
|
||||
$value = $this->getTokenAsEncodedWord($origValue);
|
||||
$encoded = false;
|
||||
}
|
||||
}
|
||||
|
||||
$valueLines = isset($this->paramEncoder) ? explode("\r\n", $value) : [$value];
|
||||
|
||||
// Need to add indices
|
||||
if (count($valueLines) > 1) {
|
||||
$paramLines = [];
|
||||
foreach ($valueLines as $i => $line) {
|
||||
$paramLines[] = $name.'*'.$i.
|
||||
$this->getEndOfParameterValue($line, true, 0 == $i);
|
||||
}
|
||||
|
||||
return implode(";\r\n ", $paramLines);
|
||||
} else {
|
||||
return $name.$this->getEndOfParameterValue(
|
||||
$valueLines[0], $encoded, true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parameter value from the "=" and beyond.
|
||||
*
|
||||
* @param string $value to append
|
||||
* @param bool $encoded
|
||||
* @param bool $firstLine
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getEndOfParameterValue($value, $encoded = false, $firstLine = false)
|
||||
{
|
||||
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
|
||||
$value = '"'.$value.'"';
|
||||
}
|
||||
$prepend = '=';
|
||||
if ($encoded) {
|
||||
$prepend = '*=';
|
||||
if ($firstLine) {
|
||||
$prepend = '*='.$this->getCharset()."'".$this->getLanguage().
|
||||
"'";
|
||||
}
|
||||
}
|
||||
|
||||
return $prepend.$value;
|
||||
}
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A MIME part, in a multipart message.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
||||
{
|
||||
/** The format parameter last specified by the user */
|
||||
protected $userFormat;
|
||||
|
||||
/** The charset last specified by the user */
|
||||
protected $userCharset;
|
||||
|
||||
/** The delsp parameter last specified by the user */
|
||||
protected $userDelSp;
|
||||
|
||||
/** The nesting level of this MimePart */
|
||||
private $nestingLevel = self::LEVEL_ALTERNATIVE;
|
||||
|
||||
/**
|
||||
* Create a new MimePart with $headers, $encoder and $cache.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $charset = null)
|
||||
{
|
||||
parent::__construct($headers, $encoder, $cache, $idGenerator);
|
||||
$this->setContentType('text/plain');
|
||||
if (null !== $charset) {
|
||||
$this->setCharset($charset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the body of this entity, either as a string, or as an instance of
|
||||
* {@link Swift_OutputByteStream}.
|
||||
*
|
||||
* @param mixed $body
|
||||
* @param string $contentType optional
|
||||
* @param string $charset optional
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBody($body, $contentType = null, $charset = null)
|
||||
{
|
||||
if (isset($charset)) {
|
||||
$this->setCharset($charset);
|
||||
}
|
||||
$body = $this->convertString($body);
|
||||
|
||||
parent::setBody($body, $contentType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the character set of this entity.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCharset()
|
||||
{
|
||||
return $this->getHeaderParameter('Content-Type', 'charset');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the character set of this entity.
|
||||
*
|
||||
* @param string $charset
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
$this->setHeaderParameter('Content-Type', 'charset', $charset);
|
||||
if ($charset !== $this->userCharset) {
|
||||
$this->clearCache();
|
||||
}
|
||||
$this->userCharset = $charset;
|
||||
parent::charsetChanged($charset);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the format of this entity (i.e. flowed or fixed).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormat()
|
||||
{
|
||||
return $this->getHeaderParameter('Content-Type', 'format');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the format of this entity (flowed or fixed).
|
||||
*
|
||||
* @param string $format
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFormat($format)
|
||||
{
|
||||
$this->setHeaderParameter('Content-Type', 'format', $format);
|
||||
$this->userFormat = $format;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if delsp is being used for this entity.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getDelSp()
|
||||
{
|
||||
return 'yes' === $this->getHeaderParameter('Content-Type', 'delsp');
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn delsp on or off for this entity.
|
||||
*
|
||||
* @param bool $delsp
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDelSp($delsp = true)
|
||||
{
|
||||
$this->setHeaderParameter('Content-Type', 'delsp', $delsp ? 'yes' : null);
|
||||
$this->userDelSp = $delsp;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the nesting level of this entity.
|
||||
*
|
||||
* @see LEVEL_TOP, LEVEL_ALTERNATIVE, LEVEL_MIXED, LEVEL_RELATED
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNestingLevel()
|
||||
{
|
||||
return $this->nestingLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive notification that the charset has changed on this document, or a
|
||||
* parent document.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function charsetChanged($charset)
|
||||
{
|
||||
$this->setCharset($charset);
|
||||
}
|
||||
|
||||
/** Fix the content-type and encoding of this entity */
|
||||
protected function fixHeaders()
|
||||
{
|
||||
parent::fixHeaders();
|
||||
if (count($this->getChildren())) {
|
||||
$this->setHeaderParameter('Content-Type', 'charset', null);
|
||||
$this->setHeaderParameter('Content-Type', 'format', null);
|
||||
$this->setHeaderParameter('Content-Type', 'delsp', null);
|
||||
} else {
|
||||
$this->setCharset($this->userCharset);
|
||||
$this->setFormat($this->userFormat);
|
||||
$this->setDelSp($this->userDelSp);
|
||||
}
|
||||
}
|
||||
|
||||
/** Set the nesting level of this entity */
|
||||
protected function setNestingLevel($level)
|
||||
{
|
||||
$this->nestingLevel = $level;
|
||||
}
|
||||
|
||||
/** Encode charset when charset is not utf-8 */
|
||||
protected function convertString($string)
|
||||
{
|
||||
$charset = strtolower($this->getCharset());
|
||||
if (!in_array($charset, ['utf-8', 'iso-8859-1', 'iso-8859-15', ''])) {
|
||||
// mb_convert_encoding must be the first one to check, since iconv cannot convert some words.
|
||||
if (function_exists('mb_convert_encoding')) {
|
||||
$string = mb_convert_encoding($string, $charset, 'utf-8');
|
||||
} elseif (function_exists('iconv')) {
|
||||
$string = iconv('utf-8//TRANSLIT//IGNORE', $charset, $string);
|
||||
} else {
|
||||
throw new Swift_SwiftException('No suitable convert encoding function (use UTF-8 as your charset or install the mbstring or iconv extension).');
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Egulias\EmailValidator\EmailValidator;
|
||||
|
||||
/**
|
||||
* Creates MIME headers.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_CharsetObserver
|
||||
{
|
||||
/** The HeaderEncoder used by these headers */
|
||||
private $encoder;
|
||||
|
||||
/** The Encoder used by parameters */
|
||||
private $paramEncoder;
|
||||
|
||||
/** Strict EmailValidator */
|
||||
private $emailValidator;
|
||||
|
||||
/** The charset of created Headers */
|
||||
private $charset;
|
||||
|
||||
/** Swift_AddressEncoder */
|
||||
private $addressEncoder;
|
||||
|
||||
/**
|
||||
* Creates a new SimpleHeaderFactory using $encoder and $paramEncoder.
|
||||
*
|
||||
* @param string|null $charset
|
||||
*/
|
||||
public function __construct(Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder, EmailValidator $emailValidator, $charset = null, Swift_AddressEncoder $addressEncoder = null)
|
||||
{
|
||||
$this->encoder = $encoder;
|
||||
$this->paramEncoder = $paramEncoder;
|
||||
$this->emailValidator = $emailValidator;
|
||||
$this->charset = $charset;
|
||||
$this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Mailbox Header with a list of $addresses.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array|string|null $addresses
|
||||
*
|
||||
* @return Swift_Mime_Header
|
||||
*/
|
||||
public function createMailboxHeader($name, $addresses = null)
|
||||
{
|
||||
$header = new Swift_Mime_Headers_MailboxHeader($name, $this->encoder, $this->emailValidator, $this->addressEncoder);
|
||||
if (isset($addresses)) {
|
||||
$header->setFieldBodyModel($addresses);
|
||||
}
|
||||
$this->setHeaderCharset($header);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Date header using $dateTime.
|
||||
*
|
||||
* @param string $name
|
||||
* @param DateTimeInterface|null $dateTime
|
||||
*
|
||||
* @return Swift_Mime_Header
|
||||
*/
|
||||
public function createDateHeader($name, DateTimeInterface $dateTime = null)
|
||||
{
|
||||
$header = new Swift_Mime_Headers_DateHeader($name);
|
||||
if (isset($dateTime)) {
|
||||
$header->setFieldBodyModel($dateTime);
|
||||
}
|
||||
$this->setHeaderCharset($header);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new basic text header with $name and $value.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @return Swift_Mime_Header
|
||||
*/
|
||||
public function createTextHeader($name, $value = null)
|
||||
{
|
||||
$header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->encoder);
|
||||
if (isset($value)) {
|
||||
$header->setFieldBodyModel($value);
|
||||
}
|
||||
$this->setHeaderCharset($header);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ParameterizedHeader with $name, $value and $params.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param array $params
|
||||
*
|
||||
* @return Swift_Mime_Headers_ParameterizedHeader
|
||||
*/
|
||||
public function createParameterizedHeader($name, $value = null, $params = [])
|
||||
{
|
||||
$header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->encoder, ('content-disposition' == strtolower($name)) ? $this->paramEncoder : null);
|
||||
if (isset($value)) {
|
||||
$header->setFieldBodyModel($value);
|
||||
}
|
||||
foreach ($params as $k => $v) {
|
||||
$header->setParameter($k, $v);
|
||||
}
|
||||
$this->setHeaderCharset($header);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ID header for Message-ID or Content-ID.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string|array $ids
|
||||
*
|
||||
* @return Swift_Mime_Header
|
||||
*/
|
||||
public function createIdHeader($name, $ids = null)
|
||||
{
|
||||
$header = new Swift_Mime_Headers_IdentificationHeader($name, $this->emailValidator);
|
||||
if (isset($ids)) {
|
||||
$header->setFieldBodyModel($ids);
|
||||
}
|
||||
$this->setHeaderCharset($header);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Path header with an address (path) in it.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $path
|
||||
*
|
||||
* @return Swift_Mime_Header
|
||||
*/
|
||||
public function createPathHeader($name, $path = null)
|
||||
{
|
||||
$header = new Swift_Mime_Headers_PathHeader($name, $this->emailValidator);
|
||||
if (isset($path)) {
|
||||
$header->setFieldBodyModel($path);
|
||||
}
|
||||
$this->setHeaderCharset($header);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify this observer that the entity's charset has changed.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function charsetChanged($charset)
|
||||
{
|
||||
$this->charset = $charset;
|
||||
$this->encoder->charsetChanged($charset);
|
||||
$this->paramEncoder->charsetChanged($charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a deep copy of object.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->encoder = clone $this->encoder;
|
||||
$this->paramEncoder = clone $this->paramEncoder;
|
||||
}
|
||||
|
||||
/** Apply the charset to the Header */
|
||||
private function setHeaderCharset(Swift_Mime_Header $header)
|
||||
{
|
||||
if (isset($this->charset)) {
|
||||
$header->setCharset($this->charset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,399 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A collection of MIME headers.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
|
||||
{
|
||||
/** HeaderFactory */
|
||||
private $factory;
|
||||
|
||||
/** Collection of set Headers */
|
||||
private $headers = [];
|
||||
|
||||
/** Field ordering details */
|
||||
private $order = [];
|
||||
|
||||
/** List of fields which are required to be displayed */
|
||||
private $required = [];
|
||||
|
||||
/** The charset used by Headers */
|
||||
private $charset;
|
||||
|
||||
/**
|
||||
* Create a new SimpleHeaderSet with the given $factory.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function __construct(Swift_Mime_SimpleHeaderFactory $factory, $charset = null)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
if (isset($charset)) {
|
||||
$this->setCharset($charset);
|
||||
}
|
||||
}
|
||||
|
||||
public function newInstance()
|
||||
{
|
||||
return new self($this->factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charset used by these headers.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
$this->charset = $charset;
|
||||
$this->factory->charsetChanged($charset);
|
||||
$this->notifyHeadersOfCharset($charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Mailbox Header with a list of $addresses.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array|string $addresses
|
||||
*/
|
||||
public function addMailboxHeader($name, $addresses = null)
|
||||
{
|
||||
$this->storeHeader($name, $this->factory->createMailboxHeader($name, $addresses));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Date header using $dateTime.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function addDateHeader($name, DateTimeInterface $dateTime = null)
|
||||
{
|
||||
$this->storeHeader($name, $this->factory->createDateHeader($name, $dateTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new basic text header with $name and $value.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*/
|
||||
public function addTextHeader($name, $value = null)
|
||||
{
|
||||
$this->storeHeader($name, $this->factory->createTextHeader($name, $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new ParameterizedHeader with $name, $value and $params.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param array $params
|
||||
*/
|
||||
public function addParameterizedHeader($name, $value = null, $params = [])
|
||||
{
|
||||
$this->storeHeader($name, $this->factory->createParameterizedHeader($name, $value, $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new ID header for Message-ID or Content-ID.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string|array $ids
|
||||
*/
|
||||
public function addIdHeader($name, $ids = null)
|
||||
{
|
||||
$this->storeHeader($name, $this->factory->createIdHeader($name, $ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Path header with an address (path) in it.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $path
|
||||
*/
|
||||
public function addPathHeader($name, $path = null)
|
||||
{
|
||||
$this->storeHeader($name, $this->factory->createPathHeader($name, $path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if at least one header with the given $name exists.
|
||||
*
|
||||
* If multiple headers match, the actual one may be specified by $index.
|
||||
*
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has($name, $index = 0)
|
||||
{
|
||||
$lowerName = strtolower($name);
|
||||
|
||||
if (!array_key_exists($lowerName, $this->headers)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (func_num_args() < 2) {
|
||||
// index was not specified, so we only need to check that there is at least one header value set
|
||||
return (bool) count($this->headers[$lowerName]);
|
||||
}
|
||||
|
||||
return array_key_exists($index, $this->headers[$lowerName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a header in the HeaderSet.
|
||||
*
|
||||
* The header may be a previously fetched header via {@link get()} or it may
|
||||
* be one that has been created separately.
|
||||
*
|
||||
* If $index is specified, the header will be inserted into the set at this
|
||||
* offset.
|
||||
*
|
||||
* @param int $index
|
||||
*/
|
||||
public function set(Swift_Mime_Header $header, $index = 0)
|
||||
{
|
||||
$this->storeHeader($header->getFieldName(), $header, $index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header with the given $name.
|
||||
*
|
||||
* If multiple headers match, the actual one may be specified by $index.
|
||||
* Returns NULL if none present.
|
||||
*
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
*
|
||||
* @return Swift_Mime_Header
|
||||
*/
|
||||
public function get($name, $index = 0)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
|
||||
if (func_num_args() < 2) {
|
||||
if ($this->has($name)) {
|
||||
$values = array_values($this->headers[$name]);
|
||||
|
||||
return array_shift($values);
|
||||
}
|
||||
} else {
|
||||
if ($this->has($name, $index)) {
|
||||
return $this->headers[$name][$index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all headers with the given $name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAll($name = null)
|
||||
{
|
||||
if (!isset($name)) {
|
||||
$headers = [];
|
||||
foreach ($this->headers as $collection) {
|
||||
$headers = array_merge($headers, $collection);
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
$lowerName = strtolower($name);
|
||||
if (!array_key_exists($lowerName, $this->headers)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->headers[$lowerName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of all Headers.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listAll()
|
||||
{
|
||||
$headers = $this->headers;
|
||||
if ($this->canSort()) {
|
||||
uksort($headers, [$this, 'sortHeaders']);
|
||||
}
|
||||
|
||||
return array_keys($headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the header with the given $name if it's set.
|
||||
*
|
||||
* If multiple headers match, the actual one may be specified by $index.
|
||||
*
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
*/
|
||||
public function remove($name, $index = 0)
|
||||
{
|
||||
$lowerName = strtolower($name);
|
||||
unset($this->headers[$lowerName][$index]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all headers with the given $name.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function removeAll($name)
|
||||
{
|
||||
$lowerName = strtolower($name);
|
||||
unset($this->headers[$lowerName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a list of Header names as an array in the correct order.
|
||||
*
|
||||
* These Headers will be output in the given order where present.
|
||||
*/
|
||||
public function defineOrdering(array $sequence)
|
||||
{
|
||||
$this->order = array_flip(array_map('strtolower', $sequence));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a list of header names which must always be displayed when set.
|
||||
*
|
||||
* Usually headers without a field value won't be output unless set here.
|
||||
*/
|
||||
public function setAlwaysDisplayed(array $names)
|
||||
{
|
||||
$this->required = array_flip(array_map('strtolower', $names));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify this observer that the entity's charset has changed.
|
||||
*
|
||||
* @param string $charset
|
||||
*/
|
||||
public function charsetChanged($charset)
|
||||
{
|
||||
$this->setCharset($charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with a representation of all headers.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
$string = '';
|
||||
$headers = $this->headers;
|
||||
if ($this->canSort()) {
|
||||
uksort($headers, [$this, 'sortHeaders']);
|
||||
}
|
||||
foreach ($headers as $collection) {
|
||||
foreach ($collection as $header) {
|
||||
if ($this->isDisplayed($header) || '' != $header->getFieldBody()) {
|
||||
$string .= $header->toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @see toString()
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/** Save a Header to the internal collection */
|
||||
private function storeHeader($name, Swift_Mime_Header $header, $offset = null)
|
||||
{
|
||||
if (!isset($this->headers[strtolower($name)])) {
|
||||
$this->headers[strtolower($name)] = [];
|
||||
}
|
||||
if (!isset($offset)) {
|
||||
$this->headers[strtolower($name)][] = $header;
|
||||
} else {
|
||||
$this->headers[strtolower($name)][$offset] = $header;
|
||||
}
|
||||
}
|
||||
|
||||
/** Test if the headers can be sorted */
|
||||
private function canSort()
|
||||
{
|
||||
return count($this->order) > 0;
|
||||
}
|
||||
|
||||
/** uksort() algorithm for Header ordering */
|
||||
private function sortHeaders($a, $b)
|
||||
{
|
||||
$lowerA = strtolower($a);
|
||||
$lowerB = strtolower($b);
|
||||
$aPos = array_key_exists($lowerA, $this->order) ? $this->order[$lowerA] : -1;
|
||||
$bPos = array_key_exists($lowerB, $this->order) ? $this->order[$lowerB] : -1;
|
||||
|
||||
if (-1 === $aPos && -1 === $bPos) {
|
||||
// just be sure to be determinist here
|
||||
return $a > $b ? -1 : 1;
|
||||
}
|
||||
|
||||
if (-1 == $aPos) {
|
||||
return 1;
|
||||
} elseif (-1 == $bPos) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $aPos < $bPos ? -1 : 1;
|
||||
}
|
||||
|
||||
/** Test if the given Header is always displayed */
|
||||
private function isDisplayed(Swift_Mime_Header $header)
|
||||
{
|
||||
return array_key_exists(strtolower($header->getFieldName()), $this->required);
|
||||
}
|
||||
|
||||
/** Notify all Headers of the new charset */
|
||||
private function notifyHeadersOfCharset($charset)
|
||||
{
|
||||
foreach ($this->headers as $headerGroup) {
|
||||
foreach ($headerGroup as $header) {
|
||||
$header->setCharset($charset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a deep copy of object.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->factory = clone $this->factory;
|
||||
foreach ($this->headers as $groupKey => $headerGroup) {
|
||||
foreach ($headerGroup as $key => $header) {
|
||||
$this->headers[$groupKey][$key] = clone $header;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A MIME part, in a multipart message.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_MimePart extends Swift_Mime_MimePart
|
||||
{
|
||||
/**
|
||||
* Create a new MimePart.
|
||||
*
|
||||
* Details may be optionally passed into the constructor.
|
||||
*
|
||||
* @param string $body
|
||||
* @param string $contentType
|
||||
* @param string $charset
|
||||
*/
|
||||
public function __construct($body = null, $contentType = null, $charset = null)
|
||||
{
|
||||
call_user_func_array(
|
||||
[$this, 'Swift_Mime_MimePart::__construct'],
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->createDependenciesFor('mime.part')
|
||||
);
|
||||
|
||||
if (!isset($charset)) {
|
||||
$charset = Swift_DependencyContainer::getInstance()
|
||||
->lookup('properties.charset');
|
||||
}
|
||||
$this->setBody($body);
|
||||
$this->setCharset($charset);
|
||||
if ($contentType) {
|
||||
$this->setContentType($contentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SendmailTransport for sending mail through a Sendmail/Postfix (etc..) binary.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_SendmailTransport extends Swift_Transport_SendmailTransport
|
||||
{
|
||||
/**
|
||||
* Create a new SendmailTransport, optionally using $command for sending.
|
||||
*
|
||||
* @param string $command
|
||||
*/
|
||||
public function __construct($command = '/usr/sbin/sendmail -bs')
|
||||
{
|
||||
call_user_func_array(
|
||||
[$this, 'Swift_Transport_SendmailTransport::__construct'],
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->createDependenciesFor('transport.sendmail')
|
||||
);
|
||||
|
||||
$this->setCommand($command);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sends Messages over SMTP with ESMTP support.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*
|
||||
* @method Swift_SmtpTransport setUsername(string $username) Set the username to authenticate with.
|
||||
* @method string getUsername() Get the username to authenticate with.
|
||||
* @method Swift_SmtpTransport setPassword(string $password) Set the password to authenticate with.
|
||||
* @method string getPassword() Get the password to authenticate with.
|
||||
* @method Swift_SmtpTransport setAuthMode(string $mode) Set the auth mode to use to authenticate.
|
||||
* @method string getAuthMode() Get the auth mode to use to authenticate.
|
||||
*/
|
||||
class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport
|
||||
{
|
||||
/**
|
||||
* @param string $host
|
||||
* @param int $port
|
||||
* @param string $encryption
|
||||
*/
|
||||
public function __construct($host = 'localhost', $port = 25, $encryption = null)
|
||||
{
|
||||
call_user_func_array(
|
||||
[$this, 'Swift_Transport_EsmtpTransport::__construct'],
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->createDependenciesFor('transport.smtp')
|
||||
);
|
||||
|
||||
$this->setHost($host);
|
||||
$this->setPort($port);
|
||||
$this->setEncryption($encryption);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base Exception class.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_SwiftException extends Exception
|
||||
{
|
||||
/**
|
||||
* Create a new SwiftException with $message.
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
*/
|
||||
public function __construct($message, $code = 0, Exception $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
@@ -1,543 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sends Messages over SMTP.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
|
||||
{
|
||||
/** Input-Output buffer for sending/receiving SMTP commands and responses */
|
||||
protected $buffer;
|
||||
|
||||
/** Connection status */
|
||||
protected $started = false;
|
||||
|
||||
/** The domain name to use in HELO command */
|
||||
protected $domain = '[127.0.0.1]';
|
||||
|
||||
/** The event dispatching layer */
|
||||
protected $eventDispatcher;
|
||||
|
||||
protected $addressEncoder;
|
||||
|
||||
/** Whether the PIPELINING SMTP extension is enabled (RFC 2920) */
|
||||
protected $pipelining = null;
|
||||
|
||||
/** The pipelined commands waiting for response */
|
||||
protected $pipeline = [];
|
||||
|
||||
/** Source Ip */
|
||||
protected $sourceIp;
|
||||
|
||||
/** Return an array of params for the Buffer */
|
||||
abstract protected function getBufferParams();
|
||||
|
||||
/**
|
||||
* Creates a new EsmtpTransport using the given I/O buffer.
|
||||
*
|
||||
* @param string $localDomain
|
||||
*/
|
||||
public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null)
|
||||
{
|
||||
$this->buffer = $buf;
|
||||
$this->eventDispatcher = $dispatcher;
|
||||
$this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
|
||||
$this->setLocalDomain($localDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the local domain which Swift will identify itself as.
|
||||
*
|
||||
* This should be a fully-qualified domain name and should be truly the domain
|
||||
* you're using.
|
||||
*
|
||||
* If your server does not have a domain name, use the IP address. This will
|
||||
* automatically be wrapped in square brackets as described in RFC 5321,
|
||||
* section 4.1.3.
|
||||
*
|
||||
* @param string $domain
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLocalDomain($domain)
|
||||
{
|
||||
if ('[' !== substr($domain, 0, 1)) {
|
||||
if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
|
||||
$domain = '['.$domain.']';
|
||||
} elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$domain = '[IPv6:'.$domain.']';
|
||||
}
|
||||
}
|
||||
|
||||
$this->domain = $domain;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the domain Swift will identify as.
|
||||
*
|
||||
* If an IP address was specified, this will be returned wrapped in square
|
||||
* brackets as described in RFC 5321, section 4.1.3.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLocalDomain()
|
||||
{
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the source IP.
|
||||
*
|
||||
* @param string $source
|
||||
*/
|
||||
public function setSourceIp($source)
|
||||
{
|
||||
$this->sourceIp = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IP used to connect to the destination.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSourceIp()
|
||||
{
|
||||
return $this->sourceIp;
|
||||
}
|
||||
|
||||
public function setAddressEncoder(Swift_AddressEncoder $addressEncoder)
|
||||
{
|
||||
$this->addressEncoder = $addressEncoder;
|
||||
}
|
||||
|
||||
public function getAddressEncoder()
|
||||
{
|
||||
return $this->addressEncoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the SMTP connection.
|
||||
*/
|
||||
public function start()
|
||||
{
|
||||
if (!$this->started) {
|
||||
if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStarted');
|
||||
if ($evt->bubbleCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$this->buffer->initialize($this->getBufferParams());
|
||||
} catch (Swift_TransportException $e) {
|
||||
$this->throwException($e);
|
||||
}
|
||||
$this->readGreeting();
|
||||
$this->doHeloCommand();
|
||||
|
||||
if ($evt) {
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'transportStarted');
|
||||
}
|
||||
|
||||
$this->started = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if an SMTP connection has been established.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isStarted()
|
||||
{
|
||||
return $this->started;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given Message.
|
||||
*
|
||||
* Recipient/sender data will be retrieved from the Message API.
|
||||
* The return value is the number of recipients who were accepted for delivery.
|
||||
*
|
||||
* @param string[] $failedRecipients An array of failures by-reference
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
|
||||
{
|
||||
if (!$this->isStarted()) {
|
||||
$this->start();
|
||||
}
|
||||
|
||||
$sent = 0;
|
||||
$failedRecipients = (array) $failedRecipients;
|
||||
|
||||
if ($evt = $this->eventDispatcher->createSendEvent($this, $message)) {
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
|
||||
if ($evt->bubbleCancelled()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$reversePath = $this->getReversePath($message)) {
|
||||
$this->throwException(new Swift_TransportException('Cannot send message without a sender address'));
|
||||
}
|
||||
|
||||
$to = (array) $message->getTo();
|
||||
$cc = (array) $message->getCc();
|
||||
$tos = array_merge($to, $cc);
|
||||
$bcc = (array) $message->getBcc();
|
||||
|
||||
$message->setBcc([]);
|
||||
|
||||
try {
|
||||
$sent += $this->sendTo($message, $reversePath, $tos, $failedRecipients);
|
||||
$sent += $this->sendBcc($message, $reversePath, $bcc, $failedRecipients);
|
||||
} finally {
|
||||
$message->setBcc($bcc);
|
||||
}
|
||||
|
||||
if ($evt) {
|
||||
if ($sent == count($to) + count($cc) + count($bcc)) {
|
||||
$evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);
|
||||
} elseif ($sent > 0) {
|
||||
$evt->setResult(Swift_Events_SendEvent::RESULT_TENTATIVE);
|
||||
} else {
|
||||
$evt->setResult(Swift_Events_SendEvent::RESULT_FAILED);
|
||||
}
|
||||
$evt->setFailedRecipients($failedRecipients);
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'sendPerformed');
|
||||
}
|
||||
|
||||
$message->generateId(); //Make sure a new Message ID is used
|
||||
|
||||
return $sent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the SMTP connection.
|
||||
*/
|
||||
public function stop()
|
||||
{
|
||||
if ($this->started) {
|
||||
if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped');
|
||||
if ($evt->bubbleCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$this->executeCommand("QUIT\r\n", [221]);
|
||||
} catch (Swift_TransportException $e) {
|
||||
}
|
||||
|
||||
try {
|
||||
$this->buffer->terminate();
|
||||
|
||||
if ($evt) {
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'transportStopped');
|
||||
}
|
||||
} catch (Swift_TransportException $e) {
|
||||
$this->throwException($e);
|
||||
}
|
||||
}
|
||||
$this->started = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function ping()
|
||||
{
|
||||
try {
|
||||
if (!$this->isStarted()) {
|
||||
$this->start();
|
||||
}
|
||||
|
||||
$this->executeCommand("NOOP\r\n", [250]);
|
||||
} catch (Swift_TransportException $e) {
|
||||
try {
|
||||
$this->stop();
|
||||
} catch (Swift_TransportException $e) {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a plugin.
|
||||
*/
|
||||
public function registerPlugin(Swift_Events_EventListener $plugin)
|
||||
{
|
||||
$this->eventDispatcher->bindEventListener($plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the current mail transaction.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->executeCommand("RSET\r\n", [250], $failures, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IoBuffer where read/writes are occurring.
|
||||
*
|
||||
* @return Swift_Transport_IoBuffer
|
||||
*/
|
||||
public function getBuffer()
|
||||
{
|
||||
return $this->buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a command against the buffer, expecting the given response codes.
|
||||
*
|
||||
* If no response codes are given, the response will not be validated.
|
||||
* If codes are given, an exception will be thrown on an invalid response.
|
||||
* If the command is RCPT TO, and the pipeline is non-empty, no exception
|
||||
* will be thrown; instead the failing address is added to $failures.
|
||||
*
|
||||
* @param string $command
|
||||
* @param int[] $codes
|
||||
* @param string[] $failures An array of failures by-reference
|
||||
* @param bool $pipeline Do not wait for response
|
||||
* @param string $address The address, if command is RCPT TO.
|
||||
*
|
||||
* @return string|null The server response, or null if pipelining is enabled
|
||||
*/
|
||||
public function executeCommand($command, $codes = [], &$failures = null, $pipeline = false, $address = null)
|
||||
{
|
||||
$failures = (array) $failures;
|
||||
$seq = $this->buffer->write($command);
|
||||
if ($evt = $this->eventDispatcher->createCommandEvent($this, $command, $codes)) {
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'commandSent');
|
||||
}
|
||||
|
||||
$this->pipeline[] = [$command, $seq, $codes, $address];
|
||||
if ($pipeline && $this->pipelining) {
|
||||
$response = null;
|
||||
} else {
|
||||
while ($this->pipeline) {
|
||||
list($command, $seq, $codes, $address) = array_shift($this->pipeline);
|
||||
$response = $this->getFullResponse($seq);
|
||||
try {
|
||||
$this->assertResponseCode($response, $codes);
|
||||
} catch (Swift_TransportException $e) {
|
||||
if ($this->pipeline && $address) {
|
||||
$failures[] = $address;
|
||||
} else {
|
||||
$this->throwException($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/** Read the opening SMTP greeting */
|
||||
protected function readGreeting()
|
||||
{
|
||||
$this->assertResponseCode($this->getFullResponse(0), [220]);
|
||||
}
|
||||
|
||||
/** Send the HELO welcome */
|
||||
protected function doHeloCommand()
|
||||
{
|
||||
$this->executeCommand(
|
||||
sprintf("HELO %s\r\n", $this->domain), [250]
|
||||
);
|
||||
}
|
||||
|
||||
/** Send the MAIL FROM command */
|
||||
protected function doMailFromCommand($address)
|
||||
{
|
||||
$address = $this->addressEncoder->encodeString($address);
|
||||
$this->executeCommand(
|
||||
sprintf("MAIL FROM:<%s>\r\n", $address), [250], $failures, true
|
||||
);
|
||||
}
|
||||
|
||||
/** Send the RCPT TO command */
|
||||
protected function doRcptToCommand($address)
|
||||
{
|
||||
$address = $this->addressEncoder->encodeString($address);
|
||||
$this->executeCommand(
|
||||
sprintf("RCPT TO:<%s>\r\n", $address), [250, 251, 252], $failures, true, $address
|
||||
);
|
||||
}
|
||||
|
||||
/** Send the DATA command */
|
||||
protected function doDataCommand(&$failedRecipients)
|
||||
{
|
||||
$this->executeCommand("DATA\r\n", [354], $failedRecipients);
|
||||
}
|
||||
|
||||
/** Stream the contents of the message over the buffer */
|
||||
protected function streamMessage(Swift_Mime_SimpleMessage $message)
|
||||
{
|
||||
$this->buffer->setWriteTranslations(["\r\n." => "\r\n.."]);
|
||||
try {
|
||||
$message->toByteStream($this->buffer);
|
||||
$this->buffer->flushBuffers();
|
||||
} catch (Swift_TransportException $e) {
|
||||
$this->throwException($e);
|
||||
}
|
||||
$this->buffer->setWriteTranslations([]);
|
||||
$this->executeCommand("\r\n.\r\n", [250]);
|
||||
}
|
||||
|
||||
/** Determine the best-use reverse path for this message */
|
||||
protected function getReversePath(Swift_Mime_SimpleMessage $message)
|
||||
{
|
||||
$return = $message->getReturnPath();
|
||||
$sender = $message->getSender();
|
||||
$from = $message->getFrom();
|
||||
$path = null;
|
||||
if (!empty($return)) {
|
||||
$path = $return;
|
||||
} elseif (!empty($sender)) {
|
||||
// Don't use array_keys
|
||||
reset($sender); // Reset Pointer to first pos
|
||||
$path = key($sender); // Get key
|
||||
} elseif (!empty($from)) {
|
||||
reset($from); // Reset Pointer to first pos
|
||||
$path = key($from); // Get key
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/** Throw a TransportException, first sending it to any listeners */
|
||||
protected function throwException(Swift_TransportException $e)
|
||||
{
|
||||
if ($evt = $this->eventDispatcher->createTransportExceptionEvent($this, $e)) {
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'exceptionThrown');
|
||||
if (!$evt->bubbleCancelled()) {
|
||||
throw $e;
|
||||
}
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/** Throws an Exception if a response code is incorrect */
|
||||
protected function assertResponseCode($response, $wanted)
|
||||
{
|
||||
if (!$response) {
|
||||
$this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got an empty response'));
|
||||
}
|
||||
|
||||
list($code) = sscanf($response, '%3d');
|
||||
$valid = (empty($wanted) || in_array($code, $wanted));
|
||||
|
||||
if ($evt = $this->eventDispatcher->createResponseEvent($this, $response,
|
||||
$valid)) {
|
||||
$this->eventDispatcher->dispatchEvent($evt, 'responseReceived');
|
||||
}
|
||||
|
||||
if (!$valid) {
|
||||
$this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got code "'.$code.'", with message "'.$response.'"', $code));
|
||||
}
|
||||
}
|
||||
|
||||
/** Get an entire multi-line response using its sequence number */
|
||||
protected function getFullResponse($seq)
|
||||
{
|
||||
$response = '';
|
||||
try {
|
||||
do {
|
||||
$line = $this->buffer->readLine($seq);
|
||||
$response .= $line;
|
||||
} while (null !== $line && false !== $line && ' ' != $line[3]);
|
||||
} catch (Swift_TransportException $e) {
|
||||
$this->throwException($e);
|
||||
} catch (Swift_IoException $e) {
|
||||
$this->throwException(new Swift_TransportException($e->getMessage(), 0, $e));
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/** Send an email to the given recipients from the given reverse path */
|
||||
private function doMailTransaction($message, $reversePath, array $recipients, array &$failedRecipients)
|
||||
{
|
||||
$sent = 0;
|
||||
$this->doMailFromCommand($reversePath);
|
||||
foreach ($recipients as $forwardPath) {
|
||||
try {
|
||||
$this->doRcptToCommand($forwardPath);
|
||||
++$sent;
|
||||
} catch (Swift_TransportException $e) {
|
||||
$failedRecipients[] = $forwardPath;
|
||||
} catch (Swift_AddressEncoderException $e) {
|
||||
$failedRecipients[] = $forwardPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != $sent) {
|
||||
$sent += count($failedRecipients);
|
||||
$this->doDataCommand($failedRecipients);
|
||||
$sent -= count($failedRecipients);
|
||||
|
||||
$this->streamMessage($message);
|
||||
} else {
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
return $sent;
|
||||
}
|
||||
|
||||
/** Send a message to the given To: recipients */
|
||||
private function sendTo(Swift_Mime_SimpleMessage $message, $reversePath, array $to, array &$failedRecipients)
|
||||
{
|
||||
if (empty($to)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $this->doMailTransaction($message, $reversePath, array_keys($to),
|
||||
$failedRecipients);
|
||||
}
|
||||
|
||||
/** Send a message to all Bcc: recipients */
|
||||
private function sendBcc(Swift_Mime_SimpleMessage $message, $reversePath, array $bcc, array &$failedRecipients)
|
||||
{
|
||||
$sent = 0;
|
||||
foreach ($bcc as $forwardPath => $name) {
|
||||
$message->setBcc([$forwardPath => $name]);
|
||||
$sent += $this->doMailTransaction(
|
||||
$message, $reversePath, [$forwardPath], $failedRecipients
|
||||
);
|
||||
}
|
||||
|
||||
return $sent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
try {
|
||||
$this->stop();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,268 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An ESMTP handler for AUTH support (RFC 5248).
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
|
||||
{
|
||||
/**
|
||||
* Authenticators available to process the request.
|
||||
*
|
||||
* @var Swift_Transport_Esmtp_Authenticator[]
|
||||
*/
|
||||
private $authenticators = [];
|
||||
|
||||
/**
|
||||
* The username for authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* The password for authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* The auth mode for authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $auth_mode;
|
||||
|
||||
/**
|
||||
* The ESMTP AUTH parameters available.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $esmtpParams = [];
|
||||
|
||||
/**
|
||||
* Create a new AuthHandler with $authenticators for support.
|
||||
*
|
||||
* @param Swift_Transport_Esmtp_Authenticator[] $authenticators
|
||||
*/
|
||||
public function __construct(array $authenticators)
|
||||
{
|
||||
$this->setAuthenticators($authenticators);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Authenticators which can process a login request.
|
||||
*
|
||||
* @param Swift_Transport_Esmtp_Authenticator[] $authenticators
|
||||
*/
|
||||
public function setAuthenticators(array $authenticators)
|
||||
{
|
||||
$this->authenticators = $authenticators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Authenticators which can process a login request.
|
||||
*
|
||||
* @return Swift_Transport_Esmtp_Authenticator[]
|
||||
*/
|
||||
public function getAuthenticators()
|
||||
{
|
||||
return $this->authenticators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the username to authenticate with.
|
||||
*
|
||||
* @param string $username
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the username to authenticate with.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the password to authenticate with.
|
||||
*
|
||||
* @param string $password
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password to authenticate with.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the auth mode to use to authenticate.
|
||||
*
|
||||
* @param string $mode
|
||||
*/
|
||||
public function setAuthMode($mode)
|
||||
{
|
||||
$this->auth_mode = $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the auth mode to use to authenticate.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthMode()
|
||||
{
|
||||
return $this->auth_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the ESMTP extension this handles.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHandledKeyword()
|
||||
{
|
||||
return 'AUTH';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the parameters which the EHLO greeting indicated.
|
||||
*
|
||||
* @param string[] $parameters
|
||||
*/
|
||||
public function setKeywordParams(array $parameters)
|
||||
{
|
||||
$this->esmtpParams = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs immediately after a EHLO has been issued.
|
||||
*
|
||||
* @param Swift_Transport_SmtpAgent $agent to read/write
|
||||
*/
|
||||
public function afterEhlo(Swift_Transport_SmtpAgent $agent)
|
||||
{
|
||||
if ($this->username) {
|
||||
$count = 0;
|
||||
$errors = [];
|
||||
foreach ($this->getAuthenticatorsForAgent() as $authenticator) {
|
||||
if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower', $this->esmtpParams))) {
|
||||
++$count;
|
||||
try {
|
||||
if ($authenticator->authenticate($agent, $this->username, $this->password)) {
|
||||
return;
|
||||
}
|
||||
} catch (Swift_TransportException $e) {
|
||||
// keep the error message, but tries the other authenticators
|
||||
$errors[] = [$authenticator->getAuthKeyword(), $e];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$message = 'Failed to authenticate on SMTP server with username "'.$this->username.'" using '.$count.' possible authenticators.';
|
||||
foreach ($errors as $error) {
|
||||
$message .= ' Authenticator '.$error[0].' returned '.$error[1].'.';
|
||||
}
|
||||
throw new Swift_TransportException($message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
*/
|
||||
public function getMailParams()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
*/
|
||||
public function getRcptParams()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
*/
|
||||
public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns +1, -1 or 0 according to the rules for usort().
|
||||
*
|
||||
* This method is called to ensure extensions can be execute in an appropriate order.
|
||||
*
|
||||
* @param string $esmtpKeyword to compare with
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPriorityOver($esmtpKeyword)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of method names which are exposed to the Esmtp class.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function exposeMixinMethods()
|
||||
{
|
||||
return ['setUsername', 'getUsername', 'setPassword', 'getPassword', 'setAuthMode', 'getAuthMode'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
*/
|
||||
public function resetState()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the authenticator list for the given agent.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAuthenticatorsForAgent()
|
||||
{
|
||||
if (!$mode = strtolower($this->auth_mode)) {
|
||||
return $this->authenticators;
|
||||
}
|
||||
|
||||
foreach ($this->authenticators as $authenticator) {
|
||||
if (strtolower($authenticator->getAuthKeyword()) == $mode) {
|
||||
return [$authenticator];
|
||||
}
|
||||
}
|
||||
|
||||
throw new Swift_TransportException('Auth mode '.$mode.' is invalid');
|
||||
}
|
||||
}
|
||||
@@ -1,446 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sends Messages over SMTP with ESMTP support.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTransport implements Swift_Transport_SmtpAgent
|
||||
{
|
||||
/**
|
||||
* ESMTP extension handlers.
|
||||
*
|
||||
* @var Swift_Transport_EsmtpHandler[]
|
||||
*/
|
||||
private $handlers = [];
|
||||
|
||||
/**
|
||||
* ESMTP capabilities.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $capabilities = [];
|
||||
|
||||
/**
|
||||
* Connection buffer parameters.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $params = [
|
||||
'protocol' => 'tcp',
|
||||
'host' => 'localhost',
|
||||
'port' => 25,
|
||||
'timeout' => 30,
|
||||
'blocking' => 1,
|
||||
'tls' => false,
|
||||
'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
|
||||
'stream_context_options' => [],
|
||||
];
|
||||
|
||||
/**
|
||||
* Creates a new EsmtpTransport using the given I/O buffer.
|
||||
*
|
||||
* @param Swift_Transport_EsmtpHandler[] $extensionHandlers
|
||||
* @param string $localDomain
|
||||
*/
|
||||
public function __construct(Swift_Transport_IoBuffer $buf, array $extensionHandlers, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null)
|
||||
{
|
||||
parent::__construct($buf, $dispatcher, $localDomain, $addressEncoder);
|
||||
$this->setExtensionHandlers($extensionHandlers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the host to connect to.
|
||||
*
|
||||
* Literal IPv6 addresses should be wrapped in square brackets.
|
||||
*
|
||||
* @param string $host
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHost($host)
|
||||
{
|
||||
$this->params['host'] = $host;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host to connect to.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHost()
|
||||
{
|
||||
return $this->params['host'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the port to connect to.
|
||||
*
|
||||
* @param int $port
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPort($port)
|
||||
{
|
||||
$this->params['port'] = (int) $port;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the port to connect to.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPort()
|
||||
{
|
||||
return $this->params['port'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the connection timeout.
|
||||
*
|
||||
* @param int $timeout seconds
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
$this->params['timeout'] = (int) $timeout;
|
||||
$this->buffer->setParam('timeout', (int) $timeout);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection timeout.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
return $this->params['timeout'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the encryption type (tls or ssl).
|
||||
*
|
||||
* @param string $encryption
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setEncryption($encryption)
|
||||
{
|
||||
$encryption = strtolower($encryption);
|
||||
if ('tls' == $encryption) {
|
||||
$this->params['protocol'] = 'tcp';
|
||||
$this->params['tls'] = true;
|
||||
} else {
|
||||
$this->params['protocol'] = $encryption;
|
||||
$this->params['tls'] = false;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the encryption type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEncryption()
|
||||
{
|
||||
return $this->params['tls'] ? 'tls' : $this->params['protocol'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the stream context options.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStreamOptions($options)
|
||||
{
|
||||
$this->params['stream_context_options'] = $options;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stream context options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getStreamOptions()
|
||||
{
|
||||
return $this->params['stream_context_options'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the source IP.
|
||||
*
|
||||
* IPv6 addresses should be wrapped in square brackets.
|
||||
*
|
||||
* @param string $source
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSourceIp($source)
|
||||
{
|
||||
$this->params['sourceIp'] = $source;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IP used to connect to the destination.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSourceIp()
|
||||
{
|
||||
return $this->params['sourceIp'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether SMTP pipelining is enabled.
|
||||
*
|
||||
* By default, support is auto-detected using the PIPELINING SMTP extension.
|
||||
* Use this function to override that in the unlikely event of compatibility
|
||||
* issues.
|
||||
*
|
||||
* @param bool $enabled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPipelining($enabled)
|
||||
{
|
||||
$this->pipelining = $enabled;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether SMTP pipelining is enabled.
|
||||
*
|
||||
* @return bool|null a boolean if pipelining is explicitly enabled or disabled,
|
||||
* or null if support is auto-detected.
|
||||
*/
|
||||
public function getPipelining()
|
||||
{
|
||||
return $this->pipelining;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ESMTP extension handlers.
|
||||
*
|
||||
* @param Swift_Transport_EsmtpHandler[] $handlers
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExtensionHandlers(array $handlers)
|
||||
{
|
||||
$assoc = [];
|
||||
foreach ($handlers as $handler) {
|
||||
$assoc[$handler->getHandledKeyword()] = $handler;
|
||||
}
|
||||
uasort($assoc, function ($a, $b) {
|
||||
return $a->getPriorityOver($b->getHandledKeyword());
|
||||
});
|
||||
$this->handlers = $assoc;
|
||||
$this->setHandlerParams();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ESMTP extension handlers.
|
||||
*
|
||||
* @return Swift_Transport_EsmtpHandler[]
|
||||
*/
|
||||
public function getExtensionHandlers()
|
||||
{
|
||||
return array_values($this->handlers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a command against the buffer, expecting the given response codes.
|
||||
*
|
||||
* If no response codes are given, the response will not be validated.
|
||||
* If codes are given, an exception will be thrown on an invalid response.
|
||||
*
|
||||
* @param string $command
|
||||
* @param int[] $codes
|
||||
* @param string[] $failures An array of failures by-reference
|
||||
* @param bool $pipeline Do not wait for response
|
||||
* @param string $address The address, if command is RCPT TO.
|
||||
*
|
||||
* @return string|null The server response, or null if pipelining is enabled
|
||||
*/
|
||||
public function executeCommand($command, $codes = [], &$failures = null, $pipeline = false, $address = null)
|
||||
{
|
||||
$failures = (array) $failures;
|
||||
$stopSignal = false;
|
||||
$response = null;
|
||||
foreach ($this->getActiveHandlers() as $handler) {
|
||||
$response = $handler->onCommand(
|
||||
$this, $command, $codes, $failures, $stopSignal
|
||||
);
|
||||
if ($stopSignal) {
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::executeCommand($command, $codes, $failures, $pipeline, $address);
|
||||
}
|
||||
|
||||
/** Mixin handling method for ESMTP handlers */
|
||||
public function __call($method, $args)
|
||||
{
|
||||
foreach ($this->handlers as $handler) {
|
||||
if (in_array(strtolower($method),
|
||||
array_map('strtolower', (array) $handler->exposeMixinMethods())
|
||||
)) {
|
||||
$return = call_user_func_array([$handler, $method], $args);
|
||||
// Allow fluid method calls
|
||||
if (null === $return && 'set' == substr($method, 0, 3)) {
|
||||
return $this;
|
||||
} else {
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
}
|
||||
trigger_error('Call to undefined method '.$method, E_USER_ERROR);
|
||||
}
|
||||
|
||||
/** Get the params to initialize the buffer */
|
||||
protected function getBufferParams()
|
||||
{
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
/** Overridden to perform EHLO instead */
|
||||
protected function doHeloCommand()
|
||||
{
|
||||
try {
|
||||
$response = $this->executeCommand(
|
||||
sprintf("EHLO %s\r\n", $this->domain), [250]
|
||||
);
|
||||
} catch (Swift_TransportException $e) {
|
||||
return parent::doHeloCommand();
|
||||
}
|
||||
|
||||
if ($this->params['tls']) {
|
||||
try {
|
||||
$this->executeCommand("STARTTLS\r\n", [220]);
|
||||
|
||||
if (!$this->buffer->startTLS()) {
|
||||
throw new Swift_TransportException('Unable to connect with TLS encryption');
|
||||
}
|
||||
|
||||
try {
|
||||
$response = $this->executeCommand(
|
||||
sprintf("EHLO %s\r\n", $this->domain), [250]
|
||||
);
|
||||
} catch (Swift_TransportException $e) {
|
||||
return parent::doHeloCommand();
|
||||
}
|
||||
} catch (Swift_TransportException $e) {
|
||||
$this->throwException($e);
|
||||
}
|
||||
}
|
||||
|
||||
$this->capabilities = $this->getCapabilities($response);
|
||||
if (!isset($this->pipelining)) {
|
||||
$this->pipelining = isset($this->capabilities['PIPELINING']);
|
||||
}
|
||||
|
||||
$this->setHandlerParams();
|
||||
foreach ($this->getActiveHandlers() as $handler) {
|
||||
$handler->afterEhlo($this);
|
||||
}
|
||||
}
|
||||
|
||||
/** Overridden to add Extension support */
|
||||
protected function doMailFromCommand($address)
|
||||
{
|
||||
$address = $this->addressEncoder->encodeString($address);
|
||||
$handlers = $this->getActiveHandlers();
|
||||
$params = [];
|
||||
foreach ($handlers as $handler) {
|
||||
$params = array_merge($params, (array) $handler->getMailParams());
|
||||
}
|
||||
$paramStr = !empty($params) ? ' '.implode(' ', $params) : '';
|
||||
$this->executeCommand(
|
||||
sprintf("MAIL FROM:<%s>%s\r\n", $address, $paramStr), [250], $failures, true
|
||||
);
|
||||
}
|
||||
|
||||
/** Overridden to add Extension support */
|
||||
protected function doRcptToCommand($address)
|
||||
{
|
||||
$address = $this->addressEncoder->encodeString($address);
|
||||
$handlers = $this->getActiveHandlers();
|
||||
$params = [];
|
||||
foreach ($handlers as $handler) {
|
||||
$params = array_merge($params, (array) $handler->getRcptParams());
|
||||
}
|
||||
$paramStr = !empty($params) ? ' '.implode(' ', $params) : '';
|
||||
$this->executeCommand(
|
||||
sprintf("RCPT TO:<%s>%s\r\n", $address, $paramStr), [250, 251, 252], $failures, true, $address
|
||||
);
|
||||
}
|
||||
|
||||
/** Determine ESMTP capabilities by function group */
|
||||
private function getCapabilities($ehloResponse)
|
||||
{
|
||||
$capabilities = [];
|
||||
$ehloResponse = trim($ehloResponse);
|
||||
$lines = explode("\r\n", $ehloResponse);
|
||||
array_shift($lines);
|
||||
foreach ($lines as $line) {
|
||||
if (preg_match('/^[0-9]{3}[ -]([A-Z0-9-]+)((?:[ =].*)?)$/Di', $line, $matches)) {
|
||||
$keyword = strtoupper($matches[1]);
|
||||
$paramStr = strtoupper(ltrim($matches[2], ' ='));
|
||||
$params = !empty($paramStr) ? explode(' ', $paramStr) : [];
|
||||
$capabilities[$keyword] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
/** Set parameters which are used by each extension handler */
|
||||
private function setHandlerParams()
|
||||
{
|
||||
foreach ($this->handlers as $keyword => $handler) {
|
||||
if (array_key_exists($keyword, $this->capabilities)) {
|
||||
$handler->setKeywordParams($this->capabilities[$keyword]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Get ESMTP handlers which are currently ok to use */
|
||||
private function getActiveHandlers()
|
||||
{
|
||||
$handlers = [];
|
||||
foreach ($this->handlers as $keyword => $handler) {
|
||||
if (array_key_exists($keyword, $this->capabilities)) {
|
||||
$handlers[] = $handler;
|
||||
}
|
||||
}
|
||||
|
||||
return $handlers;
|
||||
}
|
||||
}
|
||||
1276
vendor/symfony/console/Application.php
vendored
1276
vendor/symfony/console/Application.php
vendored
File diff suppressed because it is too large
Load Diff
666
vendor/symfony/console/Command/Command.php
vendored
666
vendor/symfony/console/Command/Command.php
vendored
@@ -1,666 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Base class for all commands.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Command
|
||||
{
|
||||
/**
|
||||
* @var string|null The default command name
|
||||
*/
|
||||
protected static $defaultName;
|
||||
|
||||
private $application;
|
||||
private $name;
|
||||
private $processTitle;
|
||||
private $aliases = [];
|
||||
private $definition;
|
||||
private $hidden = false;
|
||||
private $help = '';
|
||||
private $description = '';
|
||||
private $ignoreValidationErrors = false;
|
||||
private $applicationDefinitionMerged = false;
|
||||
private $applicationDefinitionMergedWithArgs = false;
|
||||
private $code;
|
||||
private $synopsis = [];
|
||||
private $usages = [];
|
||||
private $helperSet;
|
||||
|
||||
/**
|
||||
* @return string|null The default command name or null when no default name is set
|
||||
*/
|
||||
public static function getDefaultName()
|
||||
{
|
||||
$class = static::class;
|
||||
$r = new \ReflectionProperty($class, 'defaultName');
|
||||
|
||||
return $class === $r->class ? static::$defaultName : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $name The name of the command; passing null means it must be set in configure()
|
||||
*
|
||||
* @throws LogicException When the command name is empty
|
||||
*/
|
||||
public function __construct($name = null)
|
||||
{
|
||||
$this->definition = new InputDefinition();
|
||||
|
||||
if (null !== $name || null !== $name = static::getDefaultName()) {
|
||||
$this->setName($name);
|
||||
}
|
||||
|
||||
$this->configure();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignores validation errors.
|
||||
*
|
||||
* This is mainly useful for the help command.
|
||||
*/
|
||||
public function ignoreValidationErrors()
|
||||
{
|
||||
$this->ignoreValidationErrors = true;
|
||||
}
|
||||
|
||||
public function setApplication(Application $application = null)
|
||||
{
|
||||
$this->application = $application;
|
||||
if ($application) {
|
||||
$this->setHelperSet($application->getHelperSet());
|
||||
} else {
|
||||
$this->helperSet = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function setHelperSet(HelperSet $helperSet)
|
||||
{
|
||||
$this->helperSet = $helperSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the helper set.
|
||||
*
|
||||
* @return HelperSet|null A HelperSet instance
|
||||
*/
|
||||
public function getHelperSet()
|
||||
{
|
||||
return $this->helperSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the application instance for this command.
|
||||
*
|
||||
* @return Application|null An Application instance
|
||||
*/
|
||||
public function getApplication()
|
||||
{
|
||||
return $this->application;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the command is enabled or not in the current environment.
|
||||
*
|
||||
* Override this to check for x or y and return false if the command can not
|
||||
* run properly under the current conditions.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the current command.
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the current command.
|
||||
*
|
||||
* This method is not abstract because you can use this class
|
||||
* as a concrete class. In this case, instead of defining the
|
||||
* execute() method, you set the code to execute by passing
|
||||
* a Closure to the setCode() method.
|
||||
*
|
||||
* @return int|null null or 0 if everything went fine, or an error code
|
||||
*
|
||||
* @throws LogicException When this abstract method is not implemented
|
||||
*
|
||||
* @see setCode()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
throw new LogicException('You must override the execute() method in the concrete command class.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Interacts with the user.
|
||||
*
|
||||
* This method is executed before the InputDefinition is validated.
|
||||
* This means that this is the only place where the command can
|
||||
* interactively ask for values of missing required arguments.
|
||||
*/
|
||||
protected function interact(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the command after the input has been bound and before the input
|
||||
* is validated.
|
||||
*
|
||||
* This is mainly useful when a lot of commands extends one main command
|
||||
* where some things need to be initialized based on the input arguments and options.
|
||||
*
|
||||
* @see InputInterface::bind()
|
||||
* @see InputInterface::validate()
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the command.
|
||||
*
|
||||
* The code to execute is either defined directly with the
|
||||
* setCode() method or by overriding the execute() method
|
||||
* in a sub-class.
|
||||
*
|
||||
* @return int The command exit code
|
||||
*
|
||||
* @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
|
||||
*
|
||||
* @see setCode()
|
||||
* @see execute()
|
||||
*/
|
||||
public function run(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
// force the creation of the synopsis before the merge with the app definition
|
||||
$this->getSynopsis(true);
|
||||
$this->getSynopsis(false);
|
||||
|
||||
// add the application arguments and options
|
||||
$this->mergeApplicationDefinition();
|
||||
|
||||
// bind the input against the command specific arguments/options
|
||||
try {
|
||||
$input->bind($this->definition);
|
||||
} catch (ExceptionInterface $e) {
|
||||
if (!$this->ignoreValidationErrors) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$this->initialize($input, $output);
|
||||
|
||||
if (null !== $this->processTitle) {
|
||||
if (\function_exists('cli_set_process_title')) {
|
||||
if (!@cli_set_process_title($this->processTitle)) {
|
||||
if ('Darwin' === \PHP_OS) {
|
||||
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
|
||||
} else {
|
||||
cli_set_process_title($this->processTitle);
|
||||
}
|
||||
}
|
||||
} elseif (\function_exists('setproctitle')) {
|
||||
setproctitle($this->processTitle);
|
||||
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
|
||||
$output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
|
||||
}
|
||||
}
|
||||
|
||||
if ($input->isInteractive()) {
|
||||
$this->interact($input, $output);
|
||||
}
|
||||
|
||||
// The command name argument is often omitted when a command is executed directly with its run() method.
|
||||
// It would fail the validation if we didn't make sure the command argument is present,
|
||||
// since it's required by the application.
|
||||
if ($input->hasArgument('command') && null === $input->getArgument('command')) {
|
||||
$input->setArgument('command', $this->getName());
|
||||
}
|
||||
|
||||
$input->validate();
|
||||
|
||||
if ($this->code) {
|
||||
$statusCode = \call_user_func($this->code, $input, $output);
|
||||
} else {
|
||||
$statusCode = $this->execute($input, $output);
|
||||
}
|
||||
|
||||
return is_numeric($statusCode) ? (int) $statusCode : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the code to execute when running this command.
|
||||
*
|
||||
* If this method is used, it overrides the code defined
|
||||
* in the execute() method.
|
||||
*
|
||||
* @param callable $code A callable(InputInterface $input, OutputInterface $output)
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @see execute()
|
||||
*/
|
||||
public function setCode(callable $code)
|
||||
{
|
||||
if ($code instanceof \Closure) {
|
||||
$r = new \ReflectionFunction($code);
|
||||
if (null === $r->getClosureThis()) {
|
||||
if (\PHP_VERSION_ID < 70000) {
|
||||
// Bug in PHP5: https://bugs.php.net/64761
|
||||
// This means that we cannot bind static closures and therefore we must
|
||||
// ignore any errors here. There is no way to test if the closure is
|
||||
// bindable.
|
||||
$code = @\Closure::bind($code, $this);
|
||||
} else {
|
||||
$code = \Closure::bind($code, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->code = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges the application definition with the command definition.
|
||||
*
|
||||
* This method is not part of public API and should not be used directly.
|
||||
*
|
||||
* @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments
|
||||
*/
|
||||
public function mergeApplicationDefinition($mergeArgs = true)
|
||||
{
|
||||
if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->definition->addOptions($this->application->getDefinition()->getOptions());
|
||||
|
||||
$this->applicationDefinitionMerged = true;
|
||||
|
||||
if ($mergeArgs) {
|
||||
$currentArguments = $this->definition->getArguments();
|
||||
$this->definition->setArguments($this->application->getDefinition()->getArguments());
|
||||
$this->definition->addArguments($currentArguments);
|
||||
|
||||
$this->applicationDefinitionMergedWithArgs = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of argument and option instances.
|
||||
*
|
||||
* @param array|InputDefinition $definition An array of argument and option instances or a definition instance
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDefinition($definition)
|
||||
{
|
||||
if ($definition instanceof InputDefinition) {
|
||||
$this->definition = $definition;
|
||||
} else {
|
||||
$this->definition->setDefinition($definition);
|
||||
}
|
||||
|
||||
$this->applicationDefinitionMerged = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the InputDefinition attached to this Command.
|
||||
*
|
||||
* @return InputDefinition An InputDefinition instance
|
||||
*/
|
||||
public function getDefinition()
|
||||
{
|
||||
if (null === $this->definition) {
|
||||
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
|
||||
}
|
||||
|
||||
return $this->definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the InputDefinition to be used to create representations of this Command.
|
||||
*
|
||||
* Can be overridden to provide the original command representation when it would otherwise
|
||||
* be changed by merging with the application InputDefinition.
|
||||
*
|
||||
* This method is not part of public API and should not be used directly.
|
||||
*
|
||||
* @return InputDefinition An InputDefinition instance
|
||||
*/
|
||||
public function getNativeDefinition()
|
||||
{
|
||||
return $this->getDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an argument.
|
||||
*
|
||||
* @param string $name The argument name
|
||||
* @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
|
||||
* @param string $description A description text
|
||||
* @param string|string[]|null $default The default value (for InputArgument::OPTIONAL mode only)
|
||||
*
|
||||
* @throws InvalidArgumentException When argument mode is not valid
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addArgument($name, $mode = null, $description = '', $default = null)
|
||||
{
|
||||
$this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an option.
|
||||
*
|
||||
* @param string $name The option name
|
||||
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
|
||||
* @param string $description A description text
|
||||
* @param string|string[]|int|bool|null $default The default value (must be null for InputOption::VALUE_NONE)
|
||||
*
|
||||
* @throws InvalidArgumentException If option mode is invalid or incompatible
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
|
||||
{
|
||||
$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of the command.
|
||||
*
|
||||
* This method can set both the namespace and the name if
|
||||
* you separate them by a colon (:)
|
||||
*
|
||||
* $command->setName('foo:bar');
|
||||
*
|
||||
* @param string $name The command name
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException When the name is invalid
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->validateName($name);
|
||||
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the process title of the command.
|
||||
*
|
||||
* This feature should be used only when creating a long process command,
|
||||
* like a daemon.
|
||||
*
|
||||
* @param string $title The process title
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setProcessTitle($title)
|
||||
{
|
||||
$this->processTitle = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the command name.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $hidden Whether or not the command should be hidden from the list of commands
|
||||
*
|
||||
* @return Command The current instance
|
||||
*/
|
||||
public function setHidden($hidden)
|
||||
{
|
||||
$this->hidden = (bool) $hidden;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool whether the command should be publicly shown or not
|
||||
*/
|
||||
public function isHidden()
|
||||
{
|
||||
return $this->hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the description for the command.
|
||||
*
|
||||
* @param string $description The description for the command
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description for the command.
|
||||
*
|
||||
* @return string The description for the command
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the help for the command.
|
||||
*
|
||||
* @param string $help The help for the command
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHelp($help)
|
||||
{
|
||||
$this->help = $help;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the help for the command.
|
||||
*
|
||||
* @return string The help for the command
|
||||
*/
|
||||
public function getHelp()
|
||||
{
|
||||
return $this->help;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the processed help for the command replacing the %command.name% and
|
||||
* %command.full_name% patterns with the real values dynamically.
|
||||
*
|
||||
* @return string The processed help for the command
|
||||
*/
|
||||
public function getProcessedHelp()
|
||||
{
|
||||
$name = $this->name;
|
||||
$isSingleCommand = $this->application && $this->application->isSingleCommand();
|
||||
|
||||
$placeholders = [
|
||||
'%command.name%',
|
||||
'%command.full_name%',
|
||||
];
|
||||
$replacements = [
|
||||
$name,
|
||||
$isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
|
||||
];
|
||||
|
||||
return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the aliases for the command.
|
||||
*
|
||||
* @param string[] $aliases An array of aliases for the command
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException When an alias is invalid
|
||||
*/
|
||||
public function setAliases($aliases)
|
||||
{
|
||||
if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
|
||||
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable.');
|
||||
}
|
||||
|
||||
foreach ($aliases as $alias) {
|
||||
$this->validateName($alias);
|
||||
}
|
||||
|
||||
$this->aliases = $aliases;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the aliases for the command.
|
||||
*
|
||||
* @return array An array of aliases for the command
|
||||
*/
|
||||
public function getAliases()
|
||||
{
|
||||
return $this->aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the synopsis for the command.
|
||||
*
|
||||
* @param bool $short Whether to show the short version of the synopsis (with options folded) or not
|
||||
*
|
||||
* @return string The synopsis
|
||||
*/
|
||||
public function getSynopsis($short = false)
|
||||
{
|
||||
$key = $short ? 'short' : 'long';
|
||||
|
||||
if (!isset($this->synopsis[$key])) {
|
||||
$this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
|
||||
}
|
||||
|
||||
return $this->synopsis[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a command usage example.
|
||||
*
|
||||
* @param string $usage The usage, it'll be prefixed with the command name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addUsage($usage)
|
||||
{
|
||||
if (0 !== strpos($usage, $this->name)) {
|
||||
$usage = sprintf('%s %s', $this->name, $usage);
|
||||
}
|
||||
|
||||
$this->usages[] = $usage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns alternative usages of the command.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUsages()
|
||||
{
|
||||
return $this->usages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a helper instance by name.
|
||||
*
|
||||
* @param string $name The helper name
|
||||
*
|
||||
* @return mixed The helper value
|
||||
*
|
||||
* @throws LogicException if no HelperSet is defined
|
||||
* @throws InvalidArgumentException if the helper is not defined
|
||||
*/
|
||||
public function getHelper($name)
|
||||
{
|
||||
if (null === $this->helperSet) {
|
||||
throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
|
||||
}
|
||||
|
||||
return $this->helperSet->get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a command name.
|
||||
*
|
||||
* It must be non-empty and parts can optionally be separated by ":".
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @throws InvalidArgumentException When the name is invalid
|
||||
*/
|
||||
private function validateName($name)
|
||||
{
|
||||
if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
|
||||
throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
/**
|
||||
* HelperInterface is the interface all helpers must implement.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface HelperInterface
|
||||
{
|
||||
/**
|
||||
* Sets the helper set associated with this helper.
|
||||
*/
|
||||
public function setHelperSet(HelperSet $helperSet = null);
|
||||
|
||||
/**
|
||||
* Gets the helper set associated with this helper.
|
||||
*
|
||||
* @return HelperSet A HelperSet instance
|
||||
*/
|
||||
public function getHelperSet();
|
||||
|
||||
/**
|
||||
* Returns the canonical name of this helper.
|
||||
*
|
||||
* @return string The canonical name
|
||||
*/
|
||||
public function getName();
|
||||
}
|
||||
145
vendor/symfony/console/Helper/ProcessHelper.php
vendored
145
vendor/symfony/console/Helper/ProcessHelper.php
vendored
@@ -1,145 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
/**
|
||||
* The ProcessHelper class provides helpers to run external processes.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class ProcessHelper extends Helper
|
||||
{
|
||||
/**
|
||||
* Runs an external process.
|
||||
*
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
* @param string|array|Process $cmd An instance of Process or an array of arguments to escape and run or a command to run
|
||||
* @param string|null $error An error message that must be displayed if something went wrong
|
||||
* @param callable|null $callback A PHP callback to run whenever there is some
|
||||
* output available on STDOUT or STDERR
|
||||
* @param int $verbosity The threshold for verbosity
|
||||
*
|
||||
* @return Process The process that ran
|
||||
*/
|
||||
public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
|
||||
{
|
||||
if (!class_exists(Process::class)) {
|
||||
throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
|
||||
}
|
||||
|
||||
if ($output instanceof ConsoleOutputInterface) {
|
||||
$output = $output->getErrorOutput();
|
||||
}
|
||||
|
||||
$formatter = $this->getHelperSet()->get('debug_formatter');
|
||||
|
||||
if ($cmd instanceof Process) {
|
||||
$process = $cmd;
|
||||
} else {
|
||||
$process = new Process($cmd);
|
||||
}
|
||||
|
||||
if ($verbosity <= $output->getVerbosity()) {
|
||||
$output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
|
||||
}
|
||||
|
||||
if ($output->isDebug()) {
|
||||
$callback = $this->wrapCallback($output, $process, $callback);
|
||||
}
|
||||
|
||||
$process->run($callback);
|
||||
|
||||
if ($verbosity <= $output->getVerbosity()) {
|
||||
$message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
|
||||
$output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
|
||||
}
|
||||
|
||||
if (!$process->isSuccessful() && null !== $error) {
|
||||
$output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
|
||||
}
|
||||
|
||||
return $process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the process.
|
||||
*
|
||||
* This is identical to run() except that an exception is thrown if the process
|
||||
* exits with a non-zero exit code.
|
||||
*
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
* @param string|Process $cmd An instance of Process or a command to run
|
||||
* @param string|null $error An error message that must be displayed if something went wrong
|
||||
* @param callable|null $callback A PHP callback to run whenever there is some
|
||||
* output available on STDOUT or STDERR
|
||||
*
|
||||
* @return Process The process that ran
|
||||
*
|
||||
* @throws ProcessFailedException
|
||||
*
|
||||
* @see run()
|
||||
*/
|
||||
public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null)
|
||||
{
|
||||
$process = $this->run($output, $cmd, $error, $callback);
|
||||
|
||||
if (!$process->isSuccessful()) {
|
||||
throw new ProcessFailedException($process);
|
||||
}
|
||||
|
||||
return $process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a Process callback to add debugging output.
|
||||
*
|
||||
* @param OutputInterface $output An OutputInterface interface
|
||||
* @param Process $process The Process
|
||||
* @param callable|null $callback A PHP callable
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null)
|
||||
{
|
||||
if ($output instanceof ConsoleOutputInterface) {
|
||||
$output = $output->getErrorOutput();
|
||||
}
|
||||
|
||||
$formatter = $this->getHelperSet()->get('debug_formatter');
|
||||
|
||||
return function ($type, $buffer) use ($output, $process, $callback, $formatter) {
|
||||
$output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));
|
||||
|
||||
if (null !== $callback) {
|
||||
\call_user_func($callback, $type, $buffer);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private function escapeString($str)
|
||||
{
|
||||
return str_replace('<', '\\<', $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'process';
|
||||
}
|
||||
}
|
||||
208
vendor/symfony/console/Input/ArrayInput.php
vendored
208
vendor/symfony/console/Input/ArrayInput.php
vendored
@@ -1,208 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Console\Input;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\InvalidOptionException;
|
||||
|
||||
/**
|
||||
* ArrayInput represents an input provided as an array.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* $input = new ArrayInput(['command' => 'foo:bar', 'foo' => 'bar', '--bar' => 'foobar']);
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class ArrayInput extends Input
|
||||
{
|
||||
private $parameters;
|
||||
|
||||
public function __construct(array $parameters, InputDefinition $definition = null)
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
|
||||
parent::__construct($definition);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFirstArgument()
|
||||
{
|
||||
foreach ($this->parameters as $param => $value) {
|
||||
if ($param && \is_string($param) && '-' === $param[0]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasParameterOption($values, $onlyParams = false)
|
||||
{
|
||||
$values = (array) $values;
|
||||
|
||||
foreach ($this->parameters as $k => $v) {
|
||||
if (!\is_int($k)) {
|
||||
$v = $k;
|
||||
}
|
||||
|
||||
if ($onlyParams && '--' === $v) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (\in_array($v, $values)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParameterOption($values, $default = false, $onlyParams = false)
|
||||
{
|
||||
$values = (array) $values;
|
||||
|
||||
foreach ($this->parameters as $k => $v) {
|
||||
if ($onlyParams && ('--' === $k || (\is_int($k) && '--' === $v))) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
if (\is_int($k)) {
|
||||
if (\in_array($v, $values)) {
|
||||
return true;
|
||||
}
|
||||
} elseif (\in_array($k, $values)) {
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stringified representation of the args passed to the command.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$params = [];
|
||||
foreach ($this->parameters as $param => $val) {
|
||||
if ($param && \is_string($param) && '-' === $param[0]) {
|
||||
if (\is_array($val)) {
|
||||
foreach ($val as $v) {
|
||||
$params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
|
||||
}
|
||||
} else {
|
||||
$params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
|
||||
}
|
||||
} else {
|
||||
$params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val);
|
||||
}
|
||||
}
|
||||
|
||||
return implode(' ', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function parse()
|
||||
{
|
||||
foreach ($this->parameters as $key => $value) {
|
||||
if ('--' === $key) {
|
||||
return;
|
||||
}
|
||||
if (0 === strpos($key, '--')) {
|
||||
$this->addLongOption(substr($key, 2), $value);
|
||||
} elseif (0 === strpos($key, '-')) {
|
||||
$this->addShortOption(substr($key, 1), $value);
|
||||
} else {
|
||||
$this->addArgument($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a short option value.
|
||||
*
|
||||
* @param string $shortcut The short option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws InvalidOptionException When option given doesn't exist
|
||||
*/
|
||||
private function addShortOption($shortcut, $value)
|
||||
{
|
||||
if (!$this->definition->hasShortcut($shortcut)) {
|
||||
throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
|
||||
}
|
||||
|
||||
$this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a long option value.
|
||||
*
|
||||
* @param string $name The long option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws InvalidOptionException When option given doesn't exist
|
||||
* @throws InvalidOptionException When a required value is missing
|
||||
*/
|
||||
private function addLongOption($name, $value)
|
||||
{
|
||||
if (!$this->definition->hasOption($name)) {
|
||||
throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
|
||||
}
|
||||
|
||||
$option = $this->definition->getOption($name);
|
||||
|
||||
if (null === $value) {
|
||||
if ($option->isValueRequired()) {
|
||||
throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
|
||||
}
|
||||
|
||||
if (!$option->isValueOptional()) {
|
||||
$value = true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->options[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an argument value.
|
||||
*
|
||||
* @param string $name The argument name
|
||||
* @param mixed $value The value for the argument
|
||||
*
|
||||
* @throws InvalidArgumentException When argument given doesn't exist
|
||||
*/
|
||||
private function addArgument($name, $value)
|
||||
{
|
||||
if (!$this->definition->hasArgument($name)) {
|
||||
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
||||
}
|
||||
|
||||
$this->arguments[$name] = $value;
|
||||
}
|
||||
}
|
||||
203
vendor/symfony/console/Input/Input.php
vendored
203
vendor/symfony/console/Input/Input.php
vendored
@@ -1,203 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Console\Input;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
|
||||
/**
|
||||
* Input is the base class for all concrete Input classes.
|
||||
*
|
||||
* Three concrete classes are provided by default:
|
||||
*
|
||||
* * `ArgvInput`: The input comes from the CLI arguments (argv)
|
||||
* * `StringInput`: The input is provided as a string
|
||||
* * `ArrayInput`: The input is provided as an array
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
abstract class Input implements InputInterface, StreamableInputInterface
|
||||
{
|
||||
protected $definition;
|
||||
protected $stream;
|
||||
protected $options = [];
|
||||
protected $arguments = [];
|
||||
protected $interactive = true;
|
||||
|
||||
public function __construct(InputDefinition $definition = null)
|
||||
{
|
||||
if (null === $definition) {
|
||||
$this->definition = new InputDefinition();
|
||||
} else {
|
||||
$this->bind($definition);
|
||||
$this->validate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bind(InputDefinition $definition)
|
||||
{
|
||||
$this->arguments = [];
|
||||
$this->options = [];
|
||||
$this->definition = $definition;
|
||||
|
||||
$this->parse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes command line arguments.
|
||||
*/
|
||||
abstract protected function parse();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
$definition = $this->definition;
|
||||
$givenArguments = $this->arguments;
|
||||
|
||||
$missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
|
||||
return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
|
||||
});
|
||||
|
||||
if (\count($missingArguments) > 0) {
|
||||
throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isInteractive()
|
||||
{
|
||||
return $this->interactive;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setInteractive($interactive)
|
||||
{
|
||||
$this->interactive = (bool) $interactive;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getArguments()
|
||||
{
|
||||
return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getArgument($name)
|
||||
{
|
||||
if (!$this->definition->hasArgument($name)) {
|
||||
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
||||
}
|
||||
|
||||
return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setArgument($name, $value)
|
||||
{
|
||||
if (!$this->definition->hasArgument($name)) {
|
||||
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
||||
}
|
||||
|
||||
$this->arguments[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasArgument($name)
|
||||
{
|
||||
return $this->definition->hasArgument($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return array_merge($this->definition->getOptionDefaults(), $this->options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOption($name)
|
||||
{
|
||||
if (!$this->definition->hasOption($name)) {
|
||||
throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
|
||||
}
|
||||
|
||||
return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
if (!$this->definition->hasOption($name)) {
|
||||
throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
|
||||
}
|
||||
|
||||
$this->options[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasOption($name)
|
||||
{
|
||||
return $this->definition->hasOption($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a token through escapeshellarg if it contains unsafe chars.
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function escapeToken($token)
|
||||
{
|
||||
return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setStream($stream)
|
||||
{
|
||||
$this->stream = $stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStream()
|
||||
{
|
||||
return $this->stream;
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Debug\Exception;
|
||||
|
||||
/**
|
||||
* Fatal Error Exception.
|
||||
*
|
||||
* @author Konstanton Myakshin <koc-dp@yandex.ru>
|
||||
*/
|
||||
class FatalErrorException extends \ErrorException
|
||||
{
|
||||
public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
|
||||
|
||||
if (null !== $trace) {
|
||||
if (!$traceArgs) {
|
||||
foreach ($trace as &$frame) {
|
||||
unset($frame['args'], $frame['this'], $frame);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setTrace($trace);
|
||||
} elseif (null !== $traceOffset) {
|
||||
if (\function_exists('xdebug_get_function_stack')) {
|
||||
$trace = xdebug_get_function_stack();
|
||||
if (0 < $traceOffset) {
|
||||
array_splice($trace, -$traceOffset);
|
||||
}
|
||||
|
||||
foreach ($trace as &$frame) {
|
||||
if (!isset($frame['type'])) {
|
||||
// XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695
|
||||
if (isset($frame['class'])) {
|
||||
$frame['type'] = '::';
|
||||
}
|
||||
} elseif ('dynamic' === $frame['type']) {
|
||||
$frame['type'] = '->';
|
||||
} elseif ('static' === $frame['type']) {
|
||||
$frame['type'] = '::';
|
||||
}
|
||||
|
||||
// XDebug also has a different name for the parameters array
|
||||
if (!$traceArgs) {
|
||||
unset($frame['params'], $frame['args']);
|
||||
} elseif (isset($frame['params']) && !isset($frame['args'])) {
|
||||
$frame['args'] = $frame['params'];
|
||||
unset($frame['params']);
|
||||
}
|
||||
}
|
||||
|
||||
unset($frame);
|
||||
$trace = array_reverse($trace);
|
||||
} elseif (\function_exists('symfony_debug_backtrace')) {
|
||||
$trace = symfony_debug_backtrace();
|
||||
if (0 < $traceOffset) {
|
||||
array_splice($trace, 0, $traceOffset);
|
||||
}
|
||||
} else {
|
||||
$trace = array();
|
||||
}
|
||||
|
||||
$this->setTrace($trace);
|
||||
}
|
||||
}
|
||||
|
||||
protected function setTrace($trace)
|
||||
{
|
||||
$traceReflector = new \ReflectionProperty('Exception', 'trace');
|
||||
$traceReflector->setAccessible(true);
|
||||
$traceReflector->setValue($this, $trace);
|
||||
}
|
||||
}
|
||||
146
vendor/symfony/http-foundation/StreamedResponse.php
vendored
146
vendor/symfony/http-foundation/StreamedResponse.php
vendored
@@ -1,146 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpFoundation;
|
||||
|
||||
/**
|
||||
* StreamedResponse represents a streamed HTTP response.
|
||||
*
|
||||
* A StreamedResponse uses a callback for its content.
|
||||
*
|
||||
* The callback should use the standard PHP functions like echo
|
||||
* to stream the response back to the client. The flush() function
|
||||
* can also be used if needed.
|
||||
*
|
||||
* @see flush()
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class StreamedResponse extends Response
|
||||
{
|
||||
protected $callback;
|
||||
protected $streamed;
|
||||
private $headersSent;
|
||||
|
||||
/**
|
||||
* @param callable|null $callback A valid PHP callback or null to set it later
|
||||
* @param int $status The response status code
|
||||
* @param array $headers An array of response headers
|
||||
*/
|
||||
public function __construct(callable $callback = null, $status = 200, $headers = array())
|
||||
{
|
||||
parent::__construct(null, $status, $headers);
|
||||
|
||||
if (null !== $callback) {
|
||||
$this->setCallback($callback);
|
||||
}
|
||||
$this->streamed = false;
|
||||
$this->headersSent = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for chainability.
|
||||
*
|
||||
* @param callable|null $callback A valid PHP callback or null to set it later
|
||||
* @param int $status The response status code
|
||||
* @param array $headers An array of response headers
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function create($callback = null, $status = 200, $headers = array())
|
||||
{
|
||||
return new static($callback, $status, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the PHP callback associated with this Response.
|
||||
*
|
||||
* @param callable $callback A valid PHP callback
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCallback(callable $callback)
|
||||
{
|
||||
$this->callback = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* This method only sends the headers once.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function sendHeaders()
|
||||
{
|
||||
if ($this->headersSent) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->headersSent = true;
|
||||
|
||||
return parent::sendHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* This method only sends the content once.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function sendContent()
|
||||
{
|
||||
if ($this->streamed) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->streamed = true;
|
||||
|
||||
if (null === $this->callback) {
|
||||
throw new \LogicException('The Response callback must not be null.');
|
||||
}
|
||||
|
||||
\call_user_func($this->callback);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws \LogicException when the content is not null
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
if (null !== $content) {
|
||||
throw new \LogicException('The content cannot be set on a StreamedResponse instance.');
|
||||
}
|
||||
|
||||
$this->streamed = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*/
|
||||
class AccessDeniedHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct(403, $message, $previous, array(), $code);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* @author Kris Wallsmith <kris@symfony.com>
|
||||
*/
|
||||
class MethodNotAllowedHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* @param array $allow An array of allowed methods
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0)
|
||||
{
|
||||
$headers = array('Allow' => strtoupper(implode(', ', $allow)));
|
||||
|
||||
parent::__construct(405, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class NotFoundHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($message = null, \Exception $previous = null, $code = 0)
|
||||
{
|
||||
parent::__construct(404, $message, $previous, array(), $code);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class ServiceUnavailableHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0)
|
||||
{
|
||||
$headers = array();
|
||||
if ($retryAfter) {
|
||||
$headers = array('Retry-After' => $retryAfter);
|
||||
}
|
||||
|
||||
parent::__construct(503, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Exception;
|
||||
|
||||
/**
|
||||
* @author Ben Ramsey <ben@benramsey.com>
|
||||
*/
|
||||
class UnauthorizedHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* @param string $challenge WWW-Authenticate challenge string
|
||||
* @param string $message The internal exception message
|
||||
* @param \Exception $previous The previous exception
|
||||
* @param int $code The internal exception code
|
||||
*/
|
||||
public function __construct($challenge, $message = null, \Exception $previous = null, $code = 0)
|
||||
{
|
||||
$headers = array('WWW-Authenticate' => $challenge);
|
||||
|
||||
parent::__construct(401, $message, $previous, $headers, $code);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Formatter;
|
||||
|
||||
use Symfony\Component\Translation\MessageSelector;
|
||||
|
||||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
*/
|
||||
class MessageFormatter implements MessageFormatterInterface, ChoiceMessageFormatterInterface
|
||||
{
|
||||
private $selector;
|
||||
|
||||
/**
|
||||
* @param MessageSelector|null $selector The message selector for pluralization
|
||||
*/
|
||||
public function __construct(MessageSelector $selector = null)
|
||||
{
|
||||
$this->selector = $selector ?: new MessageSelector();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function format($message, $locale, array $parameters = array())
|
||||
{
|
||||
return strtr($message, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function choiceFormat($message, $number, $locale, array $parameters = array())
|
||||
{
|
||||
$parameters = array_merge(array('%count%' => $number), $parameters);
|
||||
|
||||
return $this->format($this->selector->choose($message, (int) $number, $locale), $locale, $parameters);
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* ArrayLoader loads translations from a PHP array.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class ArrayLoader implements LoaderInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($resource, $locale, $domain = 'messages')
|
||||
{
|
||||
$this->flatten($resource);
|
||||
$catalogue = new MessageCatalogue($locale);
|
||||
$catalogue->add($resource, $domain);
|
||||
|
||||
return $catalogue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens an nested array of translations.
|
||||
*
|
||||
* The scheme used is:
|
||||
* 'key' => array('key2' => array('key3' => 'value'))
|
||||
* Becomes:
|
||||
* 'key.key2.key3' => 'value'
|
||||
*
|
||||
* This function takes an array by reference and will modify it
|
||||
*
|
||||
* @param array &$messages The array that will be flattened
|
||||
* @param array $subnode Current subnode being parsed, used internally for recursive calls
|
||||
* @param string $path Current path being parsed, used internally for recursive calls
|
||||
*/
|
||||
private function flatten(array &$messages, array $subnode = null, $path = null)
|
||||
{
|
||||
if (null === $subnode) {
|
||||
$subnode = &$messages;
|
||||
}
|
||||
foreach ($subnode as $key => $value) {
|
||||
if (\is_array($value)) {
|
||||
$nodePath = $path ? $path.'.'.$key : $key;
|
||||
$this->flatten($messages, $value, $nodePath);
|
||||
if (null === $path) {
|
||||
unset($messages[$key]);
|
||||
}
|
||||
} elseif (null !== $path) {
|
||||
$messages[$path.'.'.$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
450
vendor/symfony/translation/Translator.php
vendored
450
vendor/symfony/translation/Translator.php
vendored
@@ -1,450 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation;
|
||||
|
||||
use Symfony\Component\Config\ConfigCacheFactory;
|
||||
use Symfony\Component\Config\ConfigCacheFactoryInterface;
|
||||
use Symfony\Component\Config\ConfigCacheInterface;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Translation\Exception\RuntimeException;
|
||||
use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface;
|
||||
use Symfony\Component\Translation\Formatter\MessageFormatter;
|
||||
use Symfony\Component\Translation\Formatter\MessageFormatterInterface;
|
||||
use Symfony\Component\Translation\Loader\LoaderInterface;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Translator implements TranslatorInterface, TranslatorBagInterface
|
||||
{
|
||||
/**
|
||||
* @var MessageCatalogueInterface[]
|
||||
*/
|
||||
protected $catalogues = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $locale;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $fallbackLocales = array();
|
||||
|
||||
/**
|
||||
* @var LoaderInterface[]
|
||||
*/
|
||||
private $loaders = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $resources = array();
|
||||
|
||||
/**
|
||||
* @var MessageFormatterInterface
|
||||
*/
|
||||
private $formatter;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $cacheDir;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $debug;
|
||||
|
||||
/**
|
||||
* @var ConfigCacheFactoryInterface|null
|
||||
*/
|
||||
private $configCacheFactory;
|
||||
|
||||
/**
|
||||
* @param string $locale The locale
|
||||
* @param MessageFormatterInterface|null $formatter The message formatter
|
||||
* @param string|null $cacheDir The directory to use for the cache
|
||||
* @param bool $debug Use cache in debug mode ?
|
||||
*
|
||||
* @throws InvalidArgumentException If a locale contains invalid characters
|
||||
*/
|
||||
public function __construct($locale, $formatter = null, $cacheDir = null, $debug = false)
|
||||
{
|
||||
$this->setLocale($locale);
|
||||
|
||||
if ($formatter instanceof MessageSelector) {
|
||||
$formatter = new MessageFormatter($formatter);
|
||||
@trigger_error(sprintf('Passing a "%s" instance into the "%s()" method as a second argument is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a "%s" implementation instead.', MessageSelector::class, __METHOD__, MessageFormatterInterface::class), E_USER_DEPRECATED);
|
||||
} elseif (null === $formatter) {
|
||||
$formatter = new MessageFormatter();
|
||||
}
|
||||
|
||||
$this->formatter = $formatter;
|
||||
$this->cacheDir = $cacheDir;
|
||||
$this->debug = $debug;
|
||||
}
|
||||
|
||||
public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory)
|
||||
{
|
||||
$this->configCacheFactory = $configCacheFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Loader.
|
||||
*
|
||||
* @param string $format The name of the loader (@see addResource())
|
||||
* @param LoaderInterface $loader A LoaderInterface instance
|
||||
*/
|
||||
public function addLoader($format, LoaderInterface $loader)
|
||||
{
|
||||
$this->loaders[$format] = $loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Resource.
|
||||
*
|
||||
* @param string $format The name of the loader (@see addLoader())
|
||||
* @param mixed $resource The resource name
|
||||
* @param string $locale The locale
|
||||
* @param string $domain The domain
|
||||
*
|
||||
* @throws InvalidArgumentException If the locale contains invalid characters
|
||||
*/
|
||||
public function addResource($format, $resource, $locale, $domain = null)
|
||||
{
|
||||
if (null === $domain) {
|
||||
$domain = 'messages';
|
||||
}
|
||||
|
||||
$this->assertValidLocale($locale);
|
||||
|
||||
$this->resources[$locale][] = array($format, $resource, $domain);
|
||||
|
||||
if (\in_array($locale, $this->fallbackLocales)) {
|
||||
$this->catalogues = array();
|
||||
} else {
|
||||
unset($this->catalogues[$locale]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->assertValidLocale($locale);
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the fallback locales.
|
||||
*
|
||||
* @param array $locales The fallback locales
|
||||
*
|
||||
* @throws InvalidArgumentException If a locale contains invalid characters
|
||||
*/
|
||||
public function setFallbackLocales(array $locales)
|
||||
{
|
||||
// needed as the fallback locales are linked to the already loaded catalogues
|
||||
$this->catalogues = array();
|
||||
|
||||
foreach ($locales as $locale) {
|
||||
$this->assertValidLocale($locale);
|
||||
}
|
||||
|
||||
$this->fallbackLocales = $locales;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fallback locales.
|
||||
*
|
||||
* @return array $locales The fallback locales
|
||||
*/
|
||||
public function getFallbackLocales()
|
||||
{
|
||||
return $this->fallbackLocales;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function trans($id, array $parameters = array(), $domain = null, $locale = null)
|
||||
{
|
||||
if (null === $domain) {
|
||||
$domain = 'messages';
|
||||
}
|
||||
|
||||
return $this->formatter->format($this->getCatalogue($locale)->get((string) $id, $domain), $locale, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
|
||||
{
|
||||
if (!$this->formatter instanceof ChoiceMessageFormatterInterface) {
|
||||
throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter)));
|
||||
}
|
||||
|
||||
if (null === $domain) {
|
||||
$domain = 'messages';
|
||||
}
|
||||
|
||||
$id = (string) $id;
|
||||
$catalogue = $this->getCatalogue($locale);
|
||||
$locale = $catalogue->getLocale();
|
||||
while (!$catalogue->defines($id, $domain)) {
|
||||
if ($cat = $catalogue->getFallbackCatalogue()) {
|
||||
$catalogue = $cat;
|
||||
$locale = $catalogue->getLocale();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->formatter->choiceFormat($catalogue->get($id, $domain), $number, $locale, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCatalogue($locale = null)
|
||||
{
|
||||
if (null === $locale) {
|
||||
$locale = $this->getLocale();
|
||||
} else {
|
||||
$this->assertValidLocale($locale);
|
||||
}
|
||||
|
||||
if (!isset($this->catalogues[$locale])) {
|
||||
$this->loadCatalogue($locale);
|
||||
}
|
||||
|
||||
return $this->catalogues[$locale];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the loaders.
|
||||
*
|
||||
* @return array LoaderInterface[]
|
||||
*/
|
||||
protected function getLoaders()
|
||||
{
|
||||
return $this->loaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $locale
|
||||
*/
|
||||
protected function loadCatalogue($locale)
|
||||
{
|
||||
if (null === $this->cacheDir) {
|
||||
$this->initializeCatalogue($locale);
|
||||
} else {
|
||||
$this->initializeCacheCatalogue($locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $locale
|
||||
*/
|
||||
protected function initializeCatalogue($locale)
|
||||
{
|
||||
$this->assertValidLocale($locale);
|
||||
|
||||
try {
|
||||
$this->doLoadCatalogue($locale);
|
||||
} catch (NotFoundResourceException $e) {
|
||||
if (!$this->computeFallbackLocales($locale)) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
$this->loadFallbackCatalogues($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $locale
|
||||
*/
|
||||
private function initializeCacheCatalogue($locale)
|
||||
{
|
||||
if (isset($this->catalogues[$locale])) {
|
||||
/* Catalogue already initialized. */
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertValidLocale($locale);
|
||||
$cache = $this->getConfigCacheFactory()->cache($this->getCatalogueCachePath($locale),
|
||||
function (ConfigCacheInterface $cache) use ($locale) {
|
||||
$this->dumpCatalogue($locale, $cache);
|
||||
}
|
||||
);
|
||||
|
||||
if (isset($this->catalogues[$locale])) {
|
||||
/* Catalogue has been initialized as it was written out to cache. */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Read catalogue from cache. */
|
||||
$this->catalogues[$locale] = include $cache->getPath();
|
||||
}
|
||||
|
||||
private function dumpCatalogue($locale, ConfigCacheInterface $cache)
|
||||
{
|
||||
$this->initializeCatalogue($locale);
|
||||
$fallbackContent = $this->getFallbackContent($this->catalogues[$locale]);
|
||||
|
||||
$content = sprintf(<<<EOF
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
\$catalogue = new MessageCatalogue('%s', %s);
|
||||
|
||||
%s
|
||||
return \$catalogue;
|
||||
|
||||
EOF
|
||||
,
|
||||
$locale,
|
||||
var_export($this->catalogues[$locale]->all(), true),
|
||||
$fallbackContent
|
||||
);
|
||||
|
||||
$cache->write($content, $this->catalogues[$locale]->getResources());
|
||||
}
|
||||
|
||||
private function getFallbackContent(MessageCatalogue $catalogue)
|
||||
{
|
||||
$fallbackContent = '';
|
||||
$current = '';
|
||||
$replacementPattern = '/[^a-z0-9_]/i';
|
||||
$fallbackCatalogue = $catalogue->getFallbackCatalogue();
|
||||
while ($fallbackCatalogue) {
|
||||
$fallback = $fallbackCatalogue->getLocale();
|
||||
$fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback));
|
||||
$currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current));
|
||||
|
||||
$fallbackContent .= sprintf(<<<'EOF'
|
||||
$catalogue%s = new MessageCatalogue('%s', %s);
|
||||
$catalogue%s->addFallbackCatalogue($catalogue%s);
|
||||
|
||||
EOF
|
||||
,
|
||||
$fallbackSuffix,
|
||||
$fallback,
|
||||
var_export($fallbackCatalogue->all(), true),
|
||||
$currentSuffix,
|
||||
$fallbackSuffix
|
||||
);
|
||||
$current = $fallbackCatalogue->getLocale();
|
||||
$fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue();
|
||||
}
|
||||
|
||||
return $fallbackContent;
|
||||
}
|
||||
|
||||
private function getCatalogueCachePath($locale)
|
||||
{
|
||||
return $this->cacheDir.'/catalogue.'.$locale.'.'.strtr(substr(base64_encode(hash('sha256', serialize($this->fallbackLocales), true)), 0, 7), '/', '_').'.php';
|
||||
}
|
||||
|
||||
private function doLoadCatalogue($locale)
|
||||
{
|
||||
$this->catalogues[$locale] = new MessageCatalogue($locale);
|
||||
|
||||
if (isset($this->resources[$locale])) {
|
||||
foreach ($this->resources[$locale] as $resource) {
|
||||
if (!isset($this->loaders[$resource[0]])) {
|
||||
throw new RuntimeException(sprintf('The "%s" translation loader is not registered.', $resource[0]));
|
||||
}
|
||||
$this->catalogues[$locale]->addCatalogue($this->loaders[$resource[0]]->load($resource[1], $locale, $resource[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function loadFallbackCatalogues($locale)
|
||||
{
|
||||
$current = $this->catalogues[$locale];
|
||||
|
||||
foreach ($this->computeFallbackLocales($locale) as $fallback) {
|
||||
if (!isset($this->catalogues[$fallback])) {
|
||||
$this->initializeCatalogue($fallback);
|
||||
}
|
||||
|
||||
$fallbackCatalogue = new MessageCatalogue($fallback, $this->catalogues[$fallback]->all());
|
||||
foreach ($this->catalogues[$fallback]->getResources() as $resource) {
|
||||
$fallbackCatalogue->addResource($resource);
|
||||
}
|
||||
$current->addFallbackCatalogue($fallbackCatalogue);
|
||||
$current = $fallbackCatalogue;
|
||||
}
|
||||
}
|
||||
|
||||
protected function computeFallbackLocales($locale)
|
||||
{
|
||||
$locales = array();
|
||||
foreach ($this->fallbackLocales as $fallback) {
|
||||
if ($fallback === $locale) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$locales[] = $fallback;
|
||||
}
|
||||
|
||||
if (false !== strrchr($locale, '_')) {
|
||||
array_unshift($locales, substr($locale, 0, -\strlen(strrchr($locale, '_'))));
|
||||
}
|
||||
|
||||
return array_unique($locales);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the locale is valid, throws an Exception if not.
|
||||
*
|
||||
* @param string $locale Locale to tests
|
||||
*
|
||||
* @throws InvalidArgumentException If the locale contains invalid characters
|
||||
*/
|
||||
protected function assertValidLocale($locale)
|
||||
{
|
||||
if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the ConfigCache factory implementation, falling back to a
|
||||
* default implementation if necessary.
|
||||
*
|
||||
* @return ConfigCacheFactoryInterface $configCacheFactory
|
||||
*/
|
||||
private function getConfigCacheFactory()
|
||||
{
|
||||
if (!$this->configCacheFactory) {
|
||||
$this->configCacheFactory = new ConfigCacheFactory($this->debug);
|
||||
}
|
||||
|
||||
return $this->configCacheFactory;
|
||||
}
|
||||
}
|
||||
276
vendor/webklex/php-imap/src/ClientManager.php
vendored
276
vendor/webklex/php-imap/src/ClientManager.php
vendored
@@ -1,276 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* File: ClientManager.php
|
||||
* Category: -
|
||||
* Author: M. Goldenbaum
|
||||
* Created: 19.01.17 22:21
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Webklex\PHPIMAP;
|
||||
|
||||
/**
|
||||
* Class ClientManager
|
||||
*
|
||||
* @package Webklex\IMAP
|
||||
*
|
||||
* @mixin Client
|
||||
*/
|
||||
class ClientManager {
|
||||
|
||||
/**
|
||||
* All library config
|
||||
*
|
||||
* @var array $config
|
||||
*/
|
||||
public static $config = [];
|
||||
|
||||
/**
|
||||
* @var array $accounts
|
||||
*/
|
||||
protected $accounts = [];
|
||||
|
||||
/**
|
||||
* ClientManager constructor.
|
||||
* @param array|string $config
|
||||
*/
|
||||
public function __construct($config = []) {
|
||||
$this->setConfig($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically pass calls to the default account.
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exceptions\MaskNotFoundException
|
||||
*/
|
||||
public function __call(string $method, array $parameters) {
|
||||
$callable = [$this->account(), $method];
|
||||
|
||||
return call_user_func_array($callable, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely create a new client instance which is not listed in accounts
|
||||
* @param array $config
|
||||
*
|
||||
* @return Client
|
||||
* @throws Exceptions\MaskNotFoundException
|
||||
*/
|
||||
public function make(array $config): Client {
|
||||
return new Client($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a dotted config parameter
|
||||
* @param string $key
|
||||
* @param null $default
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public static function get(string $key, $default = null) {
|
||||
$parts = explode('.', $key);
|
||||
$value = null;
|
||||
foreach($parts as $part) {
|
||||
if($value === null) {
|
||||
if(isset(self::$config[$part])) {
|
||||
$value = self::$config[$part];
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
if(isset($value[$part])) {
|
||||
$value = $value[$part];
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $value === null ? $default : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a account instance.
|
||||
* @param string|null $name
|
||||
*
|
||||
* @return Client
|
||||
* @throws Exceptions\MaskNotFoundException
|
||||
*/
|
||||
public function account(string $name = null): Client {
|
||||
$name = $name ?: $this->getDefaultAccount();
|
||||
|
||||
// If the connection has not been resolved we will resolve it now as all
|
||||
// the connections are resolved when they are actually needed, so we do
|
||||
// not make any unnecessary connection to the various queue end-points.
|
||||
if (!isset($this->accounts[$name])) {
|
||||
$this->accounts[$name] = $this->resolve($name);
|
||||
}
|
||||
|
||||
return $this->accounts[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve an account.
|
||||
* @param string $name
|
||||
*
|
||||
* @return Client
|
||||
* @throws Exceptions\MaskNotFoundException
|
||||
*/
|
||||
protected function resolve(string $name): Client {
|
||||
$config = $this->getClientConfig($name);
|
||||
|
||||
return new Client($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the account configuration.
|
||||
* @param string|null $name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getClientConfig($name): array {
|
||||
if ($name === null || $name === 'null') {
|
||||
return ['driver' => 'null'];
|
||||
}
|
||||
|
||||
return is_array(self::$config["accounts"][$name]) ? self::$config["accounts"][$name] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the default account.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultAccount(): string {
|
||||
return self::$config['default'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the default account.
|
||||
* @param string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultAccount(string $name) {
|
||||
self::$config['default'] = $name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Merge the vendor settings with the local config
|
||||
*
|
||||
* The default account identifier will be used as default for any missing account parameters.
|
||||
* If however the default account is missing a parameter the package default account parameter will be used.
|
||||
* This can be disabled by setting imap.default in your config file to 'false'
|
||||
*
|
||||
* @param array|string $config
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setConfig($config): ClientManager {
|
||||
|
||||
if(is_array($config) === false) {
|
||||
$config = require $config;
|
||||
}
|
||||
|
||||
$config_key = 'imap';
|
||||
$path = __DIR__.'/config/'.$config_key.'.php';
|
||||
|
||||
$vendor_config = require $path;
|
||||
$config = $this->array_merge_recursive_distinct($vendor_config, $config);
|
||||
|
||||
if(is_array($config)){
|
||||
if(isset($config['default'])){
|
||||
if(isset($config['accounts']) && $config['default']){
|
||||
|
||||
$default_config = $vendor_config['accounts']['default'];
|
||||
if(isset($config['accounts'][$config['default']])){
|
||||
$default_config = array_merge($default_config, $config['accounts'][$config['default']]);
|
||||
}
|
||||
|
||||
if(is_array($config['accounts'])){
|
||||
foreach($config['accounts'] as $account_key => $account){
|
||||
$config['accounts'][$account_key] = array_merge($default_config, $account);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self::$config = $config;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marge arrays recursively and distinct
|
||||
*
|
||||
* Merges any number of arrays / parameters recursively, replacing
|
||||
* entries with string keys with values from latter arrays.
|
||||
* If the entry or the next value to be assigned is an array, then it
|
||||
* automatically treats both arguments as an array.
|
||||
* Numeric entries are appended, not replaced, but only if they are
|
||||
* unique
|
||||
*
|
||||
* @return array|mixed
|
||||
*
|
||||
* @link http://www.php.net/manual/en/function.array-merge-recursive.php#96201
|
||||
* @author Mark Roduner <mark.roduner@gmail.com>
|
||||
*/
|
||||
private function array_merge_recursive_distinct() {
|
||||
|
||||
$arrays = func_get_args();
|
||||
$base = array_shift($arrays);
|
||||
|
||||
// From https://stackoverflow.com/a/173479
|
||||
$isAssoc = function(array $arr) {
|
||||
if (array() === $arr) return false;
|
||||
return array_keys($arr) !== range(0, count($arr) - 1);
|
||||
};
|
||||
|
||||
if(!is_array($base)) $base = empty($base) ? array() : array($base);
|
||||
|
||||
foreach($arrays as $append) {
|
||||
|
||||
if(!is_array($append)) $append = array($append);
|
||||
|
||||
foreach($append as $key => $value) {
|
||||
|
||||
if(!array_key_exists($key, $base) and !is_numeric($key)) {
|
||||
$base[$key] = $value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(
|
||||
(
|
||||
is_array($value)
|
||||
&& $isAssoc($value)
|
||||
)
|
||||
|| (
|
||||
is_array($base[$key])
|
||||
&& $isAssoc($base[$key])
|
||||
)
|
||||
) {
|
||||
// If the arrays are not associates we don't want to array_merge_recursive_distinct
|
||||
// else merging $baseConfig['dispositions'] = ['attachment', 'inline'] with $customConfig['dispositions'] = ['attachment']
|
||||
// results in $resultConfig['dispositions'] = ['attachment', 'inline']
|
||||
$base[$key] = $this->array_merge_recursive_distinct($base[$key], $value);
|
||||
} else if(is_numeric($key)) {
|
||||
if(!in_array($value, $base)) $base[] = $value;
|
||||
} else {
|
||||
$base[$key] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $base;
|
||||
}
|
||||
}
|
||||
482
vendor/webklex/php-imap/src/EncodingAliases.php
vendored
482
vendor/webklex/php-imap/src/EncodingAliases.php
vendored
@@ -1,482 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* File: EncodingAliases.php
|
||||
* Category: -
|
||||
* Author: S. Todorov (https://github.com/todorowww)
|
||||
* Created: 23.04.18 14:16
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* Contains email encoding aliases, thta can occur when fetching emails. These sometimes can break icvon()
|
||||
* This file attempts to correct this by using a list of aliases and their mappings to supported iconv() encodings
|
||||
*/
|
||||
|
||||
namespace Webklex\PHPIMAP;
|
||||
|
||||
/**
|
||||
* Class EncodingAliases
|
||||
*
|
||||
* @package Webklex\PHPIMAP
|
||||
*/
|
||||
class EncodingAliases {
|
||||
|
||||
/**
|
||||
* Contains email encoding mappings
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $aliases = [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email encoding aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Email encoding aliases used to convert to iconv supported charsets
|
||||
|
|
||||
|
|
||||
| This Source Code Form is subject to the terms of the Mozilla Public
|
||||
| License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
| file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
|
||||
| This Original Code has been modified by IBM Corporation.
|
||||
| Modifications made by IBM described herein are
|
||||
| Copyright (c) International Business Machines
|
||||
| Corporation, 1999
|
||||
|
|
||||
| Modifications to Mozilla code or documentation
|
||||
| identified per MPL Section 3.3
|
||||
|
|
||||
| Date Modified by Description of modification
|
||||
| 12/09/1999 IBM Corp. Support for IBM codepages - 850,852,855,857,862,864
|
||||
|
|
||||
| Rule of this file:
|
||||
| 1. key should always be in lower case ascii so we can do case insensitive
|
||||
| comparison in the code faster.
|
||||
| 2. value should be the one used in unicode converter
|
||||
|
|
||||
| 3. If the charset is not used for document charset, but font charset
|
||||
| (e.g. XLFD charset- such as JIS x0201, JIS x0208), don't put here
|
||||
|
|
||||
*/
|
||||
"ascii" => "us-ascii",
|
||||
"us-ascii" => "us-ascii",
|
||||
"ansi_x3.4-1968" => "us-ascii",
|
||||
"646" => "us-ascii",
|
||||
"iso-8859-1" => "ISO-8859-1",
|
||||
"iso-8859-2" => "ISO-8859-2",
|
||||
"iso-8859-3" => "ISO-8859-3",
|
||||
"iso-8859-4" => "ISO-8859-4",
|
||||
"iso-8859-5" => "ISO-8859-5",
|
||||
"iso-8859-6" => "ISO-8859-6",
|
||||
"iso-8859-6-i" => "ISO-8859-6-I",
|
||||
"iso-8859-6-e" => "ISO-8859-6-E",
|
||||
"iso-8859-7" => "ISO-8859-7",
|
||||
"iso-8859-8" => "ISO-8859-8",
|
||||
"iso-8859-8-i" => "ISO-8859-8-I",
|
||||
"iso-8859-8-e" => "ISO-8859-8-E",
|
||||
"iso-8859-9" => "ISO-8859-9",
|
||||
"iso-8859-10" => "ISO-8859-10",
|
||||
"iso-8859-11" => "ISO-8859-11",
|
||||
"iso-8859-13" => "ISO-8859-13",
|
||||
"iso-8859-14" => "ISO-8859-14",
|
||||
"iso-8859-15" => "ISO-8859-15",
|
||||
"iso-8859-16" => "ISO-8859-16",
|
||||
"iso-ir-111" => "ISO-IR-111",
|
||||
"iso-2022-cn" => "ISO-2022-CN",
|
||||
"iso-2022-cn-ext" => "ISO-2022-CN",
|
||||
"iso-2022-kr" => "ISO-2022-KR",
|
||||
"iso-2022-jp" => "ISO-2022-JP",
|
||||
"utf-16be" => "UTF-16BE",
|
||||
"utf-16le" => "UTF-16LE",
|
||||
"utf-16" => "UTF-16",
|
||||
"windows-1250" => "windows-1250",
|
||||
"windows-1251" => "windows-1251",
|
||||
"windows-1252" => "windows-1252",
|
||||
"windows-1253" => "windows-1253",
|
||||
"windows-1254" => "windows-1254",
|
||||
"windows-1255" => "windows-1255",
|
||||
"windows-1256" => "windows-1256",
|
||||
"windows-1257" => "windows-1257",
|
||||
"windows-1258" => "windows-1258",
|
||||
"ibm866" => "IBM866",
|
||||
"ibm850" => "IBM850",
|
||||
"ibm852" => "IBM852",
|
||||
"ibm855" => "IBM855",
|
||||
"ibm857" => "IBM857",
|
||||
"ibm862" => "IBM862",
|
||||
"ibm864" => "IBM864",
|
||||
"utf-8" => "UTF-8",
|
||||
"utf-7" => "UTF-7",
|
||||
"shift_jis" => "Shift_JIS",
|
||||
"big5" => "Big5",
|
||||
"euc-jp" => "EUC-JP",
|
||||
"euc-kr" => "EUC-KR",
|
||||
"gb2312" => "GB2312",
|
||||
"gb18030" => "gb18030",
|
||||
"viscii" => "VISCII",
|
||||
"koi8-r" => "KOI8-R",
|
||||
"koi8_r" => "KOI8-R",
|
||||
"cskoi8r" => "KOI8-R",
|
||||
"koi" => "KOI8-R",
|
||||
"koi8" => "KOI8-R",
|
||||
"koi8-u" => "KOI8-U",
|
||||
"tis-620" => "TIS-620",
|
||||
"t.61-8bit" => "T.61-8bit",
|
||||
"hz-gb-2312" => "HZ-GB-2312",
|
||||
"big5-hkscs" => "Big5-HKSCS",
|
||||
"gbk" => "gbk",
|
||||
"cns11643" => "x-euc-tw",
|
||||
//
|
||||
// Aliases for ISO-8859-1
|
||||
//
|
||||
"latin1" => "ISO-8859-1",
|
||||
"iso_8859-1" => "ISO-8859-1",
|
||||
"iso8859-1" => "ISO-8859-1",
|
||||
"iso8859-2" => "ISO-8859-2",
|
||||
"iso8859-3" => "ISO-8859-3",
|
||||
"iso8859-4" => "ISO-8859-4",
|
||||
"iso8859-5" => "ISO-8859-5",
|
||||
"iso8859-6" => "ISO-8859-6",
|
||||
"iso8859-7" => "ISO-8859-7",
|
||||
"iso8859-8" => "ISO-8859-8",
|
||||
"iso8859-9" => "ISO-8859-9",
|
||||
"iso8859-10" => "ISO-8859-10",
|
||||
"iso8859-11" => "ISO-8859-11",
|
||||
"iso8859-13" => "ISO-8859-13",
|
||||
"iso8859-14" => "ISO-8859-14",
|
||||
"iso8859-15" => "ISO-8859-15",
|
||||
"iso_8859-1:1987" => "ISO-8859-1",
|
||||
"iso-ir-100" => "ISO-8859-1",
|
||||
"l1" => "ISO-8859-1",
|
||||
"ibm819" => "ISO-8859-1",
|
||||
"cp819" => "ISO-8859-1",
|
||||
"csisolatin1" => "ISO-8859-1",
|
||||
//
|
||||
// Aliases for ISO-8859-2
|
||||
//
|
||||
"latin2" => "ISO-8859-2",
|
||||
"iso_8859-2" => "ISO-8859-2",
|
||||
"iso_8859-2:1987" => "ISO-8859-2",
|
||||
"iso-ir-101" => "ISO-8859-2",
|
||||
"l2" => "ISO-8859-2",
|
||||
"csisolatin2" => "ISO-8859-2",
|
||||
//
|
||||
// Aliases for ISO-8859-3
|
||||
//
|
||||
"latin3" => "ISO-8859-3",
|
||||
"iso_8859-3" => "ISO-8859-3",
|
||||
"iso_8859-3:1988" => "ISO-8859-3",
|
||||
"iso-ir-109" => "ISO-8859-3",
|
||||
"l3" => "ISO-8859-3",
|
||||
"csisolatin3" => "ISO-8859-3",
|
||||
//
|
||||
// Aliases for ISO-8859-4
|
||||
//
|
||||
"latin4" => "ISO-8859-4",
|
||||
"iso_8859-4" => "ISO-8859-4",
|
||||
"iso_8859-4:1988" => "ISO-8859-4",
|
||||
"iso-ir-110" => "ISO-8859-4",
|
||||
"l4" => "ISO-8859-4",
|
||||
"csisolatin4" => "ISO-8859-4",
|
||||
//
|
||||
// Aliases for ISO-8859-5
|
||||
//
|
||||
"cyrillic" => "ISO-8859-5",
|
||||
"iso_8859-5" => "ISO-8859-5",
|
||||
"iso_8859-5:1988" => "ISO-8859-5",
|
||||
"iso-ir-144" => "ISO-8859-5",
|
||||
"csisolatincyrillic" => "ISO-8859-5",
|
||||
//
|
||||
// Aliases for ISO-8859-6
|
||||
//
|
||||
"arabic" => "ISO-8859-6",
|
||||
"iso_8859-6" => "ISO-8859-6",
|
||||
"iso_8859-6:1987" => "ISO-8859-6",
|
||||
"iso-ir-127" => "ISO-8859-6",
|
||||
"ecma-114" => "ISO-8859-6",
|
||||
"asmo-708" => "ISO-8859-6",
|
||||
"csisolatinarabic" => "ISO-8859-6",
|
||||
//
|
||||
// Aliases for ISO-8859-6-I
|
||||
//
|
||||
"csiso88596i" => "ISO-8859-6-I",
|
||||
//
|
||||
// Aliases for ISO-8859-6-E",
|
||||
//
|
||||
"csiso88596e" => "ISO-8859-6-E",
|
||||
//
|
||||
// Aliases for ISO-8859-7",
|
||||
//
|
||||
"greek" => "ISO-8859-7",
|
||||
"greek8" => "ISO-8859-7",
|
||||
"sun_eu_greek" => "ISO-8859-7",
|
||||
"iso_8859-7" => "ISO-8859-7",
|
||||
"iso_8859-7:1987" => "ISO-8859-7",
|
||||
"iso-ir-126" => "ISO-8859-7",
|
||||
"elot_928" => "ISO-8859-7",
|
||||
"ecma-118" => "ISO-8859-7",
|
||||
"csisolatingreek" => "ISO-8859-7",
|
||||
//
|
||||
// Aliases for ISO-8859-8",
|
||||
//
|
||||
"hebrew" => "ISO-8859-8",
|
||||
"iso_8859-8" => "ISO-8859-8",
|
||||
"visual" => "ISO-8859-8",
|
||||
"iso_8859-8:1988" => "ISO-8859-8",
|
||||
"iso-ir-138" => "ISO-8859-8",
|
||||
"csisolatinhebrew" => "ISO-8859-8",
|
||||
//
|
||||
// Aliases for ISO-8859-8-I",
|
||||
//
|
||||
"csiso88598i" => "ISO-8859-8-I",
|
||||
"iso-8859-8i" => "ISO-8859-8-I",
|
||||
"logical" => "ISO-8859-8-I",
|
||||
//
|
||||
// Aliases for ISO-8859-8-E",
|
||||
//
|
||||
"csiso88598e" => "ISO-8859-8-E",
|
||||
//
|
||||
// Aliases for ISO-8859-9",
|
||||
//
|
||||
"latin5" => "ISO-8859-9",
|
||||
"iso_8859-9" => "ISO-8859-9",
|
||||
"iso_8859-9:1989" => "ISO-8859-9",
|
||||
"iso-ir-148" => "ISO-8859-9",
|
||||
"l5" => "ISO-8859-9",
|
||||
"csisolatin5" => "ISO-8859-9",
|
||||
//
|
||||
// Aliases for UTF-8",
|
||||
//
|
||||
"unicode-1-1-utf-8" => "UTF-8",
|
||||
// nl_langinfo(CODESET) in HP/UX returns 'utf8' under UTF-8 locales",
|
||||
"utf8" => "UTF-8",
|
||||
//
|
||||
// Aliases for Shift_JIS",
|
||||
//
|
||||
"x-sjis" => "Shift_JIS",
|
||||
"shift-jis" => "Shift_JIS",
|
||||
"ms_kanji" => "Shift_JIS",
|
||||
"csshiftjis" => "Shift_JIS",
|
||||
"windows-31j" => "Shift_JIS",
|
||||
"cp932" => "Shift_JIS",
|
||||
"sjis" => "Shift_JIS",
|
||||
//
|
||||
// Aliases for EUC_JP",
|
||||
//
|
||||
"cseucpkdfmtjapanese" => "EUC-JP",
|
||||
"x-euc-jp" => "EUC-JP",
|
||||
//
|
||||
// Aliases for ISO-2022-JP",
|
||||
//
|
||||
"csiso2022jp" => "ISO-2022-JP",
|
||||
// The following are really not aliases ISO-2022-JP, but sharing the same decoder",
|
||||
"iso-2022-jp-2" => "ISO-2022-JP",
|
||||
"csiso2022jp2" => "ISO-2022-JP",
|
||||
//
|
||||
// Aliases for Big5",
|
||||
//
|
||||
"csbig5" => "Big5",
|
||||
"cn-big5" => "Big5",
|
||||
// x-x-big5 is not really a alias for Big5, add it only for MS FrontPage",
|
||||
"x-x-big5" => "Big5",
|
||||
// Sun Solaris",
|
||||
"zh_tw-big5" => "Big5",
|
||||
//
|
||||
// Aliases for EUC-KR",
|
||||
//
|
||||
"cseuckr" => "EUC-KR",
|
||||
"ks_c_5601-1987" => "EUC-KR",
|
||||
"iso-ir-149" => "EUC-KR",
|
||||
"ks_c_5601-1989" => "EUC-KR",
|
||||
"ksc_5601" => "EUC-KR",
|
||||
"ksc5601" => "EUC-KR",
|
||||
"korean" => "EUC-KR",
|
||||
"csksc56011987" => "EUC-KR",
|
||||
"5601" => "EUC-KR",
|
||||
"windows-949" => "EUC-KR",
|
||||
//
|
||||
// Aliases for GB2312",
|
||||
//
|
||||
// The following are really not aliases GB2312, add them only for MS FrontPage",
|
||||
"gb_2312-80" => "GB2312",
|
||||
"iso-ir-58" => "GB2312",
|
||||
"chinese" => "GB2312",
|
||||
"csiso58gb231280" => "GB2312",
|
||||
"csgb2312" => "GB2312",
|
||||
"zh_cn.euc" => "GB2312",
|
||||
// Sun Solaris",
|
||||
"gb_2312" => "GB2312",
|
||||
//
|
||||
// Aliases for windows-125x ",
|
||||
//
|
||||
"x-cp1250" => "windows-1250",
|
||||
"x-cp1251" => "windows-1251",
|
||||
"x-cp1252" => "windows-1252",
|
||||
"x-cp1253" => "windows-1253",
|
||||
"x-cp1254" => "windows-1254",
|
||||
"x-cp1255" => "windows-1255",
|
||||
"x-cp1256" => "windows-1256",
|
||||
"x-cp1257" => "windows-1257",
|
||||
"x-cp1258" => "windows-1258",
|
||||
//
|
||||
// Aliases for windows-874 ",
|
||||
//
|
||||
"windows-874" => "windows-874",
|
||||
"ibm874" => "windows-874",
|
||||
"dos-874" => "windows-874",
|
||||
//
|
||||
// Aliases for macintosh",
|
||||
//
|
||||
"macintosh" => "macintosh",
|
||||
"x-mac-roman" => "macintosh",
|
||||
"mac" => "macintosh",
|
||||
"csmacintosh" => "macintosh",
|
||||
//
|
||||
// Aliases for IBM866",
|
||||
//
|
||||
"cp866" => "IBM866",
|
||||
"cp-866" => "IBM866",
|
||||
"866" => "IBM866",
|
||||
"csibm866" => "IBM866",
|
||||
//
|
||||
// Aliases for IBM850",
|
||||
//
|
||||
"cp850" => "IBM850",
|
||||
"850" => "IBM850",
|
||||
"csibm850" => "IBM850",
|
||||
//
|
||||
// Aliases for IBM852",
|
||||
//
|
||||
"cp852" => "IBM852",
|
||||
"852" => "IBM852",
|
||||
"csibm852" => "IBM852",
|
||||
//
|
||||
// Aliases for IBM855",
|
||||
//
|
||||
"cp855" => "IBM855",
|
||||
"855" => "IBM855",
|
||||
"csibm855" => "IBM855",
|
||||
//
|
||||
// Aliases for IBM857",
|
||||
//
|
||||
"cp857" => "IBM857",
|
||||
"857" => "IBM857",
|
||||
"csibm857" => "IBM857",
|
||||
//
|
||||
// Aliases for IBM862",
|
||||
//
|
||||
"cp862" => "IBM862",
|
||||
"862" => "IBM862",
|
||||
"csibm862" => "IBM862",
|
||||
//
|
||||
// Aliases for IBM864",
|
||||
//
|
||||
"cp864" => "IBM864",
|
||||
"864" => "IBM864",
|
||||
"csibm864" => "IBM864",
|
||||
"ibm-864" => "IBM864",
|
||||
//
|
||||
// Aliases for T.61-8bit",
|
||||
//
|
||||
"t.61" => "T.61-8bit",
|
||||
"iso-ir-103" => "T.61-8bit",
|
||||
"csiso103t618bit" => "T.61-8bit",
|
||||
//
|
||||
// Aliases for UTF-7",
|
||||
//
|
||||
"x-unicode-2-0-utf-7" => "UTF-7",
|
||||
"unicode-2-0-utf-7" => "UTF-7",
|
||||
"unicode-1-1-utf-7" => "UTF-7",
|
||||
"csunicode11utf7" => "UTF-7",
|
||||
//
|
||||
// Aliases for ISO-10646-UCS-2",
|
||||
//
|
||||
"csunicode" => "UTF-16BE",
|
||||
"csunicode11" => "UTF-16BE",
|
||||
"iso-10646-ucs-basic" => "UTF-16BE",
|
||||
"csunicodeascii" => "UTF-16BE",
|
||||
"iso-10646-unicode-latin1" => "UTF-16BE",
|
||||
"csunicodelatin1" => "UTF-16BE",
|
||||
"iso-10646" => "UTF-16BE",
|
||||
"iso-10646-j-1" => "UTF-16BE",
|
||||
//
|
||||
// Aliases for ISO-8859-10",
|
||||
//
|
||||
"latin6" => "ISO-8859-10",
|
||||
"iso-ir-157" => "ISO-8859-10",
|
||||
"l6" => "ISO-8859-10",
|
||||
// Currently .properties cannot handle : in key",
|
||||
//iso_8859-10:1992" => "ISO-8859-10",
|
||||
"csisolatin6" => "ISO-8859-10",
|
||||
//
|
||||
// Aliases for ISO-8859-15",
|
||||
//
|
||||
"iso_8859-15" => "ISO-8859-15",
|
||||
"csisolatin9" => "ISO-8859-15",
|
||||
"l9" => "ISO-8859-15",
|
||||
//
|
||||
// Aliases for ISO-IR-111",
|
||||
//
|
||||
"ecma-cyrillic" => "ISO-IR-111",
|
||||
"csiso111ecmacyrillic" => "ISO-IR-111",
|
||||
//
|
||||
// Aliases for ISO-2022-KR",
|
||||
//
|
||||
"csiso2022kr" => "ISO-2022-KR",
|
||||
//
|
||||
// Aliases for VISCII",
|
||||
//
|
||||
"csviscii" => "VISCII",
|
||||
//
|
||||
// Aliases for x-euc-tw",
|
||||
//
|
||||
"zh_tw-euc" => "x-euc-tw",
|
||||
//
|
||||
// Following names appears in unix nl_langinfo(CODESET)",
|
||||
// They can be compiled as platform specific if necessary",
|
||||
// DONT put things here if it does not look generic enough (like hp15CN)",
|
||||
//
|
||||
"iso88591" => "ISO-8859-1",
|
||||
"iso88592" => "ISO-8859-2",
|
||||
"iso88593" => "ISO-8859-3",
|
||||
"iso88594" => "ISO-8859-4",
|
||||
"iso88595" => "ISO-8859-5",
|
||||
"iso88596" => "ISO-8859-6",
|
||||
"iso88597" => "ISO-8859-7",
|
||||
"iso88598" => "ISO-8859-8",
|
||||
"iso88599" => "ISO-8859-9",
|
||||
"iso885910" => "ISO-8859-10",
|
||||
"iso885911" => "ISO-8859-11",
|
||||
"iso885912" => "ISO-8859-12",
|
||||
"iso885913" => "ISO-8859-13",
|
||||
"iso885914" => "ISO-8859-14",
|
||||
"iso885915" => "ISO-8859-15",
|
||||
"cp1250" => "windows-1250",
|
||||
"cp1251" => "windows-1251",
|
||||
"cp1252" => "windows-1252",
|
||||
"cp1253" => "windows-1253",
|
||||
"cp1254" => "windows-1254",
|
||||
"cp1255" => "windows-1255",
|
||||
"cp1256" => "windows-1256",
|
||||
"cp1257" => "windows-1257",
|
||||
"cp1258" => "windows-1258",
|
||||
"x-gbk" => "gbk",
|
||||
"windows-936" => "gbk",
|
||||
"ansi-1251" => "windows-1251",
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns proper encoding mapping, if exsists. If it doesn't, return unchanged $encoding
|
||||
* @param string|null $encoding
|
||||
* @param string|null $fallback
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get($encoding, string $fallback = null): string {
|
||||
if (isset(self::$aliases[strtolower($encoding ?? '')])) {
|
||||
return self::$aliases[strtolower($encoding ?? '')];
|
||||
}
|
||||
return $fallback !== null ? $fallback : $encoding;
|
||||
}
|
||||
|
||||
}
|
||||
475
vendor/webklex/php-imap/src/Folder.php
vendored
475
vendor/webklex/php-imap/src/Folder.php
vendored
@@ -1,475 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Folder.php
|
||||
* Category: -
|
||||
* Author: M. Goldenbaum
|
||||
* Created: 19.01.17 22:21
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Webklex\PHPIMAP;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\NotSupportedCapabilityException;
|
||||
use Webklex\PHPIMAP\Exceptions\RuntimeException;
|
||||
use Webklex\PHPIMAP\Query\WhereQuery;
|
||||
use Webklex\PHPIMAP\Support\FolderCollection;
|
||||
use Webklex\PHPIMAP\Traits\HasEvents;
|
||||
|
||||
/**
|
||||
* Class Folder
|
||||
*
|
||||
* @package Webklex\PHPIMAP
|
||||
*/
|
||||
class Folder {
|
||||
use HasEvents;
|
||||
|
||||
/**
|
||||
* Client instance
|
||||
*
|
||||
* @var Client
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* Folder full path
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $path;
|
||||
|
||||
/**
|
||||
* Folder name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Folder fullname
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $full_name;
|
||||
|
||||
/**
|
||||
* Children folders
|
||||
*
|
||||
* @var FolderCollection|array
|
||||
*/
|
||||
public $children = [];
|
||||
|
||||
/**
|
||||
* Delimiter for folder
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $delimiter;
|
||||
|
||||
/**
|
||||
* Indicates if folder can't containg any "children".
|
||||
* CreateFolder won't work on this folder.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $no_inferiors;
|
||||
|
||||
/**
|
||||
* Indicates if folder is only container, not a mailbox - you can't open it.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $no_select;
|
||||
|
||||
/**
|
||||
* Indicates if folder is marked. This means that it may contain new messages since the last time it was checked.
|
||||
* Not provided by all IMAP servers.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $marked;
|
||||
|
||||
/**
|
||||
* Indicates if folder containg any "children".
|
||||
* Not provided by all IMAP servers.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $has_children;
|
||||
|
||||
/**
|
||||
* Indicates if folder refers to other.
|
||||
* Not provided by all IMAP servers.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $referral;
|
||||
|
||||
/** @var array */
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* Folder constructor.
|
||||
* @param Client $client
|
||||
* @param string $folder_name
|
||||
* @param string $delimiter
|
||||
* @param string[] $attributes
|
||||
*/
|
||||
public function __construct(Client $client, string $folder_name, string $delimiter, array $attributes) {
|
||||
$this->client = $client;
|
||||
|
||||
$this->events["message"] = $client->getDefaultEvents("message");
|
||||
$this->events["folder"] = $client->getDefaultEvents("folder");
|
||||
|
||||
$this->setDelimiter($delimiter);
|
||||
$this->path = $folder_name;
|
||||
$this->full_name = $this->decodeName($folder_name);
|
||||
$this->name = $this->getSimpleName($this->delimiter, $this->full_name);
|
||||
|
||||
$this->parseAttributes($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new search query instance
|
||||
* @param string[] $extensions
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function query(array $extensions = []): WhereQuery {
|
||||
$this->getClient()->checkConnection();
|
||||
$this->getClient()->openFolder($this->path);
|
||||
$extensions = count($extensions) > 0 ? $extensions : $this->getClient()->extensions;
|
||||
|
||||
return new WhereQuery($this->getClient(), $extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new search query instance
|
||||
* @param string[] $extensions
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function search(array $extensions = []): WhereQuery {
|
||||
return $this->query($extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new search query instance
|
||||
* @param string[] $extensions
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function messages(array $extensions = []): WhereQuery {
|
||||
return $this->query($extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if folder has children.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasChildren(): bool {
|
||||
return $this->has_children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set children.
|
||||
* @param FolderCollection|array $children
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setChildren($children = []): Folder {
|
||||
$this->children = $children;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode name.
|
||||
* It converts UTF7-IMAP encoding to UTF-8.
|
||||
* @param $name
|
||||
*
|
||||
* @return array|false|string|string[]|null
|
||||
*/
|
||||
protected function decodeName($name) {
|
||||
return mb_convert_encoding($name, "UTF-8", "UTF7-IMAP");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get simple name (without parent folders).
|
||||
* @param $delimiter
|
||||
* @param $full_name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getSimpleName($delimiter, $full_name) {
|
||||
$arr = explode($delimiter, $full_name);
|
||||
|
||||
return end($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse attributes and set it to object properties.
|
||||
* @param $attributes
|
||||
*/
|
||||
protected function parseAttributes($attributes) {
|
||||
$this->no_inferiors = in_array('\NoInferiors', $attributes);
|
||||
$this->no_select = in_array('\NoSelect', $attributes);
|
||||
$this->marked = in_array('\Marked', $attributes);
|
||||
$this->referral = in_array('\Referral', $attributes);
|
||||
$this->has_children = in_array('\HasChildren', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move or rename the current folder
|
||||
* @param string $new_name
|
||||
* @param boolean $expunge
|
||||
*
|
||||
* @return bool
|
||||
* @throws ConnectionFailedException
|
||||
* @throws Exceptions\EventNotFoundException
|
||||
* @throws Exceptions\FolderFetchingException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function move(string $new_name, bool $expunge = true): bool {
|
||||
$this->client->checkConnection();
|
||||
$status = $this->client->getConnection()->renameFolder($this->full_name, $new_name);
|
||||
if($expunge) $this->client->expunge();
|
||||
|
||||
$folder = $this->client->getFolder($new_name);
|
||||
$event = $this->getEvent("folder", "moved");
|
||||
$event::dispatch($this, $folder);
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a message overview
|
||||
* @param string|null $sequence uid sequence
|
||||
*
|
||||
* @return array
|
||||
* @throws ConnectionFailedException
|
||||
* @throws Exceptions\InvalidMessageDateException
|
||||
* @throws Exceptions\MessageNotFoundException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function overview(string $sequence = null): array {
|
||||
$this->client->openFolder($this->path);
|
||||
$sequence = $sequence === null ? "1:*" : $sequence;
|
||||
$uid = ClientManager::get('options.sequence', IMAP::ST_MSGN) == IMAP::ST_UID;
|
||||
return $this->client->getConnection()->overview($sequence, $uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a string message to the current mailbox
|
||||
* @param string $message
|
||||
* @param array|null $options
|
||||
* @param string|null|Carbon $internal_date
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function appendMessage(string $message, array $options = null, $internal_date = null): bool {
|
||||
/**
|
||||
* Check if $internal_date is parsed. If it is null it should not be set. Otherwise, the message can't be stored.
|
||||
* If this parameter is set, it will set the INTERNALDATE on the appended message. The parameter should be a
|
||||
* date string that conforms to the rfc2060 specifications for a date_time value or be a Carbon object.
|
||||
*/
|
||||
|
||||
if ($internal_date instanceof Carbon){
|
||||
$internal_date = $internal_date->format('d-M-Y H:i:s O');
|
||||
}
|
||||
|
||||
return $this->client->getConnection()->appendMessage($this->path, $message, $options, $internal_date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename the current folder
|
||||
* @param string $new_name
|
||||
* @param boolean $expunge
|
||||
*
|
||||
* @return bool
|
||||
* @throws ConnectionFailedException
|
||||
* @throws Exceptions\EventNotFoundException
|
||||
* @throws Exceptions\FolderFetchingException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function rename(string $new_name, bool $expunge = true): bool {
|
||||
return $this->move($new_name, $expunge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the current folder
|
||||
* @param boolean $expunge
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
* @throws Exceptions\EventNotFoundException
|
||||
*/
|
||||
public function delete(bool $expunge = true): bool {
|
||||
$status = $this->client->getConnection()->deleteFolder($this->path);
|
||||
if($expunge) $this->client->expunge();
|
||||
|
||||
$event = $this->getEvent("folder", "deleted");
|
||||
$event::dispatch($this);
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe the current folder
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function subscribe(): bool {
|
||||
$this->client->openFolder($this->path);
|
||||
return $this->client->getConnection()->subscribeFolder($this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribe the current folder
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function unsubscribe(): bool {
|
||||
$this->client->openFolder($this->path);
|
||||
return $this->client->getConnection()->unsubscribeFolder($this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Idle the current connection
|
||||
* @param callable $callback
|
||||
* @param integer $timeout max 1740 seconds - recommended by rfc2177 §3. Should not be lower than the servers "* OK Still here" message interval
|
||||
* @param boolean $auto_reconnect try to reconnect on connection close (@deprecated is no longer required)
|
||||
*
|
||||
* @throws ConnectionFailedException
|
||||
* @throws Exceptions\InvalidMessageDateException
|
||||
* @throws Exceptions\MessageContentFetchingException
|
||||
* @throws Exceptions\MessageHeaderFetchingException
|
||||
* @throws Exceptions\RuntimeException
|
||||
* @throws Exceptions\EventNotFoundException
|
||||
* @throws Exceptions\MessageFlagException
|
||||
* @throws Exceptions\MessageNotFoundException
|
||||
* @throws Exceptions\NotSupportedCapabilityException
|
||||
*/
|
||||
public function idle(callable $callback, int $timeout = 300, bool $auto_reconnect = false) {
|
||||
$this->client->setTimeout($timeout);
|
||||
if (!in_array("IDLE", $this->client->getConnection()->getCapabilities())) {
|
||||
throw new NotSupportedCapabilityException("IMAP server does not support IDLE");
|
||||
}
|
||||
$this->client->openFolder($this->path, true);
|
||||
$connection = $this->client->getConnection();
|
||||
$connection->idle();
|
||||
|
||||
$sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN);
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
// This polymorphic call is fine - Protocol::idle() will throw an exception beforehand
|
||||
$line = $connection->nextLine();
|
||||
|
||||
if (($pos = strpos($line, "EXISTS")) !== false) {
|
||||
$connection->done();
|
||||
$msgn = (int) substr($line, 2, $pos -2);
|
||||
|
||||
$this->client->openFolder($this->path, true);
|
||||
$message = $this->query()->getMessageByMsgn($msgn);
|
||||
$message->setSequence($sequence);
|
||||
$callback($message);
|
||||
|
||||
$event = $this->getEvent("message", "new");
|
||||
$event::dispatch($message);
|
||||
$connection->idle();
|
||||
} elseif (strpos($line, "OK") === false) {
|
||||
$connection->done();
|
||||
$connection->idle();
|
||||
}
|
||||
}catch (Exceptions\RuntimeException $e) {
|
||||
if(strpos($e->getMessage(), "empty response") >= 0 && $connection->connected()) {
|
||||
$connection->done();
|
||||
$connection->idle();
|
||||
continue;
|
||||
}
|
||||
if(strpos($e->getMessage(), "connection closed") === false) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$this->client->reconnect();
|
||||
$this->client->openFolder($this->path, true);
|
||||
|
||||
$connection = $this->client->getConnection();
|
||||
$connection->idle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get folder status information
|
||||
*
|
||||
* @return array
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function getStatus(): array {
|
||||
return $this->examine();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws ConnectionFailedException
|
||||
*/
|
||||
public function loadStatus(): Folder
|
||||
{
|
||||
$this->status = $this->getStatus();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Examine the current folder
|
||||
*
|
||||
* @return array
|
||||
* @throws Exceptions\ConnectionFailedException
|
||||
* @throws Exceptions\RuntimeException
|
||||
*/
|
||||
public function examine(): array {
|
||||
$result = $this->client->getConnection()->examineFolder($this->path);
|
||||
return is_array($result) ? $result : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current Client instance
|
||||
*
|
||||
* @return Client
|
||||
*/
|
||||
public function getClient(): Client {
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the delimiter
|
||||
* @param $delimiter
|
||||
*/
|
||||
public function setDelimiter($delimiter){
|
||||
if(in_array($delimiter, [null, '', ' ', false]) === true) {
|
||||
$delimiter = ClientManager::get('options.delimiter', '/');
|
||||
}
|
||||
|
||||
$this->delimiter = $delimiter;
|
||||
}
|
||||
}
|
||||
546
vendor/webklex/php-imap/src/Query/WhereQuery.php
vendored
546
vendor/webklex/php-imap/src/Query/WhereQuery.php
vendored
@@ -1,546 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* File: Query.php
|
||||
* Category: -
|
||||
* Author: M. Goldenbaum
|
||||
* Created: 21.07.18 18:54
|
||||
* Updated: -
|
||||
*
|
||||
* Description:
|
||||
* -
|
||||
*/
|
||||
|
||||
namespace Webklex\PHPIMAP\Query;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Str;
|
||||
use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
|
||||
use Webklex\PHPIMAP\Exceptions\MethodNotFoundException;
|
||||
use Webklex\PHPIMAP\Exceptions\MessageSearchValidationException;
|
||||
|
||||
/**
|
||||
* Class WhereQuery
|
||||
*
|
||||
* @package Webklex\PHPIMAP\Query
|
||||
*
|
||||
* @method WhereQuery all()
|
||||
* @method WhereQuery answered()
|
||||
* @method WhereQuery deleted()
|
||||
* @method WhereQuery new()
|
||||
* @method WhereQuery old()
|
||||
* @method WhereQuery recent()
|
||||
* @method WhereQuery seen()
|
||||
* @method WhereQuery unanswered()
|
||||
* @method WhereQuery undeleted()
|
||||
* @method WhereQuery unflagged()
|
||||
* @method WhereQuery unseen()
|
||||
* @method WhereQuery not()
|
||||
* @method WhereQuery unkeyword($value)
|
||||
* @method WhereQuery to($value)
|
||||
* @method WhereQuery text($value)
|
||||
* @method WhereQuery subject($value)
|
||||
* @method WhereQuery since($date)
|
||||
* @method WhereQuery on($date)
|
||||
* @method WhereQuery keyword($value)
|
||||
* @method WhereQuery from($value)
|
||||
* @method WhereQuery flagged()
|
||||
* @method WhereQuery cc($value)
|
||||
* @method WhereQuery body($value)
|
||||
* @method WhereQuery before($date)
|
||||
* @method WhereQuery bcc($value)
|
||||
* @method WhereQuery inReplyTo($value)
|
||||
* @method WhereQuery messageId($value)
|
||||
*
|
||||
* @mixin Query
|
||||
*/
|
||||
class WhereQuery extends Query {
|
||||
|
||||
/**
|
||||
* @var array $available_criteria
|
||||
*/
|
||||
protected $available_criteria = [
|
||||
'OR', 'AND',
|
||||
'ALL', 'ANSWERED', 'BCC', 'BEFORE', 'BODY', 'CC', 'DELETED', 'FLAGGED', 'FROM', 'KEYWORD',
|
||||
'NEW', 'NOT', 'OLD', 'ON', 'RECENT', 'SEEN', 'SINCE', 'SUBJECT', 'TEXT', 'TO',
|
||||
'UNANSWERED', 'UNDELETED', 'UNFLAGGED', 'UNKEYWORD', 'UNSEEN', 'UID'
|
||||
];
|
||||
|
||||
/**
|
||||
* Magic method in order to allow alias usage of all "where" methods in an optional connection with "NOT"
|
||||
* @param string $name
|
||||
* @param array|null $arguments
|
||||
*
|
||||
* @return mixed
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
* @throws MethodNotFoundException
|
||||
*/
|
||||
public function __call(string $name, $arguments) {
|
||||
$that = $this;
|
||||
|
||||
$name = Str::camel($name);
|
||||
|
||||
if (strtolower(substr($name, 0, 3)) === 'not') {
|
||||
$that = $that->whereNot();
|
||||
$name = substr($name, 3);
|
||||
}
|
||||
|
||||
if (strpos(strtolower($name), "where") === false) {
|
||||
$method = 'where' . ucfirst($name);
|
||||
} else {
|
||||
$method = lcfirst($name);
|
||||
}
|
||||
|
||||
if (method_exists($this, $method) === true) {
|
||||
return call_user_func_array([$that, $method], $arguments);
|
||||
}
|
||||
|
||||
throw new MethodNotFoundException("Method " . self::class . '::' . $method . '() is not supported');
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a given criteria
|
||||
* @param $criteria
|
||||
*
|
||||
* @return string
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
protected function validate_criteria($criteria): string {
|
||||
$command = strtoupper($criteria);
|
||||
if (substr($command, 0, 7) === "CUSTOM ") {
|
||||
return substr($criteria, 7);
|
||||
}
|
||||
if (in_array($command, $this->available_criteria) === false) {
|
||||
throw new InvalidWhereQueryCriteriaException("Invalid imap search criteria: $command");
|
||||
}
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register search parameters
|
||||
* @param mixed $criteria
|
||||
* @param null $value
|
||||
*
|
||||
* @return $this
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*
|
||||
* Examples:
|
||||
* $query->from("someone@email.tld")->seen();
|
||||
* $query->whereFrom("someone@email.tld")->whereSeen();
|
||||
* $query->where([["FROM" => "someone@email.tld"], ["SEEN"]]);
|
||||
* $query->where(["FROM" => "someone@email.tld"])->where(["SEEN"]);
|
||||
* $query->where(["FROM" => "someone@email.tld", "SEEN"]);
|
||||
* $query->where("FROM", "someone@email.tld")->where("SEEN");
|
||||
*/
|
||||
public function where($criteria, $value = null): WhereQuery {
|
||||
if (is_array($criteria)) {
|
||||
foreach ($criteria as $key => $value) {
|
||||
if (is_numeric($key)) {
|
||||
$this->where($value);
|
||||
}else{
|
||||
$this->where($key, $value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->push_search_criteria($criteria, $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a given search criteria and value pair to the search query
|
||||
* @param $criteria string
|
||||
* @param $value mixed
|
||||
*
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
protected function push_search_criteria(string $criteria, $value){
|
||||
$criteria = $this->validate_criteria($criteria);
|
||||
$value = $this->parse_value($value);
|
||||
|
||||
if ($value === null || $value === '') {
|
||||
$this->query->push([$criteria]);
|
||||
} else {
|
||||
$this->query->push([$criteria, $value]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Closure $closure
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function orWhere(Closure $closure = null): WhereQuery {
|
||||
$this->query->push(['OR']);
|
||||
if ($closure !== null) $closure($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Closure $closure
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function andWhere(Closure $closure = null): WhereQuery {
|
||||
$this->query->push(['AND']);
|
||||
if ($closure !== null) $closure($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereAll(): WhereQuery {
|
||||
return $this->where('ALL');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereAnswered(): WhereQuery {
|
||||
return $this->where('ANSWERED');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereBcc(string $value): WhereQuery {
|
||||
return $this->where('BCC', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
* @throws MessageSearchValidationException
|
||||
*/
|
||||
public function whereBefore($value): WhereQuery {
|
||||
$date = $this->parse_date($value);
|
||||
return $this->where('BEFORE', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereBody(string $value): WhereQuery {
|
||||
return $this->where('BODY', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereCc(string $value): WhereQuery {
|
||||
return $this->where('CC', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereDeleted(): WhereQuery {
|
||||
return $this->where('DELETED');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereFlagged(string $value): WhereQuery {
|
||||
return $this->where('FLAGGED', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereFrom(string $value): WhereQuery {
|
||||
return $this->where('FROM', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereKeyword(string $value): WhereQuery {
|
||||
return $this->where('KEYWORD', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereNew(): WhereQuery {
|
||||
return $this->where('NEW');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereNot(): WhereQuery {
|
||||
return $this->where('NOT');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereOld(): WhereQuery {
|
||||
return $this->where('OLD');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws MessageSearchValidationException
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereOn($value): WhereQuery {
|
||||
$date = $this->parse_date($value);
|
||||
return $this->where('ON', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereRecent(): WhereQuery {
|
||||
return $this->where('RECENT');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereSeen(): WhereQuery {
|
||||
return $this->where('SEEN');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws MessageSearchValidationException
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereSince($value): WhereQuery {
|
||||
$date = $this->parse_date($value);
|
||||
return $this->where('SINCE', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereSubject(string $value): WhereQuery {
|
||||
return $this->where('SUBJECT', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereText(string $value): WhereQuery {
|
||||
return $this->where('TEXT', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereTo(string $value): WhereQuery {
|
||||
return $this->where('TO', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereUnkeyword(string $value): WhereQuery {
|
||||
return $this->where('UNKEYWORD', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereUnanswered(): WhereQuery {
|
||||
return $this->where('UNANSWERED');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereUndeleted(): WhereQuery {
|
||||
return $this->where('UNDELETED');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereUnflagged(): WhereQuery {
|
||||
return $this->where('UNFLAGGED');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereUnseen(): WhereQuery {
|
||||
return $this->where('UNSEEN');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereNoXSpam(): WhereQuery {
|
||||
return $this->where("CUSTOM X-Spam-Flag NO");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereIsXSpam(): WhereQuery {
|
||||
return $this->where("CUSTOM X-Spam-Flag YES");
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a specific header value
|
||||
* @param $header
|
||||
* @param $value
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereHeader($header, $value): WhereQuery {
|
||||
return $this->where("CUSTOM HEADER $header $value");
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a specific message id
|
||||
* @param $messageId
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereMessageId($messageId): WhereQuery {
|
||||
return $this->whereHeader("Message-ID", $messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a specific message id
|
||||
* @param $messageId
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereInReplyTo($messageId): WhereQuery {
|
||||
return $this->whereHeader("In-Reply-To", $messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $country_code
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereLanguage($country_code): WhereQuery {
|
||||
return $this->where("Content-Language $country_code");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message be it UID.
|
||||
*
|
||||
* @param int|string $uid
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereUid($uid): WhereQuery {
|
||||
return $this->where('UID', $uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messages by their UIDs.
|
||||
*
|
||||
* @param array<int, int> $uids
|
||||
*
|
||||
* @return WhereQuery
|
||||
* @throws InvalidWhereQueryCriteriaException
|
||||
*/
|
||||
public function whereUidIn(array $uids): WhereQuery {
|
||||
$uids = implode(',', $uids);
|
||||
return $this->where('UID', $uids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback if the given "value" is truthy.
|
||||
* copied from @url https://github.com/laravel/framework/blob/8.x/src/Illuminate/Support/Traits/Conditionable.php
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return $this|mixed
|
||||
*/
|
||||
public function when($value, callable $callback, $default = null) {
|
||||
if ($value) {
|
||||
return $callback($this, $value) ?: $this;
|
||||
} elseif ($default) {
|
||||
return $default($this, $value) ?: $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback if the given "value" is falsy.
|
||||
* copied from @url https://github.com/laravel/framework/blob/8.x/src/Illuminate/Support/Traits/Conditionable.php
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return $this|mixed
|
||||
*/
|
||||
public function unless($value, callable $callback, $default = null) {
|
||||
if (!$value) {
|
||||
return $callback($this, $value) ?: $this;
|
||||
} elseif ($default) {
|
||||
return $default($this, $value) ?: $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user