From 2e191998b9832b609fcdbc6ac606311517bf48ef Mon Sep 17 00:00:00 2001 From: Jamison Valenta Date: Fri, 17 Feb 2023 14:29:42 -0700 Subject: [PATCH] v9.51.0 changes --- framework-9.50.2/CHANGELOG.md | 1535 ------- framework-9.50.2/LICENSE.md | 21 - framework-9.50.2/README.md | 47 - framework-9.50.2/composer.json | 184 - .../Auth/Access/AuthorizationException.php | 114 - .../Auth/Access/Events/GateEvaluated.php | 51 - .../src/Illuminate/Auth/Access/Gate.php | 872 ---- .../Auth/Access/HandlesAuthorization.php | 55 - .../src/Illuminate/Auth/Access/Response.php | 215 - .../src/Illuminate/Auth/AuthManager.php | 342 -- .../Illuminate/Auth/AuthServiceProvider.php | 112 - .../src/Illuminate/Auth/Authenticatable.php | 88 - .../Auth/AuthenticationException.php | 58 - .../Auth/Console/ClearResetsCommand.php | 47 - .../Console/stubs/make/views/layouts/app.stub | 76 - .../Illuminate/Auth/CreatesUserProviders.php | 91 - .../Illuminate/Auth/DatabaseUserProvider.php | 161 - .../Illuminate/Auth/EloquentUserProvider.php | 255 -- .../src/Illuminate/Auth/Events/Attempting.php | 42 - .../Illuminate/Auth/Events/Authenticated.php | 37 - .../Auth/Events/CurrentDeviceLogout.php | 37 - .../src/Illuminate/Auth/Events/Failed.php | 42 - .../src/Illuminate/Auth/Events/Lockout.php | 26 - .../src/Illuminate/Auth/Events/Login.php | 46 - .../src/Illuminate/Auth/Events/Logout.php | 37 - .../Auth/Events/OtherDeviceLogout.php | 37 - .../Illuminate/Auth/Events/PasswordReset.php | 28 - .../src/Illuminate/Auth/Events/Registered.php | 28 - .../src/Illuminate/Auth/Events/Validated.php | 37 - .../src/Illuminate/Auth/Events/Verified.php | 28 - .../src/Illuminate/Auth/GenericUser.php | 132 - .../src/Illuminate/Auth/GuardHelpers.php | 130 - .../src/Illuminate/Auth/LICENSE.md | 21 - .../SendEmailVerificationNotification.php | 22 - .../Auth/Middleware/Authenticate.php | 97 - .../Middleware/AuthenticateWithBasicAuth.php | 45 - .../Illuminate/Auth/Middleware/Authorize.php | 93 - .../Auth/Middleware/EnsureEmailIsVerified.php | 32 - .../Auth/Middleware/RequirePassword.php | 86 - .../src/Illuminate/Auth/MustVerifyEmail.php | 50 - .../Auth/Notifications/ResetPassword.php | 124 - .../Auth/Notifications/VerifyEmail.php | 114 - .../Auth/Passwords/CanResetPassword.php | 29 - .../Passwords/DatabaseTokenRepository.php | 246 -- .../Auth/Passwords/PasswordBroker.php | 190 - .../Auth/Passwords/PasswordBrokerManager.php | 145 - .../PasswordResetServiceProvider.php | 45 - .../Passwords/TokenRepositoryInterface.php | 48 - .../src/Illuminate/Auth/Recaller.php | 96 - .../src/Illuminate/Auth/RequestGuard.php | 87 - .../src/Illuminate/Auth/SessionGuard.php | 962 ----- .../src/Illuminate/Auth/TokenGuard.php | 149 - .../src/Illuminate/Auth/composer.json | 44 - .../Broadcasting/BroadcastController.php | 44 - .../Broadcasting/BroadcastEvent.php | 148 - .../Broadcasting/BroadcastException.php | 10 - .../Broadcasting/BroadcastManager.php | 481 --- .../Broadcasting/BroadcastServiceProvider.php | 45 - .../Broadcasters/AblyBroadcaster.php | 235 - .../Broadcasting/Broadcasters/Broadcaster.php | 376 -- .../Broadcasters/LogBroadcaster.php | 54 - .../Broadcasters/NullBroadcaster.php | 30 - .../Broadcasters/PusherBroadcaster.php | 190 - .../Broadcasters/RedisBroadcaster.php | 169 - .../UsePusherChannelConventions.php | 36 - .../src/Illuminate/Broadcasting/Channel.php | 36 - .../Broadcasting/EncryptedPrivateChannel.php | 17 - .../InteractsWithBroadcasting.php | 40 - .../Broadcasting/InteractsWithSockets.php | 39 - .../src/Illuminate/Broadcasting/LICENSE.md | 21 - .../Broadcasting/PendingBroadcast.php | 74 - .../Broadcasting/PresenceChannel.php | 17 - .../Broadcasting/PrivateChannel.php | 21 - .../Broadcasting/UniqueBroadcastEvent.php | 61 - .../src/Illuminate/Broadcasting/composer.json | 45 - framework-9.50.2/src/Illuminate/Bus/Batch.php | 480 --- .../src/Illuminate/Bus/BatchFactory.php | 58 - .../src/Illuminate/Bus/BatchRepository.php | 92 - .../src/Illuminate/Bus/Batchable.php | 108 - .../src/Illuminate/Bus/BusServiceProvider.php | 70 - .../Bus/DatabaseBatchRepository.php | 388 -- .../src/Illuminate/Bus/Dispatcher.php | 295 -- .../Illuminate/Bus/Events/BatchDispatched.php | 26 - .../src/Illuminate/Bus/LICENSE.md | 21 - .../src/Illuminate/Bus/PendingBatch.php | 319 -- .../Bus/PrunableBatchRepository.php | 16 - .../src/Illuminate/Bus/Queueable.php | 276 -- .../src/Illuminate/Bus/UniqueLock.php | 75 - .../Illuminate/Bus/UpdatedBatchJobCounts.php | 43 - .../src/Illuminate/Bus/composer.json | 40 - .../src/Illuminate/Cache/ApcStore.php | 130 - .../src/Illuminate/Cache/ApcWrapper.php | 92 - .../src/Illuminate/Cache/ArrayLock.php | 102 - .../src/Illuminate/Cache/ArrayStore.php | 218 - .../src/Illuminate/Cache/CacheLock.php | 85 - .../src/Illuminate/Cache/CacheManager.php | 421 -- .../Illuminate/Cache/CacheServiceProvider.php | 52 - .../Cache/Console/CacheTableCommand.php | 94 - .../Illuminate/Cache/Console/ClearCommand.php | 158 - .../Cache/Console/ForgetCommand.php | 70 - .../Illuminate/Cache/Console/stubs/cache.stub | 39 - .../src/Illuminate/Cache/DatabaseLock.php | 147 - .../src/Illuminate/Cache/DatabaseStore.php | 395 -- .../src/Illuminate/Cache/DynamoDbLock.php | 77 - .../src/Illuminate/Cache/DynamoDbStore.php | 538 --- .../Illuminate/Cache/Events/CacheEvent.php | 46 - .../src/Illuminate/Cache/Events/CacheHit.php | 28 - .../Illuminate/Cache/Events/CacheMissed.php | 8 - .../Illuminate/Cache/Events/KeyForgotten.php | 8 - .../Illuminate/Cache/Events/KeyWritten.php | 37 - .../src/Illuminate/Cache/FileStore.php | 351 -- .../src/Illuminate/Cache/HasCacheLock.php | 31 - .../src/Illuminate/Cache/LICENSE.md | 21 - .../src/Illuminate/Cache/Lock.php | 167 - .../src/Illuminate/Cache/LuaScripts.php | 25 - .../Illuminate/Cache/MemcachedConnector.php | 87 - .../src/Illuminate/Cache/MemcachedLock.php | 75 - .../src/Illuminate/Cache/MemcachedStore.php | 279 -- .../src/Illuminate/Cache/NoLock.php | 46 - .../src/Illuminate/Cache/NullStore.php | 126 - .../src/Illuminate/Cache/PhpRedisLock.php | 35 - .../src/Illuminate/Cache/RateLimiter.php | 221 - .../Cache/RateLimiting/GlobalLimit.php | 18 - .../Illuminate/Cache/RateLimiting/Limit.php | 132 - .../Cache/RateLimiting/Unlimited.php | 16 - .../src/Illuminate/Cache/RedisLock.php | 83 - .../src/Illuminate/Cache/RedisStore.php | 347 -- .../src/Illuminate/Cache/RedisTaggedCache.php | 214 - .../src/Illuminate/Cache/Repository.php | 690 --- .../Cache/RetrievesMultipleKeys.php | 49 - .../src/Illuminate/Cache/TagSet.php | 130 - .../src/Illuminate/Cache/TaggableStore.php | 19 - .../src/Illuminate/Cache/TaggedCache.php | 125 - .../src/Illuminate/Cache/composer.json | 47 - .../src/Illuminate/Collections/Arr.php | 860 ---- .../src/Illuminate/Collections/Collection.php | 1763 -------- .../src/Illuminate/Collections/Enumerable.php | 1258 ------ .../HigherOrderCollectionProxy.php | 63 - .../Collections/ItemNotFoundException.php | 9 - .../src/Illuminate/Collections/LICENSE.md | 21 - .../Illuminate/Collections/LazyCollection.php | 1724 -------- .../MultipleItemsFoundException.php | 40 - .../Collections/Traits/EnumeratesValues.php | 1084 ----- .../src/Illuminate/Collections/composer.json | 42 - .../src/Illuminate/Collections/helpers.php | 190 - .../Conditionable/HigherOrderWhenProxy.php | 109 - .../src/Illuminate/Conditionable/LICENSE.md | 21 - .../Conditionable/Traits/Conditionable.php | 73 - .../Illuminate/Conditionable/composer.json | 33 - .../src/Illuminate/Config/LICENSE.md | 21 - .../src/Illuminate/Config/Repository.php | 182 - .../src/Illuminate/Config/composer.json | 35 - .../src/Illuminate/Console/Application.php | 347 -- .../Console/BufferedConsoleOutput.php | 41 - .../Illuminate/Console/CacheCommandMutex.php | 98 - .../src/Illuminate/Console/Command.php | 268 -- .../src/Illuminate/Console/CommandMutex.php | 30 - .../Console/Concerns/CallsCommands.php | 104 - .../Console/Concerns/CreatesMatchingTest.php | 44 - .../Console/Concerns/HasParameters.php | 56 - .../Console/Concerns/InteractsWithIO.php | 453 -- .../Console/Concerns/InteractsWithSignals.php | 51 - .../Concerns/PromptsForMissingInput.php | 108 - .../Illuminate/Console/ConfirmableTrait.php | 54 - .../Console/ContainerCommandLoader.php | 76 - .../Console/Contracts/NewLineAware.php | 13 - .../Console/Events/ArtisanStarting.php | 24 - .../Console/Events/CommandFinished.php | 54 - .../Console/Events/CommandStarting.php | 45 - .../ScheduledBackgroundTaskFinished.php | 26 - .../Console/Events/ScheduledTaskFailed.php | 36 - .../Console/Events/ScheduledTaskFinished.php | 35 - .../Console/Events/ScheduledTaskSkipped.php | 26 - .../Console/Events/ScheduledTaskStarting.php | 26 - .../Illuminate/Console/GeneratorCommand.php | 490 --- .../src/Illuminate/Console/LICENSE.md | 21 - .../src/Illuminate/Console/OutputStyle.php | 131 - .../src/Illuminate/Console/Parser.php | 141 - .../src/Illuminate/Console/QuestionHelper.php | 82 - .../Console/Scheduling/CacheAware.php | 14 - .../Console/Scheduling/CacheEventMutex.php | 81 - .../Scheduling/CacheSchedulingMutex.php | 75 - .../Console/Scheduling/CallbackEvent.php | 201 - .../Console/Scheduling/CommandBuilder.php | 75 - .../Illuminate/Console/Scheduling/Event.php | 978 ----- .../Console/Scheduling/EventMutex.php | 30 - .../Console/Scheduling/ManagesFrequencies.php | 565 --- .../Console/Scheduling/Schedule.php | 367 -- .../Scheduling/ScheduleClearCacheCommand.php | 47 - .../Scheduling/ScheduleFinishCommand.php | 61 - .../Scheduling/ScheduleListCommand.php | 259 -- .../Console/Scheduling/ScheduleRunCommand.php | 207 - .../Scheduling/ScheduleTestCommand.php | 99 - .../Scheduling/ScheduleWorkCommand.php | 77 - .../Console/Scheduling/SchedulingMutex.php | 26 - .../src/Illuminate/Console/Signals.php | 152 - .../Console/View/Components/Alert.php | 28 - .../Console/View/Components/Ask.php | 18 - .../View/Components/AskWithCompletion.php | 29 - .../Console/View/Components/BulletList.php | 28 - .../Console/View/Components/Choice.php | 29 - .../Console/View/Components/Component.php | 124 - .../Console/View/Components/Confirm.php | 20 - .../Console/View/Components/Error.php | 20 - .../Console/View/Components/Factory.php | 60 - .../Console/View/Components/Info.php | 20 - .../Console/View/Components/Line.php | 54 - .../EnsureDynamicContentIsHighlighted.php | 17 - .../Mutators/EnsureNoPunctuation.php | 21 - .../Components/Mutators/EnsurePunctuation.php | 21 - .../Mutators/EnsureRelativePaths.php | 21 - .../Console/View/Components/Task.php | 57 - .../View/Components/TwoColumnDetail.php | 36 - .../Console/View/Components/Warn.php | 21 - .../src/Illuminate/Console/composer.json | 49 - .../resources/views/components/alert.php | 3 - .../views/components/bullet-list.php | 7 - .../resources/views/components/line.php | 8 - .../views/components/two-column-detail.php | 11 - .../src/Illuminate/Container/BoundMethod.php | 202 - .../src/Illuminate/Container/Container.php | 1479 ------- .../Container/ContextualBindingBuilder.php | 96 - .../Container/EntryNotFoundException.php | 11 - .../src/Illuminate/Container/LICENSE.md | 21 - .../Container/RewindableGenerator.php | 61 - .../src/Illuminate/Container/Util.php | 74 - .../src/Illuminate/Container/composer.json | 38 - .../Contracts/Auth/Access/Authorizable.php | 15 - .../Illuminate/Contracts/Auth/Access/Gate.php | 150 - .../Contracts/Auth/Authenticatable.php | 49 - .../Contracts/Auth/CanResetPassword.php | 21 - .../src/Illuminate/Contracts/Auth/Factory.php | 22 - .../src/Illuminate/Contracts/Auth/Guard.php | 57 - .../Auth/Middleware/AuthenticatesRequests.php | 8 - .../Contracts/Auth/MustVerifyEmail.php | 34 - .../Contracts/Auth/PasswordBroker.php | 61 - .../Contracts/Auth/PasswordBrokerFactory.php | 14 - .../Contracts/Auth/StatefulGuard.php | 63 - .../Contracts/Auth/SupportsBasicAuth.php | 24 - .../Contracts/Auth/UserProvider.php | 49 - .../Contracts/Broadcasting/Broadcaster.php | 35 - .../Contracts/Broadcasting/Factory.php | 14 - .../Broadcasting/HasBroadcastChannel.php | 20 - .../Contracts/Broadcasting/ShouldBeUnique.php | 8 - .../Broadcasting/ShouldBroadcast.php | 13 - .../Broadcasting/ShouldBroadcastNow.php | 8 - .../Illuminate/Contracts/Bus/Dispatcher.php | 66 - .../Contracts/Bus/QueueingDispatcher.php | 30 - .../Illuminate/Contracts/Cache/Factory.php | 14 - .../src/Illuminate/Contracts/Cache/Lock.php | 44 - .../Contracts/Cache/LockProvider.php | 25 - .../Contracts/Cache/LockTimeoutException.php | 10 - .../Illuminate/Contracts/Cache/Repository.php | 116 - .../src/Illuminate/Contracts/Cache/Store.php | 92 - .../Contracts/Config/Repository.php | 57 - .../Contracts/Console/Application.php | 23 - .../Contracts/Console/Isolatable.php | 8 - .../Illuminate/Contracts/Console/Kernel.php | 64 - .../Console/PromptsForMissingInput.php | 8 - .../Container/BindingResolutionException.php | 11 - .../Container/CircularDependencyException.php | 11 - .../Contracts/Container/Container.php | 210 - .../Container/ContextualBindingBuilder.php | 39 - .../Illuminate/Contracts/Cookie/Factory.php | 47 - .../Contracts/Cookie/QueueingFactory.php | 30 - .../Contracts/Database/Eloquent/Builder.php | 14 - .../Contracts/Database/Eloquent/Castable.php | 14 - .../Database/Eloquent/CastsAttributes.php | 32 - .../Eloquent/CastsInboundAttributes.php | 17 - .../Eloquent/DeviatesCastableAttributes.php | 28 - .../Eloquent/SerializesCastableAttributes.php | 17 - .../Eloquent/SupportsPartialRelations.php | 30 - .../Database/Events/MigrationEvent.php | 8 - .../Contracts/Database/ModelIdentifier.php | 73 - .../Contracts/Database/Query/Builder.php | 12 - .../Contracts/Debug/ExceptionHandler.php | 48 - .../Contracts/Encryption/DecryptException.php | 10 - .../Contracts/Encryption/EncryptException.php | 10 - .../Contracts/Encryption/Encrypter.php | 35 - .../Contracts/Encryption/StringEncrypter.php | 26 - .../Contracts/Events/Dispatcher.php | 82 - .../Illuminate/Contracts/Filesystem/Cloud.php | 14 - .../Contracts/Filesystem/Factory.php | 14 - .../Filesystem/FileNotFoundException.php | 10 - .../Contracts/Filesystem/Filesystem.php | 191 - .../Filesystem/LockTimeoutException.php | 10 - .../Contracts/Foundation/Application.php | 231 - .../Foundation/CachesConfiguration.php | 27 - .../Contracts/Foundation/CachesRoutes.php | 20 - .../Foundation/ExceptionRenderer.php | 14 - .../Contracts/Foundation/MaintenanceMode.php | 35 - .../Illuminate/Contracts/Hashing/Hasher.php | 42 - .../src/Illuminate/Contracts/Http/Kernel.php | 37 - .../src/Illuminate/Contracts/LICENSE.md | 21 - .../Illuminate/Contracts/Mail/Attachable.php | 13 - .../src/Illuminate/Contracts/Mail/Factory.php | 14 - .../Illuminate/Contracts/Mail/MailQueue.php | 25 - .../Illuminate/Contracts/Mail/Mailable.php | 76 - .../src/Illuminate/Contracts/Mail/Mailer.php | 41 - .../Contracts/Notifications/Dispatcher.php | 24 - .../Contracts/Notifications/Factory.php | 32 - .../Contracts/Pagination/CursorPaginator.php | 117 - .../Pagination/LengthAwarePaginator.php | 29 - .../Contracts/Pagination/Paginator.php | 124 - .../src/Illuminate/Contracts/Pipeline/Hub.php | 15 - .../Contracts/Pipeline/Pipeline.php | 40 - .../Contracts/Queue/ClearableQueue.php | 14 - .../Queue/EntityNotFoundException.php | 22 - .../Contracts/Queue/EntityResolver.php | 15 - .../Illuminate/Contracts/Queue/Factory.php | 14 - .../src/Illuminate/Contracts/Queue/Job.php | 164 - .../Illuminate/Contracts/Queue/Monitor.php | 30 - .../src/Illuminate/Contracts/Queue/Queue.php | 99 - .../Contracts/Queue/QueueableCollection.php | 34 - .../Contracts/Queue/QueueableEntity.php | 27 - .../Contracts/Queue/ShouldBeEncrypted.php | 8 - .../Contracts/Queue/ShouldBeUnique.php | 8 - .../Queue/ShouldBeUniqueUntilProcessing.php | 8 - .../Contracts/Queue/ShouldQueue.php | 8 - .../Illuminate/Contracts/Redis/Connection.php | 35 - .../Illuminate/Contracts/Redis/Connector.php | 25 - .../Illuminate/Contracts/Redis/Factory.php | 14 - .../Redis/LimiterTimeoutException.php | 10 - .../Contracts/Routing/BindingRegistrar.php | 23 - .../Contracts/Routing/Registrar.php | 105 - .../Contracts/Routing/ResponseFactory.php | 155 - .../Contracts/Routing/UrlGenerator.php | 86 - .../Contracts/Routing/UrlRoutable.php | 39 - .../Middleware/AuthenticatesSessions.php | 8 - .../Illuminate/Contracts/Session/Session.php | 204 - .../Contracts/Support/Arrayable.php | 17 - .../Support/CanBeEscapedWhenCastToString.php | 14 - .../Contracts/Support/DeferrableProvider.php | 13 - .../Support/DeferringDisplayableValue.php | 13 - .../Illuminate/Contracts/Support/Htmlable.php | 13 - .../Illuminate/Contracts/Support/Jsonable.php | 14 - .../Contracts/Support/MessageBag.php | 102 - .../Contracts/Support/MessageProvider.php | 13 - .../Contracts/Support/Renderable.php | 13 - .../Contracts/Support/Responsable.php | 14 - .../Contracts/Support/ValidatedData.php | 11 - .../Translation/HasLocalePreference.php | 13 - .../Contracts/Translation/Loader.php | 40 - .../Contracts/Translation/Translator.php | 42 - .../Contracts/Validation/DataAwareRule.php | 14 - .../Contracts/Validation/Factory.php | 46 - .../Contracts/Validation/ImplicitRule.php | 8 - .../Contracts/Validation/InvokableRule.php | 16 - .../Illuminate/Contracts/Validation/Rule.php | 22 - .../Validation/UncompromisedVerifier.php | 14 - .../Validation/ValidatesWhenResolved.php | 13 - .../Contracts/Validation/Validator.php | 65 - .../Validation/ValidatorAwareRule.php | 14 - .../src/Illuminate/Contracts/View/Engine.php | 15 - .../src/Illuminate/Contracts/View/Factory.php | 79 - .../src/Illuminate/Contracts/View/View.php | 31 - .../View/ViewCompilationException.php | 10 - .../src/Illuminate/Contracts/composer.json | 35 - .../src/Illuminate/Cookie/CookieJar.php | 242 -- .../Cookie/CookieServiceProvider.php | 24 - .../Illuminate/Cookie/CookieValuePrefix.php | 44 - .../src/Illuminate/Cookie/LICENSE.md | 21 - .../Middleware/AddQueuedCookiesToResponse.php | 45 - .../Cookie/Middleware/EncryptCookies.php | 226 - .../src/Illuminate/Cookie/composer.json | 39 - .../Illuminate/Database/Capsule/Manager.php | 202 - .../Database/ClassMorphViolationException.php | 29 - .../Database/Concerns/BuildsQueries.php | 506 --- .../Database/Concerns/CompilesJsonPaths.php | 64 - .../Database/Concerns/ExplainsQueries.php | 24 - .../Database/Concerns/ManagesTransactions.php | 348 -- .../Database/Concerns/ParsesSearchPath.php | 25 - .../Database/ConfigurationUrlParser.php | 10 - .../src/Illuminate/Database/Connection.php | 1593 ------- .../Database/ConnectionInterface.php | 170 - .../Database/ConnectionResolver.php | 92 - .../Database/ConnectionResolverInterface.php | 29 - .../Database/Connectors/ConnectionFactory.php | 277 -- .../Database/Connectors/Connector.php | 139 - .../Connectors/ConnectorInterface.php | 14 - .../Database/Connectors/MySqlConnector.php | 208 - .../Database/Connectors/PostgresConnector.php | 216 - .../Database/Connectors/SQLiteConnector.php | 39 - .../Connectors/SqlServerConnector.php | 233 - .../Console/DatabaseInspectionCommand.php | 246 -- .../Illuminate/Database/Console/DbCommand.php | 227 - .../Database/Console/DumpCommand.php | 101 - .../Console/Factories/FactoryMakeCommand.php | 154 - .../Console/Factories/stubs/factory.stub | 23 - .../Console/Migrations/BaseCommand.php | 51 - .../Console/Migrations/FreshCommand.php | 120 - .../Console/Migrations/InstallCommand.php | 70 - .../Console/Migrations/MigrateCommand.php | 281 -- .../Console/Migrations/MigrateMakeCommand.php | 144 - .../Console/Migrations/RefreshCommand.php | 159 - .../Console/Migrations/ResetCommand.php | 91 - .../Console/Migrations/RollbackCommand.php | 91 - .../Console/Migrations/StatusCommand.php | 129 - .../Console/Migrations/TableGuesser.php | 37 - .../Database/Console/MonitorCommand.php | 151 - .../Database/Console/PruneCommand.php | 186 - .../Database/Console/Seeds/SeedCommand.php | 151 - .../Console/Seeds/SeederMakeCommand.php | 103 - .../Console/Seeds/WithoutModelEvents.php | 19 - .../Database/Console/Seeds/stubs/seeder.stub | 19 - .../Database/Console/ShowCommand.php | 189 - .../Database/Console/TableCommand.php | 246 -- .../Database/Console/WipeCommand.php | 125 - .../Database/DBAL/TimestampType.php | 95 - .../Illuminate/Database/DatabaseManager.php | 471 -- .../Database/DatabaseServiceProvider.php | 113 - .../Database/DatabaseTransactionRecord.php | 73 - .../Database/DatabaseTransactionsManager.php | 133 - .../Illuminate/Database/DeadlockException.php | 10 - .../Database/DetectsConcurrencyErrors.php | 37 - .../Database/DetectsLostConnections.php | 66 - .../BroadcastableModelEventOccurred.php | 144 - .../Database/Eloquent/BroadcastsEvents.php | 197 - .../Illuminate/Database/Eloquent/Builder.php | 1952 --------- .../Database/Eloquent/Casts/ArrayObject.php | 45 - .../Database/Eloquent/Casts/AsArrayObject.php | 42 - .../Database/Eloquent/Casts/AsCollection.php | 38 - .../Eloquent/Casts/AsEncryptedArrayObject.php | 45 - .../Eloquent/Casts/AsEncryptedCollection.php | 41 - .../Eloquent/Casts/AsEnumArrayObject.php | 84 - .../Eloquent/Casts/AsEnumCollection.php | 80 - .../Database/Eloquent/Casts/AsStringable.php | 32 - .../Database/Eloquent/Casts/Attribute.php | 105 - .../Database/Eloquent/Collection.php | 782 ---- .../Eloquent/Concerns/GuardsAttributes.php | 255 -- .../Eloquent/Concerns/HasAttributes.php | 2232 ---------- .../Database/Eloquent/Concerns/HasEvents.php | 415 -- .../Eloquent/Concerns/HasGlobalScopes.php | 71 - .../Eloquent/Concerns/HasRelationships.php | 911 ---- .../Eloquent/Concerns/HasTimestamps.php | 224 - .../Database/Eloquent/Concerns/HasUlids.php | 96 - .../Database/Eloquent/Concerns/HasUuids.php | 96 - .../Eloquent/Concerns/HidesAttributes.php | 124 - .../Concerns/QueriesRelationships.php | 879 ---- .../Factories/BelongsToManyRelationship.php | 76 - .../Factories/BelongsToRelationship.php | 97 - .../Eloquent/Factories/CrossJoinSequence.php | 26 - .../Database/Eloquent/Factories/Factory.php | 926 ---- .../Eloquent/Factories/HasFactory.php | 32 - .../Eloquent/Factories/Relationship.php | 75 - .../Database/Eloquent/Factories/Sequence.php | 63 - .../Eloquent/HigherOrderBuilderProxy.php | 50 - .../Eloquent/InvalidCastException.php | 48 - .../Eloquent/JsonEncodingException.php | 49 - .../Eloquent/MassAssignmentException.php | 10 - .../Database/Eloquent/MassPrunable.php | 48 - .../Eloquent/MissingAttributeException.php | 23 - .../Illuminate/Database/Eloquent/Model.php | 2381 ---------- .../Eloquent/ModelNotFoundException.php | 69 - .../Illuminate/Database/Eloquent/Prunable.php | 67 - .../Database/Eloquent/QueueEntityResolver.php | 29 - .../Eloquent/RelationNotFoundException.php | 46 - .../Database/Eloquent/Relations/BelongsTo.php | 383 -- .../Eloquent/Relations/BelongsToMany.php | 1503 ------- .../Eloquent/Relations/Concerns/AsPivot.php | 333 -- .../Relations/Concerns/CanBeOneOfMany.php | 310 -- .../Concerns/ComparesRelatedModels.php | 77 - .../Concerns/InteractsWithDictionary.php | 36 - .../Concerns/InteractsWithPivotTable.php | 681 --- .../Concerns/SupportsDefaultModels.php | 63 - .../Database/Eloquent/Relations/HasMany.php | 49 - .../Eloquent/Relations/HasManyThrough.php | 772 ---- .../Database/Eloquent/Relations/HasOne.php | 137 - .../Eloquent/Relations/HasOneOrMany.php | 475 -- .../Eloquent/Relations/HasOneThrough.php | 77 - .../Database/Eloquent/Relations/MorphMany.php | 62 - .../Database/Eloquent/Relations/MorphOne.php | 137 - .../Eloquent/Relations/MorphOneOrMany.php | 127 - .../Eloquent/Relations/MorphPivot.php | 182 - .../Database/Eloquent/Relations/MorphTo.php | 396 -- .../Eloquent/Relations/MorphToMany.php | 209 - .../Database/Eloquent/Relations/Pivot.php | 25 - .../Database/Eloquent/Relations/Relation.php | 503 --- .../Illuminate/Database/Eloquent/Scope.php | 15 - .../Database/Eloquent/SoftDeletes.php | 249 -- .../Database/Eloquent/SoftDeletingScope.php | 148 - .../Database/Events/ConnectionEstablished.php | 8 - .../Database/Events/ConnectionEvent.php | 32 - .../Database/Events/DatabaseBusy.php | 32 - .../Database/Events/DatabaseRefreshed.php | 10 - .../Database/Events/MigrationEnded.php | 8 - .../Database/Events/MigrationEvent.php | 36 - .../Database/Events/MigrationStarted.php | 8 - .../Database/Events/MigrationsEnded.php | 8 - .../Database/Events/MigrationsEvent.php | 26 - .../Database/Events/MigrationsStarted.php | 8 - .../Database/Events/ModelsPruned.php | 33 - .../Database/Events/NoPendingMigrations.php | 24 - .../Database/Events/QueryExecuted.php | 59 - .../Database/Events/SchemaDumped.php | 41 - .../Database/Events/SchemaLoaded.php | 41 - .../Database/Events/StatementPrepared.php | 33 - .../Database/Events/TransactionBeginning.php | 8 - .../Database/Events/TransactionCommitted.php | 8 - .../Database/Events/TransactionCommitting.php | 8 - .../Database/Events/TransactionRolledBack.php | 8 - .../src/Illuminate/Database/Grammar.php | 253 -- .../src/Illuminate/Database/LICENSE.md | 21 - .../LazyLoadingViolationException.php | 39 - .../Database/LostConnectionException.php | 10 - .../Database/MigrationServiceProvider.php | 222 - .../DatabaseMigrationRepository.php | 224 - .../Database/Migrations/Migration.php | 30 - .../Database/Migrations/MigrationCreator.php | 231 - .../MigrationRepositoryInterface.php | 88 - .../Database/Migrations/Migrator.php | 760 ---- .../Migrations/stubs/migration.create.stub | 31 - .../Database/Migrations/stubs/migration.stub | 28 - .../Migrations/stubs/migration.update.stub | 32 - .../MultipleColumnsSelectedException.php | 10 - .../MultipleRecordsFoundException.php | 40 - .../Illuminate/Database/MySqlConnection.php | 91 - .../PDO/Concerns/ConnectsToDatabase.php | 30 - .../Illuminate/Database/PDO/Connection.php | 182 - .../Illuminate/Database/PDO/MySqlDriver.php | 19 - .../Database/PDO/PostgresDriver.php | 19 - .../Illuminate/Database/PDO/SQLiteDriver.php | 19 - .../Database/PDO/SqlServerConnection.php | 152 - .../Database/PDO/SqlServerDriver.php | 32 - .../Database/PostgresConnection.php | 80 - .../src/Illuminate/Database/Query/Builder.php | 3824 ----------------- .../Illuminate/Database/Query/Expression.php | 44 - .../Database/Query/Grammars/Grammar.php | 1347 ------ .../Database/Query/Grammars/MySqlGrammar.php | 365 -- .../Query/Grammars/PostgresGrammar.php | 701 --- .../Database/Query/Grammars/SQLiteGrammar.php | 355 -- .../Query/Grammars/SqlServerGrammar.php | 620 --- .../Illuminate/Database/Query/JoinClause.php | 146 - .../Query/Processors/MySqlProcessor.php | 19 - .../Query/Processors/PostgresProcessor.php | 45 - .../Database/Query/Processors/Processor.php | 49 - .../Query/Processors/SQLiteProcessor.php | 19 - .../Query/Processors/SqlServerProcessor.php | 70 - .../Illuminate/Database/QueryException.php | 79 - .../src/Illuminate/Database/README.md | 69 - .../Database/RecordsNotFoundException.php | 10 - .../Illuminate/Database/SQLiteConnection.php | 115 - .../SQLiteDatabaseDoesNotExistException.php | 28 - .../Illuminate/Database/Schema/Blueprint.php | 1829 -------- .../Illuminate/Database/Schema/Builder.php | 495 --- .../Database/Schema/ColumnDefinition.php | 38 - .../Schema/ForeignIdColumnDefinition.php | 52 - .../Database/Schema/ForeignKeyDefinition.php | 76 - .../Database/Schema/Grammars/ChangeColumn.php | 235 - .../Database/Schema/Grammars/Grammar.php | 345 -- .../Database/Schema/Grammars/MySqlGrammar.php | 1221 ------ .../Schema/Grammars/PostgresGrammar.php | 1141 ----- .../Database/Schema/Grammars/RenameColumn.php | 84 - .../Schema/Grammars/SQLiteGrammar.php | 1005 ----- .../Schema/Grammars/SqlServerGrammar.php | 973 ----- .../Database/Schema/IndexDefinition.php | 16 - .../Database/Schema/MySqlBuilder.php | 140 - .../Database/Schema/MySqlSchemaState.php | 170 - .../Database/Schema/PostgresBuilder.php | 248 -- .../Database/Schema/PostgresSchemaState.php | 79 - .../Database/Schema/SQLiteBuilder.php | 102 - .../Database/Schema/SchemaState.php | 122 - .../Database/Schema/SqlServerBuilder.php | 78 - .../Database/Schema/SqliteSchemaState.php | 99 - .../src/Illuminate/Database/Seeder.php | 195 - .../Database/SqlServerConnection.php | 123 - .../src/Illuminate/Database/composer.json | 51 - .../src/Illuminate/Encryption/Encrypter.php | 288 -- .../Encryption/EncryptionServiceProvider.php | 83 - .../src/Illuminate/Encryption/LICENSE.md | 21 - .../Encryption/MissingAppKeyException.php | 19 - .../src/Illuminate/Encryption/composer.json | 38 - .../Illuminate/Events/CallQueuedListener.php | 180 - .../src/Illuminate/Events/Dispatcher.php | 705 --- .../Events/EventServiceProvider.php | 23 - .../Illuminate/Events/InvokeQueuedClosure.php | 34 - .../src/Illuminate/Events/LICENSE.md | 21 - .../src/Illuminate/Events/NullDispatcher.php | 144 - .../src/Illuminate/Events/QueuedClosure.php | 125 - .../src/Illuminate/Events/composer.json | 42 - .../src/Illuminate/Events/functions.php | 18 - .../Illuminate/Filesystem/AwsS3V3Adapter.php | 107 - .../src/Illuminate/Filesystem/Filesystem.php | 775 ---- .../Filesystem/FilesystemAdapter.php | 953 ---- .../Filesystem/FilesystemManager.php | 429 -- .../Filesystem/FilesystemServiceProvider.php | 82 - .../src/Illuminate/Filesystem/LICENSE.md | 21 - .../Illuminate/Filesystem/LockableFile.php | 194 - .../src/Illuminate/Filesystem/composer.json | 49 - .../src/Illuminate/Foundation/AliasLoader.php | 243 -- .../src/Illuminate/Foundation/Application.php | 1427 ------ .../Foundation/Auth/Access/Authorizable.php | 56 - .../Auth/Access/AuthorizesRequests.php | 131 - .../Auth/EmailVerificationRequest.php | 64 - .../src/Illuminate/Foundation/Auth/User.php | 20 - .../Foundation/Bootstrap/BootProviders.php | 19 - .../Foundation/Bootstrap/HandleExceptions.php | 311 -- .../Bootstrap/LoadConfiguration.php | 114 - .../Bootstrap/LoadEnvironmentVariables.php | 110 - .../Foundation/Bootstrap/RegisterFacades.php | 29 - .../Bootstrap/RegisterProviders.php | 19 - .../Bootstrap/SetRequestForConsole.php | 35 - .../Foundation/Bus/Dispatchable.php | 112 - .../Foundation/Bus/DispatchesJobs.php | 45 - .../Foundation/Bus/PendingChain.php | 165 - .../Foundation/Bus/PendingClosureDispatch.php | 21 - .../Foundation/Bus/PendingDispatch.php | 196 - .../Foundation/CacheBasedMaintenanceMode.php | 97 - .../Illuminate/Foundation/ComposerScripts.php | 69 - .../Concerns/ResolvesDumpSource.php | 197 - .../Foundation/Console/AboutCommand.php | 266 -- .../Foundation/Console/CastMakeCommand.php | 92 - .../Foundation/Console/ChannelMakeCommand.php | 91 - .../Console/ClearCompiledCommand.php | 53 - .../Foundation/Console/CliDumper.php | 134 - .../Foundation/Console/ClosureCommand.php | 82 - .../Console/ComponentMakeCommand.php | 190 - .../Foundation/Console/ConfigCacheCommand.php | 105 - .../Foundation/Console/ConfigClearCommand.php | 68 - .../Foundation/Console/ConsoleMakeCommand.php | 111 - .../Foundation/Console/DocsCommand.php | 536 --- .../Foundation/Console/DownCommand.php | 151 - .../Foundation/Console/EnvironmentCommand.php | 48 - .../Console/EnvironmentDecryptCommand.php | 159 - .../Console/EnvironmentEncryptCommand.php | 135 - .../Foundation/Console/EventCacheCommand.php | 71 - .../Foundation/Console/EventClearCommand.php | 70 - .../Console/EventGenerateCommand.php | 90 - .../Foundation/Console/EventListCommand.php | 232 - .../Foundation/Console/EventMakeCommand.php | 101 - .../Console/ExceptionMakeCommand.php | 97 - .../Foundation/Console/JobMakeCommand.php | 95 - .../Illuminate/Foundation/Console/Kernel.php | 468 -- .../Foundation/Console/KeyGenerateCommand.php | 136 - .../Console/ListenerMakeCommand.php | 154 - .../Foundation/Console/MailMakeCommand.php | 172 - .../Foundation/Console/ModelMakeCommand.php | 270 -- .../Console/NotificationMakeCommand.php | 146 - .../Console/ObserverMakeCommand.php | 179 - .../Console/OptimizeClearCommand.php | 56 - .../Foundation/Console/OptimizeCommand.php | 52 - .../Console/PackageDiscoverCommand.php | 54 - .../Foundation/Console/PolicyMakeCommand.php | 238 - .../Console/ProviderMakeCommand.php | 89 - .../Foundation/Console/QueuedCommand.php | 42 - .../Foundation/Console/RequestMakeCommand.php | 89 - .../Console/ResourceMakeCommand.php | 117 - .../Foundation/Console/RouteCacheCommand.php | 122 - .../Foundation/Console/RouteClearCommand.php | 68 - .../Foundation/Console/RouteListCommand.php | 508 --- .../Foundation/Console/RuleMakeCommand.php | 107 - .../Foundation/Console/ScopeMakeCommand.php | 89 - .../Foundation/Console/ServeCommand.php | 339 -- .../Foundation/Console/ShowModelCommand.php | 547 --- .../Foundation/Console/StorageLinkCommand.php | 89 - .../Foundation/Console/StubPublishCommand.php | 110 - .../Foundation/Console/TestMakeCommand.php | 153 - .../Foundation/Console/UpCommand.php | 72 - .../Console/VendorPublishCommand.php | 339 -- .../Foundation/Console/ViewCacheCommand.php | 113 - .../Foundation/Console/ViewClearCommand.php | 83 - .../Console/stubs/cast.inbound.stub | 22 - .../Foundation/Console/stubs/cast.stub | 36 - .../Foundation/Console/stubs/channel.stub | 29 - .../Foundation/Console/stubs/console.stub | 32 - .../Foundation/Console/stubs/event.stub | 36 - .../stubs/exception-render-report.stub | 29 - .../Console/stubs/exception-render.stub | 19 - .../Console/stubs/exception-report.stub | 18 - .../Foundation/Console/stubs/exception.stub | 10 - .../Foundation/Console/stubs/job.queued.stub | 35 - .../Foundation/Console/stubs/job.stub | 30 - .../Console/stubs/listener-duck.stub | 30 - .../Console/stubs/listener-queued-duck.stub | 32 - .../Console/stubs/listener-queued.stub | 33 - .../Foundation/Console/stubs/listener.stub | 31 - .../Foundation/Console/stubs/mail.stub | 59 - .../Console/stubs/maintenance-mode.stub | 78 - .../Console/stubs/markdown-mail.stub | 59 - .../Console/stubs/markdown-notification.stub | 58 - .../Foundation/Console/stubs/markdown.stub | 12 - .../Console/stubs/model.morph-pivot.stub | 10 - .../Foundation/Console/stubs/model.pivot.stub | 10 - .../Foundation/Console/stubs/model.stub | 11 - .../Console/stubs/notification.stub | 61 - .../Console/stubs/observer.plain.stub | 8 - .../Foundation/Console/stubs/observer.stub | 63 - .../Foundation/Console/stubs/pest.stub | 7 - .../Foundation/Console/stubs/pest.unit.stub | 5 - .../Console/stubs/policy.plain.stub | 21 - .../Foundation/Console/stubs/policy.stub | 94 - .../Foundation/Console/stubs/provider.stub | 28 - .../Foundation/Console/stubs/request.stub | 30 - .../Console/stubs/resource-collection.stub | 19 - .../Foundation/Console/stubs/resource.stub | 19 - .../Foundation/Console/stubs/routes.stub | 16 - .../stubs/rule.invokable.implicit.stub | 28 - .../Console/stubs/rule.invokable.stub | 21 - .../Foundation/Console/stubs/rule.stub | 40 - .../Foundation/Console/stubs/scope.stub | 22 - .../Foundation/Console/stubs/test.stub | 22 - .../Foundation/Console/stubs/test.unit.stub | 18 - .../Console/stubs/view-component.stub | 28 - .../Foundation/EnvironmentDetector.php | 73 - .../Foundation/Events/DiscoverEvents.php | 98 - .../Foundation/Events/Dispatchable.php | 54 - .../Foundation/Events/LocaleUpdated.php | 24 - .../Events/MaintenanceModeDisabled.php | 8 - .../Events/MaintenanceModeEnabled.php | 8 - .../Foundation/Events/PublishingStubs.php | 40 - .../Foundation/Events/VendorTagPublished.php | 33 - .../Foundation/Exceptions/Handler.php | 767 ---- .../Exceptions/RegisterErrorViewPaths.php | 20 - .../Exceptions/ReportableHandler.php | 82 - .../Whoops/WhoopsExceptionRenderer.php | 37 - .../Exceptions/Whoops/WhoopsHandler.php | 86 - .../Foundation/Exceptions/views/401.blade.php | 5 - .../Foundation/Exceptions/views/402.blade.php | 5 - .../Foundation/Exceptions/views/403.blade.php | 5 - .../Foundation/Exceptions/views/404.blade.php | 5 - .../Foundation/Exceptions/views/419.blade.php | 5 - .../Foundation/Exceptions/views/429.blade.php | 5 - .../Foundation/Exceptions/views/500.blade.php | 5 - .../Foundation/Exceptions/views/503.blade.php | 5 - .../Exceptions/views/layout.blade.php | 53 - .../Exceptions/views/minimal.blade.php | 34 - .../Foundation/FileBasedMaintenanceMode.php | 64 - .../Foundation/Http/Events/RequestHandled.php | 33 - .../Exceptions/MaintenanceModeException.php | 58 - .../Foundation/Http/FormRequest.php | 286 -- .../Illuminate/Foundation/Http/HtmlDumper.php | 140 - .../src/Illuminate/Foundation/Http/Kernel.php | 538 --- .../Http/MaintenanceModeBypassCookie.php | 43 - .../Middleware/CheckForMaintenanceMode.php | 8 - .../Middleware/ConvertEmptyStringsToNull.php | 56 - .../Middleware/HandlePrecognitiveRequests.php | 82 - .../PreventRequestsDuringMaintenance.php | 166 - .../Http/Middleware/TransformsRequest.php | 95 - .../Http/Middleware/TrimStrings.php | 69 - .../Http/Middleware/ValidatePostSize.php | 51 - .../Http/Middleware/VerifyCsrfToken.php | 227 - .../src/Illuminate/Foundation/Inspiring.php | 129 - .../Foundation/MaintenanceModeManager.php | 44 - .../src/Illuminate/Foundation/Mix.php | 74 - .../Illuminate/Foundation/PackageManifest.php | 185 - .../Illuminate/Foundation/Precognition.php | 21 - .../Foundation/ProviderRepository.php | 210 - .../Providers/ArtisanServiceProvider.php | 822 ---- .../Providers/ComposerServiceProvider.php | 32 - .../ConsoleSupportServiceProvider.php | 21 - .../Providers/FormRequestServiceProvider.php | 39 - .../Providers/FoundationServiceProvider.php | 194 - .../PrecognitionCallableDispatcher.php | 23 - .../PrecognitionControllerDispatcher.php | 45 - .../Support/Providers/AuthServiceProvider.php | 38 - .../Providers/EventServiceProvider.php | 159 - .../Providers/RouteServiceProvider.php | 139 - .../Concerns/InteractsWithAuthentication.php | 151 - .../Testing/Concerns/InteractsWithConsole.php | 96 - .../Concerns/InteractsWithContainer.php | 214 - .../Concerns/InteractsWithDatabase.php | 267 -- .../InteractsWithDeprecationHandling.php | 49 - .../InteractsWithExceptionHandling.php | 194 - .../Testing/Concerns/InteractsWithRedis.php | 117 - .../Testing/Concerns/InteractsWithSession.php | 64 - .../Testing/Concerns/InteractsWithTime.php | 70 - .../Testing/Concerns/InteractsWithViews.php | 83 - .../Testing/Concerns/MakesHttpRequests.php | 700 --- .../Concerns/MocksApplicationServices.php | 289 -- .../Foundation/Testing/DatabaseMigrations.php | 29 - .../Testing/DatabaseTransactions.php | 54 - .../Foundation/Testing/DatabaseTruncation.php | 118 - .../Testing/LazilyRefreshDatabase.php | 34 - .../Foundation/Testing/RefreshDatabase.php | 150 - .../Testing/RefreshDatabaseState.php | 20 - .../Foundation/Testing/TestCase.php | 309 -- .../Traits/CanConfigureMigrationCommands.php | 64 - .../Foundation/Testing/WithFaker.php | 54 - .../Foundation/Testing/WithoutEvents.php | 22 - .../Foundation/Testing/WithoutMiddleware.php | 22 - .../Foundation/Testing/Wormhole.php | 245 -- .../Validation/ValidatesRequests.php | 100 - .../src/Illuminate/Foundation/Vite.php | 762 ---- .../src/Illuminate/Foundation/helpers.php | 1037 ----- .../Foundation/resources/server.php | 16 - .../Illuminate/Foundation/stubs/facade.stub | 21 - .../src/Illuminate/Hashing/AbstractHasher.php | 34 - .../src/Illuminate/Hashing/Argon2IdHasher.php | 41 - .../src/Illuminate/Hashing/ArgonHasher.php | 196 - .../src/Illuminate/Hashing/BcryptHasher.php | 114 - .../src/Illuminate/Hashing/HashManager.php | 100 - .../Hashing/HashServiceProvider.php | 35 - .../src/Illuminate/Hashing/LICENSE.md | 21 - .../src/Illuminate/Hashing/composer.json | 35 - .../Client/Concerns/DeterminesStatusCode.php | 157 - .../Http/Client/ConnectionException.php | 8 - .../Http/Client/Events/ConnectionFailed.php | 26 - .../Http/Client/Events/RequestSending.php | 26 - .../Http/Client/Events/ResponseReceived.php | 36 - .../src/Illuminate/Http/Client/Factory.php | 387 -- .../Http/Client/HttpClientException.php | 10 - .../Illuminate/Http/Client/PendingRequest.php | 1314 ------ .../src/Illuminate/Http/Client/Pool.php | 92 - .../src/Illuminate/Http/Client/Request.php | 305 -- .../Http/Client/RequestException.php | 43 - .../src/Illuminate/Http/Client/Response.php | 445 -- .../Http/Client/ResponseSequence.php | 156 - .../Http/Concerns/CanBePrecognitive.php | 45 - .../Concerns/InteractsWithContentTypes.php | 179 - .../Http/Concerns/InteractsWithFlashData.php | 68 - .../Http/Concerns/InteractsWithInput.php | 637 --- .../Http/Exceptions/HttpResponseException.php | 37 - .../Http/Exceptions/PostTooLargeException.php | 23 - .../Exceptions/ThrottleRequestsException.php | 23 - framework-9.50.2/src/Illuminate/Http/File.php | 10 - .../src/Illuminate/Http/FileHelpers.php | 56 - .../src/Illuminate/Http/JsonResponse.php | 139 - .../src/Illuminate/Http/LICENSE.md | 21 - .../AddLinkHeadersForPreloadedAssets.php | 27 - .../CheckResponseForModifications.php | 27 - .../Illuminate/Http/Middleware/FrameGuard.php | 24 - .../Illuminate/Http/Middleware/HandleCors.php | 112 - .../Http/Middleware/SetCacheHeaders.php | 65 - .../Illuminate/Http/Middleware/TrustHosts.php | 73 - .../Http/Middleware/TrustProxies.php | 116 - .../src/Illuminate/Http/RedirectResponse.php | 258 -- .../src/Illuminate/Http/Request.php | 790 ---- .../Http/Resources/CollectsResources.php | 94 - .../ConditionallyLoadsAttributes.php | 353 -- .../Http/Resources/DelegatesToResource.php | 157 - .../Json/AnonymousResourceCollection.php | 34 - .../Http/Resources/Json/JsonResource.php | 243 -- .../Json/PaginatedResourceResponse.php | 92 - .../Resources/Json/ResourceCollection.php | 135 - .../Http/Resources/Json/ResourceResponse.php | 122 - .../Illuminate/Http/Resources/MergeValue.php | 33 - .../Http/Resources/MissingValue.php | 16 - .../Http/Resources/PotentiallyMissing.php | 13 - .../src/Illuminate/Http/Response.php | 108 - .../src/Illuminate/Http/ResponseTrait.php | 182 - .../src/Illuminate/Http/Testing/File.php | 147 - .../Illuminate/Http/Testing/FileFactory.php | 84 - .../src/Illuminate/Http/Testing/MimeType.php | 65 - .../src/Illuminate/Http/UploadedFile.php | 149 - .../src/Illuminate/Http/composer.json | 46 - .../Illuminate/Log/Events/MessageLogged.php | 42 - .../src/Illuminate/Log/LICENSE.md | 21 - .../src/Illuminate/Log/LogManager.php | 725 ---- .../src/Illuminate/Log/LogServiceProvider.php | 20 - .../src/Illuminate/Log/Logger.php | 310 -- .../Illuminate/Log/ParsesLogConfiguration.php | 79 - .../src/Illuminate/Log/composer.json | 36 - .../src/Illuminate/Macroable/LICENSE.md | 21 - .../Illuminate/Macroable/Traits/Macroable.php | 126 - .../src/Illuminate/Macroable/composer.json | 33 - .../src/Illuminate/Mail/Attachment.php | 172 - .../Illuminate/Mail/Events/MessageSending.php | 35 - .../Illuminate/Mail/Events/MessageSent.php | 93 - .../src/Illuminate/Mail/LICENSE.md | 21 - .../src/Illuminate/Mail/MailManager.php | 531 --- .../Illuminate/Mail/MailServiceProvider.php | 73 - .../src/Illuminate/Mail/Mailable.php | 1760 -------- .../src/Illuminate/Mail/Mailables/Address.php | 33 - .../Illuminate/Mail/Mailables/Attachment.php | 10 - .../src/Illuminate/Mail/Mailables/Content.php | 157 - .../Illuminate/Mail/Mailables/Envelope.php | 369 -- .../src/Illuminate/Mail/Mailables/Headers.php | 100 - .../src/Illuminate/Mail/Mailer.php | 604 --- .../src/Illuminate/Mail/Markdown.php | 189 - .../src/Illuminate/Mail/Message.php | 402 -- .../src/Illuminate/Mail/PendingMail.php | 166 - .../Illuminate/Mail/SendQueuedMailable.php | 137 - .../src/Illuminate/Mail/SentMessage.php | 54 - .../Mail/Transport/ArrayTransport.php | 67 - .../Mail/Transport/LogTransport.php | 60 - .../Mail/Transport/SesTransport.php | 131 - .../src/Illuminate/Mail/composer.json | 49 - .../resources/views/html/button.blade.php | 24 - .../resources/views/html/footer.blade.php | 11 - .../resources/views/html/header.blade.php | 12 - .../resources/views/html/layout.blade.php | 57 - .../resources/views/html/message.blade.php | 27 - .../Mail/resources/views/html/panel.blade.php | 14 - .../resources/views/html/subcopy.blade.php | 7 - .../Mail/resources/views/html/table.blade.php | 3 - .../resources/views/html/themes/default.css | 290 -- .../resources/views/text/button.blade.php | 1 - .../resources/views/text/footer.blade.php | 1 - .../resources/views/text/header.blade.php | 1 - .../resources/views/text/layout.blade.php | 9 - .../resources/views/text/message.blade.php | 27 - .../Mail/resources/views/text/panel.blade.php | 1 - .../resources/views/text/subcopy.blade.php | 1 - .../Mail/resources/views/text/table.blade.php | 1 - .../src/Illuminate/Notifications/Action.php | 33 - .../Notifications/AnonymousNotifiable.php | 79 - .../Notifications/ChannelManager.php | 162 - .../Channels/BroadcastChannel.php | 75 - .../Channels/DatabaseChannel.php | 65 - .../Notifications/Channels/MailChannel.php | 266 -- .../Console/NotificationTableCommand.php | 94 - .../Console/stubs/notifications.stub | 35 - .../Notifications/DatabaseNotification.php | 134 - .../DatabaseNotificationCollection.php | 28 - .../Events/BroadcastNotificationCreated.php | 123 - .../Events/NotificationFailed.php | 56 - .../Events/NotificationSending.php | 47 - .../Notifications/Events/NotificationSent.php | 56 - .../HasDatabaseNotifications.php | 36 - .../src/Illuminate/Notifications/LICENSE.md | 21 - .../Messages/BroadcastMessage.php | 41 - .../Messages/DatabaseMessage.php | 24 - .../Notifications/Messages/MailMessage.php | 387 -- .../Notifications/Messages/SimpleMessage.php | 292 -- .../Illuminate/Notifications/Notifiable.php | 8 - .../Illuminate/Notifications/Notification.php | 47 - .../Notifications/NotificationSender.php | 255 -- .../NotificationServiceProvider.php | 46 - .../Notifications/RoutesNotifications.php | 52 - .../Notifications/SendQueuedNotifications.php | 176 - .../Illuminate/Notifications/composer.json | 45 - .../resources/views/email.blade.php | 58 - .../Pagination/AbstractCursorPaginator.php | 671 --- .../Pagination/AbstractPaginator.php | 797 ---- .../src/Illuminate/Pagination/Cursor.php | 132 - .../Illuminate/Pagination/CursorPaginator.php | 172 - .../src/Illuminate/Pagination/LICENSE.md | 21 - .../Pagination/LengthAwarePaginator.php | 231 - .../Pagination/PaginationServiceProvider.php | 34 - .../Illuminate/Pagination/PaginationState.php | 35 - .../src/Illuminate/Pagination/Paginator.php | 176 - .../src/Illuminate/Pagination/UrlWindow.php | 220 - .../src/Illuminate/Pagination/composer.json | 37 - .../resources/views/bootstrap-4.blade.php | 46 - .../resources/views/bootstrap-5.blade.php | 88 - .../resources/views/default.blade.php | 46 - .../resources/views/semantic-ui.blade.php | 36 - .../views/simple-bootstrap-4.blade.php | 27 - .../views/simple-bootstrap-5.blade.php | 29 - .../resources/views/simple-default.blade.php | 19 - .../resources/views/simple-tailwind.blade.php | 25 - .../resources/views/tailwind.blade.php | 106 - .../src/Illuminate/Pipeline/Hub.php | 97 - .../src/Illuminate/Pipeline/LICENSE.md | 21 - .../src/Illuminate/Pipeline/Pipeline.php | 271 -- .../Pipeline/PipelineServiceProvider.php | 34 - .../src/Illuminate/Pipeline/composer.json | 35 - .../src/Illuminate/Queue/BeanstalkdQueue.php | 211 - .../Illuminate/Queue/CallQueuedClosure.php | 111 - .../Illuminate/Queue/CallQueuedHandler.php | 297 -- .../src/Illuminate/Queue/Capsule/Manager.php | 187 - .../Queue/Connectors/BeanstalkdConnector.php | 42 - .../Queue/Connectors/ConnectorInterface.php | 14 - .../Queue/Connectors/DatabaseConnector.php | 44 - .../Queue/Connectors/NullConnector.php | 19 - .../Queue/Connectors/RedisConnector.php | 54 - .../Queue/Connectors/SqsConnector.php | 52 - .../Queue/Connectors/SyncConnector.php | 19 - .../Queue/Console/BatchesTableCommand.php | 111 - .../Illuminate/Queue/Console/ClearCommand.php | 113 - .../Queue/Console/FailedTableCommand.php | 111 - .../Queue/Console/FlushFailedCommand.php | 53 - .../Queue/Console/ForgetFailedCommand.php | 49 - .../Queue/Console/ListFailedCommand.php | 134 - .../Queue/Console/ListenCommand.php | 141 - .../Queue/Console/MonitorCommand.php | 160 - .../Queue/Console/PruneBatchesCommand.php | 80 - .../Queue/Console/PruneFailedJobsCommand.php | 58 - .../Queue/Console/RestartCommand.php | 71 - .../Queue/Console/RetryBatchCommand.php | 64 - .../Illuminate/Queue/Console/RetryCommand.php | 205 - .../Illuminate/Queue/Console/TableCommand.php | 111 - .../Illuminate/Queue/Console/WorkCommand.php | 300 -- .../Queue/Console/stubs/batches.stub | 39 - .../Queue/Console/stubs/failed_jobs.stub | 36 - .../Illuminate/Queue/Console/stubs/jobs.stub | 36 - .../src/Illuminate/Queue/DatabaseQueue.php | 413 -- .../Queue/Events/JobExceptionOccurred.php | 42 - .../src/Illuminate/Queue/Events/JobFailed.php | 42 - .../Illuminate/Queue/Events/JobProcessed.php | 33 - .../Illuminate/Queue/Events/JobProcessing.php | 33 - .../src/Illuminate/Queue/Events/JobQueued.php | 42 - .../Events/JobReleasedAfterException.php | 33 - .../Queue/Events/JobRetryRequested.php | 45 - .../src/Illuminate/Queue/Events/Looping.php | 33 - .../src/Illuminate/Queue/Events/QueueBusy.php | 42 - .../Queue/Events/WorkerStopping.php | 33 - .../Failed/DatabaseFailedJobProvider.php | 142 - .../Failed/DatabaseUuidFailedJobProvider.php | 155 - .../Failed/DynamoDbFailedJobProvider.php | 177 - .../Failed/FailedJobProviderInterface.php | 48 - .../Queue/Failed/NullFailedJobProvider.php | 63 - .../Failed/PrunableFailedJobProvider.php | 16 - .../Illuminate/Queue/InteractsWithQueue.php | 86 - .../Queue/InvalidPayloadException.php | 19 - .../Illuminate/Queue/Jobs/BeanstalkdJob.php | 135 - .../src/Illuminate/Queue/Jobs/DatabaseJob.php | 108 - .../Queue/Jobs/DatabaseJobRecord.php | 63 - .../src/Illuminate/Queue/Jobs/Job.php | 359 -- .../src/Illuminate/Queue/Jobs/JobName.php | 35 - .../src/Illuminate/Queue/Jobs/RedisJob.php | 139 - .../src/Illuminate/Queue/Jobs/SqsJob.php | 124 - .../src/Illuminate/Queue/Jobs/SyncJob.php | 91 - .../src/Illuminate/Queue/LICENSE.md | 21 - .../src/Illuminate/Queue/Listener.php | 236 - .../src/Illuminate/Queue/ListenerOptions.php | 34 - .../src/Illuminate/Queue/LuaScripts.php | 148 - .../Queue/ManuallyFailedException.php | 10 - .../Queue/MaxAttemptsExceededException.php | 10 - .../Queue/Middleware/RateLimited.php | 146 - .../Queue/Middleware/RateLimitedWithRedis.php | 103 - .../Queue/Middleware/SkipIfBatchCancelled.php | 22 - .../Queue/Middleware/ThrottlesExceptions.php | 201 - .../ThrottlesExceptionsWithRedis.php | 62 - .../Queue/Middleware/WithoutOverlapping.php | 162 - .../src/Illuminate/Queue/NullQueue.php | 70 - .../src/Illuminate/Queue/Queue.php | 396 -- .../src/Illuminate/Queue/QueueManager.php | 293 -- .../Illuminate/Queue/QueueServiceProvider.php | 333 -- .../src/Illuminate/Queue/README.md | 34 - .../src/Illuminate/Queue/RedisQueue.php | 382 -- .../SerializesAndRestoresModelIdentifiers.php | 122 - .../src/Illuminate/Queue/SerializesModels.php | 105 - .../src/Illuminate/Queue/SqsQueue.php | 241 -- .../src/Illuminate/Queue/SyncQueue.php | 160 - .../src/Illuminate/Queue/Worker.php | 828 ---- .../src/Illuminate/Queue/WorkerOptions.php | 115 - .../src/Illuminate/Queue/composer.json | 52 - .../Redis/Connections/Connection.php | 218 - .../Redis/Connections/PacksPhpRedisValues.php | 183 - .../Connections/PhpRedisClusterConnection.php | 24 - .../Redis/Connections/PhpRedisConnection.php | 567 --- .../Connections/PredisClusterConnection.php | 25 - .../Redis/Connections/PredisConnection.php | 53 - .../Redis/Connectors/PhpRedisConnector.php | 234 - .../Redis/Connectors/PredisConnector.php | 53 - .../Redis/Events/CommandExecuted.php | 59 - .../src/Illuminate/Redis/LICENSE.md | 21 - .../Redis/Limiters/ConcurrencyLimiter.php | 167 - .../Limiters/ConcurrencyLimiterBuilder.php | 142 - .../Redis/Limiters/DurationLimiter.php | 203 - .../Redis/Limiters/DurationLimiterBuilder.php | 142 - .../src/Illuminate/Redis/RedisManager.php | 278 -- .../Illuminate/Redis/RedisServiceProvider.php | 38 - .../src/Illuminate/Redis/composer.json | 41 - .../Routing/AbstractRouteCollection.php | 284 -- .../Illuminate/Routing/CallableDispatcher.php | 54 - .../Routing/CompiledRouteCollection.php | 330 -- .../Routing/Console/ControllerMakeCommand.php | 340 -- .../Routing/Console/MiddlewareMakeCommand.php | 79 - .../Routing/Console/stubs/controller.api.stub | 64 - .../Console/stubs/controller.invokable.stub | 20 - .../Console/stubs/controller.model.api.stub | 65 - .../Console/stubs/controller.model.stub | 86 - .../Console/stubs/controller.nested.api.stub | 71 - .../controller.nested.singleton.api.stub | 57 - .../stubs/controller.nested.singleton.stub | 79 - .../Console/stubs/controller.nested.stub | 94 - .../Console/stubs/controller.plain.stub | 11 - .../stubs/controller.singleton.api.stub | 51 - .../Console/stubs/controller.singleton.stub | 71 - .../Routing/Console/stubs/controller.stub | 85 - .../Routing/Console/stubs/middleware.stub | 21 - .../Routing/Contracts/CallableDispatcher.php | 17 - .../Contracts/ControllerDispatcher.php | 27 - .../src/Illuminate/Routing/Controller.php | 72 - .../Routing/ControllerDispatcher.php | 94 - .../Routing/ControllerMiddlewareOptions.php | 50 - .../Routing/Controllers/HasMiddleware.php | 13 - .../Routing/Controllers/Middleware.php | 67 - ...eatesRegularExpressionRouteConstraints.php | 89 - .../Routing/Events/RouteMatched.php | 33 - .../src/Illuminate/Routing/Events/Routing.php | 24 - .../BackedEnumCaseNotFoundException.php | 20 - .../Exceptions/InvalidSignatureException.php | 18 - .../Exceptions/StreamedResponseException.php | 50 - .../Exceptions/UrlGenerationException.php | 37 - .../Routing/ImplicitRouteBinding.php | 118 - .../src/Illuminate/Routing/LICENSE.md | 21 - .../Routing/Matching/HostValidator.php | 27 - .../Routing/Matching/MethodValidator.php | 21 - .../Routing/Matching/SchemeValidator.php | 27 - .../Routing/Matching/UriValidator.php | 23 - .../Routing/Matching/ValidatorInterface.php | 18 - .../Routing/Middleware/SubstituteBindings.php | 52 - .../Routing/Middleware/ThrottleRequests.php | 276 -- .../Middleware/ThrottleRequestsWithRedis.php | 122 - .../Routing/Middleware/ValidateSignature.php | 39 - .../Routing/MiddlewareNameResolver.php | 85 - .../Routing/PendingResourceRegistration.php | 268 -- .../PendingSingletonResourceRegistration.php | 242 -- .../src/Illuminate/Routing/Pipeline.php | 59 - .../Illuminate/Routing/RedirectController.php | 44 - .../src/Illuminate/Routing/Redirector.php | 276 -- .../Illuminate/Routing/ResourceRegistrar.php | 728 ---- .../Illuminate/Routing/ResponseFactory.php | 276 -- .../src/Illuminate/Routing/Route.php | 1368 ------ .../src/Illuminate/Routing/RouteAction.php | 110 - .../src/Illuminate/Routing/RouteBinding.php | 84 - .../Illuminate/Routing/RouteCollection.php | 268 -- .../Routing/RouteCollectionInterface.php | 98 - .../Routing/RouteDependencyResolverTrait.php | 117 - .../Illuminate/Routing/RouteFileRegistrar.php | 37 - .../src/Illuminate/Routing/RouteGroup.php | 105 - .../Routing/RouteParameterBinder.php | 117 - .../src/Illuminate/Routing/RouteRegistrar.php | 285 -- .../Routing/RouteSignatureParameters.php | 52 - .../src/Illuminate/Routing/RouteUri.php | 62 - .../Illuminate/Routing/RouteUrlGenerator.php | 320 -- .../src/Illuminate/Routing/Router.php | 1475 ------- .../Routing/RoutingServiceProvider.php | 201 - .../Illuminate/Routing/SortedMiddleware.php | 122 - .../src/Illuminate/Routing/UrlGenerator.php | 847 ---- .../src/Illuminate/Routing/ViewController.php | 60 - .../src/Illuminate/Routing/composer.json | 50 - .../Session/ArraySessionHandler.php | 139 - .../Session/CacheBasedSessionHandler.php | 106 - .../Session/Console/SessionTableCommand.php | 94 - .../Session/Console/stubs/database.stub | 35 - .../Session/CookieSessionHandler.php | 132 - .../Session/DatabaseSessionHandler.php | 319 -- .../src/Illuminate/Session/EncryptedStore.php | 70 - .../Session/ExistenceAwareInterface.php | 14 - .../Illuminate/Session/FileSessionHandler.php | 129 - .../src/Illuminate/Session/LICENSE.md | 21 - .../Middleware/AuthenticateSession.php | 109 - .../Session/Middleware/StartSession.php | 299 -- .../Illuminate/Session/NullSessionHandler.php | 68 - .../src/Illuminate/Session/SessionManager.php | 267 -- .../Session/SessionServiceProvider.php | 55 - .../src/Illuminate/Session/Store.php | 771 ---- .../Session/SymfonySessionDecorator.php | 186 - .../Session/TokenMismatchException.php | 10 - .../src/Illuminate/Session/composer.json | 43 - .../Support/AggregateServiceProvider.php | 52 - .../src/Illuminate/Support/Benchmark.php | 50 - .../src/Illuminate/Support/Carbon.php | 21 - .../src/Illuminate/Support/Composer.php | 132 - .../Support/ConfigurationUrlParser.php | 191 - .../src/Illuminate/Support/DateFactory.php | 231 - .../src/Illuminate/Support/Env.php | 101 - .../Support/Exceptions/MathException.php | 10 - .../src/Illuminate/Support/Facades/App.php | 141 - .../Illuminate/Support/Facades/Artisan.php | 35 - .../src/Illuminate/Support/Facades/Auth.php | 98 - .../src/Illuminate/Support/Facades/Blade.php | 60 - .../Illuminate/Support/Facades/Broadcast.php | 46 - .../src/Illuminate/Support/Facades/Bus.php | 91 - .../src/Illuminate/Support/Facades/Cache.php | 67 - .../src/Illuminate/Support/Facades/Config.php | 31 - .../src/Illuminate/Support/Facades/Cookie.php | 58 - .../src/Illuminate/Support/Facades/Crypt.php | 27 - .../src/Illuminate/Support/Facades/DB.php | 119 - .../src/Illuminate/Support/Facades/Date.php | 122 - .../src/Illuminate/Support/Facades/Event.php | 124 - .../src/Illuminate/Support/Facades/Facade.php | 340 -- .../src/Illuminate/Support/Facades/File.php | 71 - .../src/Illuminate/Support/Facades/Gate.php | 47 - .../src/Illuminate/Support/Facades/Hash.php | 35 - .../src/Illuminate/Support/Facades/Http.php | 149 - .../src/Illuminate/Support/Facades/Lang.php | 46 - .../src/Illuminate/Support/Facades/Log.php | 48 - .../src/Illuminate/Support/Facades/Mail.php | 83 - .../Support/Facades/Notification.php | 78 - .../Support/Facades/ParallelTesting.php | 34 - .../Illuminate/Support/Facades/Password.php | 68 - .../src/Illuminate/Support/Facades/Queue.php | 91 - .../Support/Facades/RateLimiter.php | 32 - .../Illuminate/Support/Facades/Redirect.php | 39 - .../src/Illuminate/Support/Facades/Redis.php | 46 - .../Illuminate/Support/Facades/Request.php | 195 - .../Illuminate/Support/Facades/Response.php | 40 - .../src/Illuminate/Support/Facades/Route.php | 114 - .../src/Illuminate/Support/Facades/Schema.php | 68 - .../Illuminate/Support/Facades/Session.php | 80 - .../Illuminate/Support/Facades/Storage.php | 140 - .../src/Illuminate/Support/Facades/URL.php | 62 - .../Illuminate/Support/Facades/Validator.php | 34 - .../src/Illuminate/Support/Facades/View.php | 97 - .../src/Illuminate/Support/Facades/Vite.php | 41 - .../src/Illuminate/Support/Fluent.php | 201 - .../Support/HigherOrderTapProxy.php | 38 - .../src/Illuminate/Support/HtmlString.php | 66 - .../Illuminate/Support/InteractsWithTime.php | 64 - .../src/Illuminate/Support/Js.php | 150 - .../src/Illuminate/Support/LICENSE.md | 21 - .../src/Illuminate/Support/Lottery.php | 271 -- .../src/Illuminate/Support/Manager.php | 193 - .../src/Illuminate/Support/MessageBag.php | 420 -- .../Support/MultipleInstanceManager.php | 191 - .../Support/NamespacedItemResolver.php | 112 - .../src/Illuminate/Support/Optional.php | 131 - .../src/Illuminate/Support/Pluralizer.php | 127 - .../src/Illuminate/Support/ProcessUtils.php | 69 - .../src/Illuminate/Support/Reflector.php | 162 - .../Illuminate/Support/ServiceProvider.php | 437 -- .../src/Illuminate/Support/Str.php | 1367 ------ .../src/Illuminate/Support/Stringable.php | 1228 ------ .../Support/Testing/Fakes/BatchFake.php | 163 - .../Testing/Fakes/BatchRepositoryFake.php | 153 - .../Support/Testing/Fakes/BusFake.php | 791 ---- .../Support/Testing/Fakes/EventFake.php | 380 -- .../Support/Testing/Fakes/MailFake.php | 444 -- .../Testing/Fakes/NotificationFake.php | 375 -- .../Testing/Fakes/PendingBatchFake.php | 49 - .../Testing/Fakes/PendingChainFake.php | 56 - .../Support/Testing/Fakes/PendingMailFake.php | 42 - .../Support/Testing/Fakes/QueueFake.php | 503 --- .../src/Illuminate/Support/Timebox.php | 72 - .../Support/Traits/CapsuleManagerTrait.php | 69 - .../Support/Traits/ForwardsCalls.php | 75 - .../Illuminate/Support/Traits/Localizable.php | 34 - .../Support/Traits/ReflectsClosures.php | 88 - .../Illuminate/Support/Traits/Tappable.php | 17 - .../src/Illuminate/Support/ValidatedInput.php | 245 -- .../src/Illuminate/Support/ViewErrorBag.php | 130 - .../src/Illuminate/Support/composer.json | 57 - .../src/Illuminate/Support/helpers.php | 425 -- .../src/Illuminate/Testing/Assert.php | 79 - .../Testing/AssertableJsonString.php | 411 -- .../Testing/Concerns/AssertsStatusCodes.php | 165 - .../Testing/Concerns/TestDatabases.php | 189 - .../Testing/Constraints/ArraySubset.php | 279 -- .../Testing/Constraints/CountInDatabase.php | 83 - .../Testing/Constraints/HasInDatabase.php | 121 - .../Constraints/NotSoftDeletedInDatabase.php | 115 - .../Testing/Constraints/SeeInOrder.php | 88 - .../Constraints/SoftDeletedInDatabase.php | 117 - .../Testing/Fluent/AssertableJson.php | 177 - .../Testing/Fluent/Concerns/Debugging.php | 38 - .../Testing/Fluent/Concerns/Has.php | 213 - .../Testing/Fluent/Concerns/Interaction.php | 67 - .../Testing/Fluent/Concerns/Matching.php | 236 - .../src/Illuminate/Testing/LICENSE.md | 21 - .../Testing/LoggedExceptionCollection.php | 10 - .../Testing/ParallelConsoleOutput.php | 60 - .../src/Illuminate/Testing/ParallelRunner.php | 175 - .../Illuminate/Testing/ParallelTesting.php | 291 -- .../ParallelTestingServiceProvider.php | 38 - .../src/Illuminate/Testing/PendingCommand.php | 483 --- .../src/Illuminate/Testing/TestComponent.php | 166 - .../src/Illuminate/Testing/TestResponse.php | 1760 -------- .../src/Illuminate/Testing/TestView.php | 214 - .../src/Illuminate/Testing/composer.json | 45 - .../Illuminate/Translation/ArrayLoader.php | 81 - .../src/Illuminate/Translation/FileLoader.php | 197 - .../src/Illuminate/Translation/LICENSE.md | 21 - .../Translation/MessageSelector.php | 410 -- .../PotentiallyTranslatedString.php | 101 - .../TranslationServiceProvider.php | 56 - .../src/Illuminate/Translation/Translator.php | 486 --- .../src/Illuminate/Translation/composer.json | 39 - .../Validation/ClosureValidationRule.php | 70 - .../Concerns/FilterEmailValidation.php | 72 - .../Validation/Concerns/FormatsMessages.php | 520 --- .../Concerns/ReplacesAttributes.php | 790 ---- .../Concerns/ValidatesAttributes.php | 2478 ----------- .../Validation/ConditionalRules.php | 83 - .../Validation/DatabasePresenceVerifier.php | 137 - .../DatabasePresenceVerifierInterface.php | 14 - .../src/Illuminate/Validation/Factory.php | 335 -- .../Validation/InvokableValidationRule.php | 199 - .../src/Illuminate/Validation/LICENSE.md | 21 - .../src/Illuminate/Validation/NestedRules.php | 55 - .../Validation/NotPwnedVerifier.php | 104 - .../Validation/PresenceVerifierInterface.php | 30 - .../src/Illuminate/Validation/Rule.php | 175 - .../Validation/Rules/DatabaseRule.php | 232 - .../Validation/Rules/Dimensions.php | 135 - .../src/Illuminate/Validation/Rules/Enum.php | 65 - .../Illuminate/Validation/Rules/ExcludeIf.php | 47 - .../Illuminate/Validation/Rules/Exists.php | 24 - .../src/Illuminate/Validation/Rules/File.php | 329 -- .../Illuminate/Validation/Rules/ImageFile.php | 28 - .../src/Illuminate/Validation/Rules/In.php | 47 - .../src/Illuminate/Validation/Rules/NotIn.php | 45 - .../Illuminate/Validation/Rules/Password.php | 395 -- .../Validation/Rules/ProhibitedIf.php | 47 - .../Validation/Rules/RequiredIf.php | 44 - .../Illuminate/Validation/Rules/Unique.php | 75 - .../Validation/UnauthorizedException.php | 10 - .../Validation/ValidatesWhenResolvedTrait.php | 106 - .../Illuminate/Validation/ValidationData.php | 112 - .../Validation/ValidationException.php | 163 - .../Validation/ValidationRuleParser.php | 341 -- .../Validation/ValidationServiceProvider.php | 80 - .../src/Illuminate/Validation/Validator.php | 1559 ------- .../src/Illuminate/Validation/composer.json | 47 - .../Illuminate/View/AnonymousComponent.php | 60 - .../View/AppendableAttributeValue.php | 34 - .../View/Compilers/BladeCompiler.php | 1001 ----- .../Illuminate/View/Compilers/Compiler.php | 124 - .../View/Compilers/CompilerInterface.php | 30 - .../View/Compilers/ComponentTagCompiler.php | 789 ---- .../Concerns/CompilesAuthorizations.php | 102 - .../Compilers/Concerns/CompilesClasses.php | 19 - .../Compilers/Concerns/CompilesComments.php | 19 - .../Compilers/Concerns/CompilesComponents.php | 198 - .../Concerns/CompilesConditionals.php | 385 -- .../View/Compilers/Concerns/CompilesEchos.php | 167 - .../Compilers/Concerns/CompilesErrors.php | 37 - .../Compilers/Concerns/CompilesFragments.php | 36 - .../Compilers/Concerns/CompilesHelpers.php | 78 - .../Compilers/Concerns/CompilesIncludes.php | 82 - .../Compilers/Concerns/CompilesInjections.php | 23 - .../View/Compilers/Concerns/CompilesJs.php | 22 - .../View/Compilers/Concerns/CompilesJson.php | 30 - .../Compilers/Concerns/CompilesLayouts.php | 133 - .../View/Compilers/Concerns/CompilesLoops.php | 194 - .../Compilers/Concerns/CompilesRawPhp.php | 32 - .../Compilers/Concerns/CompilesStacks.php | 117 - .../Compilers/Concerns/CompilesStyles.php | 19 - .../Concerns/CompilesTranslations.php | 44 - .../src/Illuminate/View/Component.php | 458 -- .../Illuminate/View/ComponentAttributeBag.php | 450 -- .../src/Illuminate/View/ComponentSlot.php | 89 - .../View/Concerns/ManagesComponents.php | 222 - .../View/Concerns/ManagesEvents.php | 190 - .../View/Concerns/ManagesFragments.php | 88 - .../View/Concerns/ManagesLayouts.php | 255 -- .../Illuminate/View/Concerns/ManagesLoops.php | 96 - .../View/Concerns/ManagesStacks.php | 179 - .../View/Concerns/ManagesTranslations.php | 38 - .../src/Illuminate/View/DynamicComponent.php | 172 - .../View/Engines/CompilerEngine.php | 138 - .../src/Illuminate/View/Engines/Engine.php | 23 - .../View/Engines/EngineResolver.php | 71 - .../Illuminate/View/Engines/FileEngine.php | 39 - .../src/Illuminate/View/Engines/PhpEngine.php | 83 - .../src/Illuminate/View/Factory.php | 614 --- .../src/Illuminate/View/FileViewFinder.php | 330 -- .../View/InvokableComponentVariable.php | 96 - .../src/Illuminate/View/LICENSE.md | 21 - .../Middleware/ShareErrorsFromSession.php | 51 - framework-9.50.2/src/Illuminate/View/View.php | 494 --- .../src/Illuminate/View/ViewException.php | 41 - .../Illuminate/View/ViewFinderInterface.php | 71 - .../src/Illuminate/View/ViewName.php | 25 - .../Illuminate/View/ViewServiceProvider.php | 173 - .../src/Illuminate/View/composer.json | 41 - src/Collect/Support/Enumerable.php | 5 +- .../Support/Traits/EnumeratesValues.php | 5 +- tests/files/Support/Stringable.php | 4 +- upgrade.sh | 4 +- 1344 files changed, 8 insertions(+), 202004 deletions(-) delete mode 100644 framework-9.50.2/CHANGELOG.md delete mode 100644 framework-9.50.2/LICENSE.md delete mode 100644 framework-9.50.2/README.md delete mode 100644 framework-9.50.2/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Access/AuthorizationException.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Access/Events/GateEvaluated.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Access/Gate.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Access/HandlesAuthorization.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Access/Response.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/AuthManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/AuthServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Authenticatable.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/AuthenticationException.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Console/ClearResetsCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub delete mode 100644 framework-9.50.2/src/Illuminate/Auth/CreatesUserProviders.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/DatabaseUserProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/EloquentUserProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Attempting.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Authenticated.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/CurrentDeviceLogout.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Failed.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Lockout.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Login.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Logout.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/OtherDeviceLogout.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/PasswordReset.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Registered.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Validated.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Events/Verified.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/GenericUser.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/GuardHelpers.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Middleware/Authenticate.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Middleware/Authorize.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Middleware/RequirePassword.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/MustVerifyEmail.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Notifications/ResetPassword.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Notifications/VerifyEmail.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Passwords/CanResetPassword.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordBroker.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/Recaller.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/RequestGuard.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/SessionGuard.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/TokenGuard.php delete mode 100644 framework-9.50.2/src/Illuminate/Auth/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/BroadcastController.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/BroadcastEvent.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/BroadcastException.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/BroadcastManager.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/BroadcastServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/AblyBroadcaster.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/UsePusherChannelConventions.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/Channel.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/EncryptedPrivateChannel.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/InteractsWithBroadcasting.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/InteractsWithSockets.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/PendingBroadcast.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/PresenceChannel.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/PrivateChannel.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/UniqueBroadcastEvent.php delete mode 100644 framework-9.50.2/src/Illuminate/Broadcasting/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Bus/Batch.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/BatchFactory.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/BatchRepository.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/Batchable.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/BusServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/DatabaseBatchRepository.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/Dispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/Events/BatchDispatched.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Bus/PendingBatch.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/PrunableBatchRepository.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/Queueable.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/UniqueLock.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/UpdatedBatchJobCounts.php delete mode 100644 framework-9.50.2/src/Illuminate/Bus/composer.json delete mode 100755 framework-9.50.2/src/Illuminate/Cache/ApcStore.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/ApcWrapper.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/ArrayLock.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/ArrayStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/CacheLock.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/CacheManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/CacheServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/Console/CacheTableCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/Console/ClearCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/Console/ForgetCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/Console/stubs/cache.stub delete mode 100644 framework-9.50.2/src/Illuminate/Cache/DatabaseLock.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/DatabaseStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/DynamoDbLock.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/DynamoDbStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/Events/CacheEvent.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/Events/CacheHit.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/Events/CacheMissed.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/Events/KeyForgotten.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/Events/KeyWritten.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/FileStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/HasCacheLock.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Cache/Lock.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/LuaScripts.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/MemcachedConnector.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/MemcachedLock.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/MemcachedStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/NoLock.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/NullStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/PhpRedisLock.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/RateLimiter.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/RateLimiting/GlobalLimit.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/RateLimiting/Limit.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/RateLimiting/Unlimited.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/RedisLock.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/RedisStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/RedisTaggedCache.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/Repository.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/RetrievesMultipleKeys.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/TagSet.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/TaggableStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Cache/TaggedCache.php delete mode 100755 framework-9.50.2/src/Illuminate/Cache/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Collections/Arr.php delete mode 100644 framework-9.50.2/src/Illuminate/Collections/Collection.php delete mode 100644 framework-9.50.2/src/Illuminate/Collections/Enumerable.php delete mode 100644 framework-9.50.2/src/Illuminate/Collections/HigherOrderCollectionProxy.php delete mode 100644 framework-9.50.2/src/Illuminate/Collections/ItemNotFoundException.php delete mode 100644 framework-9.50.2/src/Illuminate/Collections/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Collections/LazyCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Collections/MultipleItemsFoundException.php delete mode 100644 framework-9.50.2/src/Illuminate/Collections/Traits/EnumeratesValues.php delete mode 100644 framework-9.50.2/src/Illuminate/Collections/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Collections/helpers.php delete mode 100644 framework-9.50.2/src/Illuminate/Conditionable/HigherOrderWhenProxy.php delete mode 100644 framework-9.50.2/src/Illuminate/Conditionable/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Conditionable/Traits/Conditionable.php delete mode 100644 framework-9.50.2/src/Illuminate/Conditionable/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Config/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Config/Repository.php delete mode 100755 framework-9.50.2/src/Illuminate/Config/composer.json delete mode 100755 framework-9.50.2/src/Illuminate/Console/Application.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/BufferedConsoleOutput.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/CacheCommandMutex.php delete mode 100755 framework-9.50.2/src/Illuminate/Console/Command.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/CommandMutex.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Concerns/CallsCommands.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Concerns/CreatesMatchingTest.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Concerns/HasParameters.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Concerns/InteractsWithIO.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Concerns/InteractsWithSignals.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Concerns/PromptsForMissingInput.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/ConfirmableTrait.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/ContainerCommandLoader.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Contracts/NewLineAware.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Events/ArtisanStarting.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Events/CommandFinished.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Events/CommandStarting.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Events/ScheduledBackgroundTaskFinished.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskFailed.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskFinished.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskSkipped.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskStarting.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/GeneratorCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Console/OutputStyle.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Parser.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/QuestionHelper.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/CacheAware.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/CacheEventMutex.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/CallbackEvent.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/CommandBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/Event.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/EventMutex.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/ManagesFrequencies.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/Schedule.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleClearCacheCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleListCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Scheduling/SchedulingMutex.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/Signals.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Alert.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Ask.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/AskWithCompletion.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/BulletList.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Choice.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Component.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Confirm.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Error.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Info.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Line.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureDynamicContentIsHighlighted.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureNoPunctuation.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsurePunctuation.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Task.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/TwoColumnDetail.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/View/Components/Warn.php delete mode 100755 framework-9.50.2/src/Illuminate/Console/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Console/resources/views/components/alert.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/resources/views/components/bullet-list.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/resources/views/components/line.php delete mode 100644 framework-9.50.2/src/Illuminate/Console/resources/views/components/two-column-detail.php delete mode 100644 framework-9.50.2/src/Illuminate/Container/BoundMethod.php delete mode 100755 framework-9.50.2/src/Illuminate/Container/Container.php delete mode 100644 framework-9.50.2/src/Illuminate/Container/ContextualBindingBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Container/EntryNotFoundException.php delete mode 100644 framework-9.50.2/src/Illuminate/Container/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Container/RewindableGenerator.php delete mode 100644 framework-9.50.2/src/Illuminate/Container/Util.php delete mode 100755 framework-9.50.2/src/Illuminate/Container/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/Access/Authorizable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/Access/Gate.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/Authenticatable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/CanResetPassword.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/Guard.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/Middleware/AuthenticatesRequests.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/MustVerifyEmail.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/PasswordBroker.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/PasswordBrokerFactory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/StatefulGuard.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/SupportsBasicAuth.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Auth/UserProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Broadcasting/Broadcaster.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Broadcasting/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Broadcasting/HasBroadcastChannel.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Broadcasting/ShouldBeUnique.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Broadcasting/ShouldBroadcast.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Broadcasting/ShouldBroadcastNow.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Bus/Dispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Bus/QueueingDispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Cache/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Cache/Lock.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Cache/LockProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Cache/LockTimeoutException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Cache/Repository.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Cache/Store.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Config/Repository.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Console/Application.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Console/Isolatable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Console/Kernel.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Console/PromptsForMissingInput.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Container/BindingResolutionException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Container/CircularDependencyException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Container/Container.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Container/ContextualBindingBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Cookie/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Cookie/QueueingFactory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/Builder.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/Castable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/CastsAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/CastsInboundAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/DeviatesCastableAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/SerializesCastableAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/SupportsPartialRelations.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Events/MigrationEvent.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/ModelIdentifier.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Database/Query/Builder.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Debug/ExceptionHandler.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Encryption/DecryptException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Encryption/EncryptException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Encryption/Encrypter.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Encryption/StringEncrypter.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Events/Dispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Filesystem/Cloud.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Filesystem/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Filesystem/FileNotFoundException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Filesystem/Filesystem.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Filesystem/LockTimeoutException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Foundation/Application.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Foundation/CachesConfiguration.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Foundation/CachesRoutes.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Foundation/ExceptionRenderer.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Foundation/MaintenanceMode.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Hashing/Hasher.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Http/Kernel.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Mail/Attachable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Mail/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Mail/MailQueue.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Mail/Mailable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Mail/Mailer.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Notifications/Dispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Notifications/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Pagination/CursorPaginator.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Pagination/LengthAwarePaginator.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Pagination/Paginator.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Pipeline/Hub.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Pipeline/Pipeline.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/ClearableQueue.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/EntityNotFoundException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/EntityResolver.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/Job.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/Monitor.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/Queue.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/QueueableCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/QueueableEntity.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/ShouldBeEncrypted.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/ShouldBeUnique.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/ShouldBeUniqueUntilProcessing.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Queue/ShouldQueue.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Redis/Connection.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Redis/Connector.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Redis/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Redis/LimiterTimeoutException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Routing/BindingRegistrar.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Routing/Registrar.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Routing/ResponseFactory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Routing/UrlGenerator.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Routing/UrlRoutable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Session/Middleware/AuthenticatesSessions.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Session/Session.php delete mode 100755 framework-9.50.2/src/Illuminate/Contracts/Support/Arrayable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Support/CanBeEscapedWhenCastToString.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Support/DeferrableProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Support/DeferringDisplayableValue.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Support/Htmlable.php delete mode 100755 framework-9.50.2/src/Illuminate/Contracts/Support/Jsonable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Support/MessageBag.php delete mode 100755 framework-9.50.2/src/Illuminate/Contracts/Support/MessageProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Contracts/Support/Renderable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Support/Responsable.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Support/ValidatedData.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Translation/HasLocalePreference.php delete mode 100755 framework-9.50.2/src/Illuminate/Contracts/Translation/Loader.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Translation/Translator.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/DataAwareRule.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/ImplicitRule.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/InvokableRule.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/Rule.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/UncompromisedVerifier.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/Validator.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/Validation/ValidatorAwareRule.php delete mode 100755 framework-9.50.2/src/Illuminate/Contracts/View/Engine.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/View/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/View/View.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/View/ViewCompilationException.php delete mode 100644 framework-9.50.2/src/Illuminate/Contracts/composer.json delete mode 100755 framework-9.50.2/src/Illuminate/Cookie/CookieJar.php delete mode 100755 framework-9.50.2/src/Illuminate/Cookie/CookieServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Cookie/CookieValuePrefix.php delete mode 100644 framework-9.50.2/src/Illuminate/Cookie/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php delete mode 100644 framework-9.50.2/src/Illuminate/Cookie/Middleware/EncryptCookies.php delete mode 100755 framework-9.50.2/src/Illuminate/Cookie/composer.json delete mode 100755 framework-9.50.2/src/Illuminate/Database/Capsule/Manager.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/ClassMorphViolationException.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Concerns/BuildsQueries.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Concerns/CompilesJsonPaths.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Concerns/ExplainsQueries.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Concerns/ManagesTransactions.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Concerns/ParsesSearchPath.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/ConfigurationUrlParser.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Connection.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/ConnectionInterface.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/ConnectionResolver.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/ConnectionResolverInterface.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Connectors/ConnectionFactory.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Connectors/Connector.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Connectors/ConnectorInterface.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Connectors/MySqlConnector.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Connectors/PostgresConnector.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Connectors/SQLiteConnector.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Connectors/SqlServerConnector.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/DatabaseInspectionCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/DbCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/DumpCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Factories/stubs/factory.stub delete mode 100755 framework-9.50.2/src/Illuminate/Database/Console/Migrations/BaseCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Migrations/FreshCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Console/Migrations/InstallCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Console/Migrations/MigrateCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Console/Migrations/RefreshCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Console/Migrations/ResetCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Console/Migrations/RollbackCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Migrations/StatusCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Migrations/TableGuesser.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/MonitorCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/PruneCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Seeds/SeedCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Seeds/WithoutModelEvents.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/ShowCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/TableCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Console/WipeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/DBAL/TimestampType.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/DatabaseManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/DatabaseServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/DatabaseTransactionRecord.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/DatabaseTransactionsManager.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/DeadlockException.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/DetectsConcurrencyErrors.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/DetectsLostConnections.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/BroadcastableModelEventOccurred.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/BroadcastsEvents.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Builder.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/ArrayObject.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsArrayObject.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEncryptedArrayObject.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEncryptedCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEnumArrayObject.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEnumCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsStringable.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/Attribute.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Collection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasUlids.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasUuids.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/BelongsToManyRelationship.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/BelongsToRelationship.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/CrossJoinSequence.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/HasFactory.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Relationship.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Sequence.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/HigherOrderBuilderProxy.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/InvalidCastException.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/JsonEncodingException.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/MassAssignmentException.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/MassPrunable.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/MissingAttributeException.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Model.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/ModelNotFoundException.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Prunable.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/QueueEntityResolver.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/RelationNotFoundException.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithDictionary.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasMany.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOne.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOneThrough.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphMany.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphOne.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphTo.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Pivot.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Relation.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/Scope.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/SoftDeletes.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Eloquent/SoftDeletingScope.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/ConnectionEstablished.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/ConnectionEvent.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/DatabaseBusy.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/DatabaseRefreshed.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/MigrationEnded.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/MigrationEvent.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/MigrationStarted.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/MigrationsEnded.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/MigrationsEvent.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/MigrationsStarted.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/ModelsPruned.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/NoPendingMigrations.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/QueryExecuted.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/SchemaDumped.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/SchemaLoaded.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/StatementPrepared.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/TransactionBeginning.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/TransactionCommitted.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/TransactionCommitting.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Events/TransactionRolledBack.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Grammar.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Database/LazyLoadingViolationException.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/LostConnectionException.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/MigrationServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Migrations/Migration.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Migrations/MigrationCreator.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Migrations/Migrator.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.create.stub delete mode 100755 framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.stub delete mode 100755 framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.update.stub delete mode 100644 framework-9.50.2/src/Illuminate/Database/MultipleColumnsSelectedException.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/MultipleRecordsFoundException.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/MySqlConnection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/PDO/Concerns/ConnectsToDatabase.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/PDO/Connection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/PDO/MySqlDriver.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/PDO/PostgresDriver.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/PDO/SQLiteDriver.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/PDO/SqlServerConnection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/PDO/SqlServerDriver.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/PostgresConnection.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Builder.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Expression.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Grammars/Grammar.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/JoinClause.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Query/Processors/MySqlProcessor.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Processors/PostgresProcessor.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Processors/Processor.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/QueryException.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/README.md delete mode 100755 framework-9.50.2/src/Illuminate/Database/RecordsNotFoundException.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/SQLiteConnection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/SQLiteDatabaseDoesNotExistException.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/Blueprint.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/Builder.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/ColumnDefinition.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/ForeignIdColumnDefinition.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/ForeignKeyDefinition.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/Grammars/Grammar.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/Grammars/RenameColumn.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/IndexDefinition.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/MySqlBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/MySqlSchemaState.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Schema/PostgresBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/PostgresSchemaState.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/SQLiteBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/SchemaState.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/SqlServerBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/Schema/SqliteSchemaState.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/Seeder.php delete mode 100755 framework-9.50.2/src/Illuminate/Database/SqlServerConnection.php delete mode 100644 framework-9.50.2/src/Illuminate/Database/composer.json delete mode 100755 framework-9.50.2/src/Illuminate/Encryption/Encrypter.php delete mode 100755 framework-9.50.2/src/Illuminate/Encryption/EncryptionServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Encryption/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Encryption/MissingAppKeyException.php delete mode 100644 framework-9.50.2/src/Illuminate/Encryption/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Events/CallQueuedListener.php delete mode 100755 framework-9.50.2/src/Illuminate/Events/Dispatcher.php delete mode 100755 framework-9.50.2/src/Illuminate/Events/EventServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Events/InvokeQueuedClosure.php delete mode 100644 framework-9.50.2/src/Illuminate/Events/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Events/NullDispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Events/QueuedClosure.php delete mode 100755 framework-9.50.2/src/Illuminate/Events/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Events/functions.php delete mode 100644 framework-9.50.2/src/Illuminate/Filesystem/AwsS3V3Adapter.php delete mode 100644 framework-9.50.2/src/Illuminate/Filesystem/Filesystem.php delete mode 100644 framework-9.50.2/src/Illuminate/Filesystem/FilesystemAdapter.php delete mode 100644 framework-9.50.2/src/Illuminate/Filesystem/FilesystemManager.php delete mode 100644 framework-9.50.2/src/Illuminate/Filesystem/FilesystemServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Filesystem/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Filesystem/LockableFile.php delete mode 100644 framework-9.50.2/src/Illuminate/Filesystem/composer.json delete mode 100755 framework-9.50.2/src/Illuminate/Foundation/AliasLoader.php delete mode 100755 framework-9.50.2/src/Illuminate/Foundation/Application.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Auth/Access/Authorizable.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Auth/EmailVerificationRequest.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Auth/User.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bootstrap/BootProviders.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bus/Dispatchable.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bus/DispatchesJobs.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bus/PendingChain.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bus/PendingClosureDispatch.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Bus/PendingDispatch.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/CacheBasedMaintenanceMode.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/ComposerScripts.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/AboutCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/CastMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ChannelMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ClearCompiledCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/CliDumper.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ClosureCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ComponentMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ConfigCacheCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ConfigClearCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/DocsCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/DownCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentDecryptCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentEncryptCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/EventCacheCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/EventClearCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/EventGenerateCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/EventListCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/EventMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ExceptionMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/JobMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/Kernel.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/KeyGenerateCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ListenerMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/MailMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ModelMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/NotificationMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ObserverMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/OptimizeClearCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/OptimizeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/PolicyMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ProviderMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/QueuedCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/RequestMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ResourceMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/RouteCacheCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/RouteClearCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/RouteListCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/RuleMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ScopeMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ServeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ShowModelCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/StorageLinkCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/StubPublishCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/TestMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/UpCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/VendorPublishCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ViewCacheCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/ViewClearCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/cast.inbound.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/cast.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/channel.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/console.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/event.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/exception-render-report.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/exception-render.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/exception-report.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/exception.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/job.queued.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/job.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/listener-duck.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/listener-queued-duck.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/listener-queued.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/listener.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/mail.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/maintenance-mode.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown-notification.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/model.morph-pivot.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/model.pivot.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/model.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/notification.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/observer.plain.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/observer.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/pest.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/pest.unit.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/policy.plain.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/policy.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/provider.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/request.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/resource-collection.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/resource.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/routes.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/rule.invokable.implicit.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/rule.invokable.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/rule.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/scope.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/test.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/test.unit.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Console/stubs/view-component.stub delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/EnvironmentDetector.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Events/DiscoverEvents.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Events/Dispatchable.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Events/LocaleUpdated.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Events/MaintenanceModeDisabled.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Events/MaintenanceModeEnabled.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Events/PublishingStubs.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Events/VendorTagPublished.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/Handler.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/ReportableHandler.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/Whoops/WhoopsExceptionRenderer.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/Whoops/WhoopsHandler.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/401.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/402.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/403.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/404.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/419.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/429.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/500.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/503.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/layout.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/minimal.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/FileBasedMaintenanceMode.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Events/RequestHandled.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/FormRequest.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/HtmlDumper.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Kernel.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/MaintenanceModeBypassCookie.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Middleware/HandlePrecognitiveRequests.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Inspiring.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/MaintenanceModeManager.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Mix.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/PackageManifest.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Precognition.php delete mode 100755 framework-9.50.2/src/Illuminate/Foundation/ProviderRepository.php delete mode 100755 framework-9.50.2/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Routing/PrecognitionCallableDispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Routing/PrecognitionControllerDispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDeprecationHandling.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTime.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/InteractsWithViews.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/DatabaseMigrations.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/DatabaseTransactions.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/DatabaseTruncation.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/LazilyRefreshDatabase.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/RefreshDatabase.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/RefreshDatabaseState.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/TestCase.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Traits/CanConfigureMigrationCommands.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/WithFaker.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/WithoutEvents.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/WithoutMiddleware.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Testing/Wormhole.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Validation/ValidatesRequests.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/Vite.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/helpers.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/resources/server.php delete mode 100644 framework-9.50.2/src/Illuminate/Foundation/stubs/facade.stub delete mode 100644 framework-9.50.2/src/Illuminate/Hashing/AbstractHasher.php delete mode 100644 framework-9.50.2/src/Illuminate/Hashing/Argon2IdHasher.php delete mode 100644 framework-9.50.2/src/Illuminate/Hashing/ArgonHasher.php delete mode 100755 framework-9.50.2/src/Illuminate/Hashing/BcryptHasher.php delete mode 100644 framework-9.50.2/src/Illuminate/Hashing/HashManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Hashing/HashServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Hashing/LICENSE.md delete mode 100755 framework-9.50.2/src/Illuminate/Hashing/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/Concerns/DeterminesStatusCode.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/ConnectionException.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/Events/ConnectionFailed.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/Events/RequestSending.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/Events/ResponseReceived.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/HttpClientException.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/PendingRequest.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/Pool.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/Request.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/RequestException.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/Response.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Client/ResponseSequence.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Concerns/CanBePrecognitive.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithFlashData.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithInput.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Exceptions/HttpResponseException.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Exceptions/PostTooLargeException.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Exceptions/ThrottleRequestsException.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/File.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/FileHelpers.php delete mode 100755 framework-9.50.2/src/Illuminate/Http/JsonResponse.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Http/Middleware/AddLinkHeadersForPreloadedAssets.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Middleware/CheckResponseForModifications.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Middleware/FrameGuard.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Middleware/HandleCors.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Middleware/SetCacheHeaders.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Middleware/TrustHosts.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Middleware/TrustProxies.php delete mode 100755 framework-9.50.2/src/Illuminate/Http/RedirectResponse.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Request.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/CollectsResources.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/DelegatesToResource.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/Json/JsonResource.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/Json/ResourceCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/Json/ResourceResponse.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/MergeValue.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/MissingValue.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Resources/PotentiallyMissing.php delete mode 100755 framework-9.50.2/src/Illuminate/Http/Response.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/ResponseTrait.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Testing/File.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Testing/FileFactory.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/Testing/MimeType.php delete mode 100644 framework-9.50.2/src/Illuminate/Http/UploadedFile.php delete mode 100755 framework-9.50.2/src/Illuminate/Http/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Log/Events/MessageLogged.php delete mode 100644 framework-9.50.2/src/Illuminate/Log/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Log/LogManager.php delete mode 100644 framework-9.50.2/src/Illuminate/Log/LogServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Log/Logger.php delete mode 100644 framework-9.50.2/src/Illuminate/Log/ParsesLogConfiguration.php delete mode 100755 framework-9.50.2/src/Illuminate/Log/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Macroable/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Macroable/Traits/Macroable.php delete mode 100644 framework-9.50.2/src/Illuminate/Macroable/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Attachment.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Events/MessageSending.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Events/MessageSent.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Mail/MailManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Mail/MailServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Mailable.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Mailables/Address.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Mailables/Attachment.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Mailables/Content.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Mailables/Envelope.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Mailables/Headers.php delete mode 100755 framework-9.50.2/src/Illuminate/Mail/Mailer.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Markdown.php delete mode 100755 framework-9.50.2/src/Illuminate/Mail/Message.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/PendingMail.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/SendQueuedMailable.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/SentMessage.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Transport/ArrayTransport.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Transport/LogTransport.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/Transport/SesTransport.php delete mode 100755 framework-9.50.2/src/Illuminate/Mail/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/button.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/footer.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/header.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/layout.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/message.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/panel.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/subcopy.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/table.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/html/themes/default.css delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/text/button.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/text/footer.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/text/header.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/text/layout.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/text/message.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/text/panel.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/text/subcopy.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Mail/resources/views/text/table.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Action.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/AnonymousNotifiable.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/ChannelManager.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Channels/BroadcastChannel.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Channels/DatabaseChannel.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Channels/MailChannel.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Console/NotificationTableCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Console/stubs/notifications.stub delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/DatabaseNotification.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/DatabaseNotificationCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Events/NotificationFailed.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Events/NotificationSending.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Events/NotificationSent.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/HasDatabaseNotifications.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Messages/BroadcastMessage.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Messages/DatabaseMessage.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Messages/MailMessage.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Messages/SimpleMessage.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Notifiable.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/Notification.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/NotificationSender.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/NotificationServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/RoutesNotifications.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/SendQueuedNotifications.php delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Notifications/resources/views/email.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/AbstractCursorPaginator.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/AbstractPaginator.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/Cursor.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/CursorPaginator.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/LengthAwarePaginator.php delete mode 100755 framework-9.50.2/src/Illuminate/Pagination/PaginationServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/PaginationState.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/Paginator.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/UrlWindow.php delete mode 100755 framework-9.50.2/src/Illuminate/Pagination/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/bootstrap-5.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/default.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-bootstrap-5.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-default.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-tailwind.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pagination/resources/views/tailwind.blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Pipeline/Hub.php delete mode 100644 framework-9.50.2/src/Illuminate/Pipeline/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Pipeline/Pipeline.php delete mode 100644 framework-9.50.2/src/Illuminate/Pipeline/PipelineServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Pipeline/composer.json delete mode 100755 framework-9.50.2/src/Illuminate/Queue/BeanstalkdQueue.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/CallQueuedClosure.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/CallQueuedHandler.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Capsule/Manager.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Connectors/ConnectorInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Connectors/DatabaseConnector.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Connectors/NullConnector.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Connectors/RedisConnector.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Connectors/SqsConnector.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Connectors/SyncConnector.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/BatchesTableCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/ClearCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/FailedTableCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/FlushFailedCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/ForgetFailedCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/ListFailedCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Console/ListenCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/MonitorCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/PruneBatchesCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/PruneFailedJobsCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/RestartCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/RetryBatchCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/RetryCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/TableCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/WorkCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/stubs/batches.stub delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/stubs/failed_jobs.stub delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Console/stubs/jobs.stub delete mode 100644 framework-9.50.2/src/Illuminate/Queue/DatabaseQueue.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/JobExceptionOccurred.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/JobFailed.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/JobProcessed.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/JobProcessing.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/JobQueued.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/JobReleasedAfterException.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/JobRetryRequested.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/Looping.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/QueueBusy.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Events/WorkerStopping.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Failed/DatabaseUuidFailedJobProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Failed/NullFailedJobProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Failed/PrunableFailedJobProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/InteractsWithQueue.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/InvalidPayloadException.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Jobs/BeanstalkdJob.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Jobs/DatabaseJob.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Jobs/Job.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Jobs/JobName.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Jobs/RedisJob.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Jobs/SqsJob.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Jobs/SyncJob.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/LICENSE.md delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Listener.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/ListenerOptions.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/LuaScripts.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/ManuallyFailedException.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/MaxAttemptsExceededException.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Middleware/RateLimited.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Middleware/RateLimitedWithRedis.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Middleware/SkipIfBatchCancelled.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Middleware/ThrottlesExceptions.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Middleware/ThrottlesExceptionsWithRedis.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Middleware/WithoutOverlapping.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/NullQueue.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/Queue.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/QueueManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/QueueServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/README.md delete mode 100644 framework-9.50.2/src/Illuminate/Queue/RedisQueue.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/SerializesModels.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/SqsQueue.php delete mode 100755 framework-9.50.2/src/Illuminate/Queue/SyncQueue.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/Worker.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/WorkerOptions.php delete mode 100644 framework-9.50.2/src/Illuminate/Queue/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Connections/Connection.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Connections/PacksPhpRedisValues.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Connections/PhpRedisConnection.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Connections/PredisClusterConnection.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Connections/PredisConnection.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Connectors/PhpRedisConnector.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Connectors/PredisConnector.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Events/CommandExecuted.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Limiters/DurationLimiter.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php delete mode 100644 framework-9.50.2/src/Illuminate/Redis/RedisManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Redis/RedisServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Redis/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Routing/AbstractRouteCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/CallableDispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/CompiledRouteCollection.php delete mode 100755 framework-9.50.2/src/Illuminate/Routing/Console/ControllerMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.api.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.invokable.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.model.api.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.model.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.nested.api.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.nested.singleton.api.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.nested.singleton.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.nested.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.plain.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.singleton.api.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.singleton.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Console/stubs/middleware.stub delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Contracts/CallableDispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Contracts/ControllerDispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Controller.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/ControllerDispatcher.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/ControllerMiddlewareOptions.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Controllers/HasMiddleware.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Controllers/Middleware.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Events/RouteMatched.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Events/Routing.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Exceptions/BackedEnumCaseNotFoundException.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Exceptions/InvalidSignatureException.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Exceptions/StreamedResponseException.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Exceptions/UrlGenerationException.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/ImplicitRouteBinding.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Matching/HostValidator.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Matching/MethodValidator.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Matching/SchemeValidator.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Matching/UriValidator.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Matching/ValidatorInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Middleware/SubstituteBindings.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Middleware/ThrottleRequests.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Middleware/ValidateSignature.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/MiddlewareNameResolver.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/PendingResourceRegistration.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/PendingSingletonResourceRegistration.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Pipeline.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RedirectController.php delete mode 100755 framework-9.50.2/src/Illuminate/Routing/Redirector.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/ResourceRegistrar.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/ResponseFactory.php delete mode 100755 framework-9.50.2/src/Illuminate/Routing/Route.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteAction.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteBinding.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteCollectionInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteDependencyResolverTrait.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteFileRegistrar.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteGroup.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteParameterBinder.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteRegistrar.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteSignatureParameters.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteUri.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/RouteUrlGenerator.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/Router.php delete mode 100755 framework-9.50.2/src/Illuminate/Routing/RoutingServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/SortedMiddleware.php delete mode 100755 framework-9.50.2/src/Illuminate/Routing/UrlGenerator.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/ViewController.php delete mode 100644 framework-9.50.2/src/Illuminate/Routing/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Session/ArraySessionHandler.php delete mode 100755 framework-9.50.2/src/Illuminate/Session/CacheBasedSessionHandler.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/Console/SessionTableCommand.php delete mode 100755 framework-9.50.2/src/Illuminate/Session/Console/stubs/database.stub delete mode 100755 framework-9.50.2/src/Illuminate/Session/CookieSessionHandler.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/DatabaseSessionHandler.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/EncryptedStore.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/ExistenceAwareInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/FileSessionHandler.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Session/Middleware/AuthenticateSession.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/Middleware/StartSession.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/NullSessionHandler.php delete mode 100755 framework-9.50.2/src/Illuminate/Session/SessionManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Session/SessionServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Session/Store.php delete mode 100644 framework-9.50.2/src/Illuminate/Session/SymfonySessionDecorator.php delete mode 100755 framework-9.50.2/src/Illuminate/Session/TokenMismatchException.php delete mode 100755 framework-9.50.2/src/Illuminate/Session/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Support/AggregateServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Benchmark.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Carbon.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Composer.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/ConfigurationUrlParser.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/DateFactory.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Env.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Exceptions/MathException.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/App.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Artisan.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Auth.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Blade.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/Broadcast.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/Bus.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Cache.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Config.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Cookie.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Crypt.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/DB.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/Date.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Event.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Facade.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/File.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/Gate.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Hash.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/Http.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Lang.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Log.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Mail.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/Notification.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/ParallelTesting.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Password.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Queue.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/RateLimiter.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Redirect.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Redis.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Request.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Response.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Route.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Schema.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Session.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/Storage.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/URL.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/Validator.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Facades/View.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Facades/Vite.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Fluent.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/HigherOrderTapProxy.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/HtmlString.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/InteractsWithTime.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Js.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Support/Lottery.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Manager.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/MessageBag.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/MultipleInstanceManager.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/NamespacedItemResolver.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Optional.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/Pluralizer.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/ProcessUtils.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Reflector.php delete mode 100755 framework-9.50.2/src/Illuminate/Support/ServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Str.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Stringable.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BatchFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BusFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/EventFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/MailFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/NotificationFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingBatchFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingChainFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Testing/Fakes/QueueFake.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Timebox.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Traits/CapsuleManagerTrait.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Traits/ForwardsCalls.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Traits/Localizable.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Traits/ReflectsClosures.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/Traits/Tappable.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/ValidatedInput.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/ViewErrorBag.php delete mode 100644 framework-9.50.2/src/Illuminate/Support/composer.json delete mode 100755 framework-9.50.2/src/Illuminate/Support/helpers.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Assert.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/AssertableJsonString.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Concerns/AssertsStatusCodes.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Concerns/TestDatabases.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Constraints/ArraySubset.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Constraints/CountInDatabase.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Constraints/HasInDatabase.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Constraints/NotSoftDeletedInDatabase.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Constraints/SeeInOrder.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Constraints/SoftDeletedInDatabase.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Fluent/AssertableJson.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Debugging.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Has.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Interaction.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Matching.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Testing/LoggedExceptionCollection.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/ParallelConsoleOutput.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/ParallelRunner.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/ParallelTesting.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/ParallelTestingServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/PendingCommand.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/TestComponent.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/TestResponse.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/TestView.php delete mode 100644 framework-9.50.2/src/Illuminate/Testing/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Translation/ArrayLoader.php delete mode 100755 framework-9.50.2/src/Illuminate/Translation/FileLoader.php delete mode 100644 framework-9.50.2/src/Illuminate/Translation/LICENSE.md delete mode 100755 framework-9.50.2/src/Illuminate/Translation/MessageSelector.php delete mode 100644 framework-9.50.2/src/Illuminate/Translation/PotentiallyTranslatedString.php delete mode 100755 framework-9.50.2/src/Illuminate/Translation/TranslationServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Translation/Translator.php delete mode 100755 framework-9.50.2/src/Illuminate/Translation/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/Validation/ClosureValidationRule.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Concerns/FilterEmailValidation.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Concerns/FormatsMessages.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Concerns/ReplacesAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Concerns/ValidatesAttributes.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/ConditionalRules.php delete mode 100755 framework-9.50.2/src/Illuminate/Validation/DatabasePresenceVerifier.php delete mode 100755 framework-9.50.2/src/Illuminate/Validation/DatabasePresenceVerifierInterface.php delete mode 100755 framework-9.50.2/src/Illuminate/Validation/Factory.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/InvokableValidationRule.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/Validation/NestedRules.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/NotPwnedVerifier.php delete mode 100755 framework-9.50.2/src/Illuminate/Validation/PresenceVerifierInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rule.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/DatabaseRule.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/Dimensions.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/Enum.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/ExcludeIf.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/Exists.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/File.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/ImageFile.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/In.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/NotIn.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/Password.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/ProhibitedIf.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/RequiredIf.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/Rules/Unique.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/UnauthorizedException.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/ValidationData.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/ValidationException.php delete mode 100644 framework-9.50.2/src/Illuminate/Validation/ValidationRuleParser.php delete mode 100755 framework-9.50.2/src/Illuminate/Validation/ValidationServiceProvider.php delete mode 100755 framework-9.50.2/src/Illuminate/Validation/Validator.php delete mode 100755 framework-9.50.2/src/Illuminate/Validation/composer.json delete mode 100644 framework-9.50.2/src/Illuminate/View/AnonymousComponent.php delete mode 100644 framework-9.50.2/src/Illuminate/View/AppendableAttributeValue.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/BladeCompiler.php delete mode 100755 framework-9.50.2/src/Illuminate/View/Compilers/Compiler.php delete mode 100755 framework-9.50.2/src/Illuminate/View/Compilers/CompilerInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/ComponentTagCompiler.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesAuthorizations.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesClasses.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesComments.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesErrors.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesFragments.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesJs.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesJson.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesStyles.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Component.php delete mode 100644 framework-9.50.2/src/Illuminate/View/ComponentAttributeBag.php delete mode 100644 framework-9.50.2/src/Illuminate/View/ComponentSlot.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Concerns/ManagesComponents.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Concerns/ManagesEvents.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Concerns/ManagesFragments.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Concerns/ManagesLayouts.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Concerns/ManagesLoops.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Concerns/ManagesStacks.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Concerns/ManagesTranslations.php delete mode 100644 framework-9.50.2/src/Illuminate/View/DynamicComponent.php delete mode 100755 framework-9.50.2/src/Illuminate/View/Engines/CompilerEngine.php delete mode 100755 framework-9.50.2/src/Illuminate/View/Engines/Engine.php delete mode 100755 framework-9.50.2/src/Illuminate/View/Engines/EngineResolver.php delete mode 100644 framework-9.50.2/src/Illuminate/View/Engines/FileEngine.php delete mode 100755 framework-9.50.2/src/Illuminate/View/Engines/PhpEngine.php delete mode 100755 framework-9.50.2/src/Illuminate/View/Factory.php delete mode 100755 framework-9.50.2/src/Illuminate/View/FileViewFinder.php delete mode 100644 framework-9.50.2/src/Illuminate/View/InvokableComponentVariable.php delete mode 100644 framework-9.50.2/src/Illuminate/View/LICENSE.md delete mode 100644 framework-9.50.2/src/Illuminate/View/Middleware/ShareErrorsFromSession.php delete mode 100755 framework-9.50.2/src/Illuminate/View/View.php delete mode 100644 framework-9.50.2/src/Illuminate/View/ViewException.php delete mode 100755 framework-9.50.2/src/Illuminate/View/ViewFinderInterface.php delete mode 100644 framework-9.50.2/src/Illuminate/View/ViewName.php delete mode 100755 framework-9.50.2/src/Illuminate/View/ViewServiceProvider.php delete mode 100644 framework-9.50.2/src/Illuminate/View/composer.json diff --git a/framework-9.50.2/CHANGELOG.md b/framework-9.50.2/CHANGELOG.md deleted file mode 100644 index 421b576..0000000 --- a/framework-9.50.2/CHANGELOG.md +++ /dev/null @@ -1,1535 +0,0 @@ -# Release Notes for 9.x - -## [Unreleased](https://github.com/laravel/framework/compare/v9.49.0...9.x) - - -## [v9.49.0](https://github.com/laravel/framework/compare/v9.48.0...v9.49.0) - 2023-01-31 - -### Added -- Added `Illuminate/Database/Schema/ForeignKeyDefinition::noActionOnDelete()` ([#45712](https://github.com/laravel/framework/pull/45712)) -- Added new throw helper methods to the HTTP Client ([#45704](https://github.com/laravel/framework/pull/45704)) -- Added configurable timezone support for WorkCommand output timestamps ([#45722](https://github.com/laravel/framework/pull/45722)) -- Added support for casting arrays containing enums ([#45621](https://github.com/laravel/framework/pull/45621)) -- Added "missing" validation rules ([#45717](https://github.com/laravel/framework/pull/45717)) -- Added `/Illuminate/Database/Eloquent/SoftDeletes::forceDeleteQuietly()` ([#45737](https://github.com/laravel/framework/pull/45737)) -- Added `Illuminate/Collections/Arr::sortDesc()` ([#45761](https://github.com/laravel/framework/pull/45761)) -- Added CLI Prompts ([#45629](https://github.com/laravel/framework/pull/45629), [#45864](https://github.com/laravel/framework/pull/45864)) -- Adds assertJsonIsArray and assertJsonIsObject for TestResponse ([#45731](https://github.com/laravel/framework/pull/45731)) -- Added `Illuminate/Database/Eloquent/Relations/HasOneOrMany::createQuietly()` ([#45783](https://github.com/laravel/framework/pull/45783)) -- Add validation rules: ascii_alpha, ascii_alpha_num, ascii_alpha_dash ([#45769](https://github.com/laravel/framework/pull/45769)) -- Extract status methods to traits ([#45789](https://github.com/laravel/framework/pull/45789)) -- Add "addRestoreOrCreate" extension to SoftDeletingScope ([#45754](https://github.com/laravel/framework/pull/45754)) -- Added connection established event ([f850d99](https://github.com/laravel/framework/commit/f850d99c50d173189ece2bb37b6c7ddcb456f1f9)) -- Add forceDeleting event to models ([#45836](https://github.com/laravel/framework/pull/45836)) -- Add title tag in mail template ([#45859](https://github.com/laravel/framework/pull/45859)) -- Added new methods to Collection ([#45839](https://github.com/laravel/framework/pull/45839)) -- Add skip cancelled middleware ([#45869](https://github.com/laravel/framework/pull/45869)) - -### Fixed -- Fix flushdb on cluster for `PredisClusterConnection.php` ([#45544](https://github.com/laravel/framework/pull/45544)) -- Fix blade tag issue with nested calls ([#45764](https://github.com/laravel/framework/pull/45764)) -- Fix infinite loop in blade compiler ([#45780](https://github.com/laravel/framework/pull/45780)) -- Fix ValidationValidator not to accept terminating newline ([#45790](https://github.com/laravel/framework/pull/45790)) -- Fix stubs publish command generating incorrect controller stubs ([#45812](https://github.com/laravel/framework/pull/45812)) -- fix: normalize route pipeline exception ([#45817](https://github.com/laravel/framework/pull/45817)) -- Fix Illuminate Filesystem replace() leaves file executable ([#45856](https://github.com/laravel/framework/pull/45856)) - -### Changed -- Ensures channel name matches from start of string ([#45692](https://github.com/laravel/framework/pull/45692)) -- Replace raw invisible characters in regex expressions with counterpart Unicode regex notations ([#45680](https://github.com/laravel/framework/pull/45680)) -- Optimize destroy method ([#45709](https://github.com/laravel/framework/pull/45709)) -- Unify prohibits behavior around prohibits_if ([#45723](https://github.com/laravel/framework/pull/45723)) -- Removes dependency on bcmath ([#45729](https://github.com/laravel/framework/pull/45729)) -- Allow brick/math 0.11 also ([#45762](https://github.com/laravel/framework/pull/45762)) -- Optimize findMany of BelongsToMany ([#45745](https://github.com/laravel/framework/pull/45745)) -- Ensure decimal rule handles large values ([#45693](https://github.com/laravel/framework/pull/45693)) -- Backed enum support for @js ([#45862](https://github.com/laravel/framework/pull/45862)) -- Restart syscalls for SIGALRM when worker times out a job ([#45871](https://github.com/laravel/framework/pull/45871)) -- Ensure subsiquent calls to Mailable->to() overwrite previous entries ([#45885](https://github.com/laravel/framework/pull/45885)) - - -## [v9.48.0](https://github.com/laravel/framework/compare/v9.47.0...v9.48.0) - 2023-01-17 - -### Added -- Added `Illuminate/Database/Schema/Builder::withoutForeignKeyConstraints()` ([#45601](https://github.com/laravel/framework/pull/45601)) -- Added `fragments()` \ `fragmentIf()` \ `fragmentsIf()` methods to `Illuminate/View/View.php` class ([#45656](https://github.com/laravel/framework/pull/45656), [#45669](https://github.com/laravel/framework/pull/45669)) -- Added `incrementEach()` and `decrementEach()` to `Illuminate/Database/Query/Builder` ([#45577](https://github.com/laravel/framework/pull/45577)) -- Added ability to drop an index when modifying a column ([#45513](https://github.com/laravel/framework/pull/45513)) -- Allow to set HTTP client for mailers ([#45684](https://github.com/laravel/framework/pull/45684)) -- Added 402 exception view ([#45682](https://github.com/laravel/framework/pull/45682)) -- Added `notFound()` helper to Http Client response ([#45681](https://github.com/laravel/framework/pull/45681)) - -### Fixed -- Fixed decimal cast ([#45602](https://github.com/laravel/framework/pull/45602)) - -### Changed -- Ignore whitespaces/newlines when finding relations in model:show command ([#45608](https://github.com/laravel/framework/pull/45608)) -- Fail queued job with a string messag ([#45625](https://github.com/laravel/framework/pull/45625)) -- Allow fake() helper in unit tests ([#45624](https://github.com/laravel/framework/pull/45624)) -- allow egulias/email-validator v4 ([#45649](https://github.com/laravel/framework/pull/45649)) -- Force countBy method in EloquentCollection to return base collection ([#45663](https://github.com/laravel/framework/pull/45663)) -- Allow for the collection of stubs to be published ([#45653](https://github.com/laravel/framework/pull/45653)) - - -## [v9.47.0](https://github.com/laravel/framework/compare/v9.46.0...v9.47.0) - 2023-01-10 - -### Added -- Added Support Lazy Collections in `BatchFake::add()` ([#45507](https://github.com/laravel/framework/pull/45507)) -- Added Decimal to list of Numeric rules ([#45533](https://github.com/laravel/framework/pull/45533)) -- Added `Illuminate/Routing/PendingSingletonResourceRegistration::destroyable()` ([#45549](https://github.com/laravel/framework/pull/45549)) -- Added setVisible and setHidden to Eloquent Collection ([#45558](https://github.com/laravel/framework/pull/45558)) - -### Fixed -- Fix bound method contextual binding ([#45500](https://github.com/laravel/framework/pull/45500)) -- Fixed Method explodeExplicitRule with regex rule ([#45555](https://github.com/laravel/framework/pull/45555)) -- Fixed `Illuminate/Database/Query/Builder::whereIntegerInRaw()` ([#45584](https://github.com/laravel/framework/pull/45584)) -- Fixes blade tags ([#45490](https://github.com/laravel/framework/pull/45490)) - -### Changed -- Return model when casting attribute ([#45539](https://github.com/laravel/framework/pull/45539)) -- always show full path to migration in `Illuminate/Database/Console/Migrations/MigrateMakeCommand.php` ([9f6ff48](https://github.com/laravel/framework/commit/9f6ff487e6964dc407c267d1a40352fa71b2fc44)) -- Remove index name when adding primary key on MySQL ([#45515](https://github.com/laravel/framework/pull/45515)) - - -## [v9.46.0](https://github.com/laravel/framework/compare/v9.45.1...v9.46.0) - 2023-01-03 - -### Added -- Added Passthrough PATH variable to serve command ([#45402](https://github.com/laravel/framework/pull/45402)) -- Added whenHas to JsonResource ([#45376](https://github.com/laravel/framework/pull/45376)) -- Added ./fleet directory to .gitignore ([#45432](https://github.com/laravel/framework/pull/45432)) -- Added unless to JsonResource ([#45419](https://github.com/laravel/framework/pull/45419)) - -### Fixed -- Fixed credentials check ([#45437](https://github.com/laravel/framework/pull/45437)) -- Fixed decimal cast precision issue ([#45456](https://github.com/laravel/framework/pull/45456), [#45492](https://github.com/laravel/framework/pull/45492)) -- Precognitive validation with nested arrays doesn't throw validation error ([#45405](https://github.com/laravel/framework/pull/45405)) -- Fixed issue on which class to check increment and decrement methods for custom cast ([#45444](https://github.com/laravel/framework/pull/45444)) - -### Changed -- Update decimal validation rule to allow validation of signed numbers ([24a48b2](https://github.com/laravel/framework/commit/24a48b2fa6154b2ba2e669999e73a060f9e82080)) -- Output only unique asset / preload tags in Vite ([#45404](https://github.com/laravel/framework/pull/45404)) -- Optimize whereKey method in Query Builder ([#45453](https://github.com/laravel/framework/pull/45453)) -- Remove extra code in Model.php to optimize performance ([#45476](https://github.com/laravel/framework/pull/45476)) -- Exception Handler prepareResponse add previous Exception ([#45499](https://github.com/laravel/framework/pull/45499)) - - -## [v9.45.1](https://github.com/laravel/framework/compare/v9.45.0...v9.45.1) - 2022-12-21 - -### Revert -- Revert "fix single line @php statements to not be parsed as php blocks" ([#45389](https://github.com/laravel/framework/pull/45389)) - -### Changed -- Load schema to in memory database ([#45375](https://github.com/laravel/framework/pull/45375)) - - -## [v9.45.0](https://github.com/laravel/framework/compare/v9.44.0...v9.45.0) - 2022-12-20 - -### Added -- Allows the registration of custom, root-level anonymous component search paths. ([#45338](https://github.com/laravel/framework/pull/45338), [1ff0379](https://github.com/laravel/framework/commit/1ff0379d203ac836c3eeae567cc07b99c352b1e7)) -- Added decimal validation rule ([#45356](https://github.com/laravel/framework/pull/45356), [e89b2b0](https://github.com/laravel/framework/commit/e89b2b0bd0e43b8aecd72a55c546288576bb0370)) -- Added align property to button mail component ([#45362](https://github.com/laravel/framework/pull/45362)) -- Added whereUlid(param) support for routing ([#45372](https://github.com/laravel/framework/pull/45372)) - -### Fixed -- Fixed single line @php statements to not be parsed as php blocks in BladeCompiler ([#45333](https://github.com/laravel/framework/pull/45333)) -- Added missing code to set locale from model preferred locale in Maillable ([#45308](https://github.com/laravel/framework/pull/45308)) - -### Changed -- Vite: ability to prevent preload tag generation from attribute resolver callback ([#45283](https://github.com/laravel/framework/pull/45283)) -- Deprecation Test Improvements ([#45317](https://github.com/laravel/framework/pull/45317)) -- Do not allow nested arrays in whereIn method ([140c3a8](https://github.com/laravel/framework/commit/140c3a81d261669d0785aebe2599aed99991e890)) -- Bump ramsey/uuid ([#45367](https://github.com/laravel/framework/pull/45367)) - - -## [v9.44.0](https://github.com/laravel/framework/compare/v9.43.0...v9.44.0) - 2022-12-15 - -### Added -- Added `Illuminate/Auth/GuardHelpers::forgetUser()` ([#45208](https://github.com/laravel/framework/pull/45208)) -- Added sort option for schedule:list ([#45198](https://github.com/laravel/framework/pull/45198)) -- Added `ascii` and `ulid` validation rules ([#45218](https://github.com/laravel/framework/pull/45218)) -- Http client - allow to provide closure as "throwif" condition ([#45251](https://github.com/laravel/framework/pull/45251)) -- Support '/' as a possible column name in database ([#45268](https://github.com/laravel/framework/pull/45268)) -- Added Granular notifications queue connections ([#45264](https://github.com/laravel/framework/pull/45264)) -- Add support for native rename/drop column commands ([#45258](https://github.com/laravel/framework/pull/45258)) -- Add $encoding parameter to substr method ([#45300](https://github.com/laravel/framework/pull/45300)) -- Use Macroable in Session facade ([#45310](https://github.com/laravel/framework/pull/45310)) - -### Fixed -- Fixed aliasing with cursor pagination ([#45188](https://github.com/laravel/framework/pull/45188)) -- Fixed email verification request ([#45227](https://github.com/laravel/framework/pull/45227)) -- Return 500 http error, instead of 200, when dotenv fails to load ([#45235](https://github.com/laravel/framework/pull/45235)) -- Fixed bug on Job Batchs Table ([#45263](https://github.com/laravel/framework/pull/45263)) -- Fixed schedule:list crash when call() is given class-string ([#45306](https://github.com/laravel/framework/pull/45306)) -- Fixed Lack of Memory when failing a job with wrong variable passed on the method fail() ([#45291](https://github.com/laravel/framework/pull/45291)) -- Fixed errors occurring when encrypted cookies has been tampered with ([#45313](https://github.com/laravel/framework/pull/45313)) -- bug fix, change array_merge to array_replace to prevent reindex ([#45309](https://github.com/laravel/framework/pull/45309)) - -### Changed -- Allow BusFake to use custom BusRepository ([#45202](https://github.com/laravel/framework/pull/45202)) -- Improved error logging for unmatched routes and route not found ([#45206](https://github.com/laravel/framework/pull/45206)) -- Improve assertSeeText and assertDontSeeText test methods ([#45274](https://github.com/laravel/framework/pull/45274)) -- Improved `Illuminate/Auth/SessionGuard::clearUserDataFromStorage()` ([#45305](https://github.com/laravel/framework/pull/45305)) -- Allows shouldIgnoresDeprecationError() to be overriden ([#45299](https://github.com/laravel/framework/pull/45299)) - - -## [v9.43.0](https://github.com/laravel/framework/compare/v9.42.2...v9.43.0) - 2022-12-06 - -### Added -- Add support for eager loading specific columns to withWhereHas ([#45168](https://github.com/laravel/framework/pull/45168)) -- Add Policies to Model Show Command ([#45153](https://github.com/laravel/framework/pull/45153)) -- Added `Illuminate/Support/Stringable::whenIsUlid()` ([#45183](https://github.com/laravel/framework/pull/45183)) - -### Fixed -- Added missing reserved names in GeneratorCommand ([#45149](https://github.com/laravel/framework/pull/45149)) - -### Changed -- Allow to pass base64 key to env:encrypt command ([#45157](https://github.com/laravel/framework/pull/45157)) -- Replace model:show searched value with correct FQCN ([#45160](https://github.com/laravel/framework/pull/45160)) - - -## [v9.42.2](https://github.com/laravel/framework/compare/v9.42.1...v9.42.2) - 2022-11-30 - -### Changed -- Improved stubs and `Illuminate/Routing/ResourceRegistrar::getResourceMethods()` ([6ddf3b0](https://github.com/laravel/framework/commit/6ddf3b017ccb8486c8dc5ff5a09d051a40e094ca)) - - -## [v9.42.1](https://github.com/laravel/framework/compare/v9.42.0...v9.42.1) - 2022-11-30 - -### Revert -- Revert "[9.x] Create new Json ParameterBag Instance when cloning Request" ([#45147](https://github.com/laravel/framework/pull/45147)) - -### Fixed -- Mailable : fixes strict comparison with int value ([#45138](https://github.com/laravel/framework/pull/45138)) -- Address Dynamic Relation Resolver inconsiency issue with extended Models ([#45122](https://github.com/laravel/framework/pull/45122)) - - -## [v9.42.0](https://github.com/laravel/framework/compare/v9.41.0...v9.42.0) - 2022-11-29 - -### Added -- Added --rest option to queue:listen ([00a12e2](https://github.com/laravel/framework/commit/00a12e256f897d215012bddf76b6b6c0d66f7f67), [82fde9e](https://github.com/laravel/framework/commit/82fde9e0dc4f08f4c4db254b9449fd87652c40a6)) -- Added `Illuminate/Support/Stringable::isUlid()` ([#45100](https://github.com/laravel/framework/pull/45100)) -- Add news report_if and report_unless helpers functions ([#45093](https://github.com/laravel/framework/pull/45093)) -- Add callback to resolve custom mutex name of schedule events ([#45126](https://github.com/laravel/framework/pull/45126)) -- Add WorkOptions to WorkerStopping Event ([#45120](https://github.com/laravel/framework/pull/45120)) -- Added `singleton` and `creatable` options to `Illuminate/Routing/Console/ControllerMakeCommand` ([#44872](https://github.com/laravel/framework/pull/44872)) - -### Fixed -- Fix pure enums validation ([#45121](https://github.com/laravel/framework/pull/45121)) -- Prevent test issues with relations with the $touches property ([#45118](https://github.com/laravel/framework/pull/45118)) -- Fix factory breaking when trying to determine whether a relation is empty ([#45135](https://github.com/laravel/framework/pull/45135)) - -### Changed -- Allow set command description via AsCommand attribute ([#45117](https://github.com/laravel/framework/pull/45117)) -- Updated Mailable to prevent duplicated recipients ([#45119](https://github.com/laravel/framework/pull/45119)) - - -## [v9.41.0](https://github.com/laravel/framework/compare/v9.40.1...v9.41.0) - 2022-11-22 - -### Added -- Added `Illuminate/Validation/Rules/DatabaseRule::onlyTrashed()` ([#44989](https://github.com/laravel/framework/pull/44989)) -- Add some class rules in class Rule ([#44998](https://github.com/laravel/framework/pull/44998)) -- Added `Illuminate/View/ComponentAttributeBag::missing()` ([#45016](https://github.com/laravel/framework/pull/45016)) -- Added `Illuminate/Http/Concerns/InteractsWithInput::whenMissing()` ([#45019](https://github.com/laravel/framework/pull/45019)) -- Add isolation levels to SQL Server Connector ([#45023](https://github.com/laravel/framework/pull/45023)) -- Fix php artisan serve with PHP_CLI_SERVER_WORKERS > 1 ([#45041](https://github.com/laravel/framework/pull/45041)) -- Add ability to prune cancelled job batches ([#45034](https://github.com/laravel/framework/pull/45034)) -- Adding option for custom manifest filename on Vite Facade ([#45007](https://github.com/laravel/framework/pull/45007)) - -### Fixed -- Fix deprecation warning when comparing a password against a NULL database password ([#44986](https://github.com/laravel/framework/pull/44986), [206e465](https://github.com/laravel/framework/commit/206e465f9680ef4618009ddfeafa672f8015a511)) -- Outlook web dark mode email layout fix ([#45024](https://github.com/laravel/framework/pull/45024)) - -### Changed -- Improves queue:work command output ([#44971](https://github.com/laravel/framework/pull/44971)) -- Optimize Collection::containsStrict ([#44970](https://github.com/laravel/framework/pull/44970)) -- Make name required in `Illuminate/Testing/TestResponse::assertRedirectToRoute()` ([98a0301](https://github.com/laravel/framework/commit/98a03013ed74925f68040beee0937203b632f57d)) -- Strip key, secret and token from root config options on aws clients ([#44979](https://github.com/laravel/framework/pull/44979)) -- Allow customised implementation of the SendQueuedMailable job ([#45040](https://github.com/laravel/framework/pull/45040)) -- Validate uuid before route binding query ([#44945](https://github.com/laravel/framework/pull/44945)) - - -## [v9.40.1](https://github.com/laravel/framework/compare/v9.40.0...v9.40.1) - 2022-11-15 - -### Added -- `Illuminate/Support/Lottery::fix()` ([7bade4f](https://github.com/laravel/framework/commit/7bade4f486e7b600cc9a5d527fcfd85ead1e17db)) - - -## [v9.40.0](https://github.com/laravel/framework/compare/v9.39.0...v9.40.0) - 2022-11-15 - -### Added -- Include Eloquent Model Observers in model:show command ([#44884](https://github.com/laravel/framework/pull/44884)) -- Added "lowercase" validation rule ([#44883](https://github.com/laravel/framework/pull/44883)) -- Introduce `Lottery` class ([#44894](https://github.com/laravel/framework/pull/44894)) -- Added `/Illuminate/Testing/TestResponse::assertRedirectToRoute()` ([#44926](https://github.com/laravel/framework/pull/44926)) -- Add uppercase validation rule ([#44918](https://github.com/laravel/framework/pull/44918)) -- Added saveManyQuietly to the hasOneOrMany and belongsToMany relations ([#44913](https://github.com/laravel/framework/pull/44913)) - -### Fixed -- Fix HasAttributes::getMutatedAttributes for classes with constructor args ([#44829](https://github.com/laravel/framework/pull/44829)) - -### Changed -- Remove argument assignment for console ([#44888](https://github.com/laravel/framework/pull/44888)) -- Pass $maxExceptions from mailable to underlying job when queuing ([#44903](https://github.com/laravel/framework/pull/44903)) -- Make Vite::isRunningHot public ([#44900](https://github.com/laravel/framework/pull/44900)) -- Add method to be able to override the exception context format ([#44895](https://github.com/laravel/framework/pull/44895)) -- Add zero-width space to trimmed characters in TrimStrings middleware ([#44906](https://github.com/laravel/framework/pull/44906)) -- Show error if key:generate artisan command fails ([#44927](https://github.com/laravel/framework/pull/44927)) -- Update database version check for lock popping for PlanetScale ([#44925](https://github.com/laravel/framework/pull/44925)) -- Move function withoutTrashed into DatabaseRule ([#44938](https://github.com/laravel/framework/pull/44938)) -- Use write connection on Schema::getColumnListing() and Schema::hasTable() for MySQL and PostgreSQL ([#44946](https://github.com/laravel/framework/pull/44946)) - - -## [v9.39.0](https://github.com/laravel/framework/compare/v9.38.0...v9.39.0) - 2022-11-08 - -### Added -- Added template fragments to Blade ([#44774](https://github.com/laravel/framework/pull/44774)) -- Added source file to Collection's dd method output ([#44793](https://github.com/laravel/framework/pull/44793), [d2e0e85](https://github.com/laravel/framework/commit/d2e0e859f00579aeb2600fce2fe9fc3cca933f41)) -- Added `Illuminate/Support/Testing/Fakes/PendingBatchFake::dispatchAfterResponse()` ([#44815](https://github.com/laravel/framework/pull/44815)) -- Added `Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase::assertDatabaseEmpty()` ([#44810](https://github.com/laravel/framework/pull/44810)) - -### Fixed -- Fixed `InteractsWithContainer::withoutMix()` ([#44822](https://github.com/laravel/framework/pull/44822)) - -### Changed -- Update `UpCommand::handle` that must return int ([#44807](https://github.com/laravel/framework/pull/44807)) -- Decouple database component from console component ([#44798](https://github.com/laravel/framework/pull/44798)) -- Improve input argument parsing for commands ([#44662](https://github.com/laravel/framework/pull/44662), [#44826](https://github.com/laravel/framework/pull/44826)) -- Added DatabaseBatchRepository to provides() in BusServiceProvider ([#44833](https://github.com/laravel/framework/pull/44833)) -- Move reusable onNotSuccessfulTest functionality to TestResponse ([#44827](https://github.com/laravel/framework/pull/44827)) -- Add CSP nonce to Vite reactRefresh inline script ([#44816](https://github.com/laravel/framework/pull/44816)) -- Allow route group method to be chained ([#44825](https://github.com/laravel/framework/pull/44825)) -- Remove __sleep() & __wakeup() from SerializesModels trait. ([#44847](https://github.com/laravel/framework/pull/44847)) -- Handle SQLite without ENABLE_DBSTAT_VTAB enabled in `Illuminate/Database/Console/DatabaseInspectionCommand::getSqliteTableSize()` ([#44867](https://github.com/laravel/framework/pull/44867)) -- Apply force flag when necessary in `Illuminate/Queue/Listener` ([#44862](https://github.com/laravel/framework/pull/44862)) -- De-couple Console component from framework ([#44864](https://github.com/laravel/framework/pull/44864)) -- Update Vite mock to return empty array for preloadedAssets ([#44858](https://github.com/laravel/framework/pull/44858)) - - -## [v9.38.0](https://github.com/laravel/framework/compare/v9.37.0...v9.38.0) - 2022-11-01 - -### Added -- Added `Illuminate/Routing/Route::flushController()` ([#44393](https://github.com/laravel/framework/pull/44393)) -- Added `Illuminate/Session/Store::setHandler()` ([#44736](https://github.com/laravel/framework/pull/44736)) -- Added dictionary to slug helper ([#44730](https://github.com/laravel/framework/pull/44730)) -- Added ability to set middleware based on notifiable instance and channel ([#44767](https://github.com/laravel/framework/pull/44767)) -- Added touchQuietly convenience method to Model ([#44722](https://github.com/laravel/framework/pull/44722)) -- Added `Illuminate/Routing/Router::removeMiddlewareFromGroup()` ([#44780](https://github.com/laravel/framework/pull/44780)) -- Allow queueable notifications to set maxExceptions ([#44773](https://github.com/laravel/framework/pull/44773)) -- Make migrate command isolated ([#44743](https://github.com/laravel/framework/pull/44743), [ac3252a](https://github.com/laravel/framework/commit/ac3252a4c2a4c94724cd5aeaf6268427d21f9e97)) - -### Fixed -- Fixed whenPivotLoaded(As) api resource methods when using Eloquent strict mode ([#44792](https://github.com/laravel/framework/pull/44792)) -- Fixed components view error when using $attributes in parent view ([#44778](https://github.com/laravel/framework/pull/44778)) -- Fixed problem with disregarding global scopes when using existOr and doesntExistOr methods on model query ([#44795](https://github.com/laravel/framework/pull/44795)) - -### Changed -- Recompiles views when necessary ([#44737](https://github.com/laravel/framework/pull/44737)) -- Throw meaningful exception when broadcast connection not configured ([#44745](https://github.com/laravel/framework/pull/44745)) -- Prevents booting of providers when running env:encrypt ([#44758](https://github.com/laravel/framework/pull/44758)) -- Added nonce for preloaded assets ([#44747](https://github.com/laravel/framework/pull/44747)) -- Inherit crossorigin attributes while preloading view ([#44800](https://github.com/laravel/framework/pull/44800)) - - -## [v9.37.0](https://github.com/laravel/framework/compare/v9.36.4...v9.37.0) - 2022-10-25 - -### Added -- Added optional verbose output when view caching ([#44673](https://github.com/laravel/framework/pull/44673)) -- Allow passing closure to rescue $report parameter ([#44710](https://github.com/laravel/framework/pull/44710)) -- Support preloading assets with Vite ([#44096](https://github.com/laravel/framework/pull/44096)) -- Added `Illuminate/Mail/Mailables/Content::htmlString()` ([#44703](https://github.com/laravel/framework/pull/44703)) - -### Fixed -- Fixed model:show registering getAttribute() as a null accessor ([#44683](https://github.com/laravel/framework/pull/44683)) -- Fix expectations for output assertions in PendingCommand ([#44723](https://github.com/laravel/framework/pull/44723)) - - -## [v9.36.4](https://github.com/laravel/framework/compare/v9.36.3...v9.36.4) - 2022-10-20 - -### Added -- Added rawValue to Database Query Builder (and Eloquent as wrapper) ([#44631](https://github.com/laravel/framework/pull/44631)) -- Added TransactionCommitting ([#44608](https://github.com/laravel/framework/pull/44608)) -- Added dontIncludeSource to CliDumper and HtmlDumper ([#44623](https://github.com/laravel/framework/pull/44623)) -- Added `Illuminate/Filesystem/FilesystemAdapter::checksum()` ([#44660](https://github.com/laravel/framework/pull/44660)) -- Added handlers for silently discarded and missing attribute violations ([#44664](https://github.com/laravel/framework/pull/44664)) - -### Reverted -- Reverted ["Let MustVerifyEmail to be used on models without id as primary key"](https://github.com/laravel/framework/pull/44613) ([#44672](https://github.com/laravel/framework/pull/44672)) - -### Changed -- Create new Json ParameterBag Instance when cloning Request ([#44671](https://github.com/laravel/framework/pull/44671)) -- Prevents booting providers when running env:decrypt ([#44654](https://github.com/laravel/framework/pull/44654)) - - -## [v9.36.3](https://github.com/laravel/framework/compare/v9.36.2...v9.36.3) - 2022-10-19 - -### Reverted -- Reverts micro-optimization on view events ([#44653](https://github.com/laravel/framework/pull/44653)) - -### Fixed -- Fixes blade not forgetting compiled views on view:clear ([#44643](https://github.com/laravel/framework/pull/44643)) -- Fixed `Illuminate/Database/Eloquent/Model::offsetExists()` ([#44642](https://github.com/laravel/framework/pull/44642)) -- Forget component's cache and factory between tests ([#44648](https://github.com/laravel/framework/pull/44648)) - -### Changed -- Bump Testbench dependencies ([#44651](https://github.com/laravel/framework/pull/44651)) - - -## [v9.36.2](https://github.com/laravel/framework/compare/v9.36.1...v9.36.2) - 2022-10-18 - -### Fixed -- Ensures view creators and composers are called when * is present ([#44636](https://github.com/laravel/framework/pull/44636)) - - -## [v9.36.1](https://github.com/laravel/framework/compare/v9.36.0...v9.36.1) - 2022-10-18 - -### Fixed -- Fixes livewire components that were using createBladeViewFromString ([#pull](https://github.com/laravel/framework/pull)) - - -## [v9.36.0](https://github.com/laravel/framework/compare/v9.35.1...v9.36.0) - 2022-10-18 - -### Added -- Added mailable assertions ([#44563](https://github.com/laravel/framework/pull/44563)) -- Added `Illuminate/Testing/TestResponse::assertContent()` ([#44580](https://github.com/laravel/framework/pull/44580)) -- Added to `Illuminate/Console/Concerns/InteractsWithIO::alert()` `$verbosity` param ([#44614](https://github.com/laravel/framework/pull/44614)) - -### Optimization -- Makes blade components blazing fast ([#44487](https://github.com/laravel/framework/pull/44487)) - -### Fixed -- Fixed `Illuminate/Filesystem/Filesystem::relativeLink()` ([#44519](https://github.com/laravel/framework/pull/44519)) -- Fixed for `model:show` failing with models that have null timestamp columns ([#44576](https://github.com/laravel/framework/pull/44576)) -- Allow Model::shouldBeStrict(false) to disable "strict mode" ([#44627](https://github.com/laravel/framework/pull/44627)) - -### Changed -- Dont require a host for sqlite connections in php artisan db ([#44585](https://github.com/laravel/framework/pull/44585)) -- Let MustVerifyEmail to be used on models without id as primary key ([#44613](https://github.com/laravel/framework/pull/44613)) -- Changed `Illuminate/Routing/Route::controllerMiddleware()` ([#44590](https://github.com/laravel/framework/pull/44590)) - - -## [v9.35.1](https://github.com/laravel/framework/compare/v9.35.0...v9.35.1) - 2022-10-11 - -### Fixed -- Remove check for `$viewFactory->exists($component)` in `Illuminate/View/Compilers/ComponentTagCompiler::componentClass` ([7c6db00](https://github.com/laravel/framework/commit/7c6db000928be240dfc6996537a0fed5b8c68ebb)) - - -## [v9.35.0](https://github.com/laravel/framework/compare/v9.34.0...v9.35.0) - 2022-10-11 - -### Added -- Allow loading trashed models for resource routes ([#44405](https://github.com/laravel/framework/pull/44405)) -- Added `Illuminate/Database/Eloquent/Model::shouldBeStrict()` and other ([#44283](https://github.com/laravel/framework/pull/44283)) -- Controller middleware without resolving controller ([#44516](https://github.com/laravel/framework/pull/44516)) -- Alternative Mailable Syntax ([#44462](https://github.com/laravel/framework/pull/44462)) - -### Fixed -- Fix issue with aggregates (withSum, etc.) for pivot columns on self-referencing many-to-many relations ([#44286](https://github.com/laravel/framework/pull/44286)) -- Fixes issue using static class properties as blade attributes ([#44473](https://github.com/laravel/framework/pull/44473)) -- Traversable should have priority over JsonSerializable in EnumerateValues ([#44456](https://github.com/laravel/framework/pull/44456)) -- Fixed `make:cast --inbound` so it's a boolean option, not value ([#44505](https://github.com/laravel/framework/pull/44505)) - -### Changed -- Testing methods. Making error messages with json_encode more readable ([#44397](https://github.com/laravel/framework/pull/44397)) -- Have 'Model::withoutTimestamps()' return the callback's return value ([#44457](https://github.com/laravel/framework/pull/44457)) -- only load trashed models on relevant routes ([#44478](https://github.com/laravel/framework/pull/44478)) -- Adding additional PHP extensions to shouldBlockPhpUpload Function ([#44512](https://github.com/laravel/framework/pull/44512)) -- Register cutInternals casters for particularly noisy objects ([#44514](https://github.com/laravel/framework/pull/44514)) -- Use get methods to access application locale ([#44521](https://github.com/laravel/framework/pull/44521)) -- return only on non empty response from channels ([09d53ee](https://github.com/laravel/framework/commit/09d53eea674db7daa8bb65aa8fa7f2ca95e62b8d), [3944a3e](https://github.com/laravel/framework/commit/3944a3e34fe860633c77b574bbfbbcdabcf7d1e7)) -- Correct channel matching ([#44531](https://github.com/laravel/framework/pull/44531)) -- Migrate mail components ([#44527](https://github.com/laravel/framework/pull/44527)) - - -## [v9.34.0](https://github.com/laravel/framework/compare/v9.33.0...v9.34.0) - 2022-10-04 - -### Added -- Short attribute syntax for Self Closing Blade Components ([#44413](https://github.com/laravel/framework/pull/44413)) -- Adds support for PHP's BackedEnum to be "rendered" on blade views ([#44445](https://github.com/laravel/framework/pull/44445)) - -### Fixed -- Fixed Precognition headers for Symfony responses ([#44424](https://github.com/laravel/framework/pull/44424)) -- Allow to create databases with dots ([#44436](https://github.com/laravel/framework/pull/44436)) -- Fixes dd source on windows ([#44451](https://github.com/laravel/framework/pull/44451)) - -### Changed -- Adds error output to db command when missing host ([#44394](https://github.com/laravel/framework/pull/44394)) -- Changed `Illuminate/Database/Schema/ForeignIdColumnDefinition::constrained()` ([#44425](https://github.com/laravel/framework/pull/44425)) -- Allow maintenance mode events to be listened to in closure based listeners ([#44417](https://github.com/laravel/framework/pull/44417)) -- Allow factories to recycle multiple models of a given typ ([#44328](https://github.com/laravel/framework/pull/44328)) -- Improves dd clickable link on multiple editors and docker environments ([#44406](https://github.com/laravel/framework/pull/44406)) - - -## [v9.33.0](https://github.com/laravel/framework/compare/v9.32.0...v9.33.0) - 2022-09-30 - -### Added -- Added `Illuminate/Support/Testing/Fakes/MailFake::cc()` ([#44319](https://github.com/laravel/framework/pull/44319)) -- Added Ignore Case of Str::contains and Str::containsAll to Stringable contains and containsAll ([#44369](https://github.com/laravel/framework/pull/44369)) -- Added missing morphs methods for the ULID support ([#44364](https://github.com/laravel/framework/pull/44364)) -- Introduce Laravel Precognition ([#44339](https://github.com/laravel/framework/pull/44339)) -- Added `Illuminate/Routing/Route::flushController()` ([#44386](https://github.com/laravel/framework/pull/44386)) - -### Fixed -- Fixes memory leak on PHPUnit's Annotations registry ([#44324](https://github.com/laravel/framework/pull/44324), [#44336](https://github.com/laravel/framework/pull/44336)) -- Fixed `Illuminate/Filesystem/FilesystemAdapter::url()` with config `prefix` ([#44330](https://github.com/laravel/framework/pull/44330)) -- Fixed the "Implicit conversion from float to int loses precision" error in Timebox Class ([#44357](https://github.com/laravel/framework/pull/44357)) - -### Changed -- Improves dd source on compiled views ([#44347](https://github.com/laravel/framework/pull/44347)) -- Only prints source on dd calls from dump.php ([#44367](https://github.com/laravel/framework/pull/44367)) -- Ensures a Carbon version that supports PHP 8.2 ([#44374](https://github.com/laravel/framework/pull/44374)) - - -## [v9.32.0](https://github.com/laravel/framework/compare/v9.31.0...v9.32.0) - 2022-09-27 - -### Added -- New env:encrypt and env:decrypt commands ([#44034](https://github.com/laravel/framework/pull/44034)) -- Share WithoutOverlapping key across jobs ([#44227](https://github.com/laravel/framework/pull/44227)) -- Add missing citext type mapping to `Illuminate/Database/Console/DatabaseInspectionCommand::$typeMappings` ([#44237](https://github.com/laravel/framework/pull/44237)) -- Short attribute syntax for Blade Components ([#44217](https://github.com/laravel/framework/pull/44217)) -- Adds source file to dd function output ([#44211](https://github.com/laravel/framework/pull/44211)) -- Add methods to get request data as integer or float ([#44239](https://github.com/laravel/framework/pull/44239)) -- Adds Eloquent User Provider query handler ([#44226](https://github.com/laravel/framework/pull/44226)) -- Added `Illuminate/Support/Testing/Fakes/BusFake::dispatchFakeBatch()` ([#44176](https://github.com/laravel/framework/pull/44176)) -- Added methods to cast Stringables ([#44238](https://github.com/laravel/framework/pull/44238)) -- Added `Illuminate/Routing/UrlGenerator::withKeyResolver()` ([#44254](https://github.com/laravel/framework/pull/44254)) -- Add a hook to the serialisation of collections ([#44272](https://github.com/laravel/framework/pull/44272)) -- Allow enum route bindings to have default values ([#44255](https://github.com/laravel/framework/pull/44255)) -- Added benchmark utility class ([b4293d7](https://github.com/laravel/framework/commit/b4293d7c18b08b363ac0af64ec04fb1d559b4698), [#44297](https://github.com/laravel/framework/pull/44297)) -- Added `Illuminate/Console/Scheduling/ManagesFrequencies::everyOddHour()` ([#44288](https://github.com/laravel/framework/pull/44288)) - -### Fixed -- Fix incrementing string keys ([#44247](https://github.com/laravel/framework/pull/44247)) -- Fix bug in Fluent Class with named arguments in migrations ([#44251](https://github.com/laravel/framework/pull/44251)) -- Fix "about" command caching report ([#44305](https://github.com/laravel/framework/pull/44305)) -- Fixes memory leaks ([#44306](https://github.com/laravel/framework/pull/44306), [#44307](https://github.com/laravel/framework/pull/44307)) - -### Changed -- Patch for timeless timing attack vulnerability in user login ([#44069](https://github.com/laravel/framework/pull/44069)) -- Refactor: register commands in artisan service ([#44257](https://github.com/laravel/framework/pull/44257)) -- Allow factories to recycle models with for method ([#44265](https://github.com/laravel/framework/pull/44265)) -- Use dedicated method for placeholder replacement in validator ([#44296](https://github.com/laravel/framework/pull/44296)) - - -## [v9.31.0](https://github.com/laravel/framework/compare/v9.30.1...v9.31.0) - 2022-09-20 - -### Added -- Added unique deferrable initially deferred constants for PostgreSQL ([#44127](https://github.com/laravel/framework/pull/44127)) -- Request lifecycle duration handler ([#44122](https://github.com/laravel/framework/pull/44122)) -- Added Model::withoutTimestamps(...) ([#44138](https://github.com/laravel/framework/pull/44138)) -- Added manifestHash function to Illuminate\Foundation\Vite ([#44136](https://github.com/laravel/framework/pull/44136)) -- Added support for operator <=> in `/Illuminate/Collections/Traits/EnumeratesValues::operatorForWhere()` ([#44154](https://github.com/laravel/framework/pull/44154)) -- Added that Illuminate/Database/Connection::registerDoctrineType() can accept object as well as classname for new doctrine type ([#44149](https://github.com/laravel/framework/pull/44149)) -- Added Fake Batches ([#44104](https://github.com/laravel/framework/pull/44104), [#44173](https://github.com/laravel/framework/pull/44173)) -- Added `Model::getAppends()` ([#44180](https://github.com/laravel/framework/pull/44180)) -- Added missing Str::wrap() static method ([#44207](https://github.com/laravel/framework/pull/44207)) -- Added require `symfony/uid` ([#44202](https://github.com/laravel/framework/pull/44202)) -- Make Vite macroable ([#44198](https://github.com/laravel/framework/pull/44198)) - -### Fixed -- Async fix in `Illuminate/Http/Client/PendingRequest` ([#44179](https://github.com/laravel/framework/pull/44179)) -- Fixes artisan serve command with PHP_CLI_SERVER_WORKERS environment variable ([#44204](https://github.com/laravel/framework/pull/44204)) -- Fixed `InteractsWithDatabase::castAsJson($value)` incorrectly handles SQLite Database ([#44196](https://github.com/laravel/framework/pull/44196)) - -### Changed -- Improve Blade compilation exception messages ([#44134](https://github.com/laravel/framework/pull/44134)) -- Improve test failure output ([#43943](https://github.com/laravel/framework/pull/43943)) -- Prompt to create MySQL db when migrating ([#44153](https://github.com/laravel/framework/pull/44153)) -- Improve UUID and ULID support for Eloquent ([#44146](https://github.com/laravel/framework/pull/44146)) - - -## [v9.30.1](https://github.com/laravel/framework/compare/v9.30.0...v9.30.1) - 2022-09-15 - -### Added -- Allow using a model instance in place of nested model factories ([#44107](https://github.com/laravel/framework/pull/44107)) -- Added UUID and ULID support for Eloquent ([#44074](https://github.com/laravel/framework/pull/44074)) -- Implement except method for fake classes to define what should not be faked ([#44117](https://github.com/laravel/framework/pull/44117)) -- Added interacts with queue middleware to send queued mailable ([#44124](https://github.com/laravel/framework/pull/44124)) -- Added new exception string to `Illuminate/Database/DetectsLostConnections` ([#44121](https://github.com/laravel/framework/pull/44121)) - -### Fixed -- Fixed BC from [Passing event into viaQueue and viaConnection of Queued Listener](https://github.com/laravel/framework/pull/44080) ([#44137](https://github.com/laravel/framework/pull/44137)) - -### Changed -- Enhance column modifying ([#44101](https://github.com/laravel/framework/pull/44101)) -- Allow to define which jobs should be actually dispatched when using Bus::fake ([#44106](https://github.com/laravel/framework/pull/44106)) - - -## [v9.30.0](https://github.com/laravel/framework/compare/v9.29.0...v9.30.0) - 2022-09-13 - -### Added -- Added stop_buffering config option to logger ([#44071](https://github.com/laravel/framework/pull/44071)) -- Added read-only filesystem adapter decoration as a config option ([#44079](https://github.com/laravel/framework/pull/44079)) -- Added scoped filesystem driver ([#44105](https://github.com/laravel/framework/pull/44105)) -- Add force option to all make commands ([#44100](https://github.com/laravel/framework/pull/44100)) - -### Fixed -- Fixed QueryBuilder whereNot with array conditions ([#44083](https://github.com/laravel/framework/pull/44083)) - -### Changed -- Passing event into viaQueue and viaConnection of Queued Listener ([#44080](https://github.com/laravel/framework/pull/44080)) -- Improve testability of batched jobs ([#44075](https://github.com/laravel/framework/pull/44075)) -- Allow any kind of whitespace in cron expression ([#44110](https://github.com/laravel/framework/pull/44110)) - - -## [v9.29.0](https://github.com/laravel/framework/compare/v9.28.0...v9.29.0) - 2022-09-09 - -### Added -- Added RequiredIfAccepted validation rule ([#44035](https://github.com/laravel/framework/pull/44035)) -- Added `Illuminate/Foundation/Vite::assetPath()` ([#44037](https://github.com/laravel/framework/pull/44037)) -- Added ability to discard Eloquent Model changes ([#43772](https://github.com/laravel/framework/pull/43772)) -- Added ability to determine if attachments exist to `Illuminate/Mail/Mailable` ([#43967](https://github.com/laravel/framework/pull/43967)) -- Added `Illuminate/Support/Testing/Fakes/BusFake::assertNothingBatched()` ([#44056](https://github.com/laravel/framework/pull/44056)) - -### Reverted -- Reverted [Fixed RoueGroup::merge to format merged prefixes correctly](https://github.com/laravel/framework/pull/44011). ([#44072](https://github.com/laravel/framework/pull/44072)) - -### Fixed -- Avoid Passing null to parameter exception on PHP 8.1 ([#43951](https://github.com/laravel/framework/pull/43951)) -- Align Remember Me Cookie Duration with CookieJar expiration ([#44026](https://github.com/laravel/framework/pull/44026)) -- Fix Stringable typehints with Enumerable ([#44030](https://github.com/laravel/framework/pull/44030)) -- Fixed middleware "SetCacheHeaders" with file responses ([#44063](https://github.com/laravel/framework/pull/44063)) - -### Changed -- Don't use locks for queue job popping for PlanetScale's MySQL-compatible Vitess engine ([#44027](https://github.com/laravel/framework/pull/44027)) -- Avoid matching 'use' in custom Stub templates in `Illuminate/Console/GeneratorCommand.php` ([#44049](https://github.com/laravel/framework/pull/44049)) - - -## [v9.28.0](https://github.com/laravel/framework/compare/v9.27.0...v9.28.0) - 2022-09-06 - -### Added -- Added view data assertions to TestView ([#43923](https://github.com/laravel/framework/pull/43923)) -- Added `Illuminate/Routing/Redirector::getIntendedUrl()` ([#43938](https://github.com/laravel/framework/pull/43938)) -- Added Eloquent mode to prevent prevently silently discarding fills for attributes not in $fillable ([#43893](https://github.com/laravel/framework/pull/43893)) -- Added `Illuminate/Testing/PendingCommand::assertOk()` ([#43968](https://github.com/laravel/framework/pull/43968)) -- Make Application macroable ([#43966](https://github.com/laravel/framework/pull/43966)) -- Introducing Signal Traps ([#43933](https://github.com/laravel/framework/pull/43933)) -- Allow registering instances of commands ([#43986](https://github.com/laravel/framework/pull/43986)) -- Support Enumerable in Stringable ([#44012](https://github.com/laravel/framework/pull/44012)) - -### Fixed -- Fixed RoueGroup::merge to format merged prefixes correctly. ([#44011](https://github.com/laravel/framework/pull/44011)) -- Fixes providesTemporaryUrls on AwsS3V3Adapter ([#44009](https://github.com/laravel/framework/pull/44009)) -- Fix ordering of stylesheets when using @vite ([#43962](https://github.com/laravel/framework/pull/43962)) - -### Changed -- Allow invokable rules to specify custom messsages ([#43925](https://github.com/laravel/framework/pull/43925)) -- Support objects like GMP for custom Model casts ([#43959](https://github.com/laravel/framework/pull/43959)) -- Default 404 message on denyAsNotFound ([#43901](https://github.com/laravel/framework/pull/43901)) -- Changed `Illuminate/Container/Container::resolvePrimitive()` for isVariadic() ([#43985](https://github.com/laravel/framework/pull/43985)) -- Allow validator messages to use nested arrays ([#43981](https://github.com/laravel/framework/pull/43981)) -- Ensure freezeUuids always resets UUID creation after exception in callback ([#44018](https://github.com/laravel/framework/pull/44018)) - - -## [v9.27.0](https://github.com/laravel/framework/compare/v9.26.1...v9.27.0) - 2022-08-30 - -### Added -- Add getter and setter for connection in the DatabaseBatchRepository class ([#43869](https://github.com/laravel/framework/pull/43869)) - -### Fixed -- Fix for potential bug with non-backed enums ([#43842](https://github.com/laravel/framework/pull/43842)) -- Patch nested array validation rule regression bug ([#43897](https://github.com/laravel/framework/pull/43897)) -- Fix registering event listeners with array callback ([#43890](https://github.com/laravel/framework/pull/43890)) - -### Changed -- Explicitly add column name to SQLite query in `Illuminate/Database/Console/DatabaseInspectionCommand::getSqliteTableSize()` ([#43832](https://github.com/laravel/framework/pull/43832)) -- Allow broadcast on demand notifications ([d2b1446](https://github.com/laravel/framework/commit/d2b14466c27a3d62219256cea27088e6ecd9d32f)) -- Make Vite::hotFile() public ([#43875](https://github.com/laravel/framework/pull/43875)) -- Prompt to create sqlite db when migrating ([#43867](https://github.com/laravel/framework/pull/43867)) -- Call prepare() on HttpException responses ([#43895](https://github.com/laravel/framework/pull/43895)) -- Make the model:prune command easier to extend ([#43919](https://github.com/laravel/framework/pull/43919)) - - -## [v9.26.1](https://github.com/laravel/framework/compare/v9.26.0...v9.26.1) - 2022-08-23 - -### Revert -- Revert "[9.x] Add statusText for an assertion message" ([#43831](https://github.com/laravel/framework/pull/43831)) - -### Fixed -- Fixed `withoutVite` ([#43826](https://github.com/laravel/framework/pull/43826)) - - -## [v9.26.0](https://github.com/laravel/framework/compare/v9.25.1...v9.26.0) - 2022-08-23 - -### Added -- Adding support for non-backed enums in Models ([#43728](https://github.com/laravel/framework/pull/43728)) -- Added vite asset url helpers ([#43702](https://github.com/laravel/framework/pull/43702)) -- Added Authentication keyword for SqlServerConnector.php ([#43757](https://github.com/laravel/framework/pull/43757)) -- Added support for additional where* methods to route groups ([#43731](https://github.com/laravel/framework/pull/43731)) -- Added min_digits and max_digits validation ([#43797](https://github.com/laravel/framework/pull/43797)) -- Added closure support to dispatch conditionals in bus ([#43784](https://github.com/laravel/framework/pull/43784)) -- Added configurable paths to Vite ([#43620](https://github.com/laravel/framework/pull/43620)) - -### Fixed -- Fix unique lock release for broadcast events ([#43738](https://github.com/laravel/framework/pull/43738)) -- Fix empty collection class serialization ([#43758](https://github.com/laravel/framework/pull/43758)) -- Fixes creation of deprecations channel ([#43812](https://github.com/laravel/framework/pull/43812)) - -### Changed -- Improve display of failures for assertDatabaseHas ([#43736](https://github.com/laravel/framework/pull/43736)) -- Always use the write PDO connection to read the just stored pending batch in bus ([#43737](https://github.com/laravel/framework/pull/43737)) -- Move unique lock release to method ([#43740](https://github.com/laravel/framework/pull/43740)) -- Remove timeoutAt fallback from Job base class ([#43749](https://github.com/laravel/framework/pull/43749)) -- Convert closures to arrow functions ([#43778](https://github.com/laravel/framework/pull/43778)) -- Use except also in `Illuminate/Routing/Middleware/ValidateSignature::handle()` ([e554d47](https://github.com/laravel/framework/commit/e554d471daab568877c039e955a01cb2f06a2e7b)) -- Adjust forever time for cookies ([#43806](https://github.com/laravel/framework/pull/43806)) -- Make string padding UTF-8 safe ([f1762ed](https://github.com/laravel/framework/commit/f1762ed1660f2a71189f1a32efe5b410ec428268)) - - -## [v9.25.1](https://github.com/laravel/framework/compare/v9.25.0...v9.25.1) - 2022-08-16 - -### Fixes -- [Fixed typos](https://github.com/laravel/framework/compare/v9.25.0...v9.25.1) - - -## [v9.25.0](https://github.com/laravel/framework/compare/v9.24.0...v9.25.0) - 2022-08-16 - -### Added -- Added whenNotExactly to Stringable ([#43700](https://github.com/laravel/framework/pull/43700)) -- Added ability to Model::query()->touch() to mass update timestamps ([#43665](https://github.com/laravel/framework/pull/43665)) - -### Fixed -- Prevent error in db/model commands when using unsupported columns ([#43635](https://github.com/laravel/framework/pull/43635)) -- Fixes ensureDependenciesExist runtime error ([#43626](https://github.com/laravel/framework/pull/43626)) -- Null value for auto-cast field caused deprication warning in php 8.1 ([#43706](https://github.com/laravel/framework/pull/43706)) -- db:table command properly handle table who doesn't exist ([#43669](https://github.com/laravel/framework/pull/43669)) - -### Changed -- Handle assoc mode within db commands ([#43636](https://github.com/laravel/framework/pull/43636)) -- Allow chunkById on Arrays, as well as Models ([#43666](https://github.com/laravel/framework/pull/43666)) -- Allow for int value parameters to whereMonth() and whereDay() ([#43668](https://github.com/laravel/framework/pull/43668)) -- Cleaning up old if-else statement ([#43712](https://github.com/laravel/framework/pull/43712)) -- Ensure correct 'integrity' value is used for css assets ([#43714](https://github.com/laravel/framework/pull/43714)) - - -## [v9.24.0](https://github.com/laravel/framework/compare/v9.23.0...v9.24.0) - 2022-08-09 - -### Added -- New db:show, db:table and db:monitor commands ([#43367](https://github.com/laravel/framework/pull/43367)) -- Added validation doesnt_end_with rule ([#43518](https://github.com/laravel/framework/pull/43518)) -- Added `Illuminate/Database/Eloquent/SoftDeletes::restoreQuietly()` ([#43550](https://github.com/laravel/framework/pull/43550)) -- Added mergeUnless to resource ConditionallyLoadsAttributes trait ([#43567](https://github.com/laravel/framework/pull/43567)) -- Added `Illuminate/Support/Testing/Fakes/NotificationFake::sentNotifications()` ([#43558](https://github.com/laravel/framework/pull/43558)) -- Added `implode` to `Passthru` in `Illuminate/Database/Eloquent/Builder.php` ([#43574](https://github.com/laravel/framework/pull/43574)) -- Make Config repository macroable ([#43598](https://github.com/laravel/framework/pull/43598)) -- Add whenNull to ConditionallyLoadsAtrribute trait ([#43600](https://github.com/laravel/framework/pull/43600)) -- Extract child route model relationship name into a method ([#43597](https://github.com/laravel/framework/pull/43597)) - -### Revert -- Reverted [Added `whereIn` to `Illuminate/Routing/RouteRegistrar::allowedAttributes`](https://github.com/laravel/framework/pull/43509) ([#43523](https://github.com/laravel/framework/pull/43523)) - -### Fixed -- Fix unique locking on broadcast events ([#43516](https://github.com/laravel/framework/pull/43516)) -- Fixes the issue of running docs command on windows ([#43566](https://github.com/laravel/framework/pull/43566), [#43585](https://github.com/laravel/framework/pull/43585)) -- Fixes output when running db:seed or using --seed in migrate commands ([#43593](https://github.com/laravel/framework/pull/43593)) - -### Changed -- Gracefully fail when unable to locate expected binary on the system for artisan docs command ([#43521](https://github.com/laravel/framework/pull/43521)) -- Improve output for some Artisan commands ([#43547](https://github.com/laravel/framework/pull/43547)) -- Alternative database name in Postgres DSN, allow pgbouncer aliased databases to continue working on 9.x ([#43542](https://github.com/laravel/framework/pull/43542)) -- Allow @class() for component tags ([#43140](https://github.com/laravel/framework/pull/43140)) -- Attribute Cast Performance Improvements ([#43554](https://github.com/laravel/framework/pull/43554)) -- Queue worker daemon should also listen for SIGQUIT ([#43607](https://github.com/laravel/framework/pull/43607)) -- Keep original keys when using Collection->sortBy() with an array of sort operations ([#43609](https://github.com/laravel/framework/pull/43609)) - - -## [v9.23.0](https://github.com/laravel/framework/compare/v9.22.1...v9.23.0) - 2022-08-02 - -### Added -- Added whereNot method to Fluent JSON testing matchers ([#43383](https://github.com/laravel/framework/pull/43383)) -- Added deleteQuietly method to Model and use arrow func for related methods ([#43447](https://github.com/laravel/framework/pull/43447)) -- Added conditionable trait to Filesystem adapters ([#43450](https://github.com/laravel/framework/pull/43450)) -- Introduce artisan docs command ([#43357](https://github.com/laravel/framework/pull/43357)) -- Added Support CSP nonce, SRI, and arbitrary attributes with Vite ([#43442](https://github.com/laravel/framework/pull/43442)) -- Support conditionables that get condition from target object ([#43449](https://github.com/laravel/framework/pull/43449)) -- Added `whereIn` to `Illuminate/Routing/RouteRegistrar::allowedAttributes` ([#43509](https://github.com/laravel/framework/pull/43509)) - -### Fixed -- Prevent redis crash when large number of jobs are scheduled for a specific time ([#43310](https://github.com/laravel/framework/pull/43310)) - -### Changed -- Make Command components Factory extensible ([#43439](https://github.com/laravel/framework/pull/43439)) -- Solve Blade component showing quote formatted for the console ([#43446](https://github.com/laravel/framework/pull/43446)) -- Improves output capture from serve command ([#43461](https://github.com/laravel/framework/pull/43461)) -- Allow terser singleton bindings ([#43469](https://github.com/laravel/framework/pull/43469)) - - -## [v9.22.1](https://github.com/laravel/framework/compare/v9.22.0...v9.22.1) - 2022-07-26 - -### Added -- Added unique locking to broadcast events ([#43416](https://github.com/laravel/framework/pull/43416)) - -### Fixed -- Fixes Artisan serve command on Windows ([#43437](https://github.com/laravel/framework/pull/43437)) - - -## [v9.22.0](https://github.com/laravel/framework/compare/v9.21.6...v9.22.0) - 2022-07-26 - -### Added -- Added ability to attach an array of files in MailMessage ([#43080](https://github.com/laravel/framework/pull/43080)) -- Added conditional lines to MailMessage ([#43387](https://github.com/laravel/framework/pull/43387)) -- Add support for multiple hash algorithms to `Illuminate/Filesystem/Filesystem::hash()` ([#43407](https://github.com/laravel/framework/pull/43407)) - -### Fixed -- Fixes for model:show when attribute default is an enum ([#43370](https://github.com/laravel/framework/pull/43370)) -- Fixed DynamoDB locks with 0 seconds duration ([#43365](https://github.com/laravel/framework/pull/43365)) -- Fixed overriding global locale ([#43426](https://github.com/laravel/framework/pull/43426)) - -### Changed -- Round milliseconds in console output runtime ([#43400](https://github.com/laravel/framework/pull/43400)) -- Improves serve Artisan command ([#43375](https://github.com/laravel/framework/pull/43375)) - - -## [v9.21.6](https://github.com/laravel/framework/compare/v9.21.5...v9.21.6) - 2022-07-22 - -### Revert -- Revert ["Protect against ambiguous columns"](https://github.com/laravel/framework/pull/43278) ([#43362](https://github.com/laravel/framework/pull/43362)) - -### Fixed -- Fixes default attribute value when using enums on model:show ([#43360](https://github.com/laravel/framework/pull/43360)) - - -## [v9.21.5](https://github.com/laravel/framework/compare/v9.21.4...v9.21.5) - 2022-07-21 - -### Added -- Adds fluent File validation rule ([#43271](https://github.com/laravel/framework/pull/43271)) - -### Revert -- Revert ["Prevent double throwing chained exception on sync queue"](https://github.com/laravel/framework/pull/42950) ([#43354](https://github.com/laravel/framework/pull/43354)) - - -### Changed -- Allow section payload to be lazy in the "about" command ([#43329](https://github.com/laravel/framework/pull/43329)) - - -## [v9.21.4](https://github.com/laravel/framework/compare/v9.21.3...v9.21.4) - 2022-07-21 - -### Added -- Added `Illuminate/Filesystem/FilesystemAdapter::supportsTemporaryUrl()` ([#43317](https://github.com/laravel/framework/pull/43317)) - -### Fixed -- Fixes confirm component default value ([#43334](https://github.com/laravel/framework/pull/43334)) - -### Changed -- Improves console output when command not found ([#43323](https://github.com/laravel/framework/pull/43323)) - - -## [v9.21.3](https://github.com/laravel/framework/compare/v9.21.2...v9.21.3) - 2022-07-20 - -### Fixed -- Fixes usage of Migrator without output ([#43326](https://github.com/laravel/framework/pull/43326)) - - -## [v9.21.2](https://github.com/laravel/framework/compare/v9.21.1...v9.21.2) - 2022-07-20 - -### Fixed -- Fixes queue:monitor command dispatching QueueBusy ([#43320](https://github.com/laravel/framework/pull/43320)) -- Ensure relation names are properly "snaked" in JsonResource::whenCounted() method ([#43322](https://github.com/laravel/framework/pull/43322)) -- Fixed Bootstrap 5 pagination ([#43319](https://github.com/laravel/framework/pull/43319)) - - -## [v9.21.1](https://github.com/laravel/framework/compare/v9.21.0...v9.21.1) - 2022-07-20 - -### Added -- Added "Logs" driver to the about command ([#43307](https://github.com/laravel/framework/pull/43307)) -- Allows to install doctrine/dbal from model:show command ([#43288](https://github.com/laravel/framework/pull/43288)) -- Added to stub publish command flag that restricts to only existing files ([#43314](https://github.com/laravel/framework/pull/43314)) - -### Fixed -- Fixes for model:show command ([#43301](https://github.com/laravel/framework/pull/43301)) - -### Changed -- Handle varying composer -V output ([#43286](https://github.com/laravel/framework/pull/43286)) -- Replace resolve() with app() for Lumen compatible ([#43312](https://github.com/laravel/framework/pull/43312)) -- Allow using backed enums as route parameters ([#43294](https://github.com/laravel/framework/pull/43294)) - - -## [v9.21.0](https://github.com/laravel/framework/compare/v9.20.0...v9.21.0) - 2022-07-19 - -### Added -- Added inspiring quote ([#43180](https://github.com/laravel/framework/pull/43180), [#43189](https://github.com/laravel/framework/pull/43189)) -- Introducing a fresh new look for Artisan ([#43065](https://github.com/laravel/framework/pull/43065)) -- Added whenCounted to JsonResource ([#43101](https://github.com/laravel/framework/pull/43101)) -- Artisan model:show command ([#43156](https://github.com/laravel/framework/pull/43156)) -- Artisan `about` Command ([#43147](https://github.com/laravel/framework/pull/43147), [51b5eda](https://github.com/laravel/framework/commit/51b5edaa2f8dfb0acb520ecb394706ade2200a35), [#43225](https://github.com/laravel/framework/pull/43225), [#43276](https://github.com/laravel/framework/pull/43276)) -- Adds enum casting to Request ([#43239](https://github.com/laravel/framework/pull/43239)) - -### Revert -- Revert ["Fix default parameter bug in routes"](https://github.com/laravel/framework/pull/42942) ([#43208](https://github.com/laravel/framework/pull/43208)) -- Revert route change PR ([#43255](https://github.com/laravel/framework/pull/43255)) - -### Fixed -- Fix transaction attempts counter for sqlsrv ([#43176](https://github.com/laravel/framework/pull/43176)) - -### Changed -- Make assertDatabaseHas failureDescription more multibyte character friendly ([#43181](https://github.com/laravel/framework/pull/43181)) -- ValidationException summarize only when use strings ([#43177](https://github.com/laravel/framework/pull/43177)) -- Improve mode function in collection ([#43240](https://github.com/laravel/framework/pull/43240)) -- clear Facade resolvedInstances in queue worker resetScope callback ([#43215](https://github.com/laravel/framework/pull/43215)) -- Improves queue:work command ([#43252](https://github.com/laravel/framework/pull/43252)) -- Remove null default attributes names when UPDATED_AT or CREATED_AT is null at Model::replicate ([#43279](https://github.com/laravel/framework/pull/43279)) -- Protect against ambiguous columns ([#43278](https://github.com/laravel/framework/pull/43278)) -- Use readpast query hint instead of holdlock for sqlsrv database queue ([#43259](https://github.com/laravel/framework/pull/43259)) -- Vendor publish flag that restricts to only existing files ([#43212](https://github.com/laravel/framework/pull/43212)) - - -## [v9.20.0](https://github.com/laravel/framework/compare/v9.19.0...v9.20.0) - 2022-07-13 - -### Added -- Added quote from Mustafa Kemal Atatürk ([#43022](https://github.com/laravel/framework/pull/43022)) -- Allow Collection random() to accept a callable ([#43028](https://github.com/laravel/framework/pull/43028)) -- Added `Str::inlineMarkdown()` ([#43126](https://github.com/laravel/framework/pull/43126)) -- Allow authorization responses to specify HTTP status codes ([#43097](https://github.com/laravel/framework/pull/43097)) -- Added required directive ([#43103](https://github.com/laravel/framework/pull/43103)) -- Added replicateQuietly to Model ([#43141](https://github.com/laravel/framework/pull/43141)) -- Added ignore param to ValidateSignature middleware ([#43160](https://github.com/laravel/framework/pull/43160)) - -### Fixed -- Fixed forceCreate on MorphMany not returning newly created object ([#42996](https://github.com/laravel/framework/pull/42996)) -- Fixed missing return in `Illuminate/Mail/Attachment::fromStorageDisk()` ([#43023](https://github.com/laravel/framework/pull/43023)) -- Fixed inconsistent content type when using ResponseSequence ([#43051](https://github.com/laravel/framework/pull/43051)) -- Prevent double throwing chained exception on sync queue ([#42950](https://github.com/laravel/framework/pull/42950)) -- Avoid matching multi-line imports in GenerateCommand stub templates ([#43093](https://github.com/laravel/framework/pull/43093)) - -### Changed -- Disable Column Statistics for php artisan schema:dump on MariaDB ([#43027](https://github.com/laravel/framework/pull/43027)) -- Bind a Vite Null Object to the Container instead of a Closure in `Illuminate/Foundation/Testing/Concerns/InteractsWithContainer::withoutVite()` ([#43040](https://github.com/laravel/framework/pull/43040)) -- Early return when message format is the default in `Illuminate/Support/MessageBag::transform()` ([#43149](https://github.com/laravel/framework/pull/43149)) - - -## [v9.19.0](https://github.com/laravel/framework/compare/v9.18.0...v9.19.0) - 2022-06-28 - -### Added -- Add new allowMaxRedirects method to PendingRequest ([#42902](https://github.com/laravel/framework/pull/42902)) -- Add support to detect dirty encrypted model attributes ([#42888](https://github.com/laravel/framework/pull/42888)) -- Added Vite ([#42785](https://github.com/laravel/framework/pull/42785)) - -### Fixed -- Fixed bug on forceCreate on a MorphMay relationship not including morph type ([#42929](https://github.com/laravel/framework/pull/42929)) -- Fix default parameter bug in routes ([#42942](https://github.com/laravel/framework/pull/42942)) -- Handle cursor paginator when no items are found ([#42963](https://github.com/laravel/framework/pull/42963)) -- Fix undefined constant error when use slot name as key of object ([#42943](https://github.com/laravel/framework/pull/42943)) -- Fix BC break for Log feature tests ([#42987](https://github.com/laravel/framework/pull/42987)) - -### Changed -- Allow instance of Enum pass Enum Rule ([#42906](https://github.com/laravel/framework/pull/42906)) - - -## [v9.18.0](https://github.com/laravel/framework/compare/v9.17.0...v9.18.0) - 2022-06-21 - -### Added -- Improve file attachment for mail and notifications ([#42563](https://github.com/laravel/framework/pull/42563)) -- Introduce Invokable validation classes ([#42689](https://github.com/laravel/framework/pull/42689)) -- Predis v2.0 ([#42577](https://github.com/laravel/framework/pull/42577)) -- Added `Illuminate/View/Compilers/Concerns/CompilesConditionals::compileReadonly()` ([#42717](https://github.com/laravel/framework/pull/42717)) -- Apply where's from union query builder in cursor pagination ([#42651](https://github.com/laravel/framework/pull/42651)) -- Added ability to define "with" relations as a nested array ([#42690](https://github.com/laravel/framework/pull/42690)) -- Added ability to set backoff in broadcast events ([#42737](https://github.com/laravel/framework/pull/42737)) -- Added host(), httpHost(), schemeAndHttpHost() to Request ([#42797](https://github.com/laravel/framework/pull/42797)) -- Allow invokable rules to push messages to nested (or other) attributes ([#42801](https://github.com/laravel/framework/pull/42801)) -- Adds compilePushIf and compileEndpushIf functions to View compiler ([#42762](https://github.com/laravel/framework/pull/42762)) -- Added: Allow removing token during tests ([#42841](https://github.com/laravel/framework/pull/42841)) -- Added predefined_constants to reservedNames array in `Illuminate/Console/GeneratorCommand` ([#42832](https://github.com/laravel/framework/pull/42832)) -- Handle collection creation around a single enum ([#42839](https://github.com/laravel/framework/pull/42839)) -- Allow for nullable morphs in whereNotMorphedT ([#42878](https://github.com/laravel/framework/pull/42878)) -- Introduce a fake() helper to resolve faker singletons, per locale ([#42844](https://github.com/laravel/framework/pull/42844)) -- Allow handling cumulative query duration limit per DB connection ([#42744](https://github.com/laravel/framework/pull/42744)) -- Add invokable option to make rule command ([#42742](https://github.com/laravel/framework/pull/42742)) - -### Fixed -- Fix deprecation error in the route:list command ([#42704](https://github.com/laravel/framework/pull/42704)) -- Fixed Request offsetExists without routeResolver ([#42754](https://github.com/laravel/framework/pull/42754)) -- Fixed: Loose comparison causes the value not to be saved ([#42793](https://github.com/laravel/framework/pull/42793)) -- Fixed: Fix database session driver keeps resetting CSRF token ([#42782](https://github.com/laravel/framework/pull/42782)) -- Fixed: Arr::map - Fix map-by-reference w/ built-ins ([#42815](https://github.com/laravel/framework/pull/42815)) -- Fixed league/flysystem suggest ([#42872](https://github.com/laravel/framework/pull/42872)) - -### Changed -- Start session in TestResponse to allow marshalling of error bag from JSON ([#42710](https://github.com/laravel/framework/pull/42710)) -- Rename methods in `Illuminate/Broadcasting/BroadcastManager` ([753e9fd](https://github.com/laravel/framework/commit/753e9fd8843c043938e20b038999fe0a26de6e16)) -- Avoid throwing on invalid mime-type in `Illuminate/Filesystem/FilesystemAdapter::mimeType()` ([#42761](https://github.com/laravel/framework/pull/42761)) -- Do not resolve already set headers in `Illuminate/Filesystem/FilesystemAdapter` ([#42760](https://github.com/laravel/framework/pull/42760)) -- Standardise invokable rule translation functionality ([#42873](https://github.com/laravel/framework/pull/42873)) -- Clear cast cache when setting attributes using arrow ([#42852](https://github.com/laravel/framework/pull/42852)) - - -## [v9.17.0](https://github.com/laravel/framework/compare/v9.16.0...v9.17.0) - 2022-06-07 - -### Added -- Added Illuminate/Database/Eloquent/Builder::withoutEagerLoad() ([#42641](https://github.com/laravel/framework/pull/42641)) -- Allow random string generation to be controlled ([#42669](https://github.com/laravel/framework/pull/42669)) -- Adds doesnt_start_with validation ([#42683](https://github.com/laravel/framework/pull/42683), [de35bf2](https://github.com/laravel/framework/commit/de35bf2a8ab40013d997c62b5a80cdb907c73b99)) -- Added quarterlyOn cron schedule frequency command ([#42692](https://github.com/laravel/framework/pull/42692)) - -### Fixed -- Free reserved memory before handling fatal errors ([#42630](https://github.com/laravel/framework/pull/42630), [#42646](https://github.com/laravel/framework/pull/42646)) -- Prevent $mailer being reset when testing mailables that implement ShouldQueue ([#42695](https://github.com/laravel/framework/pull/42695)) -- Added checks for Pusher 7.1 preps ([#42632](https://github.com/laravel/framework/pull/42632)) -- Fixed grouping for user authorization ([#42664](https://github.com/laravel/framework/pull/42664)) - -### Changed -- Allow assertions against pushed string based pushed jobs ([#42676](https://github.com/laravel/framework/pull/42676)) - - -## [v9.16.0](https://github.com/laravel/framework/compare/v9.15.0...v9.16.0) - 2022-06-02 - -### Added -- Added Eloquent withWhereHas method ([#42597](https://github.com/laravel/framework/pull/42597)) -- User authentication for Pusher ([#42531](https://github.com/laravel/framework/pull/42531)) -- Added additional uuid testing helpers ([#42619](https://github.com/laravel/framework/pull/42619)) - -### Fixed -- Fix queueable notification's ID overwritten ([#42581](https://github.com/laravel/framework/pull/42581)) -- Handle undefined array key error in route ([#42606](https://github.com/laravel/framework/pull/42606)) - -### Deprecated -- Illuminate/Routing/Redirector::home() ([#42600](https://github.com/laravel/framework/pull/42600)) - - -## [v9.15.0](https://github.com/laravel/framework/compare/v9.14.1...v9.15.0) - 2022-05-31 - -### Added -- Added --only-vendor option to route:list command ([#42549](https://github.com/laravel/framework/pull/42549)) -- Added `Illuminate/Http/Client/PendingRequest::throwUnless()` ([#42556](https://github.com/laravel/framework/pull/42556)) -- Added `Illuminate/Support/Str::isJson()` ([#42545](https://github.com/laravel/framework/pull/42545)) -- Added `Illuminate/Filesystem/Filesystem::isEmptyDirectory()` ([#42559](https://github.com/laravel/framework/pull/42559)) -- Added `Add counts to route:list command` ([#42551](https://github.com/laravel/framework/pull/42551)) -- Support kebab case for slot name shortcut ([#42574](https://github.com/laravel/framework/pull/42574)) - -### Revered -- Revert digits changes in validation ([c113768](https://github.com/laravel/framework/commit/c113768dbd47de7466d703108eaf8155916d5666), [#42562](https://github.com/laravel/framework/pull/42562)) - -### Fixed -- Fix getting '0' from route parameter in Authorize middleware ([#42582](https://github.com/laravel/framework/pull/42582)) - -### Changed -- Retain the original attribute value during validation of an array key with a dot for correct failure message ([#42395](https://github.com/laravel/framework/pull/42395)) -- Allow bootable test traits to teardown ([#42521](https://github.com/laravel/framework/pull/42521)) -- Pass thrown exception to $sleepMilliseconds closure in retry helper ([#42532](https://github.com/laravel/framework/pull/42532)) -- Make HasTimestamps::updateTimestamps chainable ([#42533](https://github.com/laravel/framework/pull/42533)) -- Remove meaningless parameter in `Illuminate/View/Concerns/ManagesEvents` ([#42546](https://github.com/laravel/framework/pull/42546)) -- Map integer parameter to parameter name when resolving binding field ([#42571](https://github.com/laravel/framework/pull/42571)) -- Conditionable should return HigherOrderWhenProxy only when the args number is exactly 1 ([#42555](https://github.com/laravel/framework/pull/42555)) - - -## [v9.14.1](https://github.com/laravel/framework/compare/v9.14.0...v9.14.1) - 2022-05-25 - -### Added -- Model::whereRelation add callback function ([#42491](https://github.com/laravel/framework/pull/42491)) -- Add Conditionable Trait to Illuminate\Support\Carbon ([#42500](https://github.com/laravel/framework/pull/42500)) - -### Fixed -- Fix afterCommit and DatabaseTransactions ([#42502](https://github.com/laravel/framework/pull/42502)) -- Fixed regression when only some route parameters are scoped ([#42517](https://github.com/laravel/framework/pull/42517)) - - -## [v9.14.0](https://github.com/laravel/framework/compare/v9.13.0...v9.14.0) - 2022-05-24 - -### Added -- Added ability to add table comments for MySQL and Postgres ([#42401](https://github.com/laravel/framework/pull/42401)) -- Added dynamic trashed factory state ([#42414](https://github.com/laravel/framework/pull/42414)) -- Added Illuminate/Collections/Arr::prependKeysWith() ([#42448](https://github.com/laravel/framework/pull/42448)) -- Added bootable traits to TestCase ([#42394](https://github.com/laravel/framework/pull/42394)) - -### Fixed -- Fix clone issue on updateOrCreate and firstOrCreate ([#42434](https://github.com/laravel/framework/pull/42434)) -- Prevent double sanitized key in RateLimiter@tooManyAttempts ([#42462](https://github.com/laravel/framework/pull/42462)) -- Add flush handler to output buffer for streamed test response (bugfix) ([#42481](https://github.com/laravel/framework/pull/42481)) - -### Changed -- Adds attaches a concise error message to SES exceptions ([#42426](https://github.com/laravel/framework/pull/42426)) -- Use duplicate instead of createFromBase to clone request when routes are cached ([#42420](https://github.com/laravel/framework/pull/42420)) -- Use model route key when route parameter does not specifiy custom binding field but a different parameter does ([#42425](https://github.com/laravel/framework/pull/42425)) -- Adds ability to have paginate() $perPage parameter as callable with access to $total ([#42429](https://github.com/laravel/framework/pull/42429)) -- Extract ServeCommand env list to static property ([#42444](https://github.com/laravel/framework/pull/42444)) -- Use route parameters in view ([#42461](https://github.com/laravel/framework/pull/42461)) - - -## [v9.13.0](https://github.com/laravel/framework/compare/v9.12.2...v9.13.0) - 2022-05-17 - -### Added -- Added Illuminate/Collections/Traits/EnumeratesValues::value() ([#42257](https://github.com/laravel/framework/pull/42257)) -- Added new TestResponse helper: assertJsonMissingPath ([#42361](https://github.com/laravel/framework/pull/42361)) -- Added Illuminate/Support/Testing/Fakes/NotificationFake::assertCount() ([#42366](https://github.com/laravel/framework/pull/42366)) -- Added new DetectLostConnections ([#42377](https://github.com/laravel/framework/pull/42377), [#42382](https://github.com/laravel/framework/pull/42382)) -- Added Illuminate/Testing/TestResponse::collect() ([#42384](https://github.com/laravel/framework/pull/42384)) -- Added full callable support to schedule:list ([#42400](https://github.com/laravel/framework/pull/42400)) -- Added `Illuminate/Collections/Arr::map()` ([#42398](https://github.com/laravel/framework/pull/42398)) - -### Fixed -- Fixed PruneCommand finding its usage within other traits ([#42350](https://github.com/laravel/framework/pull/42350)) -- Fix assert that exception is thrown without message ([#42360](https://github.com/laravel/framework/pull/42360)) - -### Changed -- Skip parameter parsing for raw post body in HTTP Client ([#42364](https://github.com/laravel/framework/pull/42364)) -- Consistency between digits and digits_between validation rules ([#42358](https://github.com/laravel/framework/pull/42358)) -- Corrects the use of "failed_jobs" instead of "job_batches" in BatchedTableCommand ([#42389](https://github.com/laravel/framework/pull/42389)) -- Update email.blade.php ([#42388](https://github.com/laravel/framework/pull/42388)) -- Remove old monolog 1.x compat code ([#42392](https://github.com/laravel/framework/pull/42392)) -- SesTransport: use correct Tags argument ([#42390](https://github.com/laravel/framework/pull/42390)) -- Implement robust handling of forwarding of exception codes ([#42393](https://github.com/laravel/framework/pull/42393)) - - -## [v9.12.2](https://github.com/laravel/framework/compare/v9.12.1...v9.12.2) - 2022-05-11 - -### Fixed -- Factory fails to eval models and factories when returned from closure ([#42344](https://github.com/laravel/framework/pull/42344)) - -### Changed -- Added is_string check to QueriesRelationships@requalifyWhereTables ([#42341](https://github.com/laravel/framework/pull/42341)) - - -## [v9.12.1](https://github.com/laravel/framework/compare/v9.12.0...v9.12.1) - 2022-05-10 - -### Fixed -- Fix TypeError in DeadlockException ([#42337](https://github.com/laravel/framework/pull/42337)) -- Fixed type mismatch on Pusher::validate_channels() ([#42340](https://github.com/laravel/framework/pull/42340)) - -### Changed -- Add custom segments on "remember me" for session rebuild ([#42316](https://github.com/laravel/framework/pull/42316)) - - -## [v9.12.0](https://github.com/laravel/framework/compare/v9.11.0...v9.12.0) - 2022-05-10 - -### Added - -- Added closure based exceptions testing ([#42155](https://github.com/laravel/framework/pull/42155)) -- Allow forcing requests made via the Http client to be faked ([#42230](https://github.com/laravel/framework/pull/42230)) -- Added 'throwIf' method to PendingRequest ([#42260](https://github.com/laravel/framework/pull/42260)) -- Allow passing key/value arrays to getArguments and getOptions ([#42268](https://github.com/laravel/framework/pull/42268)) -- Add whereNotMorphedTo, orWhereNotMorphedTo ([#42264](https://github.com/laravel/framework/pull/42264)) -- Add method to extend localeArray generation ([#42275](https://github.com/laravel/framework/pull/42275)) -- Added ability to set delay per channel based on notifiable instance ([#42239](https://github.com/laravel/framework/pull/42239)) -- Added Illuminate/Pagination/CursorPaginator::onLastPage() ([#42301](https://github.com/laravel/framework/pull/42301)) -- Added findOr method to Query/Builder ([#42290](https://github.com/laravel/framework/pull/42290)) - -### Fixed - -- Fix too many channels with pusher broadcasting ([#42287](https://github.com/laravel/framework/pull/42287)) -- Fix Str::Mask() for repeating chars ([#42295](https://github.com/laravel/framework/pull/42295)) -- Fix EventFake::assertListening() for asserting string-based observer listeners ([#42289](https://github.com/laravel/framework/pull/42289)) -- Fixed Loose comparison causes the value not to be saved ([#41337](https://github.com/laravel/framework/pull/41337)) -- Fix multiple dots for digits_between rule ([#42330](https://github.com/laravel/framework/pull/42330)) - -### Changed - -- Enable to modify HTTP Client request headers when using beforeSending() callback ([#42244](https://github.com/laravel/framework/pull/42244)) -- Make throttle lock acquisition retry configurable for concurrency limiter ([#42242](https://github.com/laravel/framework/pull/42242)) -- Defers expanding callables on Factories ([#42241](https://github.com/laravel/framework/pull/42241)) -- Add wherehas soft deleting scopes ([#42100](https://github.com/laravel/framework/pull/42100)) -- Improve password checks ([#42248](https://github.com/laravel/framework/pull/42248)) -- Set relation parent key when using forceCreate on HasOne and HasMany relations ([#42281](https://github.com/laravel/framework/pull/42281)) -- Make sure the prefix override behaviours are the same between phpredis and predis drivers ([#42279](https://github.com/laravel/framework/pull/42279)) -- Share logging context across channels and stacks ([#42276](https://github.com/laravel/framework/pull/42276)) - -## [v9.11.0](https://github.com/laravel/framework/compare/v9.10.1...v9.11.0) - 2022-05-03 - -### Added - -- Added Illuminate/Collections/Arr::join() ([#42197](https://github.com/laravel/framework/pull/42197)) -- Added has and missing methods to ValidatedInput ([#42184](https://github.com/laravel/framework/pull/42184)) -- Added deprecation stack trace config option ([#42235](https://github.com/laravel/framework/pull/42235)) - -### Fixed - -- Fix deprecation issue with translator and empty rules ([#42216](https://github.com/laravel/framework/pull/42216), [#42213](https://github.com/laravel/framework/pull/42213)) - -### Changed - -- Improve EventFake::assertListening() support for subscribers ([#42193](https://github.com/laravel/framework/pull/42193)) - -## [v9.10.1](https://github.com/laravel/framework/compare/v9.10.0...v9.10.1) - 2022-04-28 - -### Revert - -- Revert of ["Illuminate/Routing/Router::middlewareGroup() will support array of the middlewares"](https://github.com/laravel/framework/pull/42004) ([7563912](https://github.com/laravel/framework/commit/75639121cc55d4390fd75a0f422c7f0a626ece1e)) - -## [v9.10.0](https://github.com/laravel/framework/compare/v9.9.0...v9.10.0) - 2022-04-27 - -### Added - -- Add the ability to use alias when performing upsert via MySQL ([#42053](https://github.com/laravel/framework/pull/42053)) -- Illuminate/Routing/Router::middlewareGroup() will support array of the middlewares ([#42004](https://github.com/laravel/framework/pull/42004), [e6b84fb](https://github.com/laravel/framework/commit/e6b84fb0f1f1c82ce1a486643e2b20974522cda6)) -- Added Missing AsCommand attribute on schedule:list ([#42069](https://github.com/laravel/framework/pull/42069)) -- Add the beforeRefreshingDatabase function to the Testing/RefreshDatabase trait ([#42073](https://github.com/laravel/framework/pull/42073)) -- Added doesntExpectOutputToContain assertion method ([#42096](https://github.com/laravel/framework/pull/42096)) -- Added a findOr method to Eloquent ([#42092](https://github.com/laravel/framework/pull/42092)) -- Allow extension in `Illuminate/View/Compilers/Compiler.php` ([68e41fd](https://github.com/laravel/framework/commit/68e41fd3691b9aa5548e07c5caf38696c4082513)) -- Support 'IS' and 'IS NOT' PostgreSQL operators ([#42123](https://github.com/laravel/framework/pull/42123)) -- Added `str` and `string` methods to Illuminate/Http/Concerns/InteractsWithInput ([c9d34b7](https://github.com/laravel/framework/commit/c9d34b7be0611d26f3e46669934cf542cc5e9e21)) -- Added methods to append and prepend jobs to existing chain ([#42138](https://github.com/laravel/framework/pull/42138)) - -### Fixes - -- Make it so non-existent jobs run down the failed path instead of crashing ([#42079](https://github.com/laravel/framework/pull/42079)) -- Fix schedule:work command Artisan binary name ([#42083](https://github.com/laravel/framework/pull/42083)) -- Fix TrimStrings middleware with non-UTF8 characters ([#42065](https://github.com/laravel/framework/pull/42065)) -- Copy locale and defaultLocale from original request in Request::createFrom() ([#42080](https://github.com/laravel/framework/pull/42080)) -- Fix ViewErrorBag for JSON session serialization ([#42090](https://github.com/laravel/framework/pull/42090)) -- Fix array keys from cached routes in CompiledRouteCollection::getRoutesByMethod() ([#42078](https://github.com/laravel/framework/pull/42078)) -- Fix json_last_error issue with JsonResponse::setData ([#42125](https://github.com/laravel/framework/pull/42125)) -- Fix bug in BelongsToMany where non-related rows are returned ([#42087](https://github.com/laravel/framework/pull/42087)) -- Fix HasAttributes::mutateAttributeForArray when accessing non-cached attribute ([#42130](https://github.com/laravel/framework/pull/42130)) - -### Changed - -- Make password rule errors translatable ([#42060](https://github.com/laravel/framework/pull/42060)) -- Redesign of the event:list Command. ([#42068](https://github.com/laravel/framework/pull/42068)) -- Changed event:list command ([#42084](https://github.com/laravel/framework/pull/42084)) -- Throw LostDbConnectionException instead of LogicException ([#42102](https://github.com/laravel/framework/pull/42102)) -- Throw deadlock exception ([#42129](https://github.com/laravel/framework/pull/42129)) -- Support Arr::forget() for nested ArrayAccess objects ([#42142](https://github.com/laravel/framework/pull/42142)) -- Allow Illuminate/Collections/Enumerable::jsonSerialize() to return other types ([#42133](https://github.com/laravel/framework/pull/42133)) -- Update schedule:list colouring output ([#42153](%5B#42153%5D(https://github.com/laravel/framework/pull/42153)) - -## [v9.9.0](https://github.com/laravel/framework/compare/v9.8.1...v9.9.0) - 2022-04-19 - -### Added - -- Add getAllTables support for SQLite and SQLServer schema builders ([#41896](https://github.com/laravel/framework/pull/41896)) -- Added withoutEagerLoads() method to Builder ([#41950](https://github.com/laravel/framework/pull/41950)) -- Added 'throw' method to PendingRequest ([#41953](https://github.com/laravel/framework/pull/41953)) -- Configurable pluralizer language and uncountables ([#41941](https://github.com/laravel/framework/pull/41941)) - -### Fixed - -- Fixed Error in Illuminate/Routing/Exceptions/StreamedResponseException ([#41955](https://github.com/laravel/framework/pull/41955)) -- Fix PHP warnings when rendering long blade string ([#41956](https://github.com/laravel/framework/pull/41956)) -- Fix ExcludeIf regression to use Closure over is_callable() ([#41969](https://github.com/laravel/framework/pull/41969)) -- Fixes applying replacements to multi-level localization arrays ([#42022](https://github.com/laravel/framework/pull/42022)) - -### Changed - -- Improved Illuminate/Foundation/Http/Middleware/TrimStrings.php and Str::squish() ([#41949](https://github.com/laravel/framework/pull/41949), [#41971](https://github.com/laravel/framework/pull/41971)) -- Use config session domain for maintenance cookie ([#41961](https://github.com/laravel/framework/pull/41961)) -- Revert lazy command forcing ([#41982](https://github.com/laravel/framework/pull/41982)) - -## [v9.8.1](https://github.com/laravel/framework/compare/v9.8.0...v9.8.1) - 2022-04-12 - -### Reverted - -- Revert "Standardize withCount() & withExists() eager loading aggregates ([#41943](https://github.com/laravel/framework/pull/41943)) - -## [v9.8.0](https://github.com/laravel/framework/compare/v9.7.0...v9.8.0) - 2022-04-12 - -### Added - -- Added inbound option to CastMakeCommand ([#41838](https://github.com/laravel/framework/pull/41838)) -- Added a way to retrieve the first column of the first row from a query ([#41858](https://github.com/laravel/framework/pull/41858)) -- Make DatabaseManager Macroable ([#41868](https://github.com/laravel/framework/pull/41868)) -- Improve Str::squish() ([#41877](https://github.com/laravel/framework/pull/41877), [#41924](https://github.com/laravel/framework/pull/41924)) -- Added option to disable cached view ([#41859](https://github.com/laravel/framework/pull/41859)) -- Make Connection Class Macroable ([#41865](https://github.com/laravel/framework/pull/41865)) -- Added possibility to discover anonymous Blade components in other folders ([#41637](https://github.com/laravel/framework/pull/41637)) -- Added `Illuminate/Database/Eloquent/Factories/Factory::set()` ([#41890](https://github.com/laravel/framework/pull/41890)) -- Added multibyte support to string padding helper functions ([#41899](https://github.com/laravel/framework/pull/41899)) -- Allow to use custom log level in exception handler reporting ([#41925](https://github.com/laravel/framework/pull/41925)) - -### Fixed - -- Illuminate/Support/Stringable::exactly() with Stringable value ([#41846](https://github.com/laravel/framework/pull/41846)) -- Fixed afterCommit and RefreshDatabase ([#41782](https://github.com/laravel/framework/pull/41782)) -- Fix null name for email address in `Illuminate/Mail/Message` ([#41870](https://github.com/laravel/framework/pull/41870)) -- Fix seeder property for in-memory tests ([#41869](https://github.com/laravel/framework/pull/41869)) -- Fix empty paths for server.php ([#41933](https://github.com/laravel/framework/pull/41933)) -- Fix ExcludeIf constructor ([#41931](https://github.com/laravel/framework/pull/41931)) - -### Changed - -- Set custom host to the serve command with environment variable ([#41831](https://github.com/laravel/framework/pull/41831)) -- Add handling of object being passed into old method in Model ([#41842](https://github.com/laravel/framework/pull/41842)) -- Catch permission exception when creating directory ([#41871](https://github.com/laravel/framework/pull/41871)) -- Restore v8 behaviour of base query for relations ([#41918](https://github.com/laravel/framework/pull/41918), [#41923](https://github.com/laravel/framework/pull/41923)) -- Standardize withCount() & withExists() eager loading aggregates ([#41914](https://github.com/laravel/framework/pull/41914)) - -## [v9.7.0](https://github.com/laravel/framework/compare/v9.6.0...v9.7.0) - 2022-04-05 - -### Added - -- Make whereBelongsTo accept Collection ([#41733](https://github.com/laravel/framework/pull/41733)) -- Database queries containing JSON paths support array index braces ([#41767](https://github.com/laravel/framework/pull/41767)) -- Fire event before route matched ([#41765](https://github.com/laravel/framework/pull/41765)) -- Added to `Illuminate/Http/Resources/ConditionallyLoadsAttributes::whenNotNull` method ([#41769](https://github.com/laravel/framework/pull/41769)) -- Added "whereIn" route parameter constraint method ([#41794](https://github.com/laravel/framework/pull/41794)) -- Added `Illuminate/Queue/BeanstalkdQueue::bulk()` ([#41789](https://github.com/laravel/framework/pull/41789)) -- Added `Illuminate/Queue/SqsQueue::bulk()` ([#41788](https://github.com/laravel/framework/pull/41788)) -- Added String::squish() helper ([#41791](https://github.com/laravel/framework/pull/41791)) -- Added query builder method whereJsonContainsKey() ([#41802](https://github.com/laravel/framework/pull/41802)) -- Enable dispatchAfterResponse for batch ([#41787](https://github.com/laravel/framework/pull/41787)) - -### Fixed - -- Factory generation fixes ([#41688](https://github.com/laravel/framework/pull/41688)) -- Fixed Http Client throw boolean parameter of retry method ([#41762](https://github.com/laravel/framework/pull/41762), [#41792](https://github.com/laravel/framework/pull/41792)) -- Ignore empty redis username string in PhpRedisConnector ([#41773](https://github.com/laravel/framework/pull/41773)) -- Fixed support of nullable type for AsArrayObject/AsCollection ([#41797](https://github.com/laravel/framework/pull/41797), [05846e7](https://github.com/laravel/framework/commit/05846e7ba5cecc12a3ab8a3238272e9c1dd4e07f)) -- Fixed adding jobs from iterable to the pending batch ([#41786](https://github.com/laravel/framework/pull/41786)) -- Http client: fix retry handling of connection exception ([#41811](https://github.com/laravel/framework/pull/41811)) - -### Changed - -- Enable batch jobs delay for database queue ([#41758](https://github.com/laravel/framework/pull/41758)) -- Enable batch jobs delay for redis queue ([#41783](https://github.com/laravel/framework/pull/41783)) -- Http client: dispatch "response received" event for every retry attempt ([#41793](https://github.com/laravel/framework/pull/41793)) -- Http Client: provide pending request to retry callback ([#41779](https://github.com/laravel/framework/pull/41779)) -- Allow non length limited strings and char for postgresql ([#41800](https://github.com/laravel/framework/pull/41800)) -- Revert some Carbon::setTestNow() removals ([#41810](https://github.com/laravel/framework/pull/41810)) -- Allow cleanup of databases when using parallel tests ([#41806](https://github.com/laravel/framework/pull/41806)) - -## [v9.6.0](https://github.com/laravel/framework/compare/v9.5.1...v9.6.0) - 2022-03-29 - -### Added - -- Added whenTableHasColumn and whenTableDoesntHaveColumn on Schema Builder ([#41517](https://github.com/laravel/framework/pull/41517)) -- Added Illuminate/Mail/Mailable::hasSubject() ([#41575](https://github.com/laravel/framework/pull/41575)) -- Added `Illuminate/Filesystem/Filesystem::hasSameHash()` ([#41586](https://github.com/laravel/framework/pull/41586)) - -### Fixed - -- Fixed deprecation warning in `Str::exists()` ([d39d92d](https://github.com/laravel/framework/commit/d39d92df9b3c509d40b971207f03eb7f04087370)) -- Fix artisan make:seeder command nested namespace and class name problem ([#41534](https://github.com/laravel/framework/pull/41534)) -- Fixed Illuminate/Redis/Connections/PhpRedisConnection::handle() ([#41546](https://github.com/laravel/framework/pull/41546)) -- Stop throwing LazyLoadingViolationException for recently created model instances ([#41549](https://github.com/laravel/framework/pull/41549)) -- Close doctrineConnection on disconnect ([#41584](https://github.com/laravel/framework/pull/41584)) - -### Changed - -- Make throttle lock acquisition retry time configurable ([#41516](https://github.com/laravel/framework/pull/41516)) -- Allows object instead of array when adding to PendingBatch ([#41475](https://github.com/laravel/framework/pull/41475)) -- Exactly match scheduled command --name in schedule:test ([#41528](https://github.com/laravel/framework/pull/41528)) -- Handle Symfony defaultName deprecation ([#41555](https://github.com/laravel/framework/pull/41555), [#41595](https://github.com/laravel/framework/pull/41595)) -- Improve ScheduleListCommand ([#41552](https://github.com/laravel/framework/pull/41552), [#41535](https://github.com/laravel/framework/pull/41535), [#41494](https://github.com/laravel/framework/pull/41494)) -- Remove useless if statement in Str::mask() ([#41570](https://github.com/laravel/framework/pull/41570)) - -## [v9.5.1](https://github.com/laravel/framework/compare/v9.5.0...v9.5.1) - 2022-03-15 - -### Reverted - -- Revert "Fix the guard instance used." ([#41491](https://github.com/laravel/framework/pull/41491)) - -## [v9.5.0](https://github.com/laravel/framework/compare/v9.4.1...v9.5.0) - 2022-03-15 - -### Added - -- Added callback support on implode Collection method. ([#41405](https://github.com/laravel/framework/pull/41405)) -- Added `Illuminate/Filesystem/FilesystemAdapter::assertDirectoryEmpty()` ([#41398](https://github.com/laravel/framework/pull/41398)) -- Implement email "metadata" for SesTransport ([#41422](https://github.com/laravel/framework/pull/41422)) -- Make assertPath() accepts Closure ([#41409](https://github.com/laravel/framework/pull/41409)) -- Added callable support to operatorForWhere on Collection ([#41414](https://github.com/laravel/framework/pull/41414), [#41424](https://github.com/laravel/framework/pull/41424)) -- Added partial queue faking ([#41425](https://github.com/laravel/framework/pull/41425)) -- Added --name option to schedule:test command ([#41439](https://github.com/laravel/framework/pull/41439)) -- Define `Illuminate/Database/Eloquent/Concerns/HasRelationships::newRelatedThroughInstance()` ([#41444](https://github.com/laravel/framework/pull/41444)) -- Added `Illuminate/Support/Stringable::wrap()` ([#41455](https://github.com/laravel/framework/pull/41455)) -- Adds "freezeTime" helper for tests ([#41460](https://github.com/laravel/framework/pull/41460)) -- Allow for callables with beforeSending in`Illuminate/Http/Client/PendingRequest.php::runBeforeSendingCallbacks()` ([#41489](https://github.com/laravel/framework/pull/41489)) - -### Fixed - -- Fixed deprecation warnings from route:list when filtering on name or domain ([#41421](https://github.com/laravel/framework/pull/41421)) -- Fixes HTTP::pool response when a URL returns a null status code ([#41412](https://github.com/laravel/framework/pull/41412)) -- Fixed recaller name resolution in `Illuminate/Session/Middleware/AuthenticateSession.php` ([#41429](https://github.com/laravel/framework/pull/41429)) -- Fixed the guard instance used in /Illuminate/Session/Middleware/AuthenticateSession.php ([#41447](https://github.com/laravel/framework/pull/41447)) -- Fixed route:list --except-vendor hiding Route::view() & Route::redirect() ([#41465](https://github.com/laravel/framework/pull/41465)) - -### Changed - -- Add null typing to connection property in \Illuminate\Database\Eloquent\Factories\Factory ([#41418](https://github.com/laravel/framework/pull/41418)) -- Update reserved names in GeneratorCommand ([#41441](https://github.com/laravel/framework/pull/41441)) -- Redesign php artisan schedule:list Command ([#41445](https://github.com/laravel/framework/pull/41445)) -- Extend eloquent higher order proxy properties ([#41449](https://github.com/laravel/framework/pull/41449)) -- Allow passing named arguments to dynamic scopes ([#41478](https://github.com/laravel/framework/pull/41478)) -- Throw if tag is passed but is not supported in `Illuminate/Encryption/Encrypter.php` ([#41479](https://github.com/laravel/framework/pull/41479)) -- Update PackageManifest::$vendorPath initialisation for cases, when composer vendor dir is not in project director ([#41463](https://github.com/laravel/framework/pull/41463)) - -## [v9.4.1](https://github.com/laravel/framework/compare/v9.4.0...v9.4.1) - 2022-03-08 - -### Fixed - -- Fixed version of laravel - -## [v9.4.0](https://github.com/laravel/framework/compare/v9.4.0...v9.4.0) - 2022-03-08 - -### Added - -- Support modifying a char column type ([#41320](https://github.com/laravel/framework/pull/41320)) -- Add "Mutex" column to 'schedule:list' command ([#41338](https://github.com/laravel/framework/pull/41338)) -- Allow eloquent whereNot() and orWhereNot() to work on column and value ([#41296](https://github.com/laravel/framework/pull/41296)) -- Allow VerifyCsrfToken's CSRF cookie to be extended ([#41342](https://github.com/laravel/framework/pull/41342)) -- Added `soleValue()` to query builder ([#41368](https://github.com/laravel/framework/pull/41368)) -- Added `lcfirst()` to `Str` and `Stringable` ([#41384](https://github.com/laravel/framework/pull/41384)) -- Added retryUntil method to queued mailables ([#41393](https://github.com/laravel/framework/pull/41393)) - -### Fixed - -- Fixed middleware sorting for authenticating sessions ([50b46db](https://github.com/laravel/framework/commit/50b46db563e11ba52a53e3046c23e92878aed395)) -- Fixed takeUntilTimeout method of LazyCollection ([#41354](https://github.com/laravel/framework/pull/41354), [#41370](https://github.com/laravel/framework/pull/41370)) -- Fixed directory for nested markdown files for mailables ([#41366](https://github.com/laravel/framework/pull/41366)) -- Prevent serializing default values of queued jobs ([#41348](https://github.com/laravel/framework/pull/41348)) -- Fixed get() and head() in `Illuminate/Http/Client/PendingRequest.php` ([a54f481](https://github.com/laravel/framework/commit/a54f48102deea2864071e510172fe0b22a1c1d5a)) - -### Changed - -- Don't use global tap helper ([#41326](https://github.com/laravel/framework/pull/41326)) -- Allow chaining of `Illuminate/Console/Concerns/InteractsWithIO::newLine` ([#41327](https://github.com/laravel/framework/pull/41327)) -- set destinations since bcc missing from raw message in Mail SesTransport ([8ca43f4](https://github.com/laravel/framework/commit/8ca43f4c2a531ff9d28b86a7e366eef8adf8de84)) - -## [v9.3.1](https://github.com/laravel/framework/compare/v9.3.0...v9.3.1) - 2022-03-03 - -### Added - -- Optionally cascade thrown Flysystem exceptions by @driesvints in https://github.com/laravel/framework/pull/41308 - -### Changed - -- Allow overriding transport type on Mailgun transporter by @jnoordsij in https://github.com/laravel/framework/pull/41309 -- Change how Laravel handles strict morph map with pivot classes by @crynobone in https://github.com/laravel/framework/pull/41304 - -### Fixed - -- $job can be an object in some methods by @villfa in https://github.com/laravel/framework/pull/41244 -- Fix docblock on Batch class by @yoeriboven in https://github.com/laravel/framework/pull/41295 -- Correct `giveConfig` param doc by @Neol3108 in https://github.com/laravel/framework/pull/41314 -- Fix MySqlSchemaState does not add --ssl-ca to mysql cli by @DeepDiver1975 in https://github.com/laravel/framework/pull/41315 -- Do not prepend baseUrl to absolute urls by @JaZo in https://github.com/laravel/framework/pull/41307 -- Fixes getting the trusted proxies IPs from the configuration file by @nunomaduro in https://github.com/laravel/framework/pull/41322 - -## [v9.3.0 (2022-03-02)](https://github.com/laravel/framework/compare/v9.2.0...v9.3.0) - -### Added - -- Add NotificationFake::assertNothingSentTo() by @axlon ([#41232](https://github.com/laravel/framework/pull/41232)) -- Support --ssl-ca on schema load and dump by @DeepDiver1975 ([#40931](https://github.com/laravel/framework/pull/40931)) -- Add whereNot() to Query Builder and Eloquent Builder by @marcovo ([#41096](https://github.com/laravel/framework/pull/41096)) -- Added support for index and position placeholders in array validation messages by @Bird87ZA ([#41123](https://github.com/laravel/framework/pull/41123)) -- Add resource binding by @aedart ([#41233](https://github.com/laravel/framework/pull/41233)) -- Add ability to push additional pipes onto a pipeline via chain($pipes) by @stevebauman ([#41256](https://github.com/laravel/framework/pull/41256)) -- Add option to filter out routes defined in vendor packages in route:list command by @amiranagram ([#41254](https://github.com/laravel/framework/pull/41254)) - -### Fixed - -- Query PostgresBuilder fixes for renamed config 'search_path' by @derekmd ([#41215](https://github.com/laravel/framework/pull/41215)) -- Improve doctypes for Eloquent Factory guessing methods by @bastien-phi ([#41245](https://github.com/laravel/framework/pull/41245)) -- Fix Conditional::when and Conditional::unless when called with invokable by @bastien-phi ([#41270](https://github.com/laravel/framework/pull/41270)) -- Improves Support\Collection reduce method type definition by @fdalcin ([#41272](https://github.com/laravel/framework/pull/41272)) -- Fix inconsistent results of firstOrNew() when using withCasts() by @Attia-Ahmed ([#41257](https://github.com/laravel/framework/pull/41257)) -- Fix implicitBinding and withTrashed route with child with no SoftDeletes trait by @stein-j ([#41282](https://github.com/laravel/framework/pull/41282)) - -### Changed - -- Unset Connection Resolver extended callback by @emrancu ([#41216](https://github.com/laravel/framework/pull/41216)) -- Update Mailgun transport type by @driesvints ([#41255](https://github.com/laravel/framework/pull/41255)) - -## [v9.2.0 (2022-02-22)](https://github.com/laravel/framework/compare/v9.1.0...v9.2.0) - -### Added - -- Added `Illuminate/Database/Eloquent/Casts/Attribute::make()` ([#41014](https://github.com/laravel/framework/pull/41014)) -- Added `Illuminate/Collections/Arr::keyBy()` ([#41029](https://github.com/laravel/framework/pull/41029)) -- Added expectsOutputToContain to the PendingCommand. ([#40984](https://github.com/laravel/framework/pull/40984)) -- Added ability to supply HTTP client methods with JsonSerializable instances ([#41055](https://github.com/laravel/framework/pull/41055)) -- Added `Illuminate/Filesystem/AwsS3V3Adapter::getClient()` ([#41079](https://github.com/laravel/framework/pull/41079)) -- Added Support for enum in Builder::whereRelation ([#41091](https://github.com/laravel/framework/pull/41091)) -- Added X headers when using Mail::alwaysTo ([#41101](https://github.com/laravel/framework/pull/41101)) -- Added of support Bitwise operators in query ([#41112](https://github.com/laravel/framework/pull/41112)) -- Integrate Laravel CORS into framework ([#41137](https://github.com/laravel/framework/pull/41137)) -- Added `Illuminate/Support/Str::betweenFirst()` ([#41144](https://github.com/laravel/framework/pull/41144)) -- Allow specifiying custom messages for Rule objects ([#41145](https://github.com/laravel/framework/pull/41145)) - -### Fixed - -- Fixed Queue Failed_jobs insert issue with Exception contain UNICODE ([#41020](https://github.com/laravel/framework/pull/41020)) -- Fixes attempt to log deprecations on mocks ([#41057](https://github.com/laravel/framework/pull/41057)) -- Fixed loadAggregate not correctly applying casts ([#41050](https://github.com/laravel/framework/pull/41050)) -- Do not transform JsonSerializable instances to array in HTTP client methods ([#41077](https://github.com/laravel/framework/pull/41077)) -- Fix parsing config('database.connections.pgsql.search_path') ([#41088](https://github.com/laravel/framework/pull/41088)) -- Eloquent: firstWhere returns Object instead of NULL ([#41099](https://github.com/laravel/framework/pull/41099)) -- Fixed updated with provided qualified updated_at ([#41133](https://github.com/laravel/framework/pull/41133)) -- Fix setPriority Call for MailChannel ([#41120](https://github.com/laravel/framework/pull/41120)) -- Fixed route:list command output ([#41177](https://github.com/laravel/framework/pull/41177)) -- Fix database migrations $connection property ([#41161](https://github.com/laravel/framework/pull/41161)) - -### Changed - -- Cursor pagination: convert original column to expression ([#41003](https://github.com/laravel/framework/pull/41003)) -- Cast $perPage to integer on Paginator ([#41073](https://github.com/laravel/framework/pull/41073)) -- Restore S3 client extra options ([#41097](https://github.com/laravel/framework/pull/41097)) -- Use `latest()` within `notifications()` in `Illuminate/Notifications/HasDatabaseNotifications.php` ([#41095](https://github.com/laravel/framework/pull/41095)) -- Remove duplicate queries to find batch ([#41121](https://github.com/laravel/framework/pull/41121)) -- Remove redundant check in FormRequest::validated() ([#41115](https://github.com/laravel/framework/pull/41115)) -- Illuminate/Support/Facades/Storage::fake() changed ([#41113](https://github.com/laravel/framework/pull/41113)) -- Use coalesce equal as provided by PHP >= 7.4 ([#41174](https://github.com/laravel/framework/pull/41174)) -- Simplify some conditions with is_countable() ([#41168](https://github.com/laravel/framework/pull/41168)) -- Pass AWS temporary URL options to createPresignedRequest method ([#41156](https://github.com/laravel/framework/pull/41156)) -- Let Multiple* exceptions hold the number of records and items found ([#41164](https://github.com/laravel/framework/pull/41164)) - -## [v9.1.0 (2022-02-15)](https://github.com/laravel/framework/compare/v9.0.2...v9.1.0) - -### Added - -- Added the ability to use the uniqueFor method for Jobs by @andrey-helldar in https://github.com/laravel/framework/pull/40974 -- Add filtering of route:list by domain by @Synchro in https://github.com/laravel/framework/pull/40970 -- Added dropForeignIdFor method to match foreignIdFor method by @bretto36 in https://github.com/laravel/framework/pull/40950 -- Adds `Str::excerpt` by @nunomaduro in https://github.com/laravel/framework/pull/41000 -- Make:model --morph flag to generate MorphPivot model by @michael-rubel in https://github.com/laravel/framework/pull/41011 -- Add doesntContain to higher order proxies by @edemots in https://github.com/laravel/framework/pull/41034 - -### Changed - -- Improve types on model factory methods by @axlon in https://github.com/laravel/framework/pull/40902 -- Add support for passing array as the second parameter for the group method. by @hossein-zare in https://github.com/laravel/framework/pull/40945 -- Makes `ExceptionHandler::renderForConsole` internal on contract by @nunomaduro in https://github.com/laravel/framework/pull/40956 -- Put the error message at the bottom of the exceptions by @nshiro in https://github.com/laravel/framework/pull/40886 -- Expose next and previous cursor of cursor paginator by @gdebrauwer in https://github.com/laravel/framework/pull/41001 - -### Fixed - -- Fix FTP root config by @driesvints in https://github.com/laravel/framework/pull/40939 -- Allows tls encryption to be used with port different than 465 with starttls by @nicolalazzaro in https://github.com/laravel/framework/pull/40943 -- Catch suppressed deprecation logs by @nunomaduro in https://github.com/laravel/framework/pull/40942 -- Fix typo in method documentation by @shadman-ahmed in https://github.com/laravel/framework/pull/40951 -- Patch regex rule parsing due to `Rule::forEach()` by @stevebauman in https://github.com/laravel/framework/pull/40941 -- Fix replacing request options by @driesvints in https://github.com/laravel/framework/pull/40954 -- Fix `MessageSent` event by @driesvints in https://github.com/laravel/framework/pull/40963 -- Add firstOr() function to BelongsToMany relation by @r-kujawa in https://github.com/laravel/framework/pull/40828 -- Fix `isRelation()` failing to check an `Attribute` by @rodrigopedra in https://github.com/laravel/framework/pull/40967 -- Fix default pivot attributes by @iamgergo in https://github.com/laravel/framework/pull/40947 -- Fix enum casts arrayable behaviour by @diegotibi in https://github.com/laravel/framework/pull/40885 -- Solve exception error: Undefined array key "", in artisan route:list command by @manuglopez in https://github.com/laravel/framework/pull/41031 -- Fix Duplicate Route Namespace by @moisish in https://github.com/laravel/framework/pull/41021 -- Fix the error message when no routes are detected by @LukeTowers in https://github.com/laravel/framework/pull/41017 -- Fix mails with tags and metadata are not queuable by @joostdebruijn in https://github.com/laravel/framework/pull/41028 - -## [v9.0.2 (2022-02-10)](https://github.com/laravel/framework/compare/v9.0.1...v9.0.2) - -### Added - -- Add disabled directive by @belzaaron in https://github.com/laravel/framework/pull/40900 - -### Changed - -- Widen the type of `Collection::unique` `$key` parameter by @NiclasvanEyk in https://github.com/laravel/framework/pull/40903 -- Makes `ExceptionHandler::renderForConsole` internal by @nunomaduro in https://github.com/laravel/framework/pull/40936 -- Removal of Google Font integration from default exception templates by @bashgeek in https://github.com/laravel/framework/pull/40926 -- Allow base JsonResource class to be collected by @jwohlfert23 in https://github.com/laravel/framework/pull/40896 - -### Fixed - -- Fix Support\Collection reject method type definition by @joecampo in https://github.com/laravel/framework/pull/40899 -- Fix SpoofCheckValidation namespace change by @eduardor2k in https://github.com/laravel/framework/pull/40923 -- Fix notification email recipient by @driesvints in https://github.com/laravel/framework/pull/40921 -- Fix publishing visibility by @driesvints in https://github.com/laravel/framework/pull/40918 -- Fix Mailable->priority() by @giggsey in https://github.com/laravel/framework/pull/40917 - -## [v9.0.1 (2022-02-09)](https://github.com/laravel/framework/compare/v9.0.0...v9.0.1) - -### Changed - -- Improves `Support\Collection` each method type definition by @zingimmick in https://github.com/laravel/framework/pull/40879 - -### Fixed - -- Update Mailable.php by @rentalhost in https://github.com/laravel/framework/pull/40868 -- Switch to null coalescing operator in Conditionable by @inxilpro in https://github.com/laravel/framework/pull/40888 -- Bring back old return behaviour by @ankurk91 in https://github.com/laravel/framework/pull/40880 - -## [v9.0.0 (2022-02-08)](https://github.com/laravel/framework/compare/8.x...v9.0.0) - -Check the upgrade guide in the [Official Laravel Upgrade Documentation](https://laravel.com/docs/9.x/upgrade). Also you can see some release notes in the [Official Laravel Release Documentation](https://laravel.com/docs/9.x/releases). diff --git a/framework-9.50.2/LICENSE.md b/framework-9.50.2/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/README.md b/framework-9.50.2/README.md deleted file mode 100644 index df935e8..0000000 --- a/framework-9.50.2/README.md +++ /dev/null @@ -1,47 +0,0 @@ -

- -

-Build Status -Total Downloads -Latest Stable Version -License -

- -## About Laravel - -> **Note:** This repository contains the core code of the Laravel framework. If you want to build an application using Laravel, visit the main [Laravel repository](https://github.com/laravel/laravel). - -Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: - -- [Simple, fast routing engine](https://laravel.com/docs/routing). -- [Powerful dependency injection container](https://laravel.com/docs/container). -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. -- Database agnostic [schema migrations](https://laravel.com/docs/migrations). -- [Robust background job processing](https://laravel.com/docs/queues). -- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). - -Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked. - -## Learning Laravel - -Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is in-depth and complete, making it a breeze to get started learning the framework. - -You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. - -If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 1100 video tutorials covering a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. - -## Contributing - -Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). - -## Code of Conduct - -In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). - -## Security Vulnerabilities - -Please review [our security policy](https://github.com/laravel/framework/security/policy) on how to report security vulnerabilities. - -## License - -The Laravel framework is open-sourced software licensed under the [MIT license](LICENSE.md). diff --git a/framework-9.50.2/composer.json b/framework-9.50.2/composer.json deleted file mode 100644 index b06da74..0000000 --- a/framework-9.50.2/composer.json +++ /dev/null @@ -1,184 +0,0 @@ -{ - "name": "laravel/framework", - "description": "The Laravel Framework.", - "keywords": ["framework", "laravel"], - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-mbstring": "*", - "ext-openssl": "*", - "brick/math": "^0.9.3|^0.10.2|^0.11", - "doctrine/inflector": "^2.0.5", - "dragonmantank/cron-expression": "^3.3.2", - "egulias/email-validator": "^3.2.1|^4.0", - "fruitcake/php-cors": "^1.2", - "laravel/serializable-closure": "^1.2.2", - "league/commonmark": "^2.2.1", - "league/flysystem": "^3.8.0", - "monolog/monolog": "^2.0", - "nesbot/carbon": "^2.62.1", - "nunomaduro/termwind": "^1.13", - "psr/container": "^1.1.1|^2.0.1", - "psr/log": "^1.0|^2.0|^3.0", - "psr/simple-cache": "^1.0|^2.0|^3.0", - "ramsey/uuid": "^4.7", - "symfony/console": "^6.0.9", - "symfony/error-handler": "^6.0", - "symfony/finder": "^6.0", - "symfony/http-foundation": "^6.0", - "symfony/http-kernel": "^6.0", - "symfony/mailer": "^6.0", - "symfony/mime": "^6.0", - "symfony/process": "^6.0", - "symfony/routing": "^6.0", - "symfony/uid": "^6.0", - "symfony/var-dumper": "^6.0", - "tijsverkoyen/css-to-inline-styles": "^2.2.5", - "vlucas/phpdotenv": "^5.4.1", - "voku/portable-ascii": "^2.0" - }, - "replace": { - "illuminate/auth": "self.version", - "illuminate/broadcasting": "self.version", - "illuminate/bus": "self.version", - "illuminate/cache": "self.version", - "illuminate/collections": "self.version", - "illuminate/conditionable": "self.version", - "illuminate/config": "self.version", - "illuminate/console": "self.version", - "illuminate/container": "self.version", - "illuminate/contracts": "self.version", - "illuminate/cookie": "self.version", - "illuminate/database": "self.version", - "illuminate/encryption": "self.version", - "illuminate/events": "self.version", - "illuminate/filesystem": "self.version", - "illuminate/hashing": "self.version", - "illuminate/http": "self.version", - "illuminate/log": "self.version", - "illuminate/macroable": "self.version", - "illuminate/mail": "self.version", - "illuminate/notifications": "self.version", - "illuminate/pagination": "self.version", - "illuminate/pipeline": "self.version", - "illuminate/queue": "self.version", - "illuminate/redis": "self.version", - "illuminate/routing": "self.version", - "illuminate/session": "self.version", - "illuminate/support": "self.version", - "illuminate/testing": "self.version", - "illuminate/translation": "self.version", - "illuminate/validation": "self.version", - "illuminate/view": "self.version" - }, - "require-dev": { - "ably/ably-php": "^1.0", - "aws/aws-sdk-php": "^3.235.5", - "doctrine/dbal": "^2.13.3|^3.1.4", - "fakerphp/faker": "^1.21", - "guzzlehttp/guzzle": "^7.5", - "league/flysystem-aws-s3-v3": "^3.0", - "league/flysystem-ftp": "^3.0", - "league/flysystem-path-prefixing": "^3.3", - "league/flysystem-read-only": "^3.3", - "league/flysystem-sftp-v3": "^3.0", - "mockery/mockery": "^1.5.1", - "orchestra/testbench-core": "^7.16", - "pda/pheanstalk": "^4.0", - "phpstan/phpdoc-parser": "^1.15", - "phpstan/phpstan": "^1.4.7", - "phpunit/phpunit": "^9.5.8", - "predis/predis": "^1.1.9|^2.0.2", - "symfony/cache": "^6.0", - "symfony/http-client": "^6.0" - }, - "provide": { - "psr/container-implementation": "1.1|2.0", - "psr/simple-cache-implementation": "1.0|2.0|3.0" - }, - "conflict": { - "tightenco/collect": "<5.5.33" - }, - "autoload": { - "files": [ - "src/Illuminate/Collections/helpers.php", - "src/Illuminate/Events/functions.php", - "src/Illuminate/Foundation/helpers.php", - "src/Illuminate/Support/helpers.php" - ], - "psr-4": { - "Illuminate\\": "src/Illuminate/", - "Illuminate\\Support\\": [ - "src/Illuminate/Macroable/", - "src/Illuminate/Collections/", - "src/Illuminate/Conditionable/" - ] - } - }, - "autoload-dev": { - "files": [ - "tests/Database/stubs/MigrationCreatorFakeMigration.php" - ], - "psr-4": { - "Illuminate\\Tests\\": "tests/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "ext-ftp": "Required to use the Flysystem FTP driver.", - "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", - "ext-memcached": "Required to use the memcache cache driver.", - "ext-pcntl": "Required to use all features of the queue worker.", - "ext-posix": "Required to use all features of the queue worker.", - "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", - "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", - "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.235.5).", - "brianium/paratest": "Required to run tests in parallel (^6.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).", - "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", - "filp/whoops": "Required for friendly error pages in development (^2.14.3).", - "guzzlehttp/guzzle": "Required to use the HTTP Client and the ping methods on schedules (^7.5).", - "laravel/tinker": "Required to use the tinker console command (^2.0).", - "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.0).", - "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.0).", - "league/flysystem-path-prefixing": "Required to use the scoped driver (^3.3).", - "league/flysystem-read-only": "Required to use read-only disks (^3.3)", - "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.0).", - "mockery/mockery": "Required to use mocking (^1.5.1).", - "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", - "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", - "phpunit/phpunit": "Required to use assertions and run tests (^9.5.8).", - "predis/predis": "Required to use the predis connector (^1.1.9|^2.0.2).", - "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", - "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).", - "symfony/cache": "Required to PSR-6 cache bridge (^6.0).", - "symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).", - "symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.0).", - "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).", - "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).", - "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)." - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "composer/package-versions-deprecated": true - } - }, - "minimum-stability": "stable", - "prefer-stable": true -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Access/AuthorizationException.php b/framework-9.50.2/src/Illuminate/Auth/Access/AuthorizationException.php deleted file mode 100644 index 17101b4..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Access/AuthorizationException.php +++ /dev/null @@ -1,114 +0,0 @@ -code = $code ?: 0; - } - - /** - * Get the response from the gate. - * - * @return \Illuminate\Auth\Access\Response - */ - public function response() - { - return $this->response; - } - - /** - * Set the response from the gate. - * - * @param \Illuminate\Auth\Access\Response $response - * @return $this - */ - public function setResponse($response) - { - $this->response = $response; - - return $this; - } - - /** - * Set the HTTP response status code. - * - * @param int|null $status - * @return $this - */ - public function withStatus($status) - { - $this->status = $status; - - return $this; - } - - /** - * Set the HTTP response status code to 404. - * - * @return $this - */ - public function asNotFound() - { - return $this->withStatus(404); - } - - /** - * Determine if the HTTP status code has been set. - * - * @return bool - */ - public function hasStatus() - { - return $this->status !== null; - } - - /** - * Get the HTTP status code. - * - * @return int|null - */ - public function status() - { - return $this->status; - } - - /** - * Create a deny response object from this exception. - * - * @return \Illuminate\Auth\Access\Response - */ - public function toResponse() - { - return Response::deny($this->message, $this->code)->withStatus($this->status); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Access/Events/GateEvaluated.php b/framework-9.50.2/src/Illuminate/Auth/Access/Events/GateEvaluated.php deleted file mode 100644 index f77a9c8..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Access/Events/GateEvaluated.php +++ /dev/null @@ -1,51 +0,0 @@ -user = $user; - $this->ability = $ability; - $this->result = $result; - $this->arguments = $arguments; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Access/Gate.php b/framework-9.50.2/src/Illuminate/Auth/Access/Gate.php deleted file mode 100644 index 1694607..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Access/Gate.php +++ /dev/null @@ -1,872 +0,0 @@ -policies = $policies; - $this->container = $container; - $this->abilities = $abilities; - $this->userResolver = $userResolver; - $this->afterCallbacks = $afterCallbacks; - $this->beforeCallbacks = $beforeCallbacks; - $this->guessPolicyNamesUsingCallback = $guessPolicyNamesUsingCallback; - } - - /** - * 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; - } - - /** - * Perform an on-demand authorization check. Throw an authorization exception if the condition or callback is false. - * - * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition - * @param string|null $message - * @param string|null $code - * @return \Illuminate\Auth\Access\Response - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - public function allowIf($condition, $message = null, $code = null) - { - return $this->authorizeOnDemand($condition, $message, $code, true); - } - - /** - * Perform an on-demand authorization check. Throw an authorization exception if the condition or callback is true. - * - * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition - * @param string|null $message - * @param string|null $code - * @return \Illuminate\Auth\Access\Response - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - public function denyIf($condition, $message = null, $code = null) - { - return $this->authorizeOnDemand($condition, $message, $code, false); - } - - /** - * Authorize a given condition or callback. - * - * @param \Illuminate\Auth\Access\Response|\Closure|bool $condition - * @param string|null $message - * @param string|null $code - * @param bool $allowWhenResponseIs - * @return \Illuminate\Auth\Access\Response - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - protected function authorizeOnDemand($condition, $message, $code, $allowWhenResponseIs) - { - $user = $this->resolveUser(); - - if ($condition instanceof Closure) { - $response = $this->canBeCalledWithUser($user, $condition) - ? $condition($user) - : new Response(false, $message, $code); - } else { - $response = $condition; - } - - return with($response instanceof Response ? $response : new Response( - (bool) $response === $allowWhenResponseIs, $message, $code - ))->authorize(); - } - - /** - * Define a new ability. - * - * @param string $ability - * @param callable|array|string $callback - * @return $this - * - * @throws \InvalidArgumentException - */ - public function define($ability, $callback) - { - if (is_array($callback) && isset($callback[0]) && is_string($callback[0])) { - $callback = $callback[0].'@'.$callback[1]; - } - - if (is_callable($callback)) { - $this->abilities[$ability] = $callback; - } elseif (is_string($callback)) { - $this->stringCallbacks[$ability] = $callback; - - $this->abilities[$ability] = $this->buildAbilityCallback($ability, $callback); - } else { - throw new InvalidArgumentException("Callback must be a callable, callback array, or a 'Class@method' string."); - } - - return $this; - } - - /** - * Define abilities for a resource. - * - * @param string $name - * @param string $class - * @param array|null $abilities - * @return $this - */ - public function resource($name, $class, array $abilities = null) - { - $abilities = $abilities ?: [ - 'viewAny' => 'viewAny', - '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) { - if (str_contains($callback, '@')) { - [$class, $method] = Str::parseCallback($callback); - } else { - $class = $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 isset($method) - ? $policy->{$method}(...func_get_args()) - : $policy(...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( - fn ($ability) => $this->inspect($ability, $arguments)->allowed() - ); - } - - /** - * 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(fn ($ability) => $this->check($ability, $arguments)); - } - - /** - * Determine if all of the given abilities should be denied for the current user. - * - * @param iterable|string $abilities - * @param array|mixed $arguments - * @return bool - */ - public function none($abilities, $arguments = []) - { - return ! $this->any($abilities, $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 = []) - { - return $this->inspect($ability, $arguments)->authorize(); - } - - /** - * Inspect the user for the given ability. - * - * @param string $ability - * @param array|mixed $arguments - * @return \Illuminate\Auth\Access\Response - */ - public function inspect($ability, $arguments = []) - { - try { - $result = $this->raw($ability, $arguments); - - if ($result instanceof Response) { - return $result; - } - - return $result ? Response::allow() : Response::deny(); - } catch (AuthorizationException $e) { - return $e->toResponse(); - } - } - - /** - * Get the raw result from the authorization callback. - * - * @param string $ability - * @param array|mixed $arguments - * @return mixed - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - public function raw($ability, $arguments = []) - { - $arguments = Arr::wrap($arguments); - - $user = $this->resolveUser(); - - // 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. - return tap($this->callAfterCallbacks( - $user, $ability, $arguments, $result - ), function ($result) use ($user, $ability, $arguments) { - $this->dispatchGateEvaluatedEvent($user, $ability, $arguments, $result); - }); - } - - /** - * Determine whether the callback/method can be called with the given user. - * - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - * @param \Closure|string|array $class - * @param string|null $method - * @return bool - */ - protected function canBeCalledWithUser($user, $class, $method = null) - { - if (! is_null($user)) { - return true; - } - - if (! is_null($method)) { - return $this->methodAllowsGuests($class, $method); - } - - if (is_array($class)) { - $className = is_string($class[0]) ? $class[0] : get_class($class[0]); - - return $this->methodAllowsGuests($className, $class[1]); - } - - return $this->callbackAllowsGuests($class); - } - - /** - * Determine if the given class method allows guests. - * - * @param string $class - * @param string $method - * @return bool - */ - protected function methodAllowsGuests($class, $method) - { - try { - $reflection = new ReflectionClass($class); - - $method = $reflection->getMethod($method); - } catch (Exception $e) { - return false; - } - - if ($method) { - $parameters = $method->getParameters(); - - return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); - } - - return false; - } - - /** - * Determine if the callback allows guests. - * - * @param callable $callback - * @return bool - * - * @throws \ReflectionException - */ - protected function callbackAllowsGuests($callback) - { - $parameters = (new ReflectionFunction($callback))->getParameters(); - - return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); - } - - /** - * Determine if the given parameter allows guests. - * - * @param \ReflectionParameter $parameter - * @return bool - */ - protected function parameterAllowsGuests($parameter) - { - return ($parameter->hasType() && $parameter->allowsNull()) || - ($parameter->isDefaultValueAvailable() && is_null($parameter->getDefaultValue())); - } - - /** - * Resolve and call the appropriate authorization callback. - * - * @param \Illuminate\Contracts\Auth\Authenticatable|null $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|null $user - * @param string $ability - * @param array $arguments - * @return bool|null - */ - protected function callBeforeCallbacks($user, $ability, array $arguments) - { - foreach ($this->beforeCallbacks as $before) { - if (! $this->canBeCalledWithUser($user, $before)) { - continue; - } - - if (! is_null($result = $before($user, $ability, $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 bool|null - */ - protected function callAfterCallbacks($user, $ability, array $arguments, $result) - { - foreach ($this->afterCallbacks as $after) { - if (! $this->canBeCalledWithUser($user, $after)) { - continue; - } - - $afterResult = $after($user, $ability, $result, $arguments); - - $result ??= $afterResult; - } - - return $result; - } - - /** - * Dispatch a gate evaluation event. - * - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - * @param string $ability - * @param array $arguments - * @param bool|null $result - * @return void - */ - protected function dispatchGateEvaluatedEvent($user, $ability, array $arguments, $result) - { - if ($this->container->bound(Dispatcher::class)) { - $this->container->make(Dispatcher::class)->dispatch( - new GateEvaluated($user, $ability, $result, $arguments) - ); - } - } - - /** - * Resolve the callable for the given ability and arguments. - * - * @param \Illuminate\Contracts\Auth\Authenticatable|null $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->stringCallbacks[$ability])) { - [$class, $method] = Str::parseCallback($this->stringCallbacks[$ability]); - - if ($this->canBeCalledWithUser($user, $class, $method ?: '__invoke')) { - return $this->abilities[$ability]; - } - } - - if (isset($this->abilities[$ability]) && - $this->canBeCalledWithUser($user, $this->abilities[$ability])) { - return $this->abilities[$ability]; - } - - return function () { - // - }; - } - - /** - * 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->guessPolicyName($class) as $guessedPolicy) { - if (class_exists($guessedPolicy)) { - return $this->resolvePolicy($guessedPolicy); - } - } - - foreach ($this->policies as $expected => $policy) { - if (is_subclass_of($class, $expected)) { - return $this->resolvePolicy($policy); - } - } - } - - /** - * Guess the policy name for the given class. - * - * @param string $class - * @return array - */ - protected function guessPolicyName($class) - { - if ($this->guessPolicyNamesUsingCallback) { - return Arr::wrap(call_user_func($this->guessPolicyNamesUsingCallback, $class)); - } - - $classDirname = str_replace('/', '\\', dirname(str_replace('\\', '/', $class))); - - $classDirnameSegments = explode('\\', $classDirname); - - return Arr::wrap(Collection::times(count($classDirnameSegments), function ($index) use ($class, $classDirnameSegments) { - $classDirname = implode('\\', array_slice($classDirnameSegments, 0, $index)); - - return $classDirname.'\\Policies\\'.class_basename($class).'Policy'; - })->reverse()->values()->first(function ($class) { - return class_exists($class); - }) ?: [$classDirname.'\\Policies\\'.class_basename($class).'Policy']); - } - - /** - * Specify a callback to be used to guess policy names. - * - * @param callable $callback - * @return $this - */ - public function guessPolicyNamesUsing(callable $callback) - { - $this->guessPolicyNamesUsingCallback = $callback; - - return $this; - } - - /** - * Build a policy class instance of the given type. - * - * @param object|string $class - * @return mixed - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - 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; - } - - $method = $this->formatAbilityToMethod($ability); - - return $this->callPolicyMethod($policy, $method, $user, $arguments); - }; - } - - /** - * 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; - } - - if ($this->canBeCalledWithUser($user, $policy, 'before')) { - return $policy->before($user, $ability, ...$arguments); - } - } - - /** - * Call the appropriate method on the given policy. - * - * @param mixed $policy - * @param string $method - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - * @param array $arguments - * @return mixed - */ - protected function callPolicyMethod($policy, $method, $user, array $arguments) - { - // 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); - } - - if (! is_callable([$policy, $method])) { - return; - } - - if ($this->canBeCalledWithUser($user, $policy, $method)) { - return $policy->{$method}($user, ...$arguments); - } - } - - /** - * Format the policy ability into a method name. - * - * @param string $ability - * @return string - */ - protected function formatAbilityToMethod($ability) - { - return str_contains($ability, '-') ? 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 = fn () => $user; - - return new static( - $this->container, $callback, $this->abilities, - $this->policies, $this->beforeCallbacks, $this->afterCallbacks, - $this->guessPolicyNamesUsingCallback - ); - } - - /** - * 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; - } - - /** - * Set the container instance used by the gate. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Access/HandlesAuthorization.php b/framework-9.50.2/src/Illuminate/Auth/Access/HandlesAuthorization.php deleted file mode 100644 index ed21624..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Access/HandlesAuthorization.php +++ /dev/null @@ -1,55 +0,0 @@ -code = $code; - $this->allowed = $allowed; - $this->message = $message; - } - - /** - * Create a new "allow" Response. - * - * @param string|null $message - * @param mixed $code - * @return \Illuminate\Auth\Access\Response - */ - public static function allow($message = null, $code = null) - { - return new static(true, $message, $code); - } - - /** - * Create a new "deny" Response. - * - * @param string|null $message - * @param mixed $code - * @return \Illuminate\Auth\Access\Response - */ - public static function deny($message = null, $code = null) - { - return new static(false, $message, $code); - } - - /** - * Create a new "deny" Response with a HTTP status code. - * - * @param int $status - * @param string|null $message - * @param mixed $code - * @return \Illuminate\Auth\Access\Response - */ - public static function denyWithStatus($status, $message = null, $code = null) - { - return static::deny($message, $code)->withStatus($status); - } - - /** - * Create a new "deny" Response with a 404 HTTP status code. - * - * @param string|null $message - * @param mixed $code - * @return \Illuminate\Auth\Access\Response - */ - public static function denyAsNotFound($message = null, $code = null) - { - return static::denyWithStatus(404, $message, $code); - } - - /** - * Determine if the response was allowed. - * - * @return bool - */ - public function allowed() - { - return $this->allowed; - } - - /** - * Determine if the response was denied. - * - * @return bool - */ - public function denied() - { - return ! $this->allowed(); - } - - /** - * Get the response message. - * - * @return string|null - */ - public function message() - { - return $this->message; - } - - /** - * Get the response code / reason. - * - * @return mixed - */ - public function code() - { - return $this->code; - } - - /** - * Throw authorization exception if response was denied. - * - * @return \Illuminate\Auth\Access\Response - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - public function authorize() - { - if ($this->denied()) { - throw (new AuthorizationException($this->message(), $this->code())) - ->setResponse($this) - ->withStatus($this->status); - } - - return $this; - } - - /** - * Set the HTTP response status code. - * - * @param null|int $status - * @return $this - */ - public function withStatus($status) - { - $this->status = $status; - - return $this; - } - - /** - * Set the HTTP response status code to 404. - * - * @return $this - */ - public function asNotFound() - { - return $this->withStatus(404); - } - - /** - * Get the HTTP status code. - * - * @return int|null - */ - public function status() - { - return $this->status; - } - - /** - * Convert the response to an array. - * - * @return array - */ - public function toArray() - { - return [ - 'allowed' => $this->allowed(), - 'message' => $this->message(), - 'code' => $this->code(), - ]; - } - - /** - * Get the string representation of the message. - * - * @return string - */ - public function __toString() - { - return (string) $this->message(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/AuthManager.php b/framework-9.50.2/src/Illuminate/Auth/AuthManager.php deleted file mode 100755 index e95da5e..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/AuthManager.php +++ /dev/null @@ -1,342 +0,0 @@ -app = $app; - - $this->userResolver = fn ($guard = null) => $this->guard($guard)->user(); - } - - /** - * Attempt to get the guard from the local cache. - * - * @param string|null $name - * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard - */ - public function guard($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - return $this->guards[$name] ?? $this->guards[$name] = $this->resolve($name); - } - - /** - * Resolve the given guard. - * - * @param string $name - * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard - * - * @throws \InvalidArgumentException - */ - protected function resolve($name) - { - $config = $this->getConfig($name); - - if (is_null($config)) { - throw new InvalidArgumentException("Auth guard [{$name}] is not defined."); - } - - if (isset($this->customCreators[$config['driver']])) { - return $this->callCustomCreator($name, $config); - } - - $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; - - if (method_exists($this, $driverMethod)) { - return $this->{$driverMethod}($name, $config); - } - - throw new InvalidArgumentException( - "Auth driver [{$config['driver']}] for guard [{$name}] is not defined." - ); - } - - /** - * Call a custom driver creator. - * - * @param string $name - * @param array $config - * @return mixed - */ - protected function callCustomCreator($name, array $config) - { - return $this->customCreators[$config['driver']]($this->app, $name, $config); - } - - /** - * Create a session based authentication guard. - * - * @param string $name - * @param array $config - * @return \Illuminate\Auth\SessionGuard - */ - public function createSessionDriver($name, $config) - { - $provider = $this->createUserProvider($config['provider'] ?? null); - - $guard = new SessionGuard( - $name, - $provider, - $this->app['session.store'], - ); - - // When using the remember me functionality of the authentication services we - // will need to be set the encryption instance of the guard, which allows - // secure, encrypted cookie values to get generated for those cookies. - if (method_exists($guard, 'setCookieJar')) { - $guard->setCookieJar($this->app['cookie']); - } - - if (method_exists($guard, 'setDispatcher')) { - $guard->setDispatcher($this->app['events']); - } - - if (method_exists($guard, 'setRequest')) { - $guard->setRequest($this->app->refresh('request', $guard, 'setRequest')); - } - - if (isset($config['remember'])) { - $guard->setRememberDuration($config['remember']); - } - - return $guard; - } - - /** - * Create a token based authentication guard. - * - * @param string $name - * @param array $config - * @return \Illuminate\Auth\TokenGuard - */ - public function createTokenDriver($name, $config) - { - // The token guard implements a basic API token based guard implementation - // that takes an API token field from the request and matches it to the - // user in the database or another persistence layer where users are. - $guard = new TokenGuard( - $this->createUserProvider($config['provider'] ?? null), - $this->app['request'], - $config['input_key'] ?? 'api_token', - $config['storage_key'] ?? 'api_token', - $config['hash'] ?? false - ); - - $this->app->refresh('request', $guard, 'setRequest'); - - return $guard; - } - - /** - * Get the guard configuration. - * - * @param string $name - * @return array - */ - protected function getConfig($name) - { - return $this->app['config']["auth.guards.{$name}"]; - } - - /** - * Get the default authentication driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['auth.defaults.guard']; - } - - /** - * Set the default guard driver the factory should serve. - * - * @param string $name - * @return void - */ - public function shouldUse($name) - { - $name = $name ?: $this->getDefaultDriver(); - - $this->setDefaultDriver($name); - - $this->userResolver = fn ($name = null) => $this->guard($name)->user(); - } - - /** - * Set the default authentication driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['auth.defaults.guard'] = $name; - } - - /** - * Register a new callback based request guard. - * - * @param string $driver - * @param callable $callback - * @return $this - */ - public function viaRequest($driver, callable $callback) - { - return $this->extend($driver, function () use ($callback) { - $guard = new RequestGuard($callback, $this->app['request'], $this->createUserProvider()); - - $this->app->refresh('request', $guard, 'setRequest'); - - return $guard; - }); - } - - /** - * Get the user resolver callback. - * - * @return \Closure - */ - public function userResolver() - { - return $this->userResolver; - } - - /** - * Set the callback to be used to resolve users. - * - * @param \Closure $userResolver - * @return $this - */ - public function resolveUsersUsing(Closure $userResolver) - { - $this->userResolver = $userResolver; - - return $this; - } - - /** - * 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; - } - - /** - * Register a custom provider creator Closure. - * - * @param string $name - * @param \Closure $callback - * @return $this - */ - public function provider($name, Closure $callback) - { - $this->customProviderCreators[$name] = $callback; - - return $this; - } - - /** - * Determines if any guards have already been resolved. - * - * @return bool - */ - public function hasResolvedGuards() - { - return count($this->guards) > 0; - } - - /** - * Forget all of the resolved guard instances. - * - * @return $this - */ - public function forgetGuards() - { - $this->guards = []; - - return $this; - } - - /** - * Set the application instance used by the manager. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return $this - */ - public function setApplication($app) - { - $this->app = $app; - - return $this; - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->guard()->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/AuthServiceProvider.php b/framework-9.50.2/src/Illuminate/Auth/AuthServiceProvider.php deleted file mode 100755 index 2f4dfb6..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/AuthServiceProvider.php +++ /dev/null @@ -1,112 +0,0 @@ -registerAuthenticator(); - $this->registerUserResolver(); - $this->registerAccessGate(); - $this->registerRequirePassword(); - $this->registerRequestRebindHandler(); - $this->registerEventRebindHandler(); - } - - /** - * Register the authenticator services. - * - * @return void - */ - protected function registerAuthenticator() - { - $this->app->singleton('auth', fn ($app) => new AuthManager($app)); - - $this->app->singleton('auth.driver', fn ($app) => $app['auth']->guard()); - } - - /** - * Register a resolver for the authenticated user. - * - * @return void - */ - protected function registerUserResolver() - { - $this->app->bind(AuthenticatableContract::class, fn ($app) => call_user_func($app['auth']->userResolver())); - } - - /** - * Register the access gate service. - * - * @return void - */ - protected function registerAccessGate() - { - $this->app->singleton(GateContract::class, function ($app) { - return new Gate($app, fn () => call_user_func($app['auth']->userResolver())); - }); - } - - /** - * Register a resolver for the authenticated user. - * - * @return void - */ - protected function registerRequirePassword() - { - $this->app->bind(RequirePassword::class, function ($app) { - return new RequirePassword( - $app[ResponseFactory::class], - $app[UrlGenerator::class], - $app['config']->get('auth.password_timeout') - ); - }); - } - - /** - * Handle the re-binding of the request binding. - * - * @return void - */ - protected function registerRequestRebindHandler() - { - $this->app->rebinding('request', function ($app, $request) { - $request->setUserResolver(function ($guard = null) use ($app) { - return call_user_func($app['auth']->userResolver(), $guard); - }); - }); - } - - /** - * Handle the re-binding of the event dispatcher binding. - * - * @return void - */ - protected function registerEventRebindHandler() - { - $this->app->rebinding('events', function ($app, $dispatcher) { - if (! $app->resolved('auth') || - $app['auth']->hasResolvedGuards() === false) { - return; - } - - if (method_exists($guard = $app['auth']->guard(), 'setDispatcher')) { - $guard->setDispatcher($dispatcher); - } - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Authenticatable.php b/framework-9.50.2/src/Illuminate/Auth/Authenticatable.php deleted file mode 100644 index f1c0115..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Authenticatable.php +++ /dev/null @@ -1,88 +0,0 @@ -getKeyName(); - } - - /** - * Get the unique identifier for the user. - * - * @return mixed - */ - public function getAuthIdentifier() - { - return $this->{$this->getAuthIdentifierName()}; - } - - /** - * Get the unique broadcast identifier for the user. - * - * @return mixed - */ - public function getAuthIdentifierForBroadcasting() - { - return $this->getAuthIdentifier(); - } - - /** - * Get the password for the user. - * - * @return string - */ - public function getAuthPassword() - { - return $this->password; - } - - /** - * Get the token value for the "remember me" session. - * - * @return string|null - */ - public function getRememberToken() - { - if (! empty($this->getRememberTokenName())) { - return (string) $this->{$this->getRememberTokenName()}; - } - } - - /** - * Set the token value for the "remember me" session. - * - * @param string $value - * @return void - */ - public function setRememberToken($value) - { - if (! empty($this->getRememberTokenName())) { - $this->{$this->getRememberTokenName()} = $value; - } - } - - /** - * Get the column name for the "remember me" token. - * - * @return string - */ - public function getRememberTokenName() - { - return $this->rememberTokenName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/AuthenticationException.php b/framework-9.50.2/src/Illuminate/Auth/AuthenticationException.php deleted file mode 100644 index 66808c3..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/AuthenticationException.php +++ /dev/null @@ -1,58 +0,0 @@ -guards = $guards; - $this->redirectTo = $redirectTo; - } - - /** - * Get the guards that were checked. - * - * @return array - */ - public function guards() - { - return $this->guards; - } - - /** - * Get the path the user should be redirected to. - * - * @return string|null - */ - public function redirectTo() - { - return $this->redirectTo; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Console/ClearResetsCommand.php b/framework-9.50.2/src/Illuminate/Auth/Console/ClearResetsCommand.php deleted file mode 100644 index 2ea9668..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Console/ClearResetsCommand.php +++ /dev/null @@ -1,47 +0,0 @@ -laravel['auth.password']->broker($this->argument('name'))->getRepository()->deleteExpired(); - - $this->components->info('Expired reset tokens cleared successfully.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub b/framework-9.50.2/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub deleted file mode 100644 index 2f2986d..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - {{ config('app.name', 'Laravel') }} - - - - - - - - -
- - -
- @yield('content') -
-
- - diff --git a/framework-9.50.2/src/Illuminate/Auth/CreatesUserProviders.php b/framework-9.50.2/src/Illuminate/Auth/CreatesUserProviders.php deleted file mode 100644 index 761a427..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/CreatesUserProviders.php +++ /dev/null @@ -1,91 +0,0 @@ -getProviderConfiguration($provider))) { - return; - } - - if (isset($this->customProviderCreators[$driver = ($config['driver'] ?? null)])) { - return call_user_func( - $this->customProviderCreators[$driver], $this->app, $config - ); - } - - return match ($driver) { - 'database' => $this->createDatabaseProvider($config), - 'eloquent' => $this->createEloquentProvider($config), - default => throw new InvalidArgumentException( - "Authentication user provider [{$driver}] is not defined." - ), - }; - } - - /** - * Get the user provider configuration. - * - * @param string|null $provider - * @return array|null - */ - protected function getProviderConfiguration($provider) - { - if ($provider = $provider ?: $this->getDefaultUserProvider()) { - return $this->app['config']['auth.providers.'.$provider]; - } - } - - /** - * Create an instance of the database user provider. - * - * @param array $config - * @return \Illuminate\Auth\DatabaseUserProvider - */ - protected function createDatabaseProvider($config) - { - $connection = $this->app['db']->connection($config['connection'] ?? null); - - return new DatabaseUserProvider($connection, $this->app['hash'], $config['table']); - } - - /** - * Create an instance of the Eloquent user provider. - * - * @param array $config - * @return \Illuminate\Auth\EloquentUserProvider - */ - protected function createEloquentProvider($config) - { - return new EloquentUserProvider($this->app['hash'], $config['model']); - } - - /** - * Get the default user provider name. - * - * @return string - */ - public function getDefaultUserProvider() - { - return $this->app['config']['auth.defaults.provider']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/DatabaseUserProvider.php b/framework-9.50.2/src/Illuminate/Auth/DatabaseUserProvider.php deleted file mode 100755 index 16b70ee..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/DatabaseUserProvider.php +++ /dev/null @@ -1,161 +0,0 @@ -connection = $connection; - $this->table = $table; - $this->hasher = $hasher; - } - - /** - * Retrieve a user by their unique identifier. - * - * @param mixed $identifier - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveById($identifier) - { - $user = $this->connection->table($this->table)->find($identifier); - - return $this->getGenericUser($user); - } - - /** - * Retrieve a user by their unique identifier and "remember me" token. - * - * @param mixed $identifier - * @param string $token - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveByToken($identifier, $token) - { - $user = $this->getGenericUser( - $this->connection->table($this->table)->find($identifier) - ); - - return $user && $user->getRememberToken() && hash_equals($user->getRememberToken(), $token) - ? $user : null; - } - - /** - * Update the "remember me" token for the given user in storage. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param string $token - * @return void - */ - public function updateRememberToken(UserContract $user, $token) - { - $this->connection->table($this->table) - ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier()) - ->update([$user->getRememberTokenName() => $token]); - } - - /** - * Retrieve a user by the given credentials. - * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveByCredentials(array $credentials) - { - $credentials = array_filter( - $credentials, - fn ($key) => ! str_contains($key, 'password'), - ARRAY_FILTER_USE_KEY - ); - - if (empty($credentials)) { - return; - } - - // First we will add each credential element to the query as a where clause. - // Then we can execute the query and, if we found a user, return it in a - // generic "user" object that will be utilized by the Guard instances. - $query = $this->connection->table($this->table); - - foreach ($credentials as $key => $value) { - if (is_array($value) || $value instanceof Arrayable) { - $query->whereIn($key, $value); - } elseif ($value instanceof Closure) { - $value($query); - } else { - $query->where($key, $value); - } - } - - // Now we are ready to execute the query to see if we have a user matching - // the given credentials. If not, we will just return null and indicate - // that there are no matching users from the given credential arrays. - $user = $query->first(); - - return $this->getGenericUser($user); - } - - /** - * Get the generic user. - * - * @param mixed $user - * @return \Illuminate\Auth\GenericUser|null - */ - protected function getGenericUser($user) - { - if (! is_null($user)) { - return new GenericUser((array) $user); - } - } - - /** - * Validate a user against the given credentials. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param array $credentials - * @return bool - */ - public function validateCredentials(UserContract $user, array $credentials) - { - return $this->hasher->check( - $credentials['password'], $user->getAuthPassword() - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/EloquentUserProvider.php b/framework-9.50.2/src/Illuminate/Auth/EloquentUserProvider.php deleted file mode 100755 index 39a744e..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/EloquentUserProvider.php +++ /dev/null @@ -1,255 +0,0 @@ -model = $model; - $this->hasher = $hasher; - } - - /** - * Retrieve a user by their unique identifier. - * - * @param mixed $identifier - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveById($identifier) - { - $model = $this->createModel(); - - return $this->newModelQuery($model) - ->where($model->getAuthIdentifierName(), $identifier) - ->first(); - } - - /** - * Retrieve a user by their unique identifier and "remember me" token. - * - * @param mixed $identifier - * @param string $token - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveByToken($identifier, $token) - { - $model = $this->createModel(); - - $retrievedModel = $this->newModelQuery($model)->where( - $model->getAuthIdentifierName(), $identifier - )->first(); - - if (! $retrievedModel) { - return; - } - - $rememberToken = $retrievedModel->getRememberToken(); - - return $rememberToken && hash_equals($rememberToken, $token) ? $retrievedModel : null; - } - - /** - * Update the "remember me" token for the given user in storage. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param string $token - * @return void - */ - public function updateRememberToken(UserContract $user, $token) - { - $user->setRememberToken($token); - - $timestamps = $user->timestamps; - - $user->timestamps = false; - - $user->save(); - - $user->timestamps = $timestamps; - } - - /** - * Retrieve a user by the given credentials. - * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function retrieveByCredentials(array $credentials) - { - $credentials = array_filter( - $credentials, - fn ($key) => ! str_contains($key, 'password'), - ARRAY_FILTER_USE_KEY - ); - - if (empty($credentials)) { - return; - } - - // First we will add each credential element to the query as a where clause. - // Then we can execute the query and, if we found a user, return it in a - // Eloquent User "model" that will be utilized by the Guard instances. - $query = $this->newModelQuery(); - - foreach ($credentials as $key => $value) { - if (is_array($value) || $value instanceof Arrayable) { - $query->whereIn($key, $value); - } elseif ($value instanceof Closure) { - $value($query); - } else { - $query->where($key, $value); - } - } - - return $query->first(); - } - - /** - * Validate a user against the given credentials. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param array $credentials - * @return bool - */ - public function validateCredentials(UserContract $user, array $credentials) - { - if (is_null($plain = $credentials['password'])) { - return false; - } - - return $this->hasher->check($plain, $user->getAuthPassword()); - } - - /** - * Get a new query builder for the model instance. - * - * @param \Illuminate\Database\Eloquent\Model|null $model - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function newModelQuery($model = null) - { - $query = is_null($model) - ? $this->createModel()->newQuery() - : $model->newQuery(); - - with($query, $this->queryCallback); - - return $query; - } - - /** - * Create a new instance of the model. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function createModel() - { - $class = '\\'.ltrim($this->model, '\\'); - - return new $class; - } - - /** - * Gets the hasher implementation. - * - * @return \Illuminate\Contracts\Hashing\Hasher - */ - public function getHasher() - { - return $this->hasher; - } - - /** - * Sets the hasher implementation. - * - * @param \Illuminate\Contracts\Hashing\Hasher $hasher - * @return $this - */ - public function setHasher(HasherContract $hasher) - { - $this->hasher = $hasher; - - return $this; - } - - /** - * Gets the name of the Eloquent user model. - * - * @return string - */ - public function getModel() - { - return $this->model; - } - - /** - * Sets the name of the Eloquent user model. - * - * @param string $model - * @return $this - */ - public function setModel($model) - { - $this->model = $model; - - return $this; - } - - /** - * Get the callback that modifies the query before retrieving users. - * - * @return \Closure|null - */ - public function getQueryCallback() - { - return $this->queryCallback; - } - - /** - * Sets the callback to modify the query before retrieving users. - * - * @param (\Closure(\Illuminate\Database\Eloquent\Builder):mixed)|null $queryCallback - * @return $this - */ - public function withQuery($queryCallback = null) - { - $this->queryCallback = $queryCallback; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Attempting.php b/framework-9.50.2/src/Illuminate/Auth/Events/Attempting.php deleted file mode 100644 index 3f911ba..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Attempting.php +++ /dev/null @@ -1,42 +0,0 @@ -guard = $guard; - $this->remember = $remember; - $this->credentials = $credentials; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Authenticated.php b/framework-9.50.2/src/Illuminate/Auth/Events/Authenticated.php deleted file mode 100644 index faefcbe..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Authenticated.php +++ /dev/null @@ -1,37 +0,0 @@ -user = $user; - $this->guard = $guard; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/CurrentDeviceLogout.php b/framework-9.50.2/src/Illuminate/Auth/Events/CurrentDeviceLogout.php deleted file mode 100644 index 32d31fa..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/CurrentDeviceLogout.php +++ /dev/null @@ -1,37 +0,0 @@ -user = $user; - $this->guard = $guard; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Failed.php b/framework-9.50.2/src/Illuminate/Auth/Events/Failed.php deleted file mode 100644 index 34f8124..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Failed.php +++ /dev/null @@ -1,42 +0,0 @@ -user = $user; - $this->guard = $guard; - $this->credentials = $credentials; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Lockout.php b/framework-9.50.2/src/Illuminate/Auth/Events/Lockout.php deleted file mode 100644 index 347943f..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Lockout.php +++ /dev/null @@ -1,26 +0,0 @@ -request = $request; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Login.php b/framework-9.50.2/src/Illuminate/Auth/Events/Login.php deleted file mode 100644 index 87a399e..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Login.php +++ /dev/null @@ -1,46 +0,0 @@ -user = $user; - $this->guard = $guard; - $this->remember = $remember; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Logout.php b/framework-9.50.2/src/Illuminate/Auth/Events/Logout.php deleted file mode 100644 index c47341d..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Logout.php +++ /dev/null @@ -1,37 +0,0 @@ -user = $user; - $this->guard = $guard; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/OtherDeviceLogout.php b/framework-9.50.2/src/Illuminate/Auth/Events/OtherDeviceLogout.php deleted file mode 100644 index ea139a7..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/OtherDeviceLogout.php +++ /dev/null @@ -1,37 +0,0 @@ -user = $user; - $this->guard = $guard; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/PasswordReset.php b/framework-9.50.2/src/Illuminate/Auth/Events/PasswordReset.php deleted file mode 100644 index f57b3c9..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/PasswordReset.php +++ /dev/null @@ -1,28 +0,0 @@ -user = $user; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Registered.php b/framework-9.50.2/src/Illuminate/Auth/Events/Registered.php deleted file mode 100644 index f84058c..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Registered.php +++ /dev/null @@ -1,28 +0,0 @@ -user = $user; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Validated.php b/framework-9.50.2/src/Illuminate/Auth/Events/Validated.php deleted file mode 100644 index ebc3b2c..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Validated.php +++ /dev/null @@ -1,37 +0,0 @@ -user = $user; - $this->guard = $guard; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Events/Verified.php b/framework-9.50.2/src/Illuminate/Auth/Events/Verified.php deleted file mode 100644 index 1d6e4c0..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Events/Verified.php +++ /dev/null @@ -1,28 +0,0 @@ -user = $user; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/GenericUser.php b/framework-9.50.2/src/Illuminate/Auth/GenericUser.php deleted file mode 100755 index c87bc23..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/GenericUser.php +++ /dev/null @@ -1,132 +0,0 @@ -attributes = $attributes; - } - - /** - * Get the name of the unique identifier for the user. - * - * @return string - */ - public function getAuthIdentifierName() - { - return 'id'; - } - - /** - * Get the unique identifier for the user. - * - * @return mixed - */ - public function getAuthIdentifier() - { - return $this->attributes[$this->getAuthIdentifierName()]; - } - - /** - * Get the password for the user. - * - * @return string - */ - public function getAuthPassword() - { - return $this->attributes['password']; - } - - /** - * Get the "remember me" token value. - * - * @return string - */ - public function getRememberToken() - { - return $this->attributes[$this->getRememberTokenName()]; - } - - /** - * Set the "remember me" token value. - * - * @param string $value - * @return void - */ - public function setRememberToken($value) - { - $this->attributes[$this->getRememberTokenName()] = $value; - } - - /** - * Get the column name for the "remember me" token. - * - * @return string - */ - public function getRememberTokenName() - { - return 'remember_token'; - } - - /** - * Dynamically access the user's attributes. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->attributes[$key]; - } - - /** - * Dynamically set an attribute on the user. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this->attributes[$key] = $value; - } - - /** - * Dynamically check if a value is set on the user. - * - * @param string $key - * @return bool - */ - public function __isset($key) - { - return isset($this->attributes[$key]); - } - - /** - * Dynamically unset a value on the user. - * - * @param string $key - * @return void - */ - public function __unset($key) - { - unset($this->attributes[$key]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/GuardHelpers.php b/framework-9.50.2/src/Illuminate/Auth/GuardHelpers.php deleted file mode 100644 index ee98e8a..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/GuardHelpers.php +++ /dev/null @@ -1,130 +0,0 @@ -user())) { - return $user; - } - - throw new AuthenticationException; - } - - /** - * Determine if the guard has a user instance. - * - * @return bool - */ - public function hasUser() - { - return ! is_null($this->user); - } - - /** - * Determine if the current user is authenticated. - * - * @return bool - */ - public function check() - { - return ! is_null($this->user()); - } - - /** - * Determine if the current user is a guest. - * - * @return bool - */ - public function guest() - { - return ! $this->check(); - } - - /** - * Get the ID for the currently authenticated user. - * - * @return int|string|null - */ - public function id() - { - if ($this->user()) { - return $this->user()->getAuthIdentifier(); - } - } - - /** - * Set the current user. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return $this - */ - public function setUser(AuthenticatableContract $user) - { - $this->user = $user; - - return $this; - } - - /** - * Forget the current user. - * - * @return $this - */ - public function forgetUser() - { - $this->user = null; - - return $this; - } - - /** - * Get the user provider used by the guard. - * - * @return \Illuminate\Contracts\Auth\UserProvider - */ - public function getProvider() - { - return $this->provider; - } - - /** - * Set the user provider used by the guard. - * - * @param \Illuminate\Contracts\Auth\UserProvider $provider - * @return void - */ - public function setProvider(UserProvider $provider) - { - $this->provider = $provider; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/LICENSE.md b/framework-9.50.2/src/Illuminate/Auth/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php b/framework-9.50.2/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php deleted file mode 100644 index 12dfa69..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php +++ /dev/null @@ -1,22 +0,0 @@ -user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { - $event->user->sendEmailVerificationNotification(); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Middleware/Authenticate.php b/framework-9.50.2/src/Illuminate/Auth/Middleware/Authenticate.php deleted file mode 100644 index 7eda342..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Middleware/Authenticate.php +++ /dev/null @@ -1,97 +0,0 @@ -auth = $auth; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string[] ...$guards - * @return mixed - * - * @throws \Illuminate\Auth\AuthenticationException - */ - public function handle($request, Closure $next, ...$guards) - { - $this->authenticate($request, $guards); - - return $next($request); - } - - /** - * Determine if the user is logged in to any of the given guards. - * - * @param \Illuminate\Http\Request $request - * @param array $guards - * @return void - * - * @throws \Illuminate\Auth\AuthenticationException - */ - protected function authenticate($request, array $guards) - { - if (empty($guards)) { - $guards = [null]; - } - - foreach ($guards as $guard) { - if ($this->auth->guard($guard)->check()) { - return $this->auth->shouldUse($guard); - } - } - - $this->unauthenticated($request, $guards); - } - - /** - * Handle an unauthenticated user. - * - * @param \Illuminate\Http\Request $request - * @param array $guards - * @return void - * - * @throws \Illuminate\Auth\AuthenticationException - */ - protected function unauthenticated($request, array $guards) - { - throw new AuthenticationException( - 'Unauthenticated.', $guards, $this->redirectTo($request) - ); - } - - /** - * Get the path the user should be redirected to when they are not authenticated. - * - * @param \Illuminate\Http\Request $request - * @return string|null - */ - protected function redirectTo($request) - { - // - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php b/framework-9.50.2/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php deleted file mode 100644 index 92c81e6..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php +++ /dev/null @@ -1,45 +0,0 @@ -auth = $auth; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard - * @param string|null $field - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException - */ - public function handle($request, Closure $next, $guard = null, $field = null) - { - $this->auth->guard($guard)->basic($field ?: 'email'); - - return $next($request); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Middleware/Authorize.php b/framework-9.50.2/src/Illuminate/Auth/Middleware/Authorize.php deleted file mode 100644 index 1af05be..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Middleware/Authorize.php +++ /dev/null @@ -1,93 +0,0 @@ -gate = $gate; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string $ability - * @param array|null ...$models - * @return mixed - * - * @throws \Illuminate\Auth\AuthenticationException - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - public function handle($request, Closure $next, $ability, ...$models) - { - $this->gate->authorize($ability, $this->getGateArguments($request, $models)); - - return $next($request); - } - - /** - * Get the arguments parameter for the gate. - * - * @param \Illuminate\Http\Request $request - * @param array|null $models - * @return \Illuminate\Database\Eloquent\Model|array|string - */ - protected function getGateArguments($request, $models) - { - if (is_null($models)) { - return []; - } - - return collect($models)->map(function ($model) use ($request) { - return $model instanceof Model ? $model : $this->getModel($request, $model); - })->all(); - } - - /** - * Get the model to authorize. - * - * @param \Illuminate\Http\Request $request - * @param string $model - * @return \Illuminate\Database\Eloquent\Model|string - */ - protected function getModel($request, $model) - { - if ($this->isClassName($model)) { - return trim($model); - } else { - return $request->route($model, null) ?? - ((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null); - } - } - - /** - * Checks if the given string looks like a fully qualified class name. - * - * @param string $value - * @return bool - */ - protected function isClassName($value) - { - return str_contains($value, '\\'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php b/framework-9.50.2/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php deleted file mode 100644 index 8f2b33a..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php +++ /dev/null @@ -1,32 +0,0 @@ -user() || - ($request->user() instanceof MustVerifyEmail && - ! $request->user()->hasVerifiedEmail())) { - return $request->expectsJson() - ? abort(403, 'Your email address is not verified.') - : Redirect::guest(URL::route($redirectToRoute ?: 'verification.notice')); - } - - return $next($request); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Middleware/RequirePassword.php b/framework-9.50.2/src/Illuminate/Auth/Middleware/RequirePassword.php deleted file mode 100644 index 4ed4395..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Middleware/RequirePassword.php +++ /dev/null @@ -1,86 +0,0 @@ -responseFactory = $responseFactory; - $this->urlGenerator = $urlGenerator; - $this->passwordTimeout = $passwordTimeout ?: 10800; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $redirectToRoute - * @param int|null $passwordTimeoutSeconds - * @return mixed - */ - public function handle($request, Closure $next, $redirectToRoute = null, $passwordTimeoutSeconds = null) - { - if ($this->shouldConfirmPassword($request, $passwordTimeoutSeconds)) { - if ($request->expectsJson()) { - return $this->responseFactory->json([ - 'message' => 'Password confirmation required.', - ], 423); - } - - return $this->responseFactory->redirectGuest( - $this->urlGenerator->route($redirectToRoute ?? 'password.confirm') - ); - } - - return $next($request); - } - - /** - * Determine if the confirmation timeout has expired. - * - * @param \Illuminate\Http\Request $request - * @param int|null $passwordTimeoutSeconds - * @return bool - */ - protected function shouldConfirmPassword($request, $passwordTimeoutSeconds = null) - { - $confirmedAt = time() - $request->session()->get('auth.password_confirmed_at', 0); - - return $confirmedAt > ($passwordTimeoutSeconds ?? $this->passwordTimeout); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/MustVerifyEmail.php b/framework-9.50.2/src/Illuminate/Auth/MustVerifyEmail.php deleted file mode 100644 index 8e1ce33..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/MustVerifyEmail.php +++ /dev/null @@ -1,50 +0,0 @@ -email_verified_at); - } - - /** - * Mark the given user's email as verified. - * - * @return bool - */ - public function markEmailAsVerified() - { - return $this->forceFill([ - 'email_verified_at' => $this->freshTimestamp(), - ])->save(); - } - - /** - * Send the email verification notification. - * - * @return void - */ - public function sendEmailVerificationNotification() - { - $this->notify(new VerifyEmail); - } - - /** - * Get the email address that should be used for verification. - * - * @return string - */ - public function getEmailForVerification() - { - return $this->email; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Notifications/ResetPassword.php b/framework-9.50.2/src/Illuminate/Auth/Notifications/ResetPassword.php deleted file mode 100644 index 1d8da41..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Notifications/ResetPassword.php +++ /dev/null @@ -1,124 +0,0 @@ -token = $token; - } - - /** - * Get the notification's channels. - * - * @param mixed $notifiable - * @return array|string - */ - public function via($notifiable) - { - return ['mail']; - } - - /** - * Build the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail($notifiable) - { - if (static::$toMailCallback) { - return call_user_func(static::$toMailCallback, $notifiable, $this->token); - } - - return $this->buildMailMessage($this->resetUrl($notifiable)); - } - - /** - * Get the reset password notification mail message for the given URL. - * - * @param string $url - * @return \Illuminate\Notifications\Messages\MailMessage - */ - protected function buildMailMessage($url) - { - return (new MailMessage) - ->subject(Lang::get('Reset Password Notification')) - ->line(Lang::get('You are receiving this email because we received a password reset request for your account.')) - ->action(Lang::get('Reset Password'), $url) - ->line(Lang::get('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.'.config('auth.defaults.passwords').'.expire')])) - ->line(Lang::get('If you did not request a password reset, no further action is required.')); - } - - /** - * Get the reset URL for the given notifiable. - * - * @param mixed $notifiable - * @return string - */ - protected function resetUrl($notifiable) - { - if (static::$createUrlCallback) { - return call_user_func(static::$createUrlCallback, $notifiable, $this->token); - } - - return url(route('password.reset', [ - 'token' => $this->token, - 'email' => $notifiable->getEmailForPasswordReset(), - ], false)); - } - - /** - * Set a callback that should be used when creating the reset password button URL. - * - * @param \Closure(mixed, string): string $callback - * @return void - */ - public static function createUrlUsing($callback) - { - static::$createUrlCallback = $callback; - } - - /** - * Set a callback that should be used when building the notification mail message. - * - * @param \Closure(mixed, string): \Illuminate\Notifications\Messages\MailMessage $callback - * @return void - */ - public static function toMailUsing($callback) - { - static::$toMailCallback = $callback; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Notifications/VerifyEmail.php b/framework-9.50.2/src/Illuminate/Auth/Notifications/VerifyEmail.php deleted file mode 100644 index 7a5cf91..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Notifications/VerifyEmail.php +++ /dev/null @@ -1,114 +0,0 @@ -verificationUrl($notifiable); - - if (static::$toMailCallback) { - return call_user_func(static::$toMailCallback, $notifiable, $verificationUrl); - } - - return $this->buildMailMessage($verificationUrl); - } - - /** - * Get the verify email notification mail message for the given URL. - * - * @param string $url - * @return \Illuminate\Notifications\Messages\MailMessage - */ - protected function buildMailMessage($url) - { - return (new MailMessage) - ->subject(Lang::get('Verify Email Address')) - ->line(Lang::get('Please click the button below to verify your email address.')) - ->action(Lang::get('Verify Email Address'), $url) - ->line(Lang::get('If you did not create an account, no further action is required.')); - } - - /** - * Get the verification URL for the given notifiable. - * - * @param mixed $notifiable - * @return string - */ - protected function verificationUrl($notifiable) - { - if (static::$createUrlCallback) { - return call_user_func(static::$createUrlCallback, $notifiable); - } - - return URL::temporarySignedRoute( - 'verification.verify', - Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)), - [ - 'id' => $notifiable->getKey(), - 'hash' => sha1($notifiable->getEmailForVerification()), - ] - ); - } - - /** - * Set a callback that should be used when creating the email verification URL. - * - * @param \Closure $callback - * @return void - */ - public static function createUrlUsing($callback) - { - static::$createUrlCallback = $callback; - } - - /** - * Set a callback that should be used when building the notification mail message. - * - * @param \Closure $callback - * @return void - */ - public static function toMailUsing($callback) - { - static::$toMailCallback = $callback; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Passwords/CanResetPassword.php b/framework-9.50.2/src/Illuminate/Auth/Passwords/CanResetPassword.php deleted file mode 100644 index 918a288..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Passwords/CanResetPassword.php +++ /dev/null @@ -1,29 +0,0 @@ -email; - } - - /** - * Send the password reset notification. - * - * @param string $token - * @return void - */ - public function sendPasswordResetNotification($token) - { - $this->notify(new ResetPasswordNotification($token)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php b/framework-9.50.2/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php deleted file mode 100755 index fe5f54b..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php +++ /dev/null @@ -1,246 +0,0 @@ -table = $table; - $this->hasher = $hasher; - $this->hashKey = $hashKey; - $this->expires = $expires * 60; - $this->connection = $connection; - $this->throttle = $throttle; - } - - /** - * Create a new token record. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return string - */ - public function create(CanResetPasswordContract $user) - { - $email = $user->getEmailForPasswordReset(); - - $this->deleteExisting($user); - - // We will create a new, random token for the user so that we can e-mail them - // a safe link to the password reset form. Then we will insert a record in - // the database so that we can verify the token within the actual reset. - $token = $this->createNewToken(); - - $this->getTable()->insert($this->getPayload($email, $token)); - - return $token; - } - - /** - * Delete all existing reset tokens from the database. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return int - */ - protected function deleteExisting(CanResetPasswordContract $user) - { - return $this->getTable()->where('email', $user->getEmailForPasswordReset())->delete(); - } - - /** - * Build the record payload for the table. - * - * @param string $email - * @param string $token - * @return array - */ - protected function getPayload($email, $token) - { - return ['email' => $email, 'token' => $this->hasher->make($token), 'created_at' => new Carbon]; - } - - /** - * Determine if a token record exists and is valid. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @param string $token - * @return bool - */ - public function exists(CanResetPasswordContract $user, $token) - { - $record = (array) $this->getTable()->where( - 'email', $user->getEmailForPasswordReset() - )->first(); - - return $record && - ! $this->tokenExpired($record['created_at']) && - $this->hasher->check($token, $record['token']); - } - - /** - * Determine if the token has expired. - * - * @param string $createdAt - * @return bool - */ - protected function tokenExpired($createdAt) - { - return Carbon::parse($createdAt)->addSeconds($this->expires)->isPast(); - } - - /** - * Determine if the given user recently created a password reset token. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return bool - */ - public function recentlyCreatedToken(CanResetPasswordContract $user) - { - $record = (array) $this->getTable()->where( - 'email', $user->getEmailForPasswordReset() - )->first(); - - return $record && $this->tokenRecentlyCreated($record['created_at']); - } - - /** - * Determine if the token was recently created. - * - * @param string $createdAt - * @return bool - */ - protected function tokenRecentlyCreated($createdAt) - { - if ($this->throttle <= 0) { - return false; - } - - return Carbon::parse($createdAt)->addSeconds( - $this->throttle - )->isFuture(); - } - - /** - * Delete a token record by user. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return void - */ - public function delete(CanResetPasswordContract $user) - { - $this->deleteExisting($user); - } - - /** - * Delete expired tokens. - * - * @return void - */ - public function deleteExpired() - { - $expiredAt = Carbon::now()->subSeconds($this->expires); - - $this->getTable()->where('created_at', '<', $expiredAt)->delete(); - } - - /** - * Create a new token for the user. - * - * @return string - */ - public function createNewToken() - { - return hash_hmac('sha256', Str::random(40), $this->hashKey); - } - - /** - * Get the database connection instance. - * - * @return \Illuminate\Database\ConnectionInterface - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Begin a new database query against the table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function getTable() - { - return $this->connection->table($this->table); - } - - /** - * Get the hasher instance. - * - * @return \Illuminate\Contracts\Hashing\Hasher - */ - public function getHasher() - { - return $this->hasher; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordBroker.php b/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordBroker.php deleted file mode 100755 index cbbc897..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ /dev/null @@ -1,190 +0,0 @@ -users = $users; - $this->tokens = $tokens; - } - - /** - * Send a password reset link to a user. - * - * @param array $credentials - * @param \Closure|null $callback - * @return string - */ - public function sendResetLink(array $credentials, Closure $callback = null) - { - // First we will check to see if we found a user at the given credentials and - // if we did not we will redirect back to this current URI with a piece of - // "flash" data in the session to indicate to the developers the errors. - $user = $this->getUser($credentials); - - if (is_null($user)) { - return static::INVALID_USER; - } - - if ($this->tokens->recentlyCreatedToken($user)) { - return static::RESET_THROTTLED; - } - - $token = $this->tokens->create($user); - - if ($callback) { - $callback($user, $token); - } else { - // Once we have the reset token, we are ready to send the message out to this - // user with a link to reset their password. We will then redirect back to - // the current URI having nothing set in the session to indicate errors. - $user->sendPasswordResetNotification($token); - } - - return static::RESET_LINK_SENT; - } - - /** - * Reset the password for the given token. - * - * @param array $credentials - * @param \Closure $callback - * @return mixed - */ - public function reset(array $credentials, Closure $callback) - { - $user = $this->validateReset($credentials); - - // If the responses from the validate method is not a user instance, we will - // assume that it is a redirect and simply return it from this method and - // the user is properly redirected having an error message on the post. - if (! $user instanceof CanResetPasswordContract) { - return $user; - } - - $password = $credentials['password']; - - // Once the reset has been validated, we'll call the given callback with the - // new password. This gives the user an opportunity to store the password - // in their persistent storage. Then we'll delete the token and return. - $callback($user, $password); - - $this->tokens->delete($user); - - return static::PASSWORD_RESET; - } - - /** - * Validate a password reset for the given credentials. - * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\CanResetPassword|string - */ - protected function validateReset(array $credentials) - { - if (is_null($user = $this->getUser($credentials))) { - return static::INVALID_USER; - } - - if (! $this->tokens->exists($user, $credentials['token'])) { - return static::INVALID_TOKEN; - } - - return $user; - } - - /** - * Get the user for the given credentials. - * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\CanResetPassword|null - * - * @throws \UnexpectedValueException - */ - public function getUser(array $credentials) - { - $credentials = Arr::except($credentials, ['token']); - - $user = $this->users->retrieveByCredentials($credentials); - - if ($user && ! $user instanceof CanResetPasswordContract) { - throw new UnexpectedValueException('User must implement CanResetPassword interface.'); - } - - return $user; - } - - /** - * Create a new password reset token for the given user. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return string - */ - public function createToken(CanResetPasswordContract $user) - { - return $this->tokens->create($user); - } - - /** - * Delete password reset tokens of the given user. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @return void - */ - public function deleteToken(CanResetPasswordContract $user) - { - $this->tokens->delete($user); - } - - /** - * Validate the given password reset token. - * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @param string $token - * @return bool - */ - public function tokenExists(CanResetPasswordContract $user, $token) - { - return $this->tokens->exists($user, $token); - } - - /** - * Get the password reset token repository implementation. - * - * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface - */ - public function getRepository() - { - return $this->tokens; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php b/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php deleted file mode 100644 index 01cffe8..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php +++ /dev/null @@ -1,145 +0,0 @@ -app = $app; - } - - /** - * Attempt to get the broker from the local cache. - * - * @param string|null $name - * @return \Illuminate\Contracts\Auth\PasswordBroker - */ - public function broker($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - return $this->brokers[$name] ?? ($this->brokers[$name] = $this->resolve($name)); - } - - /** - * Resolve the given broker. - * - * @param string $name - * @return \Illuminate\Contracts\Auth\PasswordBroker - * - * @throws \InvalidArgumentException - */ - protected function resolve($name) - { - $config = $this->getConfig($name); - - if (is_null($config)) { - throw new InvalidArgumentException("Password resetter [{$name}] is not defined."); - } - - // The password broker uses a token repository to validate tokens and send user - // password e-mails, as well as validating that password reset process as an - // aggregate service of sorts providing a convenient interface for resets. - return new PasswordBroker( - $this->createTokenRepository($config), - $this->app['auth']->createUserProvider($config['provider'] ?? null) - ); - } - - /** - * Create a token repository instance based on the given configuration. - * - * @param array $config - * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface - */ - protected function createTokenRepository(array $config) - { - $key = $this->app['config']['app.key']; - - if (str_starts_with($key, 'base64:')) { - $key = base64_decode(substr($key, 7)); - } - - $connection = $config['connection'] ?? null; - - return new DatabaseTokenRepository( - $this->app['db']->connection($connection), - $this->app['hash'], - $config['table'], - $key, - $config['expire'], - $config['throttle'] ?? 0 - ); - } - - /** - * Get the password broker configuration. - * - * @param string $name - * @return array - */ - protected function getConfig($name) - { - return $this->app['config']["auth.passwords.{$name}"]; - } - - /** - * Get the default password broker name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['auth.defaults.passwords']; - } - - /** - * Set the default password broker name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['auth.defaults.passwords'] = $name; - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->broker()->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php b/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php deleted file mode 100755 index a26b7e6..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php +++ /dev/null @@ -1,45 +0,0 @@ -registerPasswordBroker(); - } - - /** - * Register the password broker instance. - * - * @return void - */ - protected function registerPasswordBroker() - { - $this->app->singleton('auth.password', function ($app) { - return new PasswordBrokerManager($app); - }); - - $this->app->bind('auth.password.broker', function ($app) { - return $app->make('auth.password')->broker(); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['auth.password', 'auth.password.broker']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php b/framework-9.50.2/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php deleted file mode 100755 index 47c1758..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php +++ /dev/null @@ -1,48 +0,0 @@ -recaller = @unserialize($recaller, ['allowed_classes' => false]) ?: $recaller; - } - - /** - * Get the user ID from the recaller. - * - * @return string - */ - public function id() - { - return explode('|', $this->recaller, 3)[0]; - } - - /** - * Get the "remember token" token from the recaller. - * - * @return string - */ - public function token() - { - return explode('|', $this->recaller, 3)[1]; - } - - /** - * Get the password from the recaller. - * - * @return string - */ - public function hash() - { - return explode('|', $this->recaller, 4)[2]; - } - - /** - * Determine if the recaller is valid. - * - * @return bool - */ - public function valid() - { - return $this->properString() && $this->hasAllSegments(); - } - - /** - * Determine if the recaller is an invalid string. - * - * @return bool - */ - protected function properString() - { - return is_string($this->recaller) && str_contains($this->recaller, '|'); - } - - /** - * Determine if the recaller has all segments. - * - * @return bool - */ - protected function hasAllSegments() - { - $segments = explode('|', $this->recaller); - - return count($segments) >= 3 && trim($segments[0]) !== '' && trim($segments[1]) !== ''; - } - - /** - * Get the recaller's segments. - * - * @return array - */ - public function segments() - { - return explode('|', $this->recaller); - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/RequestGuard.php b/framework-9.50.2/src/Illuminate/Auth/RequestGuard.php deleted file mode 100644 index d0af83c..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/RequestGuard.php +++ /dev/null @@ -1,87 +0,0 @@ -request = $request; - $this->callback = $callback; - $this->provider = $provider; - } - - /** - * Get the currently authenticated user. - * - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function user() - { - // If we've already retrieved the user for the current request we can just - // return it back immediately. We do not want to fetch the user data on - // every call to this method because that would be tremendously slow. - if (! is_null($this->user)) { - return $this->user; - } - - return $this->user = call_user_func( - $this->callback, $this->request, $this->getProvider() - ); - } - - /** - * Validate a user's credentials. - * - * @param array $credentials - * @return bool - */ - public function validate(array $credentials = []) - { - return ! is_null((new static( - $this->callback, $credentials['request'], $this->getProvider() - ))->user()); - } - - /** - * Set the current request instance. - * - * @param \Illuminate\Http\Request $request - * @return $this - */ - public function setRequest(Request $request) - { - $this->request = $request; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/SessionGuard.php b/framework-9.50.2/src/Illuminate/Auth/SessionGuard.php deleted file mode 100644 index 8b79921..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/SessionGuard.php +++ /dev/null @@ -1,962 +0,0 @@ -name = $name; - $this->session = $session; - $this->request = $request; - $this->provider = $provider; - $this->timebox = $timebox ?: new Timebox; - } - - /** - * Get the currently authenticated user. - * - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function user() - { - if ($this->loggedOut) { - return; - } - - // If we've already retrieved the user for the current request we can just - // return it back immediately. We do not want to fetch the user data on - // every call to this method because that would be tremendously slow. - if (! is_null($this->user)) { - return $this->user; - } - - $id = $this->session->get($this->getName()); - - // First we will try to load the user using the identifier in the session if - // one exists. Otherwise we will check for a "remember me" cookie in this - // request, and if one exists, attempt to retrieve the user using that. - if (! is_null($id) && $this->user = $this->provider->retrieveById($id)) { - $this->fireAuthenticatedEvent($this->user); - } - - // If the user is null, but we decrypt a "recaller" cookie we can attempt to - // pull the user data on that cookie which serves as a remember cookie on - // the application. Once we have a user we can return it to the caller. - if (is_null($this->user) && ! is_null($recaller = $this->recaller())) { - $this->user = $this->userFromRecaller($recaller); - - if ($this->user) { - $this->updateSession($this->user->getAuthIdentifier()); - - $this->fireLoginEvent($this->user, true); - } - } - - return $this->user; - } - - /** - * Pull a user from the repository by its "remember me" cookie token. - * - * @param \Illuminate\Auth\Recaller $recaller - * @return mixed - */ - protected function userFromRecaller($recaller) - { - if (! $recaller->valid() || $this->recallAttempted) { - return; - } - - // If the user is null, but we decrypt a "recaller" cookie we can attempt to - // pull the user data on that cookie which serves as a remember cookie on - // the application. Once we have a user we can return it to the caller. - $this->recallAttempted = true; - - $this->viaRemember = ! is_null($user = $this->provider->retrieveByToken( - $recaller->id(), $recaller->token() - )); - - return $user; - } - - /** - * Get the decrypted recaller cookie for the request. - * - * @return \Illuminate\Auth\Recaller|null - */ - protected function recaller() - { - if (is_null($this->request)) { - return; - } - - if ($recaller = $this->request->cookies->get($this->getRecallerName())) { - return new Recaller($recaller); - } - } - - /** - * Get the ID for the currently authenticated user. - * - * @return int|string|null - */ - public function id() - { - if ($this->loggedOut) { - return; - } - - return $this->user() - ? $this->user()->getAuthIdentifier() - : $this->session->get($this->getName()); - } - - /** - * Log a user into the application without sessions or cookies. - * - * @param array $credentials - * @return bool - */ - public function once(array $credentials = []) - { - $this->fireAttemptEvent($credentials); - - if ($this->validate($credentials)) { - $this->setUser($this->lastAttempted); - - return true; - } - - return false; - } - - /** - * Log the given user ID into the application without sessions or cookies. - * - * @param mixed $id - * @return \Illuminate\Contracts\Auth\Authenticatable|false - */ - public function onceUsingId($id) - { - if (! is_null($user = $this->provider->retrieveById($id))) { - $this->setUser($user); - - return $user; - } - - return false; - } - - /** - * Validate a user's credentials. - * - * @param array $credentials - * @return bool - */ - public function validate(array $credentials = []) - { - $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); - - return $this->hasValidCredentials($user, $credentials); - } - - /** - * Attempt to authenticate using HTTP Basic Auth. - * - * @param string $field - * @param array $extraConditions - * @return \Symfony\Component\HttpFoundation\Response|null - * - * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException - */ - public function basic($field = 'email', $extraConditions = []) - { - if ($this->check()) { - return; - } - - // If a username is set on the HTTP basic request, we will return out without - // interrupting the request lifecycle. Otherwise, we'll need to generate a - // request indicating that the given credentials were invalid for login. - if ($this->attemptBasic($this->getRequest(), $field, $extraConditions)) { - return; - } - - return $this->failedBasicResponse(); - } - - /** - * Perform a stateless HTTP Basic login attempt. - * - * @param string $field - * @param array $extraConditions - * @return \Symfony\Component\HttpFoundation\Response|null - * - * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException - */ - public function onceBasic($field = 'email', $extraConditions = []) - { - $credentials = $this->basicCredentials($this->getRequest(), $field); - - if (! $this->once(array_merge($credentials, $extraConditions))) { - return $this->failedBasicResponse(); - } - } - - /** - * Attempt to authenticate using basic authentication. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param string $field - * @param array $extraConditions - * @return bool - */ - protected function attemptBasic(Request $request, $field, $extraConditions = []) - { - if (! $request->getUser()) { - return false; - } - - return $this->attempt(array_merge( - $this->basicCredentials($request, $field), $extraConditions - )); - } - - /** - * Get the credential array for an HTTP Basic request. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param string $field - * @return array - */ - protected function basicCredentials(Request $request, $field) - { - return [$field => $request->getUser(), 'password' => $request->getPassword()]; - } - - /** - * Get the response for basic authentication. - * - * @return void - * - * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException - */ - protected function failedBasicResponse() - { - throw new UnauthorizedHttpException('Basic', 'Invalid credentials.'); - } - - /** - * Attempt to authenticate a user using the given credentials. - * - * @param array $credentials - * @param bool $remember - * @return bool - */ - public function attempt(array $credentials = [], $remember = false) - { - $this->fireAttemptEvent($credentials, $remember); - - $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); - - // If an implementation of UserInterface was returned, we'll ask the provider - // to validate the user against the given credentials, and if they are in - // fact valid we'll log the users into the application and return true. - if ($this->hasValidCredentials($user, $credentials)) { - $this->login($user, $remember); - - return true; - } - - // If the authentication attempt fails we will fire an event so that the user - // may be notified of any suspicious attempts to access their account from - // an unrecognized user. A developer may listen to this event as needed. - $this->fireFailedEvent($user, $credentials); - - return false; - } - - /** - * Attempt to authenticate a user with credentials and additional callbacks. - * - * @param array $credentials - * @param array|callable|null $callbacks - * @param bool $remember - * @return bool - */ - public function attemptWhen(array $credentials = [], $callbacks = null, $remember = false) - { - $this->fireAttemptEvent($credentials, $remember); - - $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); - - // This method does the exact same thing as attempt, but also executes callbacks after - // the user is retrieved and validated. If one of the callbacks returns falsy we do - // not login the user. Instead, we will fail the specific authentication attempt. - if ($this->hasValidCredentials($user, $credentials) && $this->shouldLogin($callbacks, $user)) { - $this->login($user, $remember); - - return true; - } - - $this->fireFailedEvent($user, $credentials); - - return false; - } - - /** - * Determine if the user matches the credentials. - * - * @param mixed $user - * @param array $credentials - * @return bool - */ - protected function hasValidCredentials($user, $credentials) - { - return $this->timebox->call(function ($timebox) use ($user, $credentials) { - $validated = ! is_null($user) && $this->provider->validateCredentials($user, $credentials); - - if ($validated) { - $timebox->returnEarly(); - - $this->fireValidatedEvent($user); - } - - return $validated; - }, 200 * 1000); - } - - /** - * Determine if the user should login by executing the given callbacks. - * - * @param array|callable|null $callbacks - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return bool - */ - protected function shouldLogin($callbacks, AuthenticatableContract $user) - { - foreach (Arr::wrap($callbacks) as $callback) { - if (! $callback($user, $this)) { - return false; - } - } - - return true; - } - - /** - * Log the given user ID into the application. - * - * @param mixed $id - * @param bool $remember - * @return \Illuminate\Contracts\Auth\Authenticatable|false - */ - public function loginUsingId($id, $remember = false) - { - if (! is_null($user = $this->provider->retrieveById($id))) { - $this->login($user, $remember); - - return $user; - } - - return false; - } - - /** - * Log a user into the application. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param bool $remember - * @return void - */ - public function login(AuthenticatableContract $user, $remember = false) - { - $this->updateSession($user->getAuthIdentifier()); - - // If the user should be permanently "remembered" by the application we will - // queue a permanent cookie that contains the encrypted copy of the user - // identifier. We will then decrypt this later to retrieve the users. - if ($remember) { - $this->ensureRememberTokenIsSet($user); - - $this->queueRecallerCookie($user); - } - - // If we have an event dispatcher instance set we will fire an event so that - // any listeners will hook into the authentication events and run actions - // based on the login and logout events fired from the guard instances. - $this->fireLoginEvent($user, $remember); - - $this->setUser($user); - } - - /** - * Update the session with the given ID. - * - * @param string $id - * @return void - */ - protected function updateSession($id) - { - $this->session->put($this->getName(), $id); - - $this->session->migrate(true); - } - - /** - * Create a new "remember me" token for the user if one doesn't already exist. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function ensureRememberTokenIsSet(AuthenticatableContract $user) - { - if (empty($user->getRememberToken())) { - $this->cycleRememberToken($user); - } - } - - /** - * Queue the recaller cookie into the cookie jar. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function queueRecallerCookie(AuthenticatableContract $user) - { - $this->getCookieJar()->queue($this->createRecaller( - $user->getAuthIdentifier().'|'.$user->getRememberToken().'|'.$user->getAuthPassword() - )); - } - - /** - * Create a "remember me" cookie for a given ID. - * - * @param string $value - * @return \Symfony\Component\HttpFoundation\Cookie - */ - protected function createRecaller($value) - { - return $this->getCookieJar()->make($this->getRecallerName(), $value, $this->getRememberDuration()); - } - - /** - * Log the user out of the application. - * - * @return void - */ - public function logout() - { - $user = $this->user(); - - $this->clearUserDataFromStorage(); - - if (! is_null($this->user) && ! empty($user->getRememberToken())) { - $this->cycleRememberToken($user); - } - - // If we have an event dispatcher instance, we can fire off the logout event - // so any further processing can be done. This allows the developer to be - // listening for anytime a user signs out of this application manually. - if (isset($this->events)) { - $this->events->dispatch(new Logout($this->name, $user)); - } - - // Once we have fired the logout event we will clear the users out of memory - // so they are no longer available as the user is no longer considered as - // being signed into this application and should not be available here. - $this->user = null; - - $this->loggedOut = true; - } - - /** - * Log the user out of the application on their current device only. - * - * This method does not cycle the "remember" token. - * - * @return void - */ - public function logoutCurrentDevice() - { - $user = $this->user(); - - $this->clearUserDataFromStorage(); - - // If we have an event dispatcher instance, we can fire off the logout event - // so any further processing can be done. This allows the developer to be - // listening for anytime a user signs out of this application manually. - if (isset($this->events)) { - $this->events->dispatch(new CurrentDeviceLogout($this->name, $user)); - } - - // Once we have fired the logout event we will clear the users out of memory - // so they are no longer available as the user is no longer considered as - // being signed into this application and should not be available here. - $this->user = null; - - $this->loggedOut = true; - } - - /** - * Remove the user data from the session and cookies. - * - * @return void - */ - protected function clearUserDataFromStorage() - { - $this->session->remove($this->getName()); - - $this->getCookieJar()->unqueue($this->getRecallerName()); - - if (! is_null($this->recaller())) { - $this->getCookieJar()->queue( - $this->getCookieJar()->forget($this->getRecallerName()) - ); - } - } - - /** - * Refresh the "remember me" token for the user. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function cycleRememberToken(AuthenticatableContract $user) - { - $user->setRememberToken($token = Str::random(60)); - - $this->provider->updateRememberToken($user, $token); - } - - /** - * Invalidate other sessions for the current user. - * - * The application must be using the AuthenticateSession middleware. - * - * @param string $password - * @param string $attribute - * @return \Illuminate\Contracts\Auth\Authenticatable|null - * - * @throws \Illuminate\Auth\AuthenticationException - */ - public function logoutOtherDevices($password, $attribute = 'password') - { - if (! $this->user()) { - return; - } - - $result = $this->rehashUserPassword($password, $attribute); - - if ($this->recaller() || - $this->getCookieJar()->hasQueued($this->getRecallerName())) { - $this->queueRecallerCookie($this->user()); - } - - $this->fireOtherDeviceLogoutEvent($this->user()); - - return $result; - } - - /** - * Rehash the current user's password. - * - * @param string $password - * @param string $attribute - * @return \Illuminate\Contracts\Auth\Authenticatable|null - * - * @throws \InvalidArgumentException - */ - protected function rehashUserPassword($password, $attribute) - { - if (! Hash::check($password, $this->user()->{$attribute})) { - throw new InvalidArgumentException('The given password does not match the current password.'); - } - - return tap($this->user()->forceFill([ - $attribute => Hash::make($password), - ]))->save(); - } - - /** - * Register an authentication attempt event listener. - * - * @param mixed $callback - * @return void - */ - public function attempting($callback) - { - $this->events?->listen(Events\Attempting::class, $callback); - } - - /** - * Fire the attempt event with the arguments. - * - * @param array $credentials - * @param bool $remember - * @return void - */ - protected function fireAttemptEvent(array $credentials, $remember = false) - { - $this->events?->dispatch(new Attempting($this->name, $credentials, $remember)); - } - - /** - * Fires the validated event if the dispatcher is set. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function fireValidatedEvent($user) - { - $this->events?->dispatch(new Validated($this->name, $user)); - } - - /** - * Fire the login event if the dispatcher is set. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param bool $remember - * @return void - */ - protected function fireLoginEvent($user, $remember = false) - { - $this->events?->dispatch(new Login($this->name, $user, $remember)); - } - - /** - * Fire the authenticated event if the dispatcher is set. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function fireAuthenticatedEvent($user) - { - $this->events?->dispatch(new Authenticated($this->name, $user)); - } - - /** - * Fire the other device logout event if the dispatcher is set. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return void - */ - protected function fireOtherDeviceLogoutEvent($user) - { - $this->events?->dispatch(new OtherDeviceLogout($this->name, $user)); - } - - /** - * Fire the failed authentication attempt event with the given arguments. - * - * @param \Illuminate\Contracts\Auth\Authenticatable|null $user - * @param array $credentials - * @return void - */ - protected function fireFailedEvent($user, array $credentials) - { - $this->events?->dispatch(new Failed($this->name, $user, $credentials)); - } - - /** - * Get the last user we attempted to authenticate. - * - * @return \Illuminate\Contracts\Auth\Authenticatable - */ - public function getLastAttempted() - { - return $this->lastAttempted; - } - - /** - * Get a unique identifier for the auth session value. - * - * @return string - */ - public function getName() - { - return 'login_'.$this->name.'_'.sha1(static::class); - } - - /** - * Get the name of the cookie used to store the "recaller". - * - * @return string - */ - public function getRecallerName() - { - return 'remember_'.$this->name.'_'.sha1(static::class); - } - - /** - * Determine if the user was authenticated via "remember me" cookie. - * - * @return bool - */ - public function viaRemember() - { - return $this->viaRemember; - } - - /** - * Get the number of minutes the remember me cookie should be valid for. - * - * @return int - */ - protected function getRememberDuration() - { - return $this->rememberDuration; - } - - /** - * Set the number of minutes the remember me cookie should be valid for. - * - * @param int $minutes - * @return $this - */ - public function setRememberDuration($minutes) - { - $this->rememberDuration = $minutes; - - return $this; - } - - /** - * Get the cookie creator instance used by the guard. - * - * @return \Illuminate\Contracts\Cookie\QueueingFactory - * - * @throws \RuntimeException - */ - public function getCookieJar() - { - if (! isset($this->cookie)) { - throw new RuntimeException('Cookie jar has not been set.'); - } - - return $this->cookie; - } - - /** - * Set the cookie creator instance used by the guard. - * - * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookie - * @return void - */ - public function setCookieJar(CookieJar $cookie) - { - $this->cookie = $cookie; - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getDispatcher() - { - return $this->events; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void - */ - public function setDispatcher(Dispatcher $events) - { - $this->events = $events; - } - - /** - * Get the session store used by the guard. - * - * @return \Illuminate\Contracts\Session\Session - */ - public function getSession() - { - return $this->session; - } - - /** - * Return the currently cached user. - * - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function getUser() - { - return $this->user; - } - - /** - * Set the current user. - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return $this - */ - public function setUser(AuthenticatableContract $user) - { - $this->user = $user; - - $this->loggedOut = false; - - $this->fireAuthenticatedEvent($user); - - return $this; - } - - /** - * Get the current request instance. - * - * @return \Symfony\Component\HttpFoundation\Request - */ - public function getRequest() - { - return $this->request ?: Request::createFromGlobals(); - } - - /** - * Set the current request instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return $this - */ - public function setRequest(Request $request) - { - $this->request = $request; - - return $this; - } - - /** - * Get the timebox instance used by the guard. - * - * @return \Illuminate\Support\Timebox - */ - public function getTimebox() - { - return $this->timebox; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/TokenGuard.php b/framework-9.50.2/src/Illuminate/Auth/TokenGuard.php deleted file mode 100644 index b1aa7a7..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/TokenGuard.php +++ /dev/null @@ -1,149 +0,0 @@ -hash = $hash; - $this->request = $request; - $this->provider = $provider; - $this->inputKey = $inputKey; - $this->storageKey = $storageKey; - } - - /** - * Get the currently authenticated user. - * - * @return \Illuminate\Contracts\Auth\Authenticatable|null - */ - public function user() - { - // If we've already retrieved the user for the current request we can just - // return it back immediately. We do not want to fetch the user data on - // every call to this method because that would be tremendously slow. - if (! is_null($this->user)) { - return $this->user; - } - - $user = null; - - $token = $this->getTokenForRequest(); - - if (! empty($token)) { - $user = $this->provider->retrieveByCredentials([ - $this->storageKey => $this->hash ? hash('sha256', $token) : $token, - ]); - } - - return $this->user = $user; - } - - /** - * Get the token for the current request. - * - * @return string - */ - public function getTokenForRequest() - { - $token = $this->request->query($this->inputKey); - - if (empty($token)) { - $token = $this->request->input($this->inputKey); - } - - if (empty($token)) { - $token = $this->request->bearerToken(); - } - - if (empty($token)) { - $token = $this->request->getPassword(); - } - - return $token; - } - - /** - * Validate a user's credentials. - * - * @param array $credentials - * @return bool - */ - public function validate(array $credentials = []) - { - if (empty($credentials[$this->inputKey])) { - return false; - } - - $credentials = [$this->storageKey => $credentials[$this->inputKey]]; - - if ($this->provider->retrieveByCredentials($credentials)) { - return true; - } - - return false; - } - - /** - * Set the current request instance. - * - * @param \Illuminate\Http\Request $request - * @return $this - */ - public function setRequest(Request $request) - { - $this->request = $request; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Auth/composer.json b/framework-9.50.2/src/Illuminate/Auth/composer.json deleted file mode 100644 index ae928a3..0000000 --- a/framework-9.50.2/src/Illuminate/Auth/composer.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "illuminate/auth", - "description": "The Illuminate Auth package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/http": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/queue": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Auth\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "illuminate/console": "Required to use the auth:clear-resets command (^9.0).", - "illuminate/queue": "Required to fire login / logout events (^9.0).", - "illuminate/session": "Required to use the session based guard (^9.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastController.php b/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastController.php deleted file mode 100644 index 69274b7..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastController.php +++ /dev/null @@ -1,44 +0,0 @@ -hasSession()) { - $request->session()->reflash(); - } - - return Broadcast::auth($request); - } - - /** - * Authenticate the current user. - * - * See: https://pusher.com/docs/channels/server_api/authenticating-users/#user-authentication. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function authenticateUser(Request $request) - { - if ($request->hasSession()) { - $request->session()->reflash(); - } - - return Broadcast::resolveAuthenticatedUser($request) - ?? throw new AccessDeniedHttpException; - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastEvent.php b/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastEvent.php deleted file mode 100644 index fef5423..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastEvent.php +++ /dev/null @@ -1,148 +0,0 @@ -event = $event; - $this->tries = property_exists($event, 'tries') ? $event->tries : null; - $this->timeout = property_exists($event, 'timeout') ? $event->timeout : null; - $this->backoff = property_exists($event, 'backoff') ? $event->backoff : null; - $this->afterCommit = property_exists($event, 'afterCommit') ? $event->afterCommit : null; - } - - /** - * Handle the queued job. - * - * @param \Illuminate\Contracts\Broadcasting\Factory $manager - * @return void - */ - public function handle(BroadcastingFactory $manager) - { - $name = method_exists($this->event, 'broadcastAs') - ? $this->event->broadcastAs() : get_class($this->event); - - $channels = Arr::wrap($this->event->broadcastOn()); - - if (empty($channels)) { - return; - } - - $connections = method_exists($this->event, 'broadcastConnections') - ? $this->event->broadcastConnections() - : [null]; - - $payload = $this->getPayloadFromEvent($this->event); - - foreach ($connections as $connection) { - $manager->connection($connection)->broadcast( - $channels, $name, $payload - ); - } - } - - /** - * Get the payload for the given event. - * - * @param mixed $event - * @return array - */ - protected function getPayloadFromEvent($event) - { - if (method_exists($event, 'broadcastWith') && - ! is_null($payload = $event->broadcastWith())) { - return array_merge($payload, ['socket' => data_get($event, 'socket')]); - } - - $payload = []; - - foreach ((new ReflectionClass($event))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { - $payload[$property->getName()] = $this->formatProperty($property->getValue($event)); - } - - unset($payload['broadcastQueue']); - - return $payload; - } - - /** - * Format the given value for a property. - * - * @param mixed $value - * @return mixed - */ - protected function formatProperty($value) - { - if ($value instanceof Arrayable) { - return $value->toArray(); - } - - return $value; - } - - /** - * Get the display name for the queued job. - * - * @return string - */ - public function displayName() - { - return get_class($this->event); - } - - /** - * Prepare the instance for cloning. - * - * @return void - */ - public function __clone() - { - $this->event = clone $this->event; - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastException.php b/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastException.php deleted file mode 100644 index 8fd55f7..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastException.php +++ /dev/null @@ -1,10 +0,0 @@ -app = $app; - } - - /** - * Register the routes for handling broadcast channel authentication and sockets. - * - * @param array|null $attributes - * @return void - */ - public function routes(array $attributes = null) - { - if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) { - return; - } - - $attributes = $attributes ?: ['middleware' => ['web']]; - - $this->app['router']->group($attributes, function ($router) { - $router->match( - ['get', 'post'], '/broadcasting/auth', - '\\'.BroadcastController::class.'@authenticate' - )->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]); - }); - } - - /** - * Register the routes for handling broadcast user authentication. - * - * @param array|null $attributes - * @return void - */ - public function userRoutes(array $attributes = null) - { - if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) { - return; - } - - $attributes = $attributes ?: ['middleware' => ['web']]; - - $this->app['router']->group($attributes, function ($router) { - $router->match( - ['get', 'post'], '/broadcasting/user-auth', - '\\'.BroadcastController::class.'@authenticateUser' - )->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]); - }); - } - - /** - * Register the routes for handling broadcast authentication and sockets. - * - * Alias of "routes" method. - * - * @param array|null $attributes - * @return void - */ - public function channelRoutes(array $attributes = null) - { - return $this->routes($attributes); - } - - /** - * 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 - */ - 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) - { - if ($event instanceof ShouldBroadcastNow || - (is_object($event) && - method_exists($event, 'shouldBroadcastNow') && - $event->shouldBroadcastNow())) { - return $this->app->make(BusDispatcherContract::class)->dispatchNow(new BroadcastEvent(clone $event)); - } - - $queue = null; - - if (method_exists($event, 'broadcastQueue')) { - $queue = $event->broadcastQueue(); - } elseif (isset($event->broadcastQueue)) { - $queue = $event->broadcastQueue; - } elseif (isset($event->queue)) { - $queue = $event->queue; - } - - $broadcastEvent = new BroadcastEvent(clone $event); - - if ($event instanceof ShouldBeUnique) { - $broadcastEvent = new UniqueBroadcastEvent(clone $event); - - if ($this->mustBeUniqueAndCannotAcquireLock($broadcastEvent)) { - return; - } - } - - $this->app->make('queue') - ->connection($event->connection ?? null) - ->pushOn($queue, $broadcastEvent); - } - - /** - * Determine if the broadcastable event must be unique and determine if we can acquire the necessary lock. - * - * @param mixed $event - * @return bool - */ - protected function mustBeUniqueAndCannotAcquireLock($event) - { - return ! (new UniqueLock( - method_exists($event, 'uniqueVia') - ? $event->uniqueVia() - : $this->app->make(Cache::class) - ))->acquire($event); - } - - /** - * Get a driver instance. - * - * @param string|null $driver - * @return mixed - */ - public function connection($driver = null) - { - return $this->driver($driver); - } - - /** - * Get a driver instance. - * - * @param string|null $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 broadcaster. - * - * @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("Broadcast connection [{$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($this->pusher($config)); - } - - /** - * Get a Pusher instance for the given configuration. - * - * @param array $config - * @return \Pusher\Pusher - */ - public function pusher(array $config) - { - $pusher = new Pusher( - $config['key'], - $config['secret'], - $config['app_id'], - $config['options'] ?? [], - isset($config['client_options']) && ! empty($config['client_options']) - ? new GuzzleClient($config['client_options']) - : null, - ); - - if ($config['log'] ?? false) { - $pusher->setLogger($this->app->make(LoggerInterface::class)); - } - - return $pusher; - } - - /** - * Create an instance of the driver. - * - * @param array $config - * @return \Illuminate\Contracts\Broadcasting\Broadcaster - */ - protected function createAblyDriver(array $config) - { - return new AblyBroadcaster($this->ably($config)); - } - - /** - * Get an Ably instance for the given configuration. - * - * @param array $config - * @return \Ably\AblyRest - */ - public function ably(array $config) - { - return new AblyRest($config); - } - - /** - * 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, - $this->app['config']->get('database.redis.options.prefix', '') - ); - } - - /** - * 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) - { - if (! is_null($name) && $name !== 'null') { - return $this->app['config']["broadcasting.connections.{$name}"]; - } - - return ['driver' => 'null']; - } - - /** - * 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; - } - - /** - * Disconnect the given disk and remove from local cache. - * - * @param string|null $name - * @return void - */ - public function purge($name = null) - { - $name ??= $this->getDefaultDriver(); - - unset($this->drivers[$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; - } - - /** - * Get the application instance used by the manager. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public function getApplication() - { - return $this->app; - } - - /** - * Set the application instance used by the manager. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return $this - */ - public function setApplication($app) - { - $this->app = $app; - - return $this; - } - - /** - * Forget all of the resolved driver instances. - * - * @return $this - */ - public function forgetDrivers() - { - $this->drivers = []; - - 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); - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastServiceProvider.php b/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastServiceProvider.php deleted file mode 100644 index e6897e2..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/BroadcastServiceProvider.php +++ /dev/null @@ -1,45 +0,0 @@ -app->singleton(BroadcastManager::class, function ($app) { - return new BroadcastManager($app); - }); - - $this->app->singleton(BroadcasterContract::class, function ($app) { - return $app->make(BroadcastManager::class)->connection(); - }); - - $this->app->alias( - BroadcastManager::class, BroadcastingFactory::class - ); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - BroadcastManager::class, - BroadcastingFactory::class, - BroadcasterContract::class, - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/AblyBroadcaster.php b/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/AblyBroadcaster.php deleted file mode 100644 index 3a6db78..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/AblyBroadcaster.php +++ /dev/null @@ -1,235 +0,0 @@ -ably = $ably; - } - - /** - * Authenticate the incoming request for a given channel. - * - * @param \Illuminate\Http\Request $request - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException - */ - public function auth($request) - { - $channelName = $this->normalizeChannelName($request->channel_name); - - if (empty($request->channel_name) || - ($this->isGuardedChannel($request->channel_name) && - ! $this->retrieveUser($request, $channelName))) { - throw new AccessDeniedHttpException; - } - - return parent::verifyUserCanAccessChannel( - $request, $channelName - ); - } - - /** - * Return the valid authentication response. - * - * @param \Illuminate\Http\Request $request - * @param mixed $result - * @return mixed - */ - public function validAuthenticationResponse($request, $result) - { - if (str_starts_with($request->channel_name, 'private')) { - $signature = $this->generateAblySignature( - $request->channel_name, $request->socket_id - ); - - return ['auth' => $this->getPublicToken().':'.$signature]; - } - - $channelName = $this->normalizeChannelName($request->channel_name); - - $user = $this->retrieveUser($request, $channelName); - - $broadcastIdentifier = method_exists($user, 'getAuthIdentifierForBroadcasting') - ? $user->getAuthIdentifierForBroadcasting() - : $user->getAuthIdentifier(); - - $signature = $this->generateAblySignature( - $request->channel_name, - $request->socket_id, - $userData = array_filter([ - 'user_id' => (string) $broadcastIdentifier, - 'user_info' => $result, - ]) - ); - - return [ - 'auth' => $this->getPublicToken().':'.$signature, - 'channel_data' => json_encode($userData), - ]; - } - - /** - * Generate the signature needed for Ably authentication headers. - * - * @param string $channelName - * @param string $socketId - * @param array|null $userData - * @return string - */ - public function generateAblySignature($channelName, $socketId, $userData = null) - { - return hash_hmac( - 'sha256', - sprintf('%s:%s%s', $socketId, $channelName, $userData ? ':'.json_encode($userData) : ''), - $this->getPrivateToken(), - ); - } - - /** - * Broadcast the given event. - * - * @param array $channels - * @param string $event - * @param array $payload - * @return void - * - * @throws \Illuminate\Broadcasting\BroadcastException - */ - public function broadcast(array $channels, $event, array $payload = []) - { - try { - foreach ($this->formatChannels($channels) as $channel) { - $this->ably->channels->get($channel)->publish( - $this->buildAblyMessage($event, $payload) - ); - } - } catch (AblyException $e) { - throw new BroadcastException( - sprintf('Ably error: %s', $e->getMessage()) - ); - } - } - - /** - * Build an Ably message object for broadcasting. - * - * @param string $event - * @param array $payload - * @return \Ably\Models\Message - */ - protected function buildAblyMessage($event, array $payload = []) - { - return tap(new AblyMessage, function ($message) use ($event, $payload) { - $message->name = $event; - $message->data = $payload; - $message->connectionKey = data_get($payload, 'socket'); - }); - } - - /** - * Return true if the channel is protected by authentication. - * - * @param string $channel - * @return bool - */ - public function isGuardedChannel($channel) - { - return Str::startsWith($channel, ['private-', 'presence-']); - } - - /** - * Remove prefix from channel name. - * - * @param string $channel - * @return string - */ - public function normalizeChannelName($channel) - { - if ($this->isGuardedChannel($channel)) { - return str_starts_with($channel, 'private-') - ? Str::replaceFirst('private-', '', $channel) - : Str::replaceFirst('presence-', '', $channel); - } - - return $channel; - } - - /** - * Format the channel array into an array of strings. - * - * @param array $channels - * @return array - */ - protected function formatChannels(array $channels) - { - return array_map(function ($channel) { - $channel = (string) $channel; - - if (Str::startsWith($channel, ['private-', 'presence-'])) { - return str_starts_with($channel, 'private-') - ? Str::replaceFirst('private-', 'private:', $channel) - : Str::replaceFirst('presence-', 'presence:', $channel); - } - - return 'public:'.$channel; - }, $channels); - } - - /** - * Get the public token value from the Ably key. - * - * @return mixed - */ - protected function getPublicToken() - { - return Str::before($this->ably->options->key, ':'); - } - - /** - * Get the private token value from the Ably key. - * - * @return mixed - */ - protected function getPrivateToken() - { - return Str::after($this->ably->options->key, ':'); - } - - /** - * Get the underlying Ably SDK instance. - * - * @return \Ably\AblyRest - */ - public function getAbly() - { - return $this->ably; - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php b/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php deleted file mode 100644 index 25badb9..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php +++ /dev/null @@ -1,376 +0,0 @@ -authenticatedUserCallback) { - return $this->authenticatedUserCallback->__invoke($request); - } - } - - /** - * Register the user retrieval callback used to authenticate connections. - * - * See: https://pusher.com/docs/channels/library_auth_reference/auth-signatures/#user-authentication. - * - * @param \Closure $callback - * @return void - */ - public function resolveAuthenticatedUserUsing(Closure $callback) - { - $this->authenticatedUserCallback = $callback; - } - - /** - * Register a channel authenticator. - * - * @param \Illuminate\Contracts\Broadcasting\HasBroadcastChannel|string $channel - * @param callable|string $callback - * @param array $options - * @return $this - */ - public function channel($channel, $callback, $options = []) - { - if ($channel instanceof HasBroadcastChannel) { - $channel = $channel->broadcastChannelRoute(); - } elseif (is_string($channel) && class_exists($channel) && is_a($channel, HasBroadcastChannel::class, true)) { - $channel = (new $channel)->broadcastChannelRoute(); - } - - $this->channels[$channel] = $callback; - - $this->channelOptions[$channel] = $options; - - return $this; - } - - /** - * Authenticate the incoming request for a given channel. - * - * @param \Illuminate\Http\Request $request - * @param string $channel - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException - */ - protected function verifyUserCanAccessChannel($request, $channel) - { - foreach ($this->channels as $pattern => $callback) { - if (! $this->channelNameMatchesPattern($channel, $pattern)) { - continue; - } - - $parameters = $this->extractAuthParameters($pattern, $channel, $callback); - - $handler = $this->normalizeChannelHandlerToCallable($callback); - - $result = $handler($this->retrieveUser($request, $channel), ...$parameters); - - if ($result === false) { - throw new AccessDeniedHttpException; - } elseif ($result) { - return $this->validAuthenticationResponse($request, $result); - } - } - - throw new AccessDeniedHttpException; - } - - /** - * Extract the parameters from the given pattern and channel. - * - * @param string $pattern - * @param string $channel - * @param callable|string $callback - * @return array - */ - protected function extractAuthParameters($pattern, $channel, $callback) - { - $callbackParameters = $this->extractParameters($callback); - - return collect($this->extractChannelKeys($pattern, $channel))->reject(function ($value, $key) { - return is_numeric($key); - })->map(function ($value, $key) use ($callbackParameters) { - return $this->resolveBinding($key, $value, $callbackParameters); - })->values()->all(); - } - - /** - * Extracts the parameters out of what the user passed to handle the channel authentication. - * - * @param callable|string $callback - * @return \ReflectionParameter[] - * - * @throws \Exception - */ - protected function extractParameters($callback) - { - if (is_callable($callback)) { - return (new ReflectionFunction($callback))->getParameters(); - } elseif (is_string($callback)) { - return $this->extractParametersFromClass($callback); - } - - throw new Exception('Given channel handler is an unknown type.'); - } - - /** - * Extracts the parameters out of a class channel's "join" method. - * - * @param string $callback - * @return \ReflectionParameter[] - * - * @throws \Exception - */ - protected function extractParametersFromClass($callback) - { - $reflection = new ReflectionClass($callback); - - if (! $reflection->hasMethod('join')) { - throw new Exception('Class based channel must define a "join" method.'); - } - - return $reflection->getMethod('join')->getParameters(); - } - - /** - * Extract the channel keys from the incoming channel name. - * - * @param string $pattern - * @param string $channel - * @return array - */ - protected function extractChannelKeys($pattern, $channel) - { - preg_match('/^'.preg_replace('/\{(.*?)\}/', '(?<$1>[^\.]+)', $pattern).'/', $channel, $keys); - - return $keys; - } - - /** - * Resolve the given parameter binding. - * - * @param string $key - * @param string $value - * @param array $callbackParameters - * @return mixed - */ - protected function resolveBinding($key, $value, $callbackParameters) - { - $newValue = $this->resolveExplicitBindingIfPossible($key, $value); - - return $newValue === $value ? $this->resolveImplicitBindingIfPossible( - $key, $value, $callbackParameters - ) : $newValue; - } - - /** - * Resolve an explicit parameter binding if applicable. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function resolveExplicitBindingIfPossible($key, $value) - { - $binder = $this->binder(); - - if ($binder && $binder->getBindingCallback($key)) { - return call_user_func($binder->getBindingCallback($key), $value); - } - - return $value; - } - - /** - * Resolve an implicit parameter binding if applicable. - * - * @param string $key - * @param mixed $value - * @param array $callbackParameters - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException - */ - protected function resolveImplicitBindingIfPossible($key, $value, $callbackParameters) - { - foreach ($callbackParameters as $parameter) { - if (! $this->isImplicitlyBindable($key, $parameter)) { - continue; - } - - $className = Reflector::getParameterClassName($parameter); - - if (is_null($model = (new $className)->resolveRouteBinding($value))) { - throw new AccessDeniedHttpException; - } - - return $model; - } - - return $value; - } - - /** - * Determine if a given key and parameter is implicitly bindable. - * - * @param string $key - * @param \ReflectionParameter $parameter - * @return bool - */ - protected function isImplicitlyBindable($key, $parameter) - { - return $parameter->getName() === $key && - Reflector::isParameterSubclassOf($parameter, UrlRoutable::class); - } - - /** - * Format the channel array into an array of strings. - * - * @param array $channels - * @return array - */ - protected function formatChannels(array $channels) - { - return array_map(function ($channel) { - return (string) $channel; - }, $channels); - } - - /** - * Get the model binding registrar instance. - * - * @return \Illuminate\Contracts\Routing\BindingRegistrar - */ - protected function binder() - { - if (! $this->bindingRegistrar) { - $this->bindingRegistrar = Container::getInstance()->bound(BindingRegistrar::class) - ? Container::getInstance()->make(BindingRegistrar::class) : null; - } - - return $this->bindingRegistrar; - } - - /** - * Normalize the given callback into a callable. - * - * @param mixed $callback - * @return callable - */ - protected function normalizeChannelHandlerToCallable($callback) - { - return is_callable($callback) ? $callback : function (...$args) use ($callback) { - return Container::getInstance() - ->make($callback) - ->join(...$args); - }; - } - - /** - * Retrieve the authenticated user using the configured guard (if any). - * - * @param \Illuminate\Http\Request $request - * @param string $channel - * @return mixed - */ - protected function retrieveUser($request, $channel) - { - $options = $this->retrieveChannelOptions($channel); - - $guards = $options['guards'] ?? null; - - if (is_null($guards)) { - return $request->user(); - } - - foreach (Arr::wrap($guards) as $guard) { - if ($user = $request->user($guard)) { - return $user; - } - } - } - - /** - * Retrieve options for a certain channel. - * - * @param string $channel - * @return array - */ - protected function retrieveChannelOptions($channel) - { - foreach ($this->channelOptions as $pattern => $options) { - if (! $this->channelNameMatchesPattern($channel, $pattern)) { - continue; - } - - return $options; - } - - return []; - } - - /** - * Check if the channel name from the request matches a pattern from registered channels. - * - * @param string $channel - * @param string $pattern - * @return bool - */ - protected function channelNameMatchesPattern($channel, $pattern) - { - return preg_match('/^'.preg_replace('/\{(.*?)\}/', '([^\.]+)', $pattern).'$/', $channel); - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php b/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php deleted file mode 100644 index 50877dc..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php +++ /dev/null @@ -1,54 +0,0 @@ -logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function auth($request) - { - // - } - - /** - * {@inheritdoc} - */ - public function validAuthenticationResponse($request, $result) - { - // - } - - /** - * {@inheritdoc} - */ - public function broadcast(array $channels, $event, array $payload = []) - { - $channels = implode(', ', $this->formatChannels($channels)); - - $payload = json_encode($payload, JSON_PRETTY_PRINT); - - $this->logger->info('Broadcasting ['.$event.'] on channels ['.$channels.'] with payload:'.PHP_EOL.$payload); - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php b/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php deleted file mode 100644 index 6205c90..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php +++ /dev/null @@ -1,30 +0,0 @@ -pusher = $pusher; - } - - /** - * Resolve the authenticated user payload for an incoming connection request. - * - * See: https://pusher.com/docs/channels/library_auth_reference/auth-signatures/#user-authentication - * See: https://pusher.com/docs/channels/server_api/authenticating-users/#response - * - * @param \Illuminate\Http\Request $request - * @return array|null - */ - public function resolveAuthenticatedUser($request) - { - if (! $user = parent::resolveAuthenticatedUser($request)) { - return; - } - - if (method_exists($this->pusher, 'authenticateUser')) { - return $this->pusher->authenticateUser($request->socket_id, $user); - } - - $settings = $this->pusher->getSettings(); - $encodedUser = json_encode($user); - $decodedString = "{$request->socket_id}::user::{$encodedUser}"; - - $auth = $settings['auth_key'].':'.hash_hmac( - 'sha256', $decodedString, $settings['secret'] - ); - - return [ - 'auth' => $auth, - 'user_data' => $encodedUser, - ]; - } - - /** - * Authenticate the incoming request for a given channel. - * - * @param \Illuminate\Http\Request $request - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException - */ - public function auth($request) - { - $channelName = $this->normalizeChannelName($request->channel_name); - - if (empty($request->channel_name) || - ($this->isGuardedChannel($request->channel_name) && - ! $this->retrieveUser($request, $channelName))) { - throw new AccessDeniedHttpException; - } - - return parent::verifyUserCanAccessChannel( - $request, $channelName - ); - } - - /** - * Return the valid authentication response. - * - * @param \Illuminate\Http\Request $request - * @param mixed $result - * @return mixed - */ - public function validAuthenticationResponse($request, $result) - { - if (str_starts_with($request->channel_name, 'private')) { - return $this->decodePusherResponse( - $request, - method_exists($this->pusher, 'authorizeChannel') - ? $this->pusher->authorizeChannel($request->channel_name, $request->socket_id) - : $this->pusher->socket_auth($request->channel_name, $request->socket_id) - ); - } - - $channelName = $this->normalizeChannelName($request->channel_name); - - $user = $this->retrieveUser($request, $channelName); - - $broadcastIdentifier = method_exists($user, 'getAuthIdentifierForBroadcasting') - ? $user->getAuthIdentifierForBroadcasting() - : $user->getAuthIdentifier(); - - return $this->decodePusherResponse( - $request, - method_exists($this->pusher, 'authorizePresenceChannel') - ? $this->pusher->authorizePresenceChannel($request->channel_name, $request->socket_id, $broadcastIdentifier, $result) - : $this->pusher->presence_auth($request->channel_name, $request->socket_id, $broadcastIdentifier, $result) - ); - } - - /** - * Decode the given Pusher response. - * - * @param \Illuminate\Http\Request $request - * @param mixed $response - * @return array - */ - protected function decodePusherResponse($request, $response) - { - if (! $request->input('callback', false)) { - return json_decode($response, true); - } - - return response()->json(json_decode($response, true)) - ->withCallback($request->callback); - } - - /** - * Broadcast the given event. - * - * @param array $channels - * @param string $event - * @param array $payload - * @return void - * - * @throws \Illuminate\Broadcasting\BroadcastException - */ - public function broadcast(array $channels, $event, array $payload = []) - { - $socket = Arr::pull($payload, 'socket'); - - $parameters = $socket !== null ? ['socket_id' => $socket] : []; - - $channels = Collection::make($this->formatChannels($channels)); - - try { - $channels->chunk(100)->each(function ($channels) use ($event, $payload, $parameters) { - $this->pusher->trigger($channels->toArray(), $event, $payload, $parameters); - }); - } catch (ApiErrorException $e) { - throw new BroadcastException( - sprintf('Pusher error: %s.', $e->getMessage()) - ); - } - } - - /** - * Get the Pusher SDK instance. - * - * @return \Pusher\Pusher - */ - public function getPusher() - { - return $this->pusher; - } - - /** - * Set the Pusher SDK instance. - * - * @param \Pusher\Pusher $pusher - * @return void - */ - public function setPusher($pusher) - { - $this->pusher = $pusher; - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php b/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php deleted file mode 100644 index 03245ea..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php +++ /dev/null @@ -1,169 +0,0 @@ -redis = $redis; - $this->prefix = $prefix; - $this->connection = $connection; - } - - /** - * Authenticate the incoming request for a given channel. - * - * @param \Illuminate\Http\Request $request - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException - */ - public function auth($request) - { - $channelName = $this->normalizeChannelName( - str_replace($this->prefix, '', $request->channel_name) - ); - - if (empty($request->channel_name) || - ($this->isGuardedChannel($request->channel_name) && - ! $this->retrieveUser($request, $channelName))) { - throw new AccessDeniedHttpException; - } - - return parent::verifyUserCanAccessChannel( - $request, $channelName - ); - } - - /** - * Return the valid authentication response. - * - * @param \Illuminate\Http\Request $request - * @param mixed $result - * @return mixed - */ - public function validAuthenticationResponse($request, $result) - { - if (is_bool($result)) { - return json_encode($result); - } - - $channelName = $this->normalizeChannelName($request->channel_name); - - $user = $this->retrieveUser($request, $channelName); - - $broadcastIdentifier = method_exists($user, 'getAuthIdentifierForBroadcasting') - ? $user->getAuthIdentifierForBroadcasting() - : $user->getAuthIdentifier(); - - return json_encode(['channel_data' => [ - 'user_id' => $broadcastIdentifier, - 'user_info' => $result, - ]]); - } - - /** - * Broadcast the given event. - * - * @param array $channels - * @param string $event - * @param array $payload - * @return void - * - * @throws \Illuminate\Broadcasting\BroadcastException - */ - public function broadcast(array $channels, $event, array $payload = []) - { - if (empty($channels)) { - return; - } - - $connection = $this->redis->connection($this->connection); - - $payload = json_encode([ - 'event' => $event, - 'data' => $payload, - 'socket' => Arr::pull($payload, 'socket'), - ]); - - try { - $connection->eval( - $this->broadcastMultipleChannelsScript(), - 0, $payload, ...$this->formatChannels($channels) - ); - } catch (ConnectionException|RedisException $e) { - throw new BroadcastException( - sprintf('Redis error: %s.', $e->getMessage()) - ); - } - } - - /** - * Get the Lua script for broadcasting to multiple channels. - * - * ARGV[1] - The payload - * ARGV[2...] - The channels - * - * @return string - */ - protected function broadcastMultipleChannelsScript() - { - return <<<'LUA' -for i = 2, #ARGV do - redis.call('publish', ARGV[i], ARGV[1]) -end -LUA; - } - - /** - * Format the channel array into an array of strings. - * - * @param array $channels - * @return array - */ - protected function formatChannels(array $channels) - { - return array_map(function ($channel) { - return $this->prefix.$channel; - }, parent::formatChannels($channels)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/UsePusherChannelConventions.php b/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/UsePusherChannelConventions.php deleted file mode 100644 index 690cf3d..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/Broadcasters/UsePusherChannelConventions.php +++ /dev/null @@ -1,36 +0,0 @@ -name = $name instanceof HasBroadcastChannel ? $name->broadcastChannel() : $name; - } - - /** - * Convert the channel instance to a string. - * - * @return string - */ - public function __toString() - { - return $this->name; - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/EncryptedPrivateChannel.php b/framework-9.50.2/src/Illuminate/Broadcasting/EncryptedPrivateChannel.php deleted file mode 100644 index 76977c1..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/EncryptedPrivateChannel.php +++ /dev/null @@ -1,17 +0,0 @@ -broadcastConnection = is_null($connection) - ? [null] - : Arr::wrap($connection); - - return $this; - } - - /** - * Get the broadcaster connections the event should be broadcast on. - * - * @return array - */ - public function broadcastConnections() - { - return $this->broadcastConnection; - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/InteractsWithSockets.php b/framework-9.50.2/src/Illuminate/Broadcasting/InteractsWithSockets.php deleted file mode 100644 index 6be0791..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/InteractsWithSockets.php +++ /dev/null @@ -1,39 +0,0 @@ -socket = Broadcast::socket(); - - return $this; - } - - /** - * Broadcast the event to everyone. - * - * @return $this - */ - public function broadcastToEveryone() - { - $this->socket = null; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/LICENSE.md b/framework-9.50.2/src/Illuminate/Broadcasting/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/PendingBroadcast.php b/framework-9.50.2/src/Illuminate/Broadcasting/PendingBroadcast.php deleted file mode 100644 index 191b905..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/PendingBroadcast.php +++ /dev/null @@ -1,74 +0,0 @@ -event = $event; - $this->events = $events; - } - - /** - * Broadcast the event using a specific broadcaster. - * - * @param string|null $connection - * @return $this - */ - public function via($connection = null) - { - if (method_exists($this->event, 'broadcastVia')) { - $this->event->broadcastVia($connection); - } - - return $this; - } - - /** - * Broadcast the event to everyone except the current user. - * - * @return $this - */ - public function toOthers() - { - if (method_exists($this->event, 'dontBroadcastToCurrentUser')) { - $this->event->dontBroadcastToCurrentUser(); - } - - return $this; - } - - /** - * Handle the object's destruction. - * - * @return void - */ - public function __destruct() - { - $this->events->dispatch($this->event); - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/PresenceChannel.php b/framework-9.50.2/src/Illuminate/Broadcasting/PresenceChannel.php deleted file mode 100644 index 22de12d..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/PresenceChannel.php +++ /dev/null @@ -1,17 +0,0 @@ -broadcastChannel() : $name; - - parent::__construct('private-'.$name); - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/UniqueBroadcastEvent.php b/framework-9.50.2/src/Illuminate/Broadcasting/UniqueBroadcastEvent.php deleted file mode 100644 index 83c752d..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/UniqueBroadcastEvent.php +++ /dev/null @@ -1,61 +0,0 @@ -uniqueId = get_class($event); - - if (method_exists($event, 'uniqueId')) { - $this->uniqueId .= $event->uniqueId(); - } elseif (property_exists($event, 'uniqueId')) { - $this->uniqueId .= $event->uniqueId; - } - - if (method_exists($event, 'uniqueFor')) { - $this->uniqueFor = $event->uniqueFor(); - } elseif (property_exists($event, 'uniqueFor')) { - $this->uniqueFor = $event->uniqueFor; - } - - parent::__construct($event); - } - - /** - * Resolve the cache implementation that should manage the event's uniqueness. - * - * @return \Illuminate\Contracts\Cache\Repository - */ - public function uniqueVia() - { - return method_exists($this->event, 'uniqueVia') - ? $this->event->uniqueVia() - : Container::getInstance()->make(Repository::class); - } -} diff --git a/framework-9.50.2/src/Illuminate/Broadcasting/composer.json b/framework-9.50.2/src/Illuminate/Broadcasting/composer.json deleted file mode 100644 index 1f38b07..0000000 --- a/framework-9.50.2/src/Illuminate/Broadcasting/composer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "illuminate/broadcasting", - "description": "The Illuminate Broadcasting package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "psr/log": "^1.0|^2.0|^3.0", - "illuminate/bus": "^9.0", - "illuminate/collections": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/queue": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Broadcasting\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", - "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Bus/Batch.php b/framework-9.50.2/src/Illuminate/Bus/Batch.php deleted file mode 100644 index 644bfbc..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/Batch.php +++ /dev/null @@ -1,480 +0,0 @@ -queue = $queue; - $this->repository = $repository; - $this->id = $id; - $this->name = $name; - $this->totalJobs = $totalJobs; - $this->pendingJobs = $pendingJobs; - $this->failedJobs = $failedJobs; - $this->failedJobIds = $failedJobIds; - $this->options = $options; - $this->createdAt = $createdAt; - $this->cancelledAt = $cancelledAt; - $this->finishedAt = $finishedAt; - } - - /** - * Get a fresh instance of the batch represented by this ID. - * - * @return self - */ - public function fresh() - { - return $this->repository->find($this->id); - } - - /** - * Add additional jobs to the batch. - * - * @param \Illuminate\Support\Enumerable|object|array $jobs - * @return self - */ - public function add($jobs) - { - $count = 0; - - $jobs = Collection::wrap($jobs)->map(function ($job) use (&$count) { - $job = $job instanceof Closure ? CallQueuedClosure::create($job) : $job; - - if (is_array($job)) { - $count += count($job); - - return with($this->prepareBatchedChain($job), function ($chain) { - return $chain->first() - ->allOnQueue($this->options['queue'] ?? null) - ->allOnConnection($this->options['connection'] ?? null) - ->chain($chain->slice(1)->values()->all()); - }); - } else { - $job->withBatchId($this->id); - - $count++; - } - - return $job; - }); - - $this->repository->transaction(function () use ($jobs, $count) { - $this->repository->incrementTotalJobs($this->id, $count); - - $this->queue->connection($this->options['connection'] ?? null)->bulk( - $jobs->all(), - $data = '', - $this->options['queue'] ?? null - ); - }); - - return $this->fresh(); - } - - /** - * Prepare a chain that exists within the jobs being added. - * - * @param array $chain - * @return \Illuminate\Support\Collection - */ - protected function prepareBatchedChain(array $chain) - { - return collect($chain)->map(function ($job) { - $job = $job instanceof Closure ? CallQueuedClosure::create($job) : $job; - - return $job->withBatchId($this->id); - }); - } - - /** - * Get the total number of jobs that have been processed by the batch thus far. - * - * @return int - */ - public function processedJobs() - { - return $this->totalJobs - $this->pendingJobs; - } - - /** - * Get the percentage of jobs that have been processed (between 0-100). - * - * @return int - */ - public function progress() - { - return $this->totalJobs > 0 ? round(($this->processedJobs() / $this->totalJobs) * 100) : 0; - } - - /** - * Record that a job within the batch finished successfully, executing any callbacks if necessary. - * - * @param string $jobId - * @return void - */ - public function recordSuccessfulJob(string $jobId) - { - $counts = $this->decrementPendingJobs($jobId); - - if ($counts->pendingJobs === 0) { - $this->repository->markAsFinished($this->id); - } - - if ($counts->pendingJobs === 0 && $this->hasThenCallbacks()) { - $batch = $this->fresh(); - - collect($this->options['then'])->each(function ($handler) use ($batch) { - $this->invokeHandlerCallback($handler, $batch); - }); - } - - if ($counts->allJobsHaveRanExactlyOnce() && $this->hasFinallyCallbacks()) { - $batch = $this->fresh(); - - collect($this->options['finally'])->each(function ($handler) use ($batch) { - $this->invokeHandlerCallback($handler, $batch); - }); - } - } - - /** - * Decrement the pending jobs for the batch. - * - * @param string $jobId - * @return \Illuminate\Bus\UpdatedBatchJobCounts - */ - public function decrementPendingJobs(string $jobId) - { - return $this->repository->decrementPendingJobs($this->id, $jobId); - } - - /** - * Determine if the batch has finished executing. - * - * @return bool - */ - public function finished() - { - return ! is_null($this->finishedAt); - } - - /** - * Determine if the batch has "success" callbacks. - * - * @return bool - */ - public function hasThenCallbacks() - { - return isset($this->options['then']) && ! empty($this->options['then']); - } - - /** - * Determine if the batch allows jobs to fail without cancelling the batch. - * - * @return bool - */ - public function allowsFailures() - { - return Arr::get($this->options, 'allowFailures', false) === true; - } - - /** - * Determine if the batch has job failures. - * - * @return bool - */ - public function hasFailures() - { - return $this->failedJobs > 0; - } - - /** - * Record that a job within the batch failed to finish successfully, executing any callbacks if necessary. - * - * @param string $jobId - * @param \Throwable $e - * @return void - */ - public function recordFailedJob(string $jobId, $e) - { - $counts = $this->incrementFailedJobs($jobId); - - if ($counts->failedJobs === 1 && ! $this->allowsFailures()) { - $this->cancel(); - } - - if ($counts->failedJobs === 1 && $this->hasCatchCallbacks()) { - $batch = $this->fresh(); - - collect($this->options['catch'])->each(function ($handler) use ($batch, $e) { - $this->invokeHandlerCallback($handler, $batch, $e); - }); - } - - if ($counts->allJobsHaveRanExactlyOnce() && $this->hasFinallyCallbacks()) { - $batch = $this->fresh(); - - collect($this->options['finally'])->each(function ($handler) use ($batch, $e) { - $this->invokeHandlerCallback($handler, $batch, $e); - }); - } - } - - /** - * Increment the failed jobs for the batch. - * - * @param string $jobId - * @return \Illuminate\Bus\UpdatedBatchJobCounts - */ - public function incrementFailedJobs(string $jobId) - { - return $this->repository->incrementFailedJobs($this->id, $jobId); - } - - /** - * Determine if the batch has "catch" callbacks. - * - * @return bool - */ - public function hasCatchCallbacks() - { - return isset($this->options['catch']) && ! empty($this->options['catch']); - } - - /** - * Determine if the batch has "finally" callbacks. - * - * @return bool - */ - public function hasFinallyCallbacks() - { - return isset($this->options['finally']) && ! empty($this->options['finally']); - } - - /** - * Cancel the batch. - * - * @return void - */ - public function cancel() - { - $this->repository->cancel($this->id); - } - - /** - * Determine if the batch has been cancelled. - * - * @return bool - */ - public function canceled() - { - return $this->cancelled(); - } - - /** - * Determine if the batch has been cancelled. - * - * @return bool - */ - public function cancelled() - { - return ! is_null($this->cancelledAt); - } - - /** - * Delete the batch from storage. - * - * @return void - */ - public function delete() - { - $this->repository->delete($this->id); - } - - /** - * Invoke a batch callback handler. - * - * @param callable $handler - * @param \Illuminate\Bus\Batch $batch - * @param \Throwable|null $e - * @return void - */ - protected function invokeHandlerCallback($handler, Batch $batch, Throwable $e = null) - { - try { - return $handler($batch, $e); - } catch (Throwable $e) { - if (function_exists('report')) { - report($e); - } - } - } - - /** - * Convert the batch to an array. - * - * @return array - */ - public function toArray() - { - return [ - 'id' => $this->id, - 'name' => $this->name, - 'totalJobs' => $this->totalJobs, - 'pendingJobs' => $this->pendingJobs, - 'processedJobs' => $this->processedJobs(), - 'progress' => $this->progress(), - 'failedJobs' => $this->failedJobs, - 'options' => $this->options, - 'createdAt' => $this->createdAt, - 'cancelledAt' => $this->cancelledAt, - 'finishedAt' => $this->finishedAt, - ]; - } - - /** - * Get the JSON serializable representation of the object. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->toArray(); - } - - /** - * Dynamically access the batch's "options" via properties. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->options[$key] ?? null; - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/BatchFactory.php b/framework-9.50.2/src/Illuminate/Bus/BatchFactory.php deleted file mode 100644 index 2c3a4e9..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/BatchFactory.php +++ /dev/null @@ -1,58 +0,0 @@ -queue = $queue; - } - - /** - * Create a new batch instance. - * - * @param \Illuminate\Bus\BatchRepository $repository - * @param string $id - * @param string $name - * @param int $totalJobs - * @param int $pendingJobs - * @param int $failedJobs - * @param array $failedJobIds - * @param array $options - * @param \Carbon\CarbonImmutable $createdAt - * @param \Carbon\CarbonImmutable|null $cancelledAt - * @param \Carbon\CarbonImmutable|null $finishedAt - * @return \Illuminate\Bus\Batch - */ - public function make(BatchRepository $repository, - string $id, - string $name, - int $totalJobs, - int $pendingJobs, - int $failedJobs, - array $failedJobIds, - array $options, - CarbonImmutable $createdAt, - ?CarbonImmutable $cancelledAt, - ?CarbonImmutable $finishedAt) - { - return new Batch($this->queue, $repository, $id, $name, $totalJobs, $pendingJobs, $failedJobs, $failedJobIds, $options, $createdAt, $cancelledAt, $finishedAt); - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/BatchRepository.php b/framework-9.50.2/src/Illuminate/Bus/BatchRepository.php deleted file mode 100644 index 098ccef..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/BatchRepository.php +++ /dev/null @@ -1,92 +0,0 @@ -fakeBatch) { - return $this->fakeBatch; - } - - if ($this->batchId) { - return Container::getInstance()->make(BatchRepository::class)->find($this->batchId); - } - } - - /** - * Determine if the batch is still active and processing. - * - * @return bool - */ - public function batching() - { - $batch = $this->batch(); - - return $batch && ! $batch->cancelled(); - } - - /** - * Set the batch ID on the job. - * - * @param string $batchId - * @return $this - */ - public function withBatchId(string $batchId) - { - $this->batchId = $batchId; - - return $this; - } - - /** - * Indicate that the job should use a fake batch. - * - * @param string $id - * @param string $name - * @param int $totalJobs - * @param int $pendingJobs - * @param int $failedJobs - * @param array $failedJobIds - * @param array $options - * @param \Carbon\CarbonImmutable $createdAt - * @param \Carbon\CarbonImmutable|null $cancelledAt - * @param \Carbon\CarbonImmutable|null $finishedAt - * @return array{0: $this, 1: \Illuminate\Support\Testing\BatchFake} - */ - public function withFakeBatch(string $id = '', - string $name = '', - int $totalJobs = 0, - int $pendingJobs = 0, - int $failedJobs = 0, - array $failedJobIds = [], - array $options = [], - CarbonImmutable $createdAt = null, - ?CarbonImmutable $cancelledAt = null, - ?CarbonImmutable $finishedAt = null) - { - $this->fakeBatch = new BatchFake( - empty($id) ? (string) Str::uuid() : $id, - $name, - $totalJobs, - $pendingJobs, - $failedJobs, - $failedJobIds, - $options, - $createdAt ?? CarbonImmutable::now(), - $cancelledAt, - $finishedAt, - ); - - return [$this, $this->fakeBatch]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/BusServiceProvider.php b/framework-9.50.2/src/Illuminate/Bus/BusServiceProvider.php deleted file mode 100644 index bd6192d..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/BusServiceProvider.php +++ /dev/null @@ -1,70 +0,0 @@ -app->singleton(Dispatcher::class, function ($app) { - return new Dispatcher($app, function ($connection = null) use ($app) { - return $app[QueueFactoryContract::class]->connection($connection); - }); - }); - - $this->registerBatchServices(); - - $this->app->alias( - Dispatcher::class, DispatcherContract::class - ); - - $this->app->alias( - Dispatcher::class, QueueingDispatcherContract::class - ); - } - - /** - * Register the batch handling services. - * - * @return void - */ - protected function registerBatchServices() - { - $this->app->singleton(BatchRepository::class, DatabaseBatchRepository::class); - - $this->app->singleton(DatabaseBatchRepository::class, function ($app) { - return new DatabaseBatchRepository( - $app->make(BatchFactory::class), - $app->make('db')->connection($app->config->get('queue.batching.database')), - $app->config->get('queue.batching.table', 'job_batches') - ); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - Dispatcher::class, - DispatcherContract::class, - QueueingDispatcherContract::class, - BatchRepository::class, - DatabaseBatchRepository::class, - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/DatabaseBatchRepository.php b/framework-9.50.2/src/Illuminate/Bus/DatabaseBatchRepository.php deleted file mode 100644 index 624da19..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/DatabaseBatchRepository.php +++ /dev/null @@ -1,388 +0,0 @@ -factory = $factory; - $this->connection = $connection; - $this->table = $table; - } - - /** - * Retrieve a list of batches. - * - * @param int $limit - * @param mixed $before - * @return \Illuminate\Bus\Batch[] - */ - public function get($limit = 50, $before = null) - { - return $this->connection->table($this->table) - ->orderByDesc('id') - ->take($limit) - ->when($before, fn ($q) => $q->where('id', '<', $before)) - ->get() - ->map(function ($batch) { - return $this->toBatch($batch); - }) - ->all(); - } - - /** - * Retrieve information about an existing batch. - * - * @param string $batchId - * @return \Illuminate\Bus\Batch|null - */ - public function find(string $batchId) - { - $batch = $this->connection->table($this->table) - ->useWritePdo() - ->where('id', $batchId) - ->first(); - - if ($batch) { - return $this->toBatch($batch); - } - } - - /** - * Store a new pending batch. - * - * @param \Illuminate\Bus\PendingBatch $batch - * @return \Illuminate\Bus\Batch - */ - public function store(PendingBatch $batch) - { - $id = (string) Str::orderedUuid(); - - $this->connection->table($this->table)->insert([ - 'id' => $id, - 'name' => $batch->name, - 'total_jobs' => 0, - 'pending_jobs' => 0, - 'failed_jobs' => 0, - 'failed_job_ids' => '[]', - 'options' => $this->serialize($batch->options), - 'created_at' => time(), - 'cancelled_at' => null, - 'finished_at' => null, - ]); - - return $this->find($id); - } - - /** - * Increment the total number of jobs within the batch. - * - * @param string $batchId - * @param int $amount - * @return void - */ - public function incrementTotalJobs(string $batchId, int $amount) - { - $this->connection->table($this->table)->where('id', $batchId)->update([ - 'total_jobs' => new Expression('total_jobs + '.$amount), - 'pending_jobs' => new Expression('pending_jobs + '.$amount), - 'finished_at' => null, - ]); - } - - /** - * Decrement the total number of pending jobs for the batch. - * - * @param string $batchId - * @param string $jobId - * @return \Illuminate\Bus\UpdatedBatchJobCounts - */ - public function decrementPendingJobs(string $batchId, string $jobId) - { - $values = $this->updateAtomicValues($batchId, function ($batch) use ($jobId) { - return [ - 'pending_jobs' => $batch->pending_jobs - 1, - 'failed_jobs' => $batch->failed_jobs, - 'failed_job_ids' => json_encode(array_values(array_diff(json_decode($batch->failed_job_ids, true), [$jobId]))), - ]; - }); - - return new UpdatedBatchJobCounts( - $values['pending_jobs'], - $values['failed_jobs'] - ); - } - - /** - * Increment the total number of failed jobs for the batch. - * - * @param string $batchId - * @param string $jobId - * @return \Illuminate\Bus\UpdatedBatchJobCounts - */ - public function incrementFailedJobs(string $batchId, string $jobId) - { - $values = $this->updateAtomicValues($batchId, function ($batch) use ($jobId) { - return [ - 'pending_jobs' => $batch->pending_jobs, - 'failed_jobs' => $batch->failed_jobs + 1, - 'failed_job_ids' => json_encode(array_values(array_unique(array_merge(json_decode($batch->failed_job_ids, true), [$jobId])))), - ]; - }); - - return new UpdatedBatchJobCounts( - $values['pending_jobs'], - $values['failed_jobs'] - ); - } - - /** - * Update an atomic value within the batch. - * - * @param string $batchId - * @param \Closure $callback - * @return int|null - */ - protected function updateAtomicValues(string $batchId, Closure $callback) - { - return $this->connection->transaction(function () use ($batchId, $callback) { - $batch = $this->connection->table($this->table)->where('id', $batchId) - ->lockForUpdate() - ->first(); - - return is_null($batch) ? [] : tap($callback($batch), function ($values) use ($batchId) { - $this->connection->table($this->table)->where('id', $batchId)->update($values); - }); - }); - } - - /** - * Mark the batch that has the given ID as finished. - * - * @param string $batchId - * @return void - */ - public function markAsFinished(string $batchId) - { - $this->connection->table($this->table)->where('id', $batchId)->update([ - 'finished_at' => time(), - ]); - } - - /** - * Cancel the batch that has the given ID. - * - * @param string $batchId - * @return void - */ - public function cancel(string $batchId) - { - $this->connection->table($this->table)->where('id', $batchId)->update([ - 'cancelled_at' => time(), - 'finished_at' => time(), - ]); - } - - /** - * Delete the batch that has the given ID. - * - * @param string $batchId - * @return void - */ - public function delete(string $batchId) - { - $this->connection->table($this->table)->where('id', $batchId)->delete(); - } - - /** - * Prune all of the entries older than the given date. - * - * @param \DateTimeInterface $before - * @return int - */ - public function prune(DateTimeInterface $before) - { - $query = $this->connection->table($this->table) - ->whereNotNull('finished_at') - ->where('finished_at', '<', $before->getTimestamp()); - - $totalDeleted = 0; - - do { - $deleted = $query->take(1000)->delete(); - - $totalDeleted += $deleted; - } while ($deleted !== 0); - - return $totalDeleted; - } - - /** - * Prune all of the unfinished entries older than the given date. - * - * @param \DateTimeInterface $before - * @return int - */ - public function pruneUnfinished(DateTimeInterface $before) - { - $query = $this->connection->table($this->table) - ->whereNull('finished_at') - ->where('created_at', '<', $before->getTimestamp()); - - $totalDeleted = 0; - - do { - $deleted = $query->take(1000)->delete(); - - $totalDeleted += $deleted; - } while ($deleted !== 0); - - return $totalDeleted; - } - - /** - * Prune all of the cancelled entries older than the given date. - * - * @param \DateTimeInterface $before - * @return int - */ - public function pruneCancelled(DateTimeInterface $before) - { - $query = $this->connection->table($this->table) - ->whereNotNull('cancelled_at') - ->where('created_at', '<', $before->getTimestamp()); - - $totalDeleted = 0; - - do { - $deleted = $query->take(1000)->delete(); - - $totalDeleted += $deleted; - } while ($deleted !== 0); - - return $totalDeleted; - } - - /** - * Execute the given Closure within a storage specific transaction. - * - * @param \Closure $callback - * @return mixed - */ - public function transaction(Closure $callback) - { - return $this->connection->transaction(fn () => $callback()); - } - - /** - * Serialize the given value. - * - * @param mixed $value - * @return string - */ - protected function serialize($value) - { - $serialized = serialize($value); - - return $this->connection instanceof PostgresConnection - ? base64_encode($serialized) - : $serialized; - } - - /** - * Unserialize the given value. - * - * @param string $serialized - * @return mixed - */ - protected function unserialize($serialized) - { - if ($this->connection instanceof PostgresConnection && - ! Str::contains($serialized, [':', ';'])) { - $serialized = base64_decode($serialized); - } - - return unserialize($serialized); - } - - /** - * Convert the given raw batch to a Batch object. - * - * @param object $batch - * @return \Illuminate\Bus\Batch - */ - protected function toBatch($batch) - { - return $this->factory->make( - $this, - $batch->id, - $batch->name, - (int) $batch->total_jobs, - (int) $batch->pending_jobs, - (int) $batch->failed_jobs, - json_decode($batch->failed_job_ids, true), - $this->unserialize($batch->options), - CarbonImmutable::createFromTimestamp($batch->created_at), - $batch->cancelled_at ? CarbonImmutable::createFromTimestamp($batch->cancelled_at) : $batch->cancelled_at, - $batch->finished_at ? CarbonImmutable::createFromTimestamp($batch->finished_at) : $batch->finished_at - ); - } - - /** - * Get the underlying database connection. - * - * @return \Illuminate\Database\Connection - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Set the underlying database connection. - * - * @param \Illuminate\Database\Connection $connection - * @return void - */ - public function setConnection(Connection $connection) - { - $this->connection = $connection; - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/Dispatcher.php b/framework-9.50.2/src/Illuminate/Bus/Dispatcher.php deleted file mode 100644 index 4dc390e..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/Dispatcher.php +++ /dev/null @@ -1,295 +0,0 @@ -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) - { - return $this->queueResolver && $this->commandShouldBeQueued($command) - ? $this->dispatchToQueue($command) - : $this->dispatchNow($command); - } - - /** - * Dispatch a command to its appropriate handler in the current process. - * - * Queueable jobs will be dispatched to the "sync" queue. - * - * @param mixed $command - * @param mixed $handler - * @return mixed - */ - public function dispatchSync($command, $handler = null) - { - if ($this->queueResolver && - $this->commandShouldBeQueued($command) && - method_exists($command, 'onConnection')) { - return $this->dispatchToQueue($command->onConnection('sync')); - } - - return $this->dispatchNow($command, $handler); - } - - /** - * Dispatch a command to its appropriate handler in the current process without using the synchronous queue. - * - * @param mixed $command - * @param mixed $handler - * @return mixed - */ - public function dispatchNow($command, $handler = null) - { - $uses = class_uses_recursive($command); - - if (in_array(InteractsWithQueue::class, $uses) && - in_array(Queueable::class, $uses) && - ! $command->job) { - $command->setJob(new SyncJob($this->container, json_encode([]), 'sync', 'sync')); - } - - if ($handler || $handler = $this->getCommandHandler($command)) { - $callback = function ($command) use ($handler) { - $method = method_exists($handler, 'handle') ? 'handle' : '__invoke'; - - return $handler->{$method}($command); - }; - } else { - $callback = function ($command) { - $method = method_exists($command, 'handle') ? 'handle' : '__invoke'; - - return $this->container->call([$command, $method]); - }; - } - - return $this->pipeline->send($command)->through($this->pipes)->then($callback); - } - - /** - * Attempt to find the batch with the given ID. - * - * @param string $batchId - * @return \Illuminate\Bus\Batch|null - */ - public function findBatch(string $batchId) - { - return $this->container->make(BatchRepository::class)->find($batchId); - } - - /** - * Create a new batch of queueable jobs. - * - * @param \Illuminate\Support\Collection|array|mixed $jobs - * @return \Illuminate\Bus\PendingBatch - */ - public function batch($jobs) - { - return new PendingBatch($this->container, Collection::wrap($jobs)); - } - - /** - * Create a new chain of queueable jobs. - * - * @param \Illuminate\Support\Collection|array $jobs - * @return \Illuminate\Foundation\Bus\PendingChain - */ - public function chain($jobs) - { - $jobs = Collection::wrap($jobs); - - return new PendingChain($jobs->shift(), $jobs->toArray()); - } - - /** - * 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); - } - - /** - * Dispatch a command to its appropriate handler after the current process. - * - * @param mixed $command - * @param mixed $handler - * @return void - */ - public function dispatchAfterResponse($command, $handler = null) - { - $this->container->terminating(function () use ($command, $handler) { - $this->dispatchNow($command, $handler); - }); - } - - /** - * 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; - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/Events/BatchDispatched.php b/framework-9.50.2/src/Illuminate/Bus/Events/BatchDispatched.php deleted file mode 100644 index b9a161a..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/Events/BatchDispatched.php +++ /dev/null @@ -1,26 +0,0 @@ -batch = $batch; - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/LICENSE.md b/framework-9.50.2/src/Illuminate/Bus/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Bus/PendingBatch.php b/framework-9.50.2/src/Illuminate/Bus/PendingBatch.php deleted file mode 100644 index 6cd5183..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/PendingBatch.php +++ /dev/null @@ -1,319 +0,0 @@ -container = $container; - $this->jobs = $jobs; - } - - /** - * Add jobs to the batch. - * - * @param iterable|object|array $jobs - * @return $this - */ - public function add($jobs) - { - $jobs = is_iterable($jobs) ? $jobs : Arr::wrap($jobs); - - foreach ($jobs as $job) { - $this->jobs->push($job); - } - - return $this; - } - - /** - * Add a callback to be executed after all jobs in the batch have executed successfully. - * - * @param callable $callback - * @return $this - */ - public function then($callback) - { - $this->options['then'][] = $callback instanceof Closure - ? new SerializableClosure($callback) - : $callback; - - return $this; - } - - /** - * Get the "then" callbacks that have been registered with the pending batch. - * - * @return array - */ - public function thenCallbacks() - { - return $this->options['then'] ?? []; - } - - /** - * Add a callback to be executed after the first failing job in the batch. - * - * @param callable $callback - * @return $this - */ - public function catch($callback) - { - $this->options['catch'][] = $callback instanceof Closure - ? new SerializableClosure($callback) - : $callback; - - return $this; - } - - /** - * Get the "catch" callbacks that have been registered with the pending batch. - * - * @return array - */ - public function catchCallbacks() - { - return $this->options['catch'] ?? []; - } - - /** - * Add a callback to be executed after the batch has finished executing. - * - * @param callable $callback - * @return $this - */ - public function finally($callback) - { - $this->options['finally'][] = $callback instanceof Closure - ? new SerializableClosure($callback) - : $callback; - - return $this; - } - - /** - * Get the "finally" callbacks that have been registered with the pending batch. - * - * @return array - */ - public function finallyCallbacks() - { - return $this->options['finally'] ?? []; - } - - /** - * Indicate that the batch should not be cancelled when a job within the batch fails. - * - * @param bool $allowFailures - * @return $this - */ - public function allowFailures($allowFailures = true) - { - $this->options['allowFailures'] = $allowFailures; - - return $this; - } - - /** - * Determine if the pending batch allows jobs to fail without cancelling the batch. - * - * @return bool - */ - public function allowsFailures() - { - return Arr::get($this->options, 'allowFailures', false) === true; - } - - /** - * Set the name for the batch. - * - * @param string $name - * @return $this - */ - public function name(string $name) - { - $this->name = $name; - - return $this; - } - - /** - * Specify the queue connection that the batched jobs should run on. - * - * @param string $connection - * @return $this - */ - public function onConnection(string $connection) - { - $this->options['connection'] = $connection; - - return $this; - } - - /** - * Get the connection used by the pending batch. - * - * @return string|null - */ - public function connection() - { - return $this->options['connection'] ?? null; - } - - /** - * Specify the queue that the batched jobs should run on. - * - * @param string $queue - * @return $this - */ - public function onQueue(string $queue) - { - $this->options['queue'] = $queue; - - return $this; - } - - /** - * Get the queue used by the pending batch. - * - * @return string|null - */ - public function queue() - { - return $this->options['queue'] ?? null; - } - - /** - * Add additional data into the batch's options array. - * - * @param string $key - * @param mixed $value - * @return $this - */ - public function withOption(string $key, $value) - { - $this->options[$key] = $value; - - return $this; - } - - /** - * Dispatch the batch. - * - * @return \Illuminate\Bus\Batch - * - * @throws \Throwable - */ - public function dispatch() - { - $repository = $this->container->make(BatchRepository::class); - - try { - $batch = $repository->store($this); - - $batch = $batch->add($this->jobs); - } catch (Throwable $e) { - if (isset($batch)) { - $repository->delete($batch->id); - } - - throw $e; - } - - $this->container->make(EventDispatcher::class)->dispatch( - new BatchDispatched($batch) - ); - - return $batch; - } - - /** - * Dispatch the batch after the response is sent to the browser. - * - * @return \Illuminate\Bus\Batch - */ - public function dispatchAfterResponse() - { - $repository = $this->container->make(BatchRepository::class); - - $batch = $repository->store($this); - - if ($batch) { - $this->container->terminating(function () use ($batch) { - $this->dispatchExistingBatch($batch); - }); - } - - return $batch; - } - - /** - * Dispatch an existing batch. - * - * @param \Illuminate\Bus\Batch $batch - * @return void - * - * @throws \Throwable - */ - protected function dispatchExistingBatch($batch) - { - try { - $batch = $batch->add($this->jobs); - } catch (Throwable $e) { - if (isset($batch)) { - $batch->delete(); - } - - throw $e; - } - - $this->container->make(EventDispatcher::class)->dispatch( - new BatchDispatched($batch) - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/PrunableBatchRepository.php b/framework-9.50.2/src/Illuminate/Bus/PrunableBatchRepository.php deleted file mode 100644 index 3f97255..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/PrunableBatchRepository.php +++ /dev/null @@ -1,16 +0,0 @@ -connection = $connection; - - return $this; - } - - /** - * Set the desired queue for the job. - * - * @param string|null $queue - * @return $this - */ - public function onQueue($queue) - { - $this->queue = $queue; - - return $this; - } - - /** - * Set the desired connection for the chain. - * - * @param string|null $connection - * @return $this - */ - public function allOnConnection($connection) - { - $this->chainConnection = $connection; - $this->connection = $connection; - - return $this; - } - - /** - * Set the desired queue for the chain. - * - * @param string|null $queue - * @return $this - */ - public function allOnQueue($queue) - { - $this->chainQueue = $queue; - $this->queue = $queue; - - return $this; - } - - /** - * Set the desired delay in seconds for the job. - * - * @param \DateTimeInterface|\DateInterval|array|int|null $delay - * @return $this - */ - public function delay($delay) - { - $this->delay = $delay; - - return $this; - } - - /** - * Indicate that the job should be dispatched after all database transactions have committed. - * - * @return $this - */ - public function afterCommit() - { - $this->afterCommit = true; - - return $this; - } - - /** - * Indicate that the job should not wait until database transactions have been committed before dispatching. - * - * @return $this - */ - public function beforeCommit() - { - $this->afterCommit = false; - - return $this; - } - - /** - * Specify the middleware the job should be dispatched through. - * - * @param array|object $middleware - * @return $this - */ - public function through($middleware) - { - $this->middleware = Arr::wrap($middleware); - - return $this; - } - - /** - * Set the jobs that should run if this job is successful. - * - * @param array $chain - * @return $this - */ - public function chain($chain) - { - $this->chained = collect($chain)->map(function ($job) { - return $this->serializeJob($job); - })->all(); - - return $this; - } - - /** - * Prepend a job to the current chain so that it is run after the currently running job. - * - * @param mixed $job - * @return $this - */ - public function prependToChain($job) - { - $this->chained = Arr::prepend($this->chained, $this->serializeJob($job)); - - return $this; - } - - /** - * Append a job to the end of the current chain. - * - * @param mixed $job - * @return $this - */ - public function appendToChain($job) - { - $this->chained = array_merge($this->chained, [$this->serializeJob($job)]); - - return $this; - } - - /** - * Serialize a job for queuing. - * - * @param mixed $job - * @return string - * - * @throws \RuntimeException - */ - protected function serializeJob($job) - { - if ($job instanceof Closure) { - if (! class_exists(CallQueuedClosure::class)) { - throw new RuntimeException( - 'To enable support for closure jobs, please install the illuminate/queue package.' - ); - } - - $job = CallQueuedClosure::create($job); - } - - return serialize($job); - } - - /** - * Dispatch the next job on the chain. - * - * @return void - */ - public function dispatchNextJobInChain() - { - if (! empty($this->chained)) { - dispatch(tap(unserialize(array_shift($this->chained)), function ($next) { - $next->chained = $this->chained; - - $next->onConnection($next->connection ?: $this->chainConnection); - $next->onQueue($next->queue ?: $this->chainQueue); - - $next->chainConnection = $this->chainConnection; - $next->chainQueue = $this->chainQueue; - $next->chainCatchCallbacks = $this->chainCatchCallbacks; - })); - } - } - - /** - * Invoke all of the chain's failed job callbacks. - * - * @param \Throwable $e - * @return void - */ - public function invokeChainCatchCallbacks($e) - { - collect($this->chainCatchCallbacks)->each(function ($callback) use ($e) { - $callback($e); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/UniqueLock.php b/framework-9.50.2/src/Illuminate/Bus/UniqueLock.php deleted file mode 100644 index a4066b7..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/UniqueLock.php +++ /dev/null @@ -1,75 +0,0 @@ -cache = $cache; - } - - /** - * Attempt to acquire a lock for the given job. - * - * @param mixed $job - * @return bool - */ - public function acquire($job) - { - $uniqueFor = method_exists($job, 'uniqueFor') - ? $job->uniqueFor() - : ($job->uniqueFor ?? 0); - - $cache = method_exists($job, 'uniqueVia') - ? $job->uniqueVia() - : $this->cache; - - return (bool) $cache->lock($this->getKey($job), $uniqueFor)->get(); - } - - /** - * Release the lock for the given job. - * - * @param mixed $job - * @return void - */ - public function release($job) - { - $cache = method_exists($job, 'uniqueVia') - ? $job->uniqueVia() - : $this->cache; - - $cache->lock($this->getKey($job))->forceRelease(); - } - - /** - * Generate the lock key for the given job. - * - * @param mixed $job - * @return string - */ - protected function getKey($job) - { - $uniqueId = method_exists($job, 'uniqueId') - ? $job->uniqueId() - : ($job->uniqueId ?? ''); - - return 'laravel_unique_job:'.get_class($job).$uniqueId; - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/UpdatedBatchJobCounts.php b/framework-9.50.2/src/Illuminate/Bus/UpdatedBatchJobCounts.php deleted file mode 100644 index 83d33a4..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/UpdatedBatchJobCounts.php +++ /dev/null @@ -1,43 +0,0 @@ -pendingJobs = $pendingJobs; - $this->failedJobs = $failedJobs; - } - - /** - * Determine if all jobs have run exactly once. - * - * @return bool - */ - public function allJobsHaveRanExactlyOnce() - { - return ($this->pendingJobs - $this->failedJobs) === 0; - } -} diff --git a/framework-9.50.2/src/Illuminate/Bus/composer.json b/framework-9.50.2/src/Illuminate/Bus/composer.json deleted file mode 100644 index 44e795a..0000000 --- a/framework-9.50.2/src/Illuminate/Bus/composer.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "illuminate/bus", - "description": "The Illuminate Bus package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/pipeline": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Bus\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "illuminate/queue": "Required to use closures when chaining jobs (^7.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Cache/ApcStore.php b/framework-9.50.2/src/Illuminate/Cache/ApcStore.php deleted file mode 100755 index 90132c1..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/ApcStore.php +++ /dev/null @@ -1,130 +0,0 @@ -apc = $apc; - $this->prefix = $prefix; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string|array $key - * @return mixed - */ - public function get($key) - { - $value = $this->apc->get($this->prefix.$key); - - if ($value !== false) { - return $value; - } - } - - /** - * Store an item in the cache for a given number of seconds. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function put($key, $value, $seconds) - { - return $this->apc->put($this->prefix.$key, $value, $seconds); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - return $this->apc->increment($this->prefix.$key, $value); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - return $this->apc->decrement($this->prefix.$key, $value); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - return $this->put($key, $value, 0); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return $this->apc->delete($this->prefix.$key); - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - return $this->apc->flush(); - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/ApcWrapper.php b/framework-9.50.2/src/Illuminate/Cache/ApcWrapper.php deleted file mode 100755 index 6c129c6..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/ApcWrapper.php +++ /dev/null @@ -1,92 +0,0 @@ -apcu = function_exists('apcu_fetch'); - } - - /** - * Get an item from the cache. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - return $this->apcu ? apcu_fetch($key) : apc_fetch($key); - } - - /** - * Store an item in the cache. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return array|bool - */ - public function put($key, $value, $seconds) - { - return $this->apcu ? apcu_store($key, $value, $seconds) : apc_store($key, $value, $seconds); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value) - { - return $this->apcu ? apcu_inc($key, $value) : apc_inc($key, $value); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value) - { - return $this->apcu ? apcu_dec($key, $value) : apc_dec($key, $value); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function delete($key) - { - return $this->apcu ? apcu_delete($key) : apc_delete($key); - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - return $this->apcu ? apcu_clear_cache() : apc_clear_cache('user'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/ArrayLock.php b/framework-9.50.2/src/Illuminate/Cache/ArrayLock.php deleted file mode 100644 index 4c20783..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/ArrayLock.php +++ /dev/null @@ -1,102 +0,0 @@ -store = $store; - } - - /** - * Attempt to acquire the lock. - * - * @return bool - */ - public function acquire() - { - $expiration = $this->store->locks[$this->name]['expiresAt'] ?? Carbon::now()->addSecond(); - - if ($this->exists() && $expiration->isFuture()) { - return false; - } - - $this->store->locks[$this->name] = [ - 'owner' => $this->owner, - 'expiresAt' => $this->seconds === 0 ? null : Carbon::now()->addSeconds($this->seconds), - ]; - - return true; - } - - /** - * Determine if the current lock exists. - * - * @return bool - */ - protected function exists() - { - return isset($this->store->locks[$this->name]); - } - - /** - * Release the lock. - * - * @return bool - */ - public function release() - { - if (! $this->exists()) { - return false; - } - - if (! $this->isOwnedByCurrentProcess()) { - return false; - } - - $this->forceRelease(); - - return true; - } - - /** - * Returns the owner value written into the driver for this lock. - * - * @return string - */ - protected function getCurrentOwner() - { - return $this->store->locks[$this->name]['owner']; - } - - /** - * Releases this lock in disregard of ownership. - * - * @return void - */ - public function forceRelease() - { - unset($this->store->locks[$this->name]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/ArrayStore.php b/framework-9.50.2/src/Illuminate/Cache/ArrayStore.php deleted file mode 100644 index 22b42ba..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/ArrayStore.php +++ /dev/null @@ -1,218 +0,0 @@ -serializesValues = $serializesValues; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string|array $key - * @return mixed - */ - public function get($key) - { - if (! isset($this->storage[$key])) { - return; - } - - $item = $this->storage[$key]; - - $expiresAt = $item['expiresAt'] ?? 0; - - if ($expiresAt !== 0 && $this->currentTime() > $expiresAt) { - $this->forget($key); - - return; - } - - return $this->serializesValues ? unserialize($item['value']) : $item['value']; - } - - /** - * Store an item in the cache for a given number of seconds. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function put($key, $value, $seconds) - { - $this->storage[$key] = [ - 'value' => $this->serializesValues ? serialize($value) : $value, - 'expiresAt' => $this->calculateExpiration($seconds), - ]; - - return true; - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function increment($key, $value = 1) - { - if (! is_null($existing = $this->get($key))) { - return tap(((int) $existing) + $value, function ($incremented) use ($key) { - $value = $this->serializesValues ? serialize($incremented) : $incremented; - - $this->storage[$key]['value'] = $value; - }); - } - - $this->forever($key, $value); - - return $value; - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function decrement($key, $value = 1) - { - return $this->increment($key, $value * -1); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - return $this->put($key, $value, 0); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - if (array_key_exists($key, $this->storage)) { - unset($this->storage[$key]); - - return true; - } - - return false; - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - $this->storage = []; - - return true; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return ''; - } - - /** - * Get the expiration time of the key. - * - * @param int $seconds - * @return int - */ - protected function calculateExpiration($seconds) - { - return $this->toTimestamp($seconds); - } - - /** - * Get the UNIX timestamp for the given number of seconds. - * - * @param int $seconds - * @return int - */ - protected function toTimestamp($seconds) - { - return $seconds > 0 ? $this->availableAt($seconds) : 0; - } - - /** - * Get a lock instance. - * - * @param string $name - * @param int $seconds - * @param string|null $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function lock($name, $seconds = 0, $owner = null) - { - return new ArrayLock($this, $name, $seconds, $owner); - } - - /** - * Restore a lock instance using the owner identifier. - * - * @param string $name - * @param string $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function restoreLock($name, $owner) - { - return $this->lock($name, 0, $owner); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/CacheLock.php b/framework-9.50.2/src/Illuminate/Cache/CacheLock.php deleted file mode 100644 index 5cc4eea..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/CacheLock.php +++ /dev/null @@ -1,85 +0,0 @@ -store = $store; - } - - /** - * Attempt to acquire the lock. - * - * @return bool - */ - public function acquire() - { - if (method_exists($this->store, 'add') && $this->seconds > 0) { - return $this->store->add( - $this->name, $this->owner, $this->seconds - ); - } - - if (! is_null($this->store->get($this->name))) { - return false; - } - - return ($this->seconds > 0) - ? $this->store->put($this->name, $this->owner, $this->seconds) - : $this->store->forever($this->name, $this->owner); - } - - /** - * Release the lock. - * - * @return bool - */ - public function release() - { - if ($this->isOwnedByCurrentProcess()) { - return $this->store->forget($this->name); - } - - return false; - } - - /** - * Releases this lock regardless of ownership. - * - * @return void - */ - public function forceRelease() - { - $this->store->forget($this->name); - } - - /** - * Returns the owner value written into the driver for this lock. - * - * @return mixed - */ - protected function getCurrentOwner() - { - return $this->store->get($this->name); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/CacheManager.php b/framework-9.50.2/src/Illuminate/Cache/CacheManager.php deleted file mode 100755 index d945db9..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/CacheManager.php +++ /dev/null @@ -1,421 +0,0 @@ -app = $app; - } - - /** - * Get a cache store instance by name, wrapped in a repository. - * - * @param string|null $name - * @return \Illuminate\Contracts\Cache\Repository - */ - public function store($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - return $this->stores[$name] = $this->get($name); - } - - /** - * Get a cache driver instance. - * - * @param string|null $driver - * @return \Illuminate\Contracts\Cache\Repository - */ - public function driver($driver = null) - { - return $this->store($driver); - } - - /** - * Attempt to get the store from the local cache. - * - * @param string $name - * @return \Illuminate\Contracts\Cache\Repository - */ - protected function get($name) - { - return $this->stores[$name] ?? $this->resolve($name); - } - - /** - * Resolve the given store. - * - * @param string $name - * @return \Illuminate\Contracts\Cache\Repository - * - * @throws \InvalidArgumentException - */ - protected function resolve($name) - { - $config = $this->getConfig($name); - - if (is_null($config)) { - throw new InvalidArgumentException("Cache store [{$name}] is not defined."); - } - - if (isset($this->customCreators[$config['driver']])) { - return $this->callCustomCreator($config); - } else { - $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; - - if (method_exists($this, $driverMethod)) { - return $this->{$driverMethod}($config); - } else { - throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); - } - } - } - - /** - * 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 APC cache driver. - * - * @param array $config - * @return \Illuminate\Cache\Repository - */ - protected function createApcDriver(array $config) - { - $prefix = $this->getPrefix($config); - - return $this->repository(new ApcStore(new ApcWrapper, $prefix)); - } - - /** - * Create an instance of the array cache driver. - * - * @param array $config - * @return \Illuminate\Cache\Repository - */ - protected function createArrayDriver(array $config) - { - return $this->repository(new ArrayStore($config['serialize'] ?? false)); - } - - /** - * Create an instance of the file cache driver. - * - * @param array $config - * @return \Illuminate\Cache\Repository - */ - protected function createFileDriver(array $config) - { - return $this->repository(new FileStore($this->app['files'], $config['path'], $config['permission'] ?? null)); - } - - /** - * Create an instance of the Memcached cache driver. - * - * @param array $config - * @return \Illuminate\Cache\Repository - */ - protected function createMemcachedDriver(array $config) - { - $prefix = $this->getPrefix($config); - - $memcached = $this->app['memcached.connector']->connect( - $config['servers'], - $config['persistent_id'] ?? null, - $config['options'] ?? [], - array_filter($config['sasl'] ?? []) - ); - - return $this->repository(new MemcachedStore($memcached, $prefix)); - } - - /** - * Create an instance of the Null cache driver. - * - * @return \Illuminate\Cache\Repository - */ - protected function createNullDriver() - { - return $this->repository(new NullStore); - } - - /** - * Create an instance of the Redis cache driver. - * - * @param array $config - * @return \Illuminate\Cache\Repository - */ - protected function createRedisDriver(array $config) - { - $redis = $this->app['redis']; - - $connection = $config['connection'] ?? 'default'; - - $store = new RedisStore($redis, $this->getPrefix($config), $connection); - - return $this->repository( - $store->setLockConnection($config['lock_connection'] ?? $connection) - ); - } - - /** - * Create an instance of the database cache driver. - * - * @param array $config - * @return \Illuminate\Cache\Repository - */ - protected function createDatabaseDriver(array $config) - { - $connection = $this->app['db']->connection($config['connection'] ?? null); - - $store = new DatabaseStore( - $connection, - $config['table'], - $this->getPrefix($config), - $config['lock_table'] ?? 'cache_locks', - $config['lock_lottery'] ?? [2, 100] - ); - - return $this->repository($store->setLockConnection( - $this->app['db']->connection($config['lock_connection'] ?? $config['connection'] ?? null) - )); - } - - /** - * Create an instance of the DynamoDB cache driver. - * - * @param array $config - * @return \Illuminate\Cache\Repository - */ - protected function createDynamodbDriver(array $config) - { - $client = $this->newDynamodbClient($config); - - return $this->repository( - new DynamoDbStore( - $client, - $config['table'], - $config['attributes']['key'] ?? 'key', - $config['attributes']['value'] ?? 'value', - $config['attributes']['expiration'] ?? 'expires_at', - $this->getPrefix($config) - ) - ); - } - - /** - * Create new DynamoDb Client instance. - * - * @return \Aws\DynamoDb\DynamoDbClient - */ - protected function newDynamodbClient(array $config) - { - $dynamoConfig = [ - 'region' => $config['region'], - 'version' => 'latest', - 'endpoint' => $config['endpoint'] ?? null, - ]; - - if (isset($config['key'], $config['secret'])) { - $dynamoConfig['credentials'] = Arr::only( - $config, ['key', 'secret', 'token'] - ); - } - - return new DynamoDbClient($dynamoConfig); - } - - /** - * Create a new cache repository with the given implementation. - * - * @param \Illuminate\Contracts\Cache\Store $store - * @return \Illuminate\Cache\Repository - */ - public function repository(Store $store) - { - return tap(new Repository($store), function ($repository) { - $this->setEventDispatcher($repository); - }); - } - - /** - * Set the event dispatcher on the given repository instance. - * - * @param \Illuminate\Cache\Repository $repository - * @return void - */ - protected function setEventDispatcher(Repository $repository) - { - if (! $this->app->bound(DispatcherContract::class)) { - return; - } - - $repository->setEventDispatcher( - $this->app[DispatcherContract::class] - ); - } - - /** - * Re-set the event dispatcher on all resolved cache repositories. - * - * @return void - */ - public function refreshEventDispatcher() - { - array_map([$this, 'setEventDispatcher'], $this->stores); - } - - /** - * Get the cache prefix. - * - * @param array $config - * @return string - */ - protected function getPrefix(array $config) - { - return $config['prefix'] ?? $this->app['config']['cache.prefix']; - } - - /** - * Get the cache connection configuration. - * - * @param string $name - * @return array|null - */ - protected function getConfig($name) - { - if (! is_null($name) && $name !== 'null') { - return $this->app['config']["cache.stores.{$name}"]; - } - - return ['driver' => 'null']; - } - - /** - * Get the default cache driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['cache.default']; - } - - /** - * Set the default cache driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['cache.default'] = $name; - } - - /** - * Unset the given driver instances. - * - * @param array|string|null $name - * @return $this - */ - public function forgetDriver($name = null) - { - $name ??= $this->getDefaultDriver(); - - foreach ((array) $name as $cacheName) { - if (isset($this->stores[$cacheName])) { - unset($this->stores[$cacheName]); - } - } - - return $this; - } - - /** - * Disconnect the given driver and remove from local cache. - * - * @param string|null $name - * @return void - */ - public function purge($name = null) - { - $name ??= $this->getDefaultDriver(); - - unset($this->stores[$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->bindTo($this, $this); - - return $this; - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->store()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/CacheServiceProvider.php b/framework-9.50.2/src/Illuminate/Cache/CacheServiceProvider.php deleted file mode 100755 index 662d556..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/CacheServiceProvider.php +++ /dev/null @@ -1,52 +0,0 @@ -app->singleton('cache', function ($app) { - return new CacheManager($app); - }); - - $this->app->singleton('cache.store', function ($app) { - return $app['cache']->driver(); - }); - - $this->app->singleton('cache.psr6', function ($app) { - return new Psr16Adapter($app['cache.store']); - }); - - $this->app->singleton('memcached.connector', function () { - return new MemcachedConnector; - }); - - $this->app->singleton(RateLimiter::class, function ($app) { - return new RateLimiter($app->make('cache')->driver( - $app['config']->get('cache.limiter') - )); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'cache', 'cache.store', 'cache.psr6', 'memcached.connector', RateLimiter::class, - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/Console/CacheTableCommand.php b/framework-9.50.2/src/Illuminate/Cache/Console/CacheTableCommand.php deleted file mode 100644 index 19b591b..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Console/CacheTableCommand.php +++ /dev/null @@ -1,94 +0,0 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $fullPath = $this->createBaseMigration(); - - $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/cache.stub')); - - $this->components->info('Migration created successfully.'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the table. - * - * @return string - */ - protected function createBaseMigration() - { - $name = 'create_cache_table'; - - $path = $this->laravel->databasePath().'/migrations'; - - return $this->laravel['migration.creator']->create($name, $path); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/Console/ClearCommand.php b/framework-9.50.2/src/Illuminate/Cache/Console/ClearCommand.php deleted file mode 100755 index 7d3336c..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Console/ClearCommand.php +++ /dev/null @@ -1,158 +0,0 @@ -cache = $cache; - $this->files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->laravel['events']->dispatch( - 'cache:clearing', [$this->argument('store'), $this->tags()] - ); - - $successful = $this->cache()->flush(); - - $this->flushFacades(); - - if (! $successful) { - return $this->components->error('Failed to clear cache. Make sure you have the appropriate permissions.'); - } - - $this->laravel['events']->dispatch( - 'cache:cleared', [$this->argument('store'), $this->tags()] - ); - - $this->components->info('Application cache cleared successfully.'); - } - - /** - * Flush the real-time facades stored in the cache directory. - * - * @return void - */ - public function flushFacades() - { - if (! $this->files->exists($storagePath = storage_path('framework/cache'))) { - return; - } - - foreach ($this->files->files($storagePath) as $file) { - if (preg_match('/facade-.*\.php$/', $file)) { - $this->files->delete($file); - } - } - } - - /** - * Get the cache instance for the command. - * - * @return \Illuminate\Cache\Repository - */ - protected function cache() - { - $cache = $this->cache->store($this->argument('store')); - - return empty($this->tags()) ? $cache : $cache->tags($this->tags()); - } - - /** - * Get the tags passed to the command. - * - * @return array - */ - protected function tags() - { - return array_filter(explode(',', $this->option('tags') ?? '')); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['store', InputArgument::OPTIONAL, 'The name of the store you would like to clear'], - ]; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['tags', null, InputOption::VALUE_OPTIONAL, 'The cache tags you would like to clear', null], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/Console/ForgetCommand.php b/framework-9.50.2/src/Illuminate/Cache/Console/ForgetCommand.php deleted file mode 100755 index c7fc830..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Console/ForgetCommand.php +++ /dev/null @@ -1,70 +0,0 @@ -cache = $cache; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->cache->store($this->argument('store'))->forget( - $this->argument('key') - ); - - $this->components->info('The ['.$this->argument('key').'] key has been removed from the cache.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/Console/stubs/cache.stub b/framework-9.50.2/src/Illuminate/Cache/Console/stubs/cache.stub deleted file mode 100644 index eee35e9..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Console/stubs/cache.stub +++ /dev/null @@ -1,39 +0,0 @@ -string('key')->primary(); - $table->mediumText('value'); - $table->integer('expiration'); - }); - - Schema::create('cache_locks', function (Blueprint $table) { - $table->string('key')->primary(); - $table->string('owner'); - $table->integer('expiration'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('cache'); - Schema::dropIfExists('cache_locks'); - } -}; diff --git a/framework-9.50.2/src/Illuminate/Cache/DatabaseLock.php b/framework-9.50.2/src/Illuminate/Cache/DatabaseLock.php deleted file mode 100644 index c8db07a..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/DatabaseLock.php +++ /dev/null @@ -1,147 +0,0 @@ -connection = $connection; - $this->table = $table; - $this->lottery = $lottery; - } - - /** - * Attempt to acquire the lock. - * - * @return bool - */ - public function acquire() - { - try { - $this->connection->table($this->table)->insert([ - 'key' => $this->name, - 'owner' => $this->owner, - 'expiration' => $this->expiresAt(), - ]); - - $acquired = true; - } catch (QueryException $e) { - $updated = $this->connection->table($this->table) - ->where('key', $this->name) - ->where(function ($query) { - return $query->where('owner', $this->owner)->orWhere('expiration', '<=', time()); - })->update([ - 'owner' => $this->owner, - 'expiration' => $this->expiresAt(), - ]); - - $acquired = $updated >= 1; - } - - if (random_int(1, $this->lottery[1]) <= $this->lottery[0]) { - $this->connection->table($this->table)->where('expiration', '<=', time())->delete(); - } - - return $acquired; - } - - /** - * Get the UNIX timestamp indicating when the lock should expire. - * - * @return int - */ - protected function expiresAt() - { - return $this->seconds > 0 ? time() + $this->seconds : Carbon::now()->addDays(1)->getTimestamp(); - } - - /** - * Release the lock. - * - * @return bool - */ - public function release() - { - if ($this->isOwnedByCurrentProcess()) { - $this->connection->table($this->table) - ->where('key', $this->name) - ->where('owner', $this->owner) - ->delete(); - - return true; - } - - return false; - } - - /** - * Releases this lock in disregard of ownership. - * - * @return void - */ - public function forceRelease() - { - $this->connection->table($this->table) - ->where('key', $this->name) - ->delete(); - } - - /** - * Returns the owner value written into the driver for this lock. - * - * @return string - */ - protected function getCurrentOwner() - { - return optional($this->connection->table($this->table)->where('key', $this->name)->first())->owner; - } - - /** - * Get the name of the database connection being used to manage the lock. - * - * @return string - */ - public function getConnectionName() - { - return $this->connection->getName(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/DatabaseStore.php b/framework-9.50.2/src/Illuminate/Cache/DatabaseStore.php deleted file mode 100755 index b43761b..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/DatabaseStore.php +++ /dev/null @@ -1,395 +0,0 @@ -table = $table; - $this->prefix = $prefix; - $this->connection = $connection; - $this->lockTable = $lockTable; - $this->lockLottery = $lockLottery; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string|array $key - * @return mixed - */ - public function get($key) - { - $prefixed = $this->prefix.$key; - - $cache = $this->table()->where('key', '=', $prefixed)->first(); - - // If we have a cache record we will check the expiration time against current - // time on the system and see if the record has expired. If it has, we will - // remove the records from the database table so it isn't returned again. - if (is_null($cache)) { - return; - } - - $cache = is_array($cache) ? (object) $cache : $cache; - - // If this cache expiration date is past the current time, we will remove this - // item from the cache. Then we will return a null value since the cache is - // expired. We will use "Carbon" to make this comparison with the column. - if ($this->currentTime() >= $cache->expiration) { - $this->forget($key); - - return; - } - - return $this->unserialize($cache->value); - } - - /** - * Store an item in the cache for a given number of seconds. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function put($key, $value, $seconds) - { - $key = $this->prefix.$key; - $value = $this->serialize($value); - $expiration = $this->getTime() + $seconds; - - try { - return $this->table()->insert(compact('key', 'value', 'expiration')); - } catch (Exception $e) { - $result = $this->table()->where('key', $key)->update(compact('value', 'expiration')); - - return $result > 0; - } - } - - /** - * Store an item in the cache if the key doesn't exist. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function add($key, $value, $seconds) - { - $key = $this->prefix.$key; - $value = $this->serialize($value); - $expiration = $this->getTime() + $seconds; - - try { - return $this->table()->insert(compact('key', 'value', 'expiration')); - } catch (QueryException $e) { - return $this->table() - ->where('key', $key) - ->where('expiration', '<=', $this->getTime()) - ->update([ - 'value' => $value, - 'expiration' => $expiration, - ]) >= 1; - } - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - return $this->incrementOrDecrement($key, $value, function ($current, $value) { - return $current + $value; - }); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - return $this->incrementOrDecrement($key, $value, function ($current, $value) { - return $current - $value; - }); - } - - /** - * Increment or decrement an item in the cache. - * - * @param string $key - * @param mixed $value - * @param \Closure $callback - * @return int|bool - */ - protected function incrementOrDecrement($key, $value, Closure $callback) - { - return $this->connection->transaction(function () use ($key, $value, $callback) { - $prefixed = $this->prefix.$key; - - $cache = $this->table()->where('key', $prefixed) - ->lockForUpdate()->first(); - - // If there is no value in the cache, we will return false here. Otherwise the - // value will be decrypted and we will proceed with this function to either - // increment or decrement this value based on the given action callbacks. - if (is_null($cache)) { - return false; - } - - $cache = is_array($cache) ? (object) $cache : $cache; - - $current = $this->unserialize($cache->value); - - // Here we'll call this callback function that was given to the function which - // is used to either increment or decrement the function. We use a callback - // so we do not have to recreate all this logic in each of the functions. - $new = $callback((int) $current, $value); - - if (! is_numeric($current)) { - return false; - } - - // Here we will update the values in the table. We will also encrypt the value - // since database cache values are encrypted by default with secure storage - // that can't be easily read. We will return the new value after storing. - $this->table()->where('key', $prefixed)->update([ - 'value' => $this->serialize($new), - ]); - - return $new; - }); - } - - /** - * Get the current system time. - * - * @return int - */ - protected function getTime() - { - return $this->currentTime(); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - return $this->put($key, $value, 315360000); - } - - /** - * Get a lock instance. - * - * @param string $name - * @param int $seconds - * @param string|null $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function lock($name, $seconds = 0, $owner = null) - { - return new DatabaseLock( - $this->lockConnection ?? $this->connection, - $this->lockTable, - $this->prefix.$name, - $seconds, - $owner, - $this->lockLottery - ); - } - - /** - * Restore a lock instance using the owner identifier. - * - * @param string $name - * @param string $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function restoreLock($name, $owner) - { - return $this->lock($name, 0, $owner); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - $this->table()->where('key', '=', $this->prefix.$key)->delete(); - - return true; - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - $this->table()->delete(); - - return true; - } - - /** - * Get a query builder for the cache table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function table() - { - return $this->connection->table($this->table); - } - - /** - * Get the underlying database connection. - * - * @return \Illuminate\Database\ConnectionInterface - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Specify the name of the connection that should be used to manage locks. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @return $this - */ - public function setLockConnection($connection) - { - $this->lockConnection = $connection; - - return $this; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * Serialize the given value. - * - * @param mixed $value - * @return string - */ - protected function serialize($value) - { - $result = serialize($value); - - if ($this->connection instanceof PostgresConnection && str_contains($result, "\0")) { - $result = base64_encode($result); - } - - return $result; - } - - /** - * Unserialize the given value. - * - * @param string $value - * @return mixed - */ - protected function unserialize($value) - { - if ($this->connection instanceof PostgresConnection && ! Str::contains($value, [':', ';'])) { - $value = base64_decode($value); - } - - return unserialize($value); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/DynamoDbLock.php b/framework-9.50.2/src/Illuminate/Cache/DynamoDbLock.php deleted file mode 100644 index 9222607..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/DynamoDbLock.php +++ /dev/null @@ -1,77 +0,0 @@ -dynamo = $dynamo; - } - - /** - * Attempt to acquire the lock. - * - * @return bool - */ - public function acquire() - { - if ($this->seconds > 0) { - return $this->dynamo->add($this->name, $this->owner, $this->seconds); - } else { - return $this->dynamo->add($this->name, $this->owner, 86400); - } - } - - /** - * Release the lock. - * - * @return bool - */ - public function release() - { - if ($this->isOwnedByCurrentProcess()) { - return $this->dynamo->forget($this->name); - } - - return false; - } - - /** - * Release this lock in disregard of ownership. - * - * @return void - */ - public function forceRelease() - { - $this->dynamo->forget($this->name); - } - - /** - * Returns the owner value written into the driver for this lock. - * - * @return mixed - */ - protected function getCurrentOwner() - { - return $this->dynamo->get($this->name); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/DynamoDbStore.php b/framework-9.50.2/src/Illuminate/Cache/DynamoDbStore.php deleted file mode 100644 index 30e175a..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/DynamoDbStore.php +++ /dev/null @@ -1,538 +0,0 @@ -table = $table; - $this->dynamo = $dynamo; - $this->keyAttribute = $keyAttribute; - $this->valueAttribute = $valueAttribute; - $this->expirationAttribute = $expirationAttribute; - - $this->setPrefix($prefix); - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $response = $this->dynamo->getItem([ - 'TableName' => $this->table, - 'ConsistentRead' => false, - 'Key' => [ - $this->keyAttribute => [ - 'S' => $this->prefix.$key, - ], - ], - ]); - - if (! isset($response['Item'])) { - return; - } - - if ($this->isExpired($response['Item'])) { - return; - } - - if (isset($response['Item'][$this->valueAttribute])) { - return $this->unserialize( - $response['Item'][$this->valueAttribute]['S'] ?? - $response['Item'][$this->valueAttribute]['N'] ?? - null - ); - } - } - - /** - * Retrieve multiple items from the cache by key. - * - * Items not found in the cache will have a null value. - * - * @param array $keys - * @return array - */ - public function many(array $keys) - { - $prefixedKeys = array_map(function ($key) { - return $this->prefix.$key; - }, $keys); - - $response = $this->dynamo->batchGetItem([ - 'RequestItems' => [ - $this->table => [ - 'ConsistentRead' => false, - 'Keys' => collect($prefixedKeys)->map(function ($key) { - return [ - $this->keyAttribute => [ - 'S' => $key, - ], - ]; - })->all(), - ], - ], - ]); - - $now = Carbon::now(); - - return array_merge(collect(array_flip($keys))->map(function () { - // - })->all(), collect($response['Responses'][$this->table])->mapWithKeys(function ($response) use ($now) { - if ($this->isExpired($response, $now)) { - $value = null; - } else { - $value = $this->unserialize( - $response[$this->valueAttribute]['S'] ?? - $response[$this->valueAttribute]['N'] ?? - null - ); - } - - return [Str::replaceFirst($this->prefix, '', $response[$this->keyAttribute]['S']) => $value]; - })->all()); - } - - /** - * Determine if the given item is expired. - * - * @param array $item - * @param \DateTimeInterface|null $expiration - * @return bool - */ - protected function isExpired(array $item, $expiration = null) - { - $expiration = $expiration ?: Carbon::now(); - - return isset($item[$this->expirationAttribute]) && - $expiration->getTimestamp() >= $item[$this->expirationAttribute]['N']; - } - - /** - * Store an item in the cache for a given number of seconds. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function put($key, $value, $seconds) - { - $this->dynamo->putItem([ - 'TableName' => $this->table, - 'Item' => [ - $this->keyAttribute => [ - 'S' => $this->prefix.$key, - ], - $this->valueAttribute => [ - $this->type($value) => $this->serialize($value), - ], - $this->expirationAttribute => [ - 'N' => (string) $this->toTimestamp($seconds), - ], - ], - ]); - - return true; - } - - /** - * Store multiple items in the cache for a given number of seconds. - * - * @param array $values - * @param int $seconds - * @return bool - */ - public function putMany(array $values, $seconds) - { - $expiration = $this->toTimestamp($seconds); - - $this->dynamo->batchWriteItem([ - 'RequestItems' => [ - $this->table => collect($values)->map(function ($value, $key) use ($expiration) { - return [ - 'PutRequest' => [ - 'Item' => [ - $this->keyAttribute => [ - 'S' => $this->prefix.$key, - ], - $this->valueAttribute => [ - $this->type($value) => $this->serialize($value), - ], - $this->expirationAttribute => [ - 'N' => (string) $expiration, - ], - ], - ], - ]; - })->values()->all(), - ], - ]); - - return true; - } - - /** - * Store an item in the cache if the key doesn't exist. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function add($key, $value, $seconds) - { - try { - $this->dynamo->putItem([ - 'TableName' => $this->table, - 'Item' => [ - $this->keyAttribute => [ - 'S' => $this->prefix.$key, - ], - $this->valueAttribute => [ - $this->type($value) => $this->serialize($value), - ], - $this->expirationAttribute => [ - 'N' => (string) $this->toTimestamp($seconds), - ], - ], - 'ConditionExpression' => 'attribute_not_exists(#key) OR #expires_at < :now', - 'ExpressionAttributeNames' => [ - '#key' => $this->keyAttribute, - '#expires_at' => $this->expirationAttribute, - ], - 'ExpressionAttributeValues' => [ - ':now' => [ - 'N' => (string) Carbon::now()->getTimestamp(), - ], - ], - ]); - - return true; - } catch (DynamoDbException $e) { - if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) { - return false; - } - - throw $e; - } - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - try { - $response = $this->dynamo->updateItem([ - 'TableName' => $this->table, - 'Key' => [ - $this->keyAttribute => [ - 'S' => $this->prefix.$key, - ], - ], - 'ConditionExpression' => 'attribute_exists(#key) AND #expires_at > :now', - 'UpdateExpression' => 'SET #value = #value + :amount', - 'ExpressionAttributeNames' => [ - '#key' => $this->keyAttribute, - '#value' => $this->valueAttribute, - '#expires_at' => $this->expirationAttribute, - ], - 'ExpressionAttributeValues' => [ - ':now' => [ - 'N' => (string) Carbon::now()->getTimestamp(), - ], - ':amount' => [ - 'N' => (string) $value, - ], - ], - 'ReturnValues' => 'UPDATED_NEW', - ]); - - return (int) $response['Attributes'][$this->valueAttribute]['N']; - } catch (DynamoDbException $e) { - if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) { - return false; - } - - throw $e; - } - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - try { - $response = $this->dynamo->updateItem([ - 'TableName' => $this->table, - 'Key' => [ - $this->keyAttribute => [ - 'S' => $this->prefix.$key, - ], - ], - 'ConditionExpression' => 'attribute_exists(#key) AND #expires_at > :now', - 'UpdateExpression' => 'SET #value = #value - :amount', - 'ExpressionAttributeNames' => [ - '#key' => $this->keyAttribute, - '#value' => $this->valueAttribute, - '#expires_at' => $this->expirationAttribute, - ], - 'ExpressionAttributeValues' => [ - ':now' => [ - 'N' => (string) Carbon::now()->getTimestamp(), - ], - ':amount' => [ - 'N' => (string) $value, - ], - ], - 'ReturnValues' => 'UPDATED_NEW', - ]); - - return (int) $response['Attributes'][$this->valueAttribute]['N']; - } catch (DynamoDbException $e) { - if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) { - return false; - } - - throw $e; - } - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - return $this->put($key, $value, Carbon::now()->addYears(5)->getTimestamp()); - } - - /** - * Get a lock instance. - * - * @param string $name - * @param int $seconds - * @param string|null $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function lock($name, $seconds = 0, $owner = null) - { - return new DynamoDbLock($this, $this->prefix.$name, $seconds, $owner); - } - - /** - * Restore a lock instance using the owner identifier. - * - * @param string $name - * @param string $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function restoreLock($name, $owner) - { - return $this->lock($name, 0, $owner); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - $this->dynamo->deleteItem([ - 'TableName' => $this->table, - 'Key' => [ - $this->keyAttribute => [ - 'S' => $this->prefix.$key, - ], - ], - ]); - - return true; - } - - /** - * Remove all items from the cache. - * - * @return bool - * - * @throws \RuntimeException - */ - public function flush() - { - throw new RuntimeException('DynamoDb does not support flushing an entire table. Please create a new table.'); - } - - /** - * Get the UNIX timestamp for the given number of seconds. - * - * @param int $seconds - * @return int - */ - protected function toTimestamp($seconds) - { - return $seconds > 0 - ? $this->availableAt($seconds) - : Carbon::now()->getTimestamp(); - } - - /** - * Serialize the value. - * - * @param mixed $value - * @return mixed - */ - protected function serialize($value) - { - return is_numeric($value) ? (string) $value : serialize($value); - } - - /** - * Unserialize the value. - * - * @param mixed $value - * @return mixed - */ - protected function unserialize($value) - { - if (filter_var($value, FILTER_VALIDATE_INT) !== false) { - return (int) $value; - } - - if (is_numeric($value)) { - return (float) $value; - } - - return unserialize($value); - } - - /** - * Get the DynamoDB type for the given value. - * - * @param mixed $value - * @return string - */ - protected function type($value) - { - return is_numeric($value) ? 'N' : 'S'; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * Set the cache key prefix. - * - * @param string $prefix - * @return void - */ - public function setPrefix($prefix) - { - $this->prefix = ! empty($prefix) ? $prefix.':' : ''; - } - - /** - * Get the DynamoDb Client instance. - * - * @return \Aws\DynamoDb\DynamoDbClient - */ - public function getClient() - { - return $this->dynamo; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/Events/CacheEvent.php b/framework-9.50.2/src/Illuminate/Cache/Events/CacheEvent.php deleted file mode 100644 index 6c9d42c..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Events/CacheEvent.php +++ /dev/null @@ -1,46 +0,0 @@ -key = $key; - $this->tags = $tags; - } - - /** - * Set the tags for the cache event. - * - * @param array $tags - * @return $this - */ - public function setTags($tags) - { - $this->tags = $tags; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/Events/CacheHit.php b/framework-9.50.2/src/Illuminate/Cache/Events/CacheHit.php deleted file mode 100644 index 976c9e4..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Events/CacheHit.php +++ /dev/null @@ -1,28 +0,0 @@ -value = $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/Events/CacheMissed.php b/framework-9.50.2/src/Illuminate/Cache/Events/CacheMissed.php deleted file mode 100644 index d2a5c9f..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Events/CacheMissed.php +++ /dev/null @@ -1,8 +0,0 @@ -value = $value; - $this->seconds = $seconds; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/FileStore.php b/framework-9.50.2/src/Illuminate/Cache/FileStore.php deleted file mode 100755 index 4229229..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/FileStore.php +++ /dev/null @@ -1,351 +0,0 @@ -files = $files; - $this->directory = $directory; - $this->filePermission = $filePermission; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string|array $key - * @return mixed - */ - public function get($key) - { - return $this->getPayload($key)['data'] ?? null; - } - - /** - * Store an item in the cache for a given number of seconds. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function put($key, $value, $seconds) - { - $this->ensureCacheDirectoryExists($path = $this->path($key)); - - $result = $this->files->put( - $path, $this->expiration($seconds).serialize($value), true - ); - - if ($result !== false && $result > 0) { - $this->ensurePermissionsAreCorrect($path); - - return true; - } - - return false; - } - - /** - * Store an item in the cache if the key doesn't exist. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function add($key, $value, $seconds) - { - $this->ensureCacheDirectoryExists($path = $this->path($key)); - - $file = new LockableFile($path, 'c+'); - - try { - $file->getExclusiveLock(); - } catch (LockTimeoutException $e) { - $file->close(); - - return false; - } - - $expire = $file->read(10); - - if (empty($expire) || $this->currentTime() >= $expire) { - $file->truncate() - ->write($this->expiration($seconds).serialize($value)) - ->close(); - - $this->ensurePermissionsAreCorrect($path); - - return true; - } - - $file->close(); - - return false; - } - - /** - * Create the file cache directory if necessary. - * - * @param string $path - * @return void - */ - protected function ensureCacheDirectoryExists($path) - { - $directory = dirname($path); - - if (! $this->files->exists($directory)) { - $this->files->makeDirectory($directory, 0777, true, true); - - // We're creating two levels of directories (e.g. 7e/24), so we check them both... - $this->ensurePermissionsAreCorrect($directory); - $this->ensurePermissionsAreCorrect(dirname($directory)); - } - } - - /** - * Ensure the created node has the correct permissions. - * - * @param string $path - * @return void - */ - protected function ensurePermissionsAreCorrect($path) - { - if (is_null($this->filePermission) || - intval($this->files->chmod($path), 8) == $this->filePermission) { - return; - } - - $this->files->chmod($path, $this->filePermission); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function increment($key, $value = 1) - { - $raw = $this->getPayload($key); - - return tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) { - $this->put($key, $newValue, $raw['time'] ?? 0); - }); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function decrement($key, $value = 1) - { - return $this->increment($key, $value * -1); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - return $this->put($key, $value, 0); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - if ($this->files->exists($file = $this->path($key))) { - return $this->files->delete($file); - } - - return false; - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - if (! $this->files->isDirectory($this->directory)) { - return false; - } - - foreach ($this->files->directories($this->directory) as $directory) { - $deleted = $this->files->deleteDirectory($directory); - - if (! $deleted || $this->files->exists($directory)) { - return false; - } - } - - return true; - } - - /** - * Retrieve an item and expiry time from the cache by key. - * - * @param string $key - * @return array - */ - protected function getPayload($key) - { - $path = $this->path($key); - - // If the file doesn't exist, we obviously cannot return the cache so we will - // just return null. Otherwise, we'll get the contents of the file and get - // the expiration UNIX timestamps from the start of the file's contents. - try { - $expire = substr( - $contents = $this->files->get($path, true), 0, 10 - ); - } catch (Exception $e) { - return $this->emptyPayload(); - } - - // If the current time is greater than expiration timestamps we will delete - // the file and return null. This helps clean up the old files and keeps - // this directory much cleaner for us as old files aren't hanging out. - if ($this->currentTime() >= $expire) { - $this->forget($key); - - return $this->emptyPayload(); - } - - try { - $data = unserialize(substr($contents, 10)); - } catch (Exception $e) { - $this->forget($key); - - return $this->emptyPayload(); - } - - // Next, we'll extract the number of seconds that are remaining for a cache - // so that we can properly retain the time for things like the increment - // operation that may be performed on this cache on a later operation. - $time = $expire - $this->currentTime(); - - return compact('data', 'time'); - } - - /** - * Get a default empty payload for the cache. - * - * @return array - */ - protected function emptyPayload() - { - return ['data' => null, 'time' => null]; - } - - /** - * Get the full path for the given cache key. - * - * @param string $key - * @return string - */ - protected function path($key) - { - $parts = array_slice(str_split($hash = sha1($key), 2), 0, 2); - - return $this->directory.'/'.implode('/', $parts).'/'.$hash; - } - - /** - * Get the expiration time based on the given seconds. - * - * @param int $seconds - * @return int - */ - protected function expiration($seconds) - { - $time = $this->availableAt($seconds); - - return $seconds === 0 || $time > 9999999999 ? 9999999999 : $time; - } - - /** - * Get the Filesystem instance. - * - * @return \Illuminate\Filesystem\Filesystem - */ - public function getFilesystem() - { - return $this->files; - } - - /** - * Get the working directory of the cache. - * - * @return string - */ - public function getDirectory() - { - return $this->directory; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/HasCacheLock.php b/framework-9.50.2/src/Illuminate/Cache/HasCacheLock.php deleted file mode 100644 index 82ad9c2..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/HasCacheLock.php +++ /dev/null @@ -1,31 +0,0 @@ -lock($name, 0, $owner); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/LICENSE.md b/framework-9.50.2/src/Illuminate/Cache/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Cache/Lock.php b/framework-9.50.2/src/Illuminate/Cache/Lock.php deleted file mode 100644 index bed1705..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Lock.php +++ /dev/null @@ -1,167 +0,0 @@ -name = $name; - $this->owner = $owner; - $this->seconds = $seconds; - } - - /** - * Attempt to acquire the lock. - * - * @return bool - */ - abstract public function acquire(); - - /** - * Release the lock. - * - * @return bool - */ - abstract public function release(); - - /** - * Returns the owner value written into the driver for this lock. - * - * @return string - */ - abstract protected function getCurrentOwner(); - - /** - * Attempt to acquire the lock. - * - * @param callable|null $callback - * @return mixed - */ - public function get($callback = null) - { - $result = $this->acquire(); - - if ($result && is_callable($callback)) { - try { - return $callback(); - } finally { - $this->release(); - } - } - - return $result; - } - - /** - * Attempt to acquire the lock for the given number of seconds. - * - * @param int $seconds - * @param callable|null $callback - * @return mixed - * - * @throws \Illuminate\Contracts\Cache\LockTimeoutException - */ - public function block($seconds, $callback = null) - { - $starting = $this->currentTime(); - - while (! $this->acquire()) { - usleep($this->sleepMilliseconds * 1000); - - if ($this->currentTime() - $seconds >= $starting) { - throw new LockTimeoutException; - } - } - - if (is_callable($callback)) { - try { - return $callback(); - } finally { - $this->release(); - } - } - - return true; - } - - /** - * Returns the current owner of the lock. - * - * @return string - */ - public function owner() - { - return $this->owner; - } - - /** - * Determines whether this lock is allowed to release the lock in the driver. - * - * @return bool - */ - protected function isOwnedByCurrentProcess() - { - return $this->getCurrentOwner() === $this->owner; - } - - /** - * Specify the number of milliseconds to sleep in between blocked lock acquisition attempts. - * - * @param int $milliseconds - * @return $this - */ - public function betweenBlockedAttemptsSleepFor($milliseconds) - { - $this->sleepMilliseconds = $milliseconds; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/LuaScripts.php b/framework-9.50.2/src/Illuminate/Cache/LuaScripts.php deleted file mode 100644 index 6d22fcd..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/LuaScripts.php +++ /dev/null @@ -1,25 +0,0 @@ -getMemcached( - $connectionId, $credentials, $options - ); - - if (! $memcached->getServerList()) { - // For each server in the array, we'll just extract the configuration and add - // the server to the Memcached connection. Once we have added all of these - // servers we'll verify the connection is successful and return it back. - foreach ($servers as $server) { - $memcached->addServer( - $server['host'], $server['port'], $server['weight'] - ); - } - } - - return $memcached; - } - - /** - * Get a new Memcached instance. - * - * @param string|null $connectionId - * @param array $credentials - * @param array $options - * @return \Memcached - */ - protected function getMemcached($connectionId, array $credentials, array $options) - { - $memcached = $this->createMemcachedInstance($connectionId); - - if (count($credentials) === 2) { - $this->setCredentials($memcached, $credentials); - } - - if (count($options)) { - $memcached->setOptions($options); - } - - return $memcached; - } - - /** - * Create the Memcached instance. - * - * @param string|null $connectionId - * @return \Memcached - */ - protected function createMemcachedInstance($connectionId) - { - return empty($connectionId) ? new Memcached : new Memcached($connectionId); - } - - /** - * Set the SASL credentials on the Memcached connection. - * - * @param \Memcached $memcached - * @param array $credentials - * @return void - */ - protected function setCredentials($memcached, $credentials) - { - [$username, $password] = $credentials; - - $memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true); - - $memcached->setSaslAuthData($username, $password); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/MemcachedLock.php b/framework-9.50.2/src/Illuminate/Cache/MemcachedLock.php deleted file mode 100644 index 0078a09..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/MemcachedLock.php +++ /dev/null @@ -1,75 +0,0 @@ -memcached = $memcached; - } - - /** - * Attempt to acquire the lock. - * - * @return bool - */ - public function acquire() - { - return $this->memcached->add( - $this->name, $this->owner, $this->seconds - ); - } - - /** - * Release the lock. - * - * @return bool - */ - public function release() - { - if ($this->isOwnedByCurrentProcess()) { - return $this->memcached->delete($this->name); - } - - return false; - } - - /** - * Releases this lock in disregard of ownership. - * - * @return void - */ - public function forceRelease() - { - $this->memcached->delete($this->name); - } - - /** - * Returns the owner value written into the driver for this lock. - * - * @return mixed - */ - protected function getCurrentOwner() - { - return $this->memcached->get($this->name); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/MemcachedStore.php b/framework-9.50.2/src/Illuminate/Cache/MemcachedStore.php deleted file mode 100755 index 299dab9..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/MemcachedStore.php +++ /dev/null @@ -1,279 +0,0 @@ -= 3.0.0. - * - * @var bool - */ - protected $onVersionThree; - - /** - * Create a new Memcached store. - * - * @param \Memcached $memcached - * @param string $prefix - * @return void - */ - public function __construct($memcached, $prefix = '') - { - $this->setPrefix($prefix); - $this->memcached = $memcached; - - $this->onVersionThree = (new ReflectionMethod('Memcached', 'getMulti')) - ->getNumberOfParameters() == 2; - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function get($key) - { - $value = $this->memcached->get($this->prefix.$key); - - if ($this->memcached->getResultCode() == 0) { - return $value; - } - } - - /** - * Retrieve multiple items from the cache by key. - * - * Items not found in the cache will have a null value. - * - * @param array $keys - * @return array - */ - public function many(array $keys) - { - $prefixedKeys = array_map(function ($key) { - return $this->prefix.$key; - }, $keys); - - if ($this->onVersionThree) { - $values = $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER); - } else { - $null = null; - - $values = $this->memcached->getMulti($prefixedKeys, $null, Memcached::GET_PRESERVE_ORDER); - } - - if ($this->memcached->getResultCode() != 0) { - return array_fill_keys($keys, null); - } - - return array_combine($keys, $values); - } - - /** - * Store an item in the cache for a given number of seconds. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function put($key, $value, $seconds) - { - return $this->memcached->set( - $this->prefix.$key, $value, $this->calculateExpiration($seconds) - ); - } - - /** - * Store multiple items in the cache for a given number of seconds. - * - * @param array $values - * @param int $seconds - * @return bool - */ - public function putMany(array $values, $seconds) - { - $prefixedValues = []; - - foreach ($values as $key => $value) { - $prefixedValues[$this->prefix.$key] = $value; - } - - return $this->memcached->setMulti( - $prefixedValues, $this->calculateExpiration($seconds) - ); - } - - /** - * Store an item in the cache if the key doesn't exist. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function add($key, $value, $seconds) - { - return $this->memcached->add( - $this->prefix.$key, $value, $this->calculateExpiration($seconds) - ); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - return $this->memcached->increment($this->prefix.$key, $value); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - return $this->memcached->decrement($this->prefix.$key, $value); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - return $this->put($key, $value, 0); - } - - /** - * Get a lock instance. - * - * @param string $name - * @param int $seconds - * @param string|null $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function lock($name, $seconds = 0, $owner = null) - { - return new MemcachedLock($this->memcached, $this->prefix.$name, $seconds, $owner); - } - - /** - * Restore a lock instance using the owner identifier. - * - * @param string $name - * @param string $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function restoreLock($name, $owner) - { - return $this->lock($name, 0, $owner); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return $this->memcached->delete($this->prefix.$key); - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - return $this->memcached->flush(); - } - - /** - * Get the expiration time of the key. - * - * @param int $seconds - * @return int - */ - protected function calculateExpiration($seconds) - { - return $this->toTimestamp($seconds); - } - - /** - * Get the UNIX timestamp for the given number of seconds. - * - * @param int $seconds - * @return int - */ - protected function toTimestamp($seconds) - { - return $seconds > 0 ? $this->availableAt($seconds) : 0; - } - - /** - * Get the underlying Memcached connection. - * - * @return \Memcached - */ - public function getMemcached() - { - return $this->memcached; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * Set the cache key prefix. - * - * @param string $prefix - * @return void - */ - public function setPrefix($prefix) - { - $this->prefix = ! empty($prefix) ? $prefix.':' : ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/NoLock.php b/framework-9.50.2/src/Illuminate/Cache/NoLock.php deleted file mode 100644 index 68560f8..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/NoLock.php +++ /dev/null @@ -1,46 +0,0 @@ -owner; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/NullStore.php b/framework-9.50.2/src/Illuminate/Cache/NullStore.php deleted file mode 100755 index 5694e6c..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/NullStore.php +++ /dev/null @@ -1,126 +0,0 @@ -lock($name, 0, $owner); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return true; - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - return true; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/PhpRedisLock.php b/framework-9.50.2/src/Illuminate/Cache/PhpRedisLock.php deleted file mode 100644 index 6cfce79..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/PhpRedisLock.php +++ /dev/null @@ -1,35 +0,0 @@ -redis->eval( - LuaScripts::releaseLock(), - 1, - $this->name, - ...$this->redis->pack([$this->owner]) - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/RateLimiter.php b/framework-9.50.2/src/Illuminate/Cache/RateLimiter.php deleted file mode 100644 index 32e4b34..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/RateLimiter.php +++ /dev/null @@ -1,221 +0,0 @@ -cache = $cache; - } - - /** - * Register a named limiter configuration. - * - * @param string $name - * @param \Closure $callback - * @return $this - */ - public function for(string $name, Closure $callback) - { - $this->limiters[$name] = $callback; - - return $this; - } - - /** - * Get the given named rate limiter. - * - * @param string $name - * @return \Closure - */ - public function limiter(string $name) - { - return $this->limiters[$name] ?? null; - } - - /** - * Attempts to execute a callback if it's not limited. - * - * @param string $key - * @param int $maxAttempts - * @param \Closure $callback - * @param int $decaySeconds - * @return mixed - */ - public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60) - { - if ($this->tooManyAttempts($key, $maxAttempts)) { - return false; - } - - return tap($callback() ?: true, function () use ($key, $decaySeconds) { - $this->hit($key, $decaySeconds); - }); - } - - /** - * Determine if the given key has been "accessed" too many times. - * - * @param string $key - * @param int $maxAttempts - * @return bool - */ - public function tooManyAttempts($key, $maxAttempts) - { - if ($this->attempts($key) >= $maxAttempts) { - if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) { - return true; - } - - $this->resetAttempts($key); - } - - return false; - } - - /** - * Increment the counter for a given key for a given decay time. - * - * @param string $key - * @param int $decaySeconds - * @return int - */ - public function hit($key, $decaySeconds = 60) - { - $key = $this->cleanRateLimiterKey($key); - - $this->cache->add( - $key.':timer', $this->availableAt($decaySeconds), $decaySeconds - ); - - $added = $this->cache->add($key, 0, $decaySeconds); - - $hits = (int) $this->cache->increment($key); - - if (! $added && $hits == 1) { - $this->cache->put($key, 1, $decaySeconds); - } - - return $hits; - } - - /** - * Get the number of attempts for the given key. - * - * @param string $key - * @return mixed - */ - public function attempts($key) - { - $key = $this->cleanRateLimiterKey($key); - - return $this->cache->get($key, 0); - } - - /** - * Reset the number of attempts for the given key. - * - * @param string $key - * @return mixed - */ - public function resetAttempts($key) - { - $key = $this->cleanRateLimiterKey($key); - - return $this->cache->forget($key); - } - - /** - * Get the number of retries left for the given key. - * - * @param string $key - * @param int $maxAttempts - * @return int - */ - public function remaining($key, $maxAttempts) - { - $key = $this->cleanRateLimiterKey($key); - - $attempts = $this->attempts($key); - - return $maxAttempts - $attempts; - } - - /** - * Get the number of retries left for the given key. - * - * @param string $key - * @param int $maxAttempts - * @return int - */ - public function retriesLeft($key, $maxAttempts) - { - return $this->remaining($key, $maxAttempts); - } - - /** - * Clear the hits and lockout timer for the given key. - * - * @param string $key - * @return void - */ - public function clear($key) - { - $key = $this->cleanRateLimiterKey($key); - - $this->resetAttempts($key); - - $this->cache->forget($key.':timer'); - } - - /** - * Get the number of seconds until the "key" is accessible again. - * - * @param string $key - * @return int - */ - public function availableIn($key) - { - $key = $this->cleanRateLimiterKey($key); - - return max(0, $this->cache->get($key.':timer') - $this->currentTime()); - } - - /** - * Clean the rate limiter key from unicode characters. - * - * @param string $key - * @return string - */ - public function cleanRateLimiterKey($key) - { - return preg_replace('/&([a-z])[a-z]+;/i', '$1', htmlentities($key)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/RateLimiting/GlobalLimit.php b/framework-9.50.2/src/Illuminate/Cache/RateLimiting/GlobalLimit.php deleted file mode 100644 index 4f084eb..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/RateLimiting/GlobalLimit.php +++ /dev/null @@ -1,18 +0,0 @@ -key = $key; - $this->maxAttempts = $maxAttempts; - $this->decayMinutes = $decayMinutes; - } - - /** - * Create a new rate limit. - * - * @param int $maxAttempts - * @return static - */ - public static function perMinute($maxAttempts) - { - return new static('', $maxAttempts); - } - - /** - * Create a new rate limit using minutes as decay time. - * - * @param int $decayMinutes - * @param int $maxAttempts - * @return static - */ - public static function perMinutes($decayMinutes, $maxAttempts) - { - return new static('', $maxAttempts, $decayMinutes); - } - - /** - * Create a new rate limit using hours as decay time. - * - * @param int $maxAttempts - * @param int $decayHours - * @return static - */ - public static function perHour($maxAttempts, $decayHours = 1) - { - return new static('', $maxAttempts, 60 * $decayHours); - } - - /** - * Create a new rate limit using days as decay time. - * - * @param int $maxAttempts - * @param int $decayDays - * @return static - */ - public static function perDay($maxAttempts, $decayDays = 1) - { - return new static('', $maxAttempts, 60 * 24 * $decayDays); - } - - /** - * Create a new unlimited rate limit. - * - * @return static - */ - public static function none() - { - return new Unlimited; - } - - /** - * Set the key of the rate limit. - * - * @param mixed $key - * @return $this - */ - public function by($key) - { - $this->key = $key; - - return $this; - } - - /** - * Set the callback that should generate the response when the limit is exceeded. - * - * @param callable $callback - * @return $this - */ - public function response(callable $callback) - { - $this->responseCallback = $callback; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/RateLimiting/Unlimited.php b/framework-9.50.2/src/Illuminate/Cache/RateLimiting/Unlimited.php deleted file mode 100644 index fcfaa31..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/RateLimiting/Unlimited.php +++ /dev/null @@ -1,16 +0,0 @@ -redis = $redis; - } - - /** - * Attempt to acquire the lock. - * - * @return bool - */ - public function acquire() - { - if ($this->seconds > 0) { - return $this->redis->set($this->name, $this->owner, 'EX', $this->seconds, 'NX') == true; - } else { - return $this->redis->setnx($this->name, $this->owner) === 1; - } - } - - /** - * Release the lock. - * - * @return bool - */ - public function release() - { - return (bool) $this->redis->eval(LuaScripts::releaseLock(), 1, $this->name, $this->owner); - } - - /** - * Releases this lock in disregard of ownership. - * - * @return void - */ - public function forceRelease() - { - $this->redis->del($this->name); - } - - /** - * Returns the owner value written into the driver for this lock. - * - * @return string - */ - protected function getCurrentOwner() - { - return $this->redis->get($this->name); - } - - /** - * Get the name of the Redis connection being used to manage the lock. - * - * @return string - */ - public function getConnectionName() - { - return $this->redis->getName(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/RedisStore.php b/framework-9.50.2/src/Illuminate/Cache/RedisStore.php deleted file mode 100755 index 4896c91..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/RedisStore.php +++ /dev/null @@ -1,347 +0,0 @@ -redis = $redis; - $this->setPrefix($prefix); - $this->setConnection($connection); - } - - /** - * Retrieve an item from the cache by key. - * - * @param string|array $key - * @return mixed - */ - public function get($key) - { - $value = $this->connection()->get($this->prefix.$key); - - return ! is_null($value) ? $this->unserialize($value) : null; - } - - /** - * Retrieve multiple items from the cache by key. - * - * Items not found in the cache will have a null value. - * - * @param array $keys - * @return array - */ - public function many(array $keys) - { - $results = []; - - $values = $this->connection()->mget(array_map(function ($key) { - return $this->prefix.$key; - }, $keys)); - - foreach ($values as $index => $value) { - $results[$keys[$index]] = ! is_null($value) ? $this->unserialize($value) : null; - } - - return $results; - } - - /** - * Store an item in the cache for a given number of seconds. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function put($key, $value, $seconds) - { - return (bool) $this->connection()->setex( - $this->prefix.$key, (int) max(1, $seconds), $this->serialize($value) - ); - } - - /** - * Store multiple items in the cache for a given number of seconds. - * - * @param array $values - * @param int $seconds - * @return bool - */ - public function putMany(array $values, $seconds) - { - $this->connection()->multi(); - - $manyResult = null; - - foreach ($values as $key => $value) { - $result = $this->put($key, $value, $seconds); - - $manyResult = is_null($manyResult) ? $result : $result && $manyResult; - } - - $this->connection()->exec(); - - return $manyResult ?: false; - } - - /** - * Store an item in the cache if the key doesn't exist. - * - * @param string $key - * @param mixed $value - * @param int $seconds - * @return bool - */ - public function add($key, $value, $seconds) - { - $lua = "return redis.call('exists',KEYS[1])<1 and redis.call('setex',KEYS[1],ARGV[2],ARGV[1])"; - - return (bool) $this->connection()->eval( - $lua, 1, $this->prefix.$key, $this->serialize($value), (int) max(1, $seconds) - ); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function increment($key, $value = 1) - { - return $this->connection()->incrby($this->prefix.$key, $value); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int - */ - public function decrement($key, $value = 1) - { - return $this->connection()->decrby($this->prefix.$key, $value); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - return (bool) $this->connection()->set($this->prefix.$key, $this->serialize($value)); - } - - /** - * Get a lock instance. - * - * @param string $name - * @param int $seconds - * @param string|null $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function lock($name, $seconds = 0, $owner = null) - { - $lockName = $this->prefix.$name; - - $lockConnection = $this->lockConnection(); - - if ($lockConnection instanceof PhpRedisConnection) { - return new PhpRedisLock($lockConnection, $lockName, $seconds, $owner); - } - - return new RedisLock($lockConnection, $lockName, $seconds, $owner); - } - - /** - * Restore a lock instance using the owner identifier. - * - * @param string $name - * @param string $owner - * @return \Illuminate\Contracts\Cache\Lock - */ - public function restoreLock($name, $owner) - { - return $this->lock($name, 0, $owner); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return (bool) $this->connection()->del($this->prefix.$key); - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - $this->connection()->flushdb(); - - return true; - } - - /** - * Begin executing a new tags operation. - * - * @param array|mixed $names - * @return \Illuminate\Cache\RedisTaggedCache - */ - public function tags($names) - { - return new RedisTaggedCache( - $this, new TagSet($this, is_array($names) ? $names : func_get_args()) - ); - } - - /** - * Get the Redis connection instance. - * - * @return \Illuminate\Redis\Connections\Connection - */ - public function connection() - { - return $this->redis->connection($this->connection); - } - - /** - * Get the Redis connection instance that should be used to manage locks. - * - * @return \Illuminate\Redis\Connections\Connection - */ - public function lockConnection() - { - return $this->redis->connection($this->lockConnection ?? $this->connection); - } - - /** - * Specify the name of the connection that should be used to store data. - * - * @param string $connection - * @return void - */ - public function setConnection($connection) - { - $this->connection = $connection; - } - - /** - * Specify the name of the connection that should be used to manage locks. - * - * @param string $connection - * @return $this - */ - public function setLockConnection($connection) - { - $this->lockConnection = $connection; - - return $this; - } - - /** - * Get the Redis database instance. - * - * @return \Illuminate\Contracts\Redis\Factory - */ - public function getRedis() - { - return $this->redis; - } - - /** - * Get the cache key prefix. - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * Set the cache key prefix. - * - * @param string $prefix - * @return void - */ - public function setPrefix($prefix) - { - $this->prefix = ! empty($prefix) ? $prefix.':' : ''; - } - - /** - * Serialize the value. - * - * @param mixed $value - * @return mixed - */ - protected function serialize($value) - { - return is_numeric($value) && ! in_array($value, [INF, -INF]) && ! is_nan($value) ? $value : serialize($value); - } - - /** - * Unserialize the value. - * - * @param mixed $value - * @return mixed - */ - protected function unserialize($value) - { - return is_numeric($value) ? $value : unserialize($value); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/RedisTaggedCache.php b/framework-9.50.2/src/Illuminate/Cache/RedisTaggedCache.php deleted file mode 100644 index 7863dbc..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/RedisTaggedCache.php +++ /dev/null @@ -1,214 +0,0 @@ -forever($key, $value); - } - - $this->pushStandardKeys($this->tags->getNamespace(), $key); - - return parent::put($key, $value, $ttl); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - $this->pushStandardKeys($this->tags->getNamespace(), $key); - - return parent::increment($key, $value); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - $this->pushStandardKeys($this->tags->getNamespace(), $key); - - return parent::decrement($key, $value); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - $this->pushForeverKeys($this->tags->getNamespace(), $key); - - return parent::forever($key, $value); - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - $this->deleteForeverKeys(); - $this->deleteStandardKeys(); - - $this->tags->flush(); - - return true; - } - - /** - * Store standard key references into store. - * - * @param string $namespace - * @param string $key - * @return void - */ - protected function pushStandardKeys($namespace, $key) - { - $this->pushKeys($namespace, $key, self::REFERENCE_KEY_STANDARD); - } - - /** - * Store forever key references into store. - * - * @param string $namespace - * @param string $key - * @return void - */ - protected function pushForeverKeys($namespace, $key) - { - $this->pushKeys($namespace, $key, self::REFERENCE_KEY_FOREVER); - } - - /** - * Store a reference to the cache key against the reference key. - * - * @param string $namespace - * @param string $key - * @param string $reference - * @return void - */ - protected function pushKeys($namespace, $key, $reference) - { - $fullKey = $this->store->getPrefix().sha1($namespace).':'.$key; - - foreach (explode('|', $namespace) as $segment) { - $this->store->connection()->sadd($this->referenceKey($segment, $reference), $fullKey); - } - } - - /** - * Delete all of the items that were stored forever. - * - * @return void - */ - protected function deleteForeverKeys() - { - $this->deleteKeysByReference(self::REFERENCE_KEY_FOREVER); - } - - /** - * Delete all standard items. - * - * @return void - */ - protected function deleteStandardKeys() - { - $this->deleteKeysByReference(self::REFERENCE_KEY_STANDARD); - } - - /** - * Find and delete all of the items that were stored against a reference. - * - * @param string $reference - * @return void - */ - protected function deleteKeysByReference($reference) - { - foreach (explode('|', $this->tags->getNamespace()) as $segment) { - $this->deleteValues($segment = $this->referenceKey($segment, $reference)); - - $this->store->connection()->del($segment); - } - } - - /** - * Delete item keys that have been stored against a reference. - * - * @param string $referenceKey - * @return void - */ - protected function deleteValues($referenceKey) - { - $cursor = $defaultCursorValue = '0'; - - do { - [$cursor, $valuesChunk] = $this->store->connection()->sscan( - $referenceKey, $cursor, ['match' => '*', 'count' => 1000] - ); - - // PhpRedis client returns false if set does not exist or empty. Array destruction - // on false stores null in each variable. If valuesChunk is null, it means that - // there were not results from the previously executed "sscan" Redis command. - if (is_null($valuesChunk)) { - break; - } - - $valuesChunk = array_unique($valuesChunk); - - if (count($valuesChunk) > 0) { - $this->store->connection()->del(...$valuesChunk); - } - } while (((string) $cursor) !== $defaultCursorValue); - } - - /** - * Get the reference key for the segment. - * - * @param string $segment - * @param string $suffix - * @return string - */ - protected function referenceKey($segment, $suffix) - { - return $this->store->getPrefix().$segment.':'.$suffix; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/Repository.php b/framework-9.50.2/src/Illuminate/Cache/Repository.php deleted file mode 100755 index f6cd1c2..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/Repository.php +++ /dev/null @@ -1,690 +0,0 @@ -store = $store; - } - - /** - * Determine if an item exists in the cache. - * - * @param array|string $key - * @return bool - */ - public function has($key): bool - { - return ! is_null($this->get($key)); - } - - /** - * Determine if an item doesn't exist in the cache. - * - * @param string $key - * @return bool - */ - public function missing($key) - { - return ! $this->has($key); - } - - /** - * Retrieve an item from the cache by key. - * - * @template TCacheValue - * - * @param array|string $key - * @param TCacheValue|(\Closure(): TCacheValue) $default - * @return (TCacheValue is null ? mixed : TCacheValue) - */ - public function get($key, $default = null): mixed - { - if (is_array($key)) { - return $this->many($key); - } - - $value = $this->store->get($this->itemKey($key)); - - // If we could not find the cache value, we will fire the missed event and get - // the default value for this cache value. This default could be a callback - // so we will execute the value function which will resolve it if needed. - if (is_null($value)) { - $this->event(new CacheMissed($key)); - - $value = value($default); - } else { - $this->event(new CacheHit($key, $value)); - } - - return $value; - } - - /** - * Retrieve multiple items from the cache by key. - * - * Items not found in the cache will have a null value. - * - * @param array $keys - * @return array - */ - public function many(array $keys) - { - $values = $this->store->many(collect($keys)->map(function ($value, $key) { - return is_string($key) ? $key : $value; - })->values()->all()); - - return collect($values)->map(function ($value, $key) use ($keys) { - return $this->handleManyResult($keys, $key, $value); - })->all(); - } - - /** - * {@inheritdoc} - * - * @return iterable - */ - public function getMultiple($keys, $default = null): iterable - { - $defaults = []; - - foreach ($keys as $key) { - $defaults[$key] = $default; - } - - return $this->many($defaults); - } - - /** - * Handle a result for the "many" method. - * - * @param array $keys - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function handleManyResult($keys, $key, $value) - { - // If we could not find the cache value, we will fire the missed event and get - // the default value for this cache value. This default could be a callback - // so we will execute the value function which will resolve it if needed. - if (is_null($value)) { - $this->event(new CacheMissed($key)); - - return isset($keys[$key]) ? value($keys[$key]) : null; - } - - // If we found a valid value we will fire the "hit" event and return the value - // back from this function. The "hit" event gives developers an opportunity - // to listen for every possible cache "hit" throughout this applications. - $this->event(new CacheHit($key, $value)); - - return $value; - } - - /** - * Retrieve an item from the cache and delete it. - * - * @template TCacheValue - * - * @param array|string $key - * @param TCacheValue|(\Closure(): TCacheValue) $default - * @return (TCacheValue is null ? mixed : TCacheValue) - */ - public function pull($key, $default = null) - { - return tap($this->get($key, $default), function () use ($key) { - $this->forget($key); - }); - } - - /** - * Store an item in the cache. - * - * @param array|string $key - * @param mixed $value - * @param \DateTimeInterface|\DateInterval|int|null $ttl - * @return bool - */ - public function put($key, $value, $ttl = null) - { - if (is_array($key)) { - return $this->putMany($key, $value); - } - - if ($ttl === null) { - return $this->forever($key, $value); - } - - $seconds = $this->getSeconds($ttl); - - if ($seconds <= 0) { - return $this->forget($key); - } - - $result = $this->store->put($this->itemKey($key), $value, $seconds); - - if ($result) { - $this->event(new KeyWritten($key, $value, $seconds)); - } - - return $result; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function set($key, $value, $ttl = null): bool - { - return $this->put($key, $value, $ttl); - } - - /** - * Store multiple items in the cache for a given number of seconds. - * - * @param array $values - * @param \DateTimeInterface|\DateInterval|int|null $ttl - * @return bool - */ - public function putMany(array $values, $ttl = null) - { - if ($ttl === null) { - return $this->putManyForever($values); - } - - $seconds = $this->getSeconds($ttl); - - if ($seconds <= 0) { - return $this->deleteMultiple(array_keys($values)); - } - - $result = $this->store->putMany($values, $seconds); - - if ($result) { - foreach ($values as $key => $value) { - $this->event(new KeyWritten($key, $value, $seconds)); - } - } - - return $result; - } - - /** - * Store multiple items in the cache indefinitely. - * - * @param array $values - * @return bool - */ - protected function putManyForever(array $values) - { - $result = true; - - foreach ($values as $key => $value) { - if (! $this->forever($key, $value)) { - $result = false; - } - } - - return $result; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function setMultiple($values, $ttl = null): bool - { - return $this->putMany(is_array($values) ? $values : iterator_to_array($values), $ttl); - } - - /** - * Store an item in the cache if the key does not exist. - * - * @param string $key - * @param mixed $value - * @param \DateTimeInterface|\DateInterval|int|null $ttl - * @return bool - */ - public function add($key, $value, $ttl = null) - { - $seconds = null; - - if ($ttl !== null) { - $seconds = $this->getSeconds($ttl); - - if ($seconds <= 0) { - return false; - } - - // If the store has an "add" method we will call the method on the store so it - // has a chance to override this logic. Some drivers better support the way - // this operation should work with a total "atomic" implementation of it. - if (method_exists($this->store, 'add')) { - return $this->store->add( - $this->itemKey($key), $value, $seconds - ); - } - } - - // If the value did not exist in the cache, we will put the value in the cache - // so it exists for subsequent requests. Then, we will return true so it is - // easy to know if the value gets added. Otherwise, we will return false. - if (is_null($this->get($key))) { - return $this->put($key, $value, $seconds); - } - - return false; - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - return $this->store->increment($key, $value); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - return $this->store->decrement($key, $value); - } - - /** - * Store an item in the cache indefinitely. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function forever($key, $value) - { - $result = $this->store->forever($this->itemKey($key), $value); - - if ($result) { - $this->event(new KeyWritten($key, $value)); - } - - return $result; - } - - /** - * Get an item from the cache, or execute the given Closure and store the result. - * - * @template TCacheValue - * - * @param string $key - * @param \Closure|\DateTimeInterface|\DateInterval|int|null $ttl - * @param \Closure(): TCacheValue $callback - * @return TCacheValue - */ - public function remember($key, $ttl, Closure $callback) - { - $value = $this->get($key); - - // If the item exists in the cache we will just return this immediately and if - // not we will execute the given Closure and cache the result of that for a - // given number of seconds so it's available for all subsequent requests. - if (! is_null($value)) { - return $value; - } - - $this->put($key, $value = $callback(), value($ttl)); - - return $value; - } - - /** - * Get an item from the cache, or execute the given Closure and store the result forever. - * - * @template TCacheValue - * - * @param string $key - * @param \Closure(): TCacheValue $callback - * @return TCacheValue - */ - public function sear($key, Closure $callback) - { - return $this->rememberForever($key, $callback); - } - - /** - * Get an item from the cache, or execute the given Closure and store the result forever. - * - * @template TCacheValue - * - * @param string $key - * @param \Closure(): TCacheValue $callback - * @return TCacheValue - */ - public function rememberForever($key, Closure $callback) - { - $value = $this->get($key); - - // If the item exists in the cache we will just return this immediately - // and if not we will execute the given Closure and cache the result - // of that forever so it is available for all subsequent requests. - if (! is_null($value)) { - return $value; - } - - $this->forever($key, $value = $callback()); - - return $value; - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return bool - */ - public function forget($key) - { - return tap($this->store->forget($this->itemKey($key)), function ($result) use ($key) { - if ($result) { - $this->event(new KeyForgotten($key)); - } - }); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function delete($key): bool - { - return $this->forget($key); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function deleteMultiple($keys): bool - { - $result = true; - - foreach ($keys as $key) { - if (! $this->forget($key)) { - $result = false; - } - } - - return $result; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function clear(): bool - { - return $this->store->flush(); - } - - /** - * Begin executing a new tags operation if the store supports it. - * - * @param array|mixed $names - * @return \Illuminate\Cache\TaggedCache - * - * @throws \BadMethodCallException - */ - public function tags($names) - { - if (! $this->supportsTags()) { - throw new BadMethodCallException('This cache store does not support tagging.'); - } - - $cache = $this->store->tags(is_array($names) ? $names : func_get_args()); - - if (! is_null($this->events)) { - $cache->setEventDispatcher($this->events); - } - - return $cache->setDefaultCacheTime($this->default); - } - - /** - * Format the key for a cache item. - * - * @param string $key - * @return string - */ - protected function itemKey($key) - { - return $key; - } - - /** - * Calculate the number of seconds for the given TTL. - * - * @param \DateTimeInterface|\DateInterval|int $ttl - * @return int - */ - protected function getSeconds($ttl) - { - $duration = $this->parseDateInterval($ttl); - - if ($duration instanceof DateTimeInterface) { - $duration = Carbon::now()->diffInRealSeconds($duration, false); - } - - return (int) ($duration > 0 ? $duration : 0); - } - - /** - * Determine if the current store supports tags. - * - * @return bool - */ - public function supportsTags() - { - return method_exists($this->store, 'tags'); - } - - /** - * Get the default cache time. - * - * @return int|null - */ - public function getDefaultCacheTime() - { - return $this->default; - } - - /** - * Set the default cache time in seconds. - * - * @param int|null $seconds - * @return $this - */ - public function setDefaultCacheTime($seconds) - { - $this->default = $seconds; - - return $this; - } - - /** - * Get the cache store implementation. - * - * @return \Illuminate\Contracts\Cache\Store - */ - public function getStore() - { - return $this->store; - } - - /** - * Fire an event for this cache instance. - * - * @param object|string $event - * @return void - */ - protected function event($event) - { - $this->events?->dispatch($event); - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getEventDispatcher() - { - return $this->events; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void - */ - public function setEventDispatcher(Dispatcher $events) - { - $this->events = $events; - } - - /** - * Determine if a cached value exists. - * - * @param string $key - * @return bool - */ - public function offsetExists($key): bool - { - return $this->has($key); - } - - /** - * Retrieve an item from the cache by key. - * - * @param string $key - * @return mixed - */ - public function offsetGet($key): mixed - { - return $this->get($key); - } - - /** - * Store an item in the cache for the default time. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value): void - { - $this->put($key, $value, $this->default); - } - - /** - * Remove an item from the cache. - * - * @param string $key - * @return void - */ - public function offsetUnset($key): void - { - $this->forget($key); - } - - /** - * Handle dynamic calls into macros or pass missing methods to the store. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - return $this->store->$method(...$parameters); - } - - /** - * Clone cache repository instance. - * - * @return void - */ - public function __clone() - { - $this->store = clone $this->store; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/RetrievesMultipleKeys.php b/framework-9.50.2/src/Illuminate/Cache/RetrievesMultipleKeys.php deleted file mode 100644 index 7db7a0a..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/RetrievesMultipleKeys.php +++ /dev/null @@ -1,49 +0,0 @@ -mapWithKeys(function ($value, $key) { - return [is_string($key) ? $key : $value => is_string($key) ? $value : null]; - })->all(); - - foreach ($keys as $key => $default) { - $return[$key] = $this->get($key, $default); - } - - return $return; - } - - /** - * Store multiple items in the cache for a given number of seconds. - * - * @param array $values - * @param int $seconds - * @return bool - */ - public function putMany(array $values, $seconds) - { - $manyResult = null; - - foreach ($values as $key => $value) { - $result = $this->put($key, $value, $seconds); - - $manyResult = is_null($manyResult) ? $result : $result && $manyResult; - } - - return $manyResult ?: false; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/TagSet.php b/framework-9.50.2/src/Illuminate/Cache/TagSet.php deleted file mode 100644 index 471dc67..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/TagSet.php +++ /dev/null @@ -1,130 +0,0 @@ -store = $store; - $this->names = $names; - } - - /** - * Reset all tags in the set. - * - * @return void - */ - public function reset() - { - array_walk($this->names, [$this, 'resetTag']); - } - - /** - * Reset the tag and return the new tag identifier. - * - * @param string $name - * @return string - */ - public function resetTag($name) - { - $this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true))); - - return $id; - } - - /** - * Flush all the tags in the set. - * - * @return void - */ - public function flush() - { - array_walk($this->names, [$this, 'flushTag']); - } - - /** - * Flush the tag from the cache. - * - * @param string $name - */ - public function flushTag($name) - { - $this->store->forget($this->tagKey($name)); - } - - /** - * Get a unique namespace that changes when any of the tags are flushed. - * - * @return string - */ - public function getNamespace() - { - return implode('|', $this->tagIds()); - } - - /** - * Get an array of tag identifiers for all of the tags in the set. - * - * @return array - */ - protected function tagIds() - { - return array_map([$this, 'tagId'], $this->names); - } - - /** - * Get the unique tag identifier for a given tag. - * - * @param string $name - * @return string - */ - public function tagId($name) - { - return $this->store->get($this->tagKey($name)) ?: $this->resetTag($name); - } - - /** - * Get the tag identifier key for a given tag. - * - * @param string $name - * @return string - */ - public function tagKey($name) - { - return 'tag:'.$name.':key'; - } - - /** - * Get all of the tag names in the set. - * - * @return array - */ - public function getNames() - { - return $this->names; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/TaggableStore.php b/framework-9.50.2/src/Illuminate/Cache/TaggableStore.php deleted file mode 100644 index 6a12b45..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/TaggableStore.php +++ /dev/null @@ -1,19 +0,0 @@ -tags = $tags; - } - - /** - * Store multiple items in the cache for a given number of seconds. - * - * @param array $values - * @param int|null $ttl - * @return bool - */ - public function putMany(array $values, $ttl = null) - { - if ($ttl === null) { - return $this->putManyForever($values); - } - - return $this->putManyAlias($values, $ttl); - } - - /** - * Increment the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function increment($key, $value = 1) - { - return $this->store->increment($this->itemKey($key), $value); - } - - /** - * Decrement the value of an item in the cache. - * - * @param string $key - * @param mixed $value - * @return int|bool - */ - public function decrement($key, $value = 1) - { - return $this->store->decrement($this->itemKey($key), $value); - } - - /** - * Remove all items from the cache. - * - * @return bool - */ - public function flush() - { - $this->tags->reset(); - - return true; - } - - /** - * {@inheritdoc} - */ - protected function itemKey($key) - { - return $this->taggedItemKey($key); - } - - /** - * Get a fully qualified key for a tagged item. - * - * @param string $key - * @return string - */ - public function taggedItemKey($key) - { - return sha1($this->tags->getNamespace()).':'.$key; - } - - /** - * Fire an event for this cache instance. - * - * @param \Illuminate\Cache\Events\CacheEvent $event - * @return void - */ - protected function event($event) - { - parent::event($event->setTags($this->tags->getNames())); - } - - /** - * Get the tag set instance. - * - * @return \Illuminate\Cache\TagSet - */ - public function getTags() - { - return $this->tags; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cache/composer.json b/framework-9.50.2/src/Illuminate/Cache/composer.json deleted file mode 100755 index 92dd4fb..0000000 --- a/framework-9.50.2/src/Illuminate/Cache/composer.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "illuminate/cache", - "description": "The Illuminate Cache package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0" - }, - "provide": { - "psr/simple-cache-implementation": "1.0|2.0|3.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Cache\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "ext-memcached": "Required to use the memcache cache driver.", - "illuminate/database": "Required to use the database cache driver (^9.0).", - "illuminate/filesystem": "Required to use the file cache driver (^9.0).", - "illuminate/redis": "Required to use the redis cache driver (^9.0).", - "symfony/cache": "Required to use PSR-6 cache bridge (^6.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Collections/Arr.php b/framework-9.50.2/src/Illuminate/Collections/Arr.php deleted file mode 100644 index 1b38fc5..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/Arr.php +++ /dev/null @@ -1,860 +0,0 @@ -all(); - } elseif (! is_array($values)) { - continue; - } - - $results[] = $values; - } - - return array_merge([], ...$results); - } - - /** - * Cross join the given arrays, returning all possible permutations. - * - * @param iterable ...$arrays - * @return array - */ - public static function crossJoin(...$arrays) - { - $results = [[]]; - - foreach ($arrays as $index => $array) { - $append = []; - - foreach ($results as $product) { - foreach ($array as $item) { - $product[$index] = $item; - - $append[] = $product; - } - } - - $results = $append; - } - - return $results; - } - - /** - * Divide an array into two arrays. One with keys and the other with values. - * - * @param array $array - * @return array - */ - public static function divide($array) - { - return [array_keys($array), array_values($array)]; - } - - /** - * Flatten a multi-dimensional associative array with dots. - * - * @param iterable $array - * @param string $prepend - * @return array - */ - public static function dot($array, $prepend = '') - { - $results = []; - - foreach ($array as $key => $value) { - if (is_array($value) && ! empty($value)) { - $results = array_merge($results, static::dot($value, $prepend.$key.'.')); - } else { - $results[$prepend.$key] = $value; - } - } - - return $results; - } - - /** - * Convert a flatten "dot" notation array into an expanded array. - * - * @param iterable $array - * @return array - */ - public static function undot($array) - { - $results = []; - - foreach ($array as $key => $value) { - static::set($results, $key, $value); - } - - return $results; - } - - /** - * Get all of the given array except for a specified array of keys. - * - * @param array $array - * @param array|string|int|float $keys - * @return array - */ - public static function except($array, $keys) - { - static::forget($array, $keys); - - return $array; - } - - /** - * Determine if the given key exists in the provided array. - * - * @param \ArrayAccess|array $array - * @param string|int $key - * @return bool - */ - public static function exists($array, $key) - { - if ($array instanceof Enumerable) { - return $array->has($key); - } - - if ($array instanceof ArrayAccess) { - return $array->offsetExists($key); - } - - if (is_float($key)) { - $key = (string) $key; - } - - return array_key_exists($key, $array); - } - - /** - * Return the first element in an array passing a given truth test. - * - * @param iterable $array - * @param callable|null $callback - * @param mixed $default - * @return mixed - */ - public static function first($array, callable $callback = null, $default = null) - { - if (is_null($callback)) { - if (empty($array)) { - return value($default); - } - - foreach ($array as $item) { - return $item; - } - } - - foreach ($array as $key => $value) { - if ($callback($value, $key)) { - return $value; - } - } - - return value($default); - } - - /** - * Return the last element in an array passing a given truth test. - * - * @param array $array - * @param callable|null $callback - * @param mixed $default - * @return mixed - */ - public static function last($array, callable $callback = null, $default = null) - { - if (is_null($callback)) { - return empty($array) ? value($default) : end($array); - } - - return static::first(array_reverse($array, true), $callback, $default); - } - - /** - * Flatten a multi-dimensional array into a single level. - * - * @param iterable $array - * @param int $depth - * @return array - */ - public static function flatten($array, $depth = INF) - { - $result = []; - - foreach ($array as $item) { - $item = $item instanceof Collection ? $item->all() : $item; - - if (! is_array($item)) { - $result[] = $item; - } else { - $values = $depth === 1 - ? array_values($item) - : static::flatten($item, $depth - 1); - - foreach ($values as $value) { - $result[] = $value; - } - } - } - - return $result; - } - - /** - * Remove one or many array items from a given array using "dot" notation. - * - * @param array $array - * @param array|string|int|float $keys - * @return void - */ - public static function forget(&$array, $keys) - { - $original = &$array; - - $keys = (array) $keys; - - if (count($keys) === 0) { - return; - } - - foreach ($keys as $key) { - // if the exact key exists in the top-level, remove it - if (static::exists($array, $key)) { - unset($array[$key]); - - continue; - } - - $parts = explode('.', $key); - - // clean up before each pass - $array = &$original; - - while (count($parts) > 1) { - $part = array_shift($parts); - - if (isset($array[$part]) && static::accessible($array[$part])) { - $array = &$array[$part]; - } else { - continue 2; - } - } - - unset($array[array_shift($parts)]); - } - } - - /** - * Get an item from an array using "dot" notation. - * - * @param \ArrayAccess|array $array - * @param string|int|null $key - * @param mixed $default - * @return mixed - */ - public static function get($array, $key, $default = null) - { - if (! static::accessible($array)) { - return value($default); - } - - if (is_null($key)) { - return $array; - } - - if (static::exists($array, $key)) { - return $array[$key]; - } - - if (! str_contains($key, '.')) { - return $array[$key] ?? value($default); - } - - foreach (explode('.', $key) as $segment) { - if (static::accessible($array) && static::exists($array, $segment)) { - $array = $array[$segment]; - } else { - return value($default); - } - } - - return $array; - } - - /** - * Check if an item or items exist in an array using "dot" notation. - * - * @param \ArrayAccess|array $array - * @param string|array $keys - * @return bool - */ - public static function has($array, $keys) - { - $keys = (array) $keys; - - if (! $array || $keys === []) { - return false; - } - - foreach ($keys as $key) { - $subKeyArray = $array; - - if (static::exists($array, $key)) { - continue; - } - - foreach (explode('.', $key) as $segment) { - if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) { - $subKeyArray = $subKeyArray[$segment]; - } else { - return false; - } - } - } - - return true; - } - - /** - * Determine if any of the keys exist in an array using "dot" notation. - * - * @param \ArrayAccess|array $array - * @param string|array $keys - * @return bool - */ - public static function hasAny($array, $keys) - { - if (is_null($keys)) { - return false; - } - - $keys = (array) $keys; - - if (! $array) { - return false; - } - - if ($keys === []) { - return false; - } - - foreach ($keys as $key) { - if (static::has($array, $key)) { - return true; - } - } - - return false; - } - - /** - * Determines if an array is associative. - * - * An array is "associative" if it doesn't have sequential numerical keys beginning with zero. - * - * @param array $array - * @return bool - */ - public static function isAssoc(array $array) - { - $keys = array_keys($array); - - return array_keys($keys) !== $keys; - } - - /** - * Determines if an array is a list. - * - * An array is a "list" if all array keys are sequential integers starting from 0 with no gaps in between. - * - * @param array $array - * @return bool - */ - public static function isList($array) - { - return ! self::isAssoc($array); - } - - /** - * Join all items using a string. The final items can use a separate glue string. - * - * @param array $array - * @param string $glue - * @param string $finalGlue - * @return string - */ - public static function join($array, $glue, $finalGlue = '') - { - if ($finalGlue === '') { - return implode($glue, $array); - } - - if (count($array) === 0) { - return ''; - } - - if (count($array) === 1) { - return end($array); - } - - $finalItem = array_pop($array); - - return implode($glue, $array).$finalGlue.$finalItem; - } - - /** - * Key an associative array by a field or using a callback. - * - * @param array $array - * @param callable|array|string $keyBy - * @return array - */ - public static function keyBy($array, $keyBy) - { - return Collection::make($array)->keyBy($keyBy)->all(); - } - - /** - * Prepend the key names of an associative array. - * - * @param array $array - * @param string $prependWith - * @return array - */ - public static function prependKeysWith($array, $prependWith) - { - return Collection::make($array)->mapWithKeys(function ($item, $key) use ($prependWith) { - return [$prependWith.$key => $item]; - })->all(); - } - - /** - * Get a subset of the items from the given array. - * - * @param array $array - * @param array|string $keys - * @return array - */ - public static function only($array, $keys) - { - return array_intersect_key($array, array_flip((array) $keys)); - } - - /** - * Pluck an array of values from an array. - * - * @param iterable $array - * @param string|array|int|null $value - * @param string|array|null $key - * @return array - */ - public static function pluck($array, $value, $key = null) - { - $results = []; - - [$value, $key] = static::explodePluckParameters($value, $key); - - foreach ($array as $item) { - $itemValue = data_get($item, $value); - - // If the key is "null", we will just append the value to the array and keep - // looping. Otherwise we will key the array using the value of the key we - // received from the developer. Then we'll return the final array form. - if (is_null($key)) { - $results[] = $itemValue; - } else { - $itemKey = data_get($item, $key); - - if (is_object($itemKey) && method_exists($itemKey, '__toString')) { - $itemKey = (string) $itemKey; - } - - $results[$itemKey] = $itemValue; - } - } - - return $results; - } - - /** - * Explode the "value" and "key" arguments passed to "pluck". - * - * @param string|array $value - * @param string|array|null $key - * @return array - */ - protected static function explodePluckParameters($value, $key) - { - $value = is_string($value) ? explode('.', $value) : $value; - - $key = is_null($key) || is_array($key) ? $key : explode('.', $key); - - return [$value, $key]; - } - - /** - * Run a map over each of the items in the array. - * - * @param array $array - * @param callable $callback - * @return array - */ - public static function map(array $array, callable $callback) - { - $keys = array_keys($array); - - try { - $items = array_map($callback, $array, $keys); - } catch (ArgumentCountError) { - $items = array_map($callback, $array); - } - - return array_combine($keys, $items); - } - - /** - * Push an item onto the beginning of an array. - * - * @param array $array - * @param mixed $value - * @param mixed $key - * @return array - */ - public static function prepend($array, $value, $key = null) - { - if (func_num_args() == 2) { - array_unshift($array, $value); - } else { - $array = [$key => $value] + $array; - } - - return $array; - } - - /** - * Get a value from the array, and remove it. - * - * @param array $array - * @param string|int $key - * @param mixed $default - * @return mixed - */ - public static function pull(&$array, $key, $default = null) - { - $value = static::get($array, $key, $default); - - static::forget($array, $key); - - return $value; - } - - /** - * Convert the array into a query string. - * - * @param array $array - * @return string - */ - public static function query($array) - { - return http_build_query($array, '', '&', PHP_QUERY_RFC3986); - } - - /** - * Get one or a specified number of random values from an array. - * - * @param array $array - * @param int|null $number - * @param bool $preserveKeys - * @return mixed - * - * @throws \InvalidArgumentException - */ - public static function random($array, $number = null, $preserveKeys = false) - { - $requested = is_null($number) ? 1 : $number; - - $count = count($array); - - if ($requested > $count) { - throw new InvalidArgumentException( - "You requested {$requested} items, but there are only {$count} items available." - ); - } - - if (is_null($number)) { - return $array[array_rand($array)]; - } - - if ((int) $number === 0) { - return []; - } - - $keys = array_rand($array, $number); - - $results = []; - - if ($preserveKeys) { - foreach ((array) $keys as $key) { - $results[$key] = $array[$key]; - } - } else { - foreach ((array) $keys as $key) { - $results[] = $array[$key]; - } - } - - return $results; - } - - /** - * Set an array item to a given value using "dot" notation. - * - * If no key is given to the method, the entire array will be replaced. - * - * @param array $array - * @param string|int|null $key - * @param mixed $value - * @return array - */ - public static function set(&$array, $key, $value) - { - if (is_null($key)) { - return $array = $value; - } - - $keys = explode('.', $key); - - foreach ($keys as $i => $key) { - if (count($keys) === 1) { - break; - } - - unset($keys[$i]); - - // If the key doesn't exist at this depth, we will just create an empty array - // to hold the next value, allowing us to create the arrays to hold final - // values at the correct depth. Then we'll keep digging into the array. - if (! isset($array[$key]) || ! is_array($array[$key])) { - $array[$key] = []; - } - - $array = &$array[$key]; - } - - $array[array_shift($keys)] = $value; - - return $array; - } - - /** - * Shuffle the given array and return the result. - * - * @param array $array - * @param int|null $seed - * @return array - */ - public static function shuffle($array, $seed = null) - { - if (is_null($seed)) { - shuffle($array); - } else { - mt_srand($seed); - shuffle($array); - mt_srand(); - } - - return $array; - } - - /** - * Sort the array using the given callback or "dot" notation. - * - * @param array $array - * @param callable|array|string|null $callback - * @return array - */ - public static function sort($array, $callback = null) - { - return Collection::make($array)->sortBy($callback)->all(); - } - - /** - * Sort the array in descending order using the given callback or "dot" notation. - * - * @param array $array - * @param callable|array|string|null $callback - * @return array - */ - public static function sortDesc($array, $callback = null) - { - return Collection::make($array)->sortByDesc($callback)->all(); - } - - /** - * Recursively sort an array by keys and values. - * - * @param array $array - * @param int $options - * @param bool $descending - * @return array - */ - public static function sortRecursive($array, $options = SORT_REGULAR, $descending = false) - { - foreach ($array as &$value) { - if (is_array($value)) { - $value = static::sortRecursive($value, $options, $descending); - } - } - - if (static::isAssoc($array)) { - $descending - ? krsort($array, $options) - : ksort($array, $options); - } else { - $descending - ? rsort($array, $options) - : sort($array, $options); - } - - return $array; - } - - /** - * Conditionally compile classes from an array into a CSS class list. - * - * @param array $array - * @return string - */ - public static function toCssClasses($array) - { - $classList = static::wrap($array); - - $classes = []; - - foreach ($classList as $class => $constraint) { - if (is_numeric($class)) { - $classes[] = $constraint; - } elseif ($constraint) { - $classes[] = $class; - } - } - - return implode(' ', $classes); - } - - /** - * Conditionally compile styles from an array into a style list. - * - * @param array $array - * @return string - */ - public static function toCssStyles($array) - { - $styleList = static::wrap($array); - - $styles = []; - - foreach ($styleList as $class => $constraint) { - if (is_numeric($class)) { - $styles[] = Str::finish($constraint, ';'); - } elseif ($constraint) { - $styles[] = Str::finish($class, ';'); - } - } - - return implode(' ', $styles); - } - - /** - * Filter the array using the given callback. - * - * @param array $array - * @param callable $callback - * @return array - */ - public static function where($array, callable $callback) - { - return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH); - } - - /** - * Filter items where the value is not null. - * - * @param array $array - * @return array - */ - public static function whereNotNull($array) - { - return static::where($array, function ($value) { - return ! is_null($value); - }); - } - - /** - * If the given value is not an array and not null, wrap it in one. - * - * @param mixed $value - * @return array - */ - public static function wrap($value) - { - if (is_null($value)) { - return []; - } - - return is_array($value) ? $value : [$value]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Collections/Collection.php b/framework-9.50.2/src/Illuminate/Collections/Collection.php deleted file mode 100644 index 37aada7..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/Collection.php +++ /dev/null @@ -1,1763 +0,0 @@ - - * @implements \Illuminate\Support\Enumerable - */ -class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerable -{ - /** - * @use \Illuminate\Support\Traits\EnumeratesValues - */ - use EnumeratesValues, Macroable; - - /** - * The items contained in the collection. - * - * @var array - */ - protected $items = []; - - /** - * Create a new collection. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable|null $items - * @return void - */ - public function __construct($items = []) - { - $this->items = $this->getArrayableItems($items); - } - - /** - * Create a collection with the given range. - * - * @param int $from - * @param int $to - * @return static - */ - public static function range($from, $to) - { - return new static(range($from, $to)); - } - - /** - * Get all of the items in the collection. - * - * @return array - */ - public function all() - { - return $this->items; - } - - /** - * Get a lazy collection for the items in this collection. - * - * @return \Illuminate\Support\LazyCollection - */ - public function lazy() - { - return new LazyCollection($this->items); - } - - /** - * Get the average value of a given key. - * - * @param (callable(TValue): float|int)|string|null $callback - * @return float|int|null - */ - public function avg($callback = null) - { - $callback = $this->valueRetriever($callback); - - $items = $this->map(function ($value) use ($callback) { - return $callback($value); - })->filter(function ($value) { - return ! is_null($value); - }); - - if ($count = $items->count()) { - return $items->sum() / $count; - } - } - - /** - * Get the median of a given key. - * - * @param string|array|null $key - * @return float|int|null - */ - public function median($key = null) - { - $values = (isset($key) ? $this->pluck($key) : $this) - ->filter(fn ($item) => ! is_null($item)) - ->sort()->values(); - - $count = $values->count(); - - if ($count === 0) { - return; - } - - $middle = (int) ($count / 2); - - if ($count % 2) { - return $values->get($middle); - } - - return (new static([ - $values->get($middle - 1), $values->get($middle), - ]))->average(); - } - - /** - * Get the mode of a given key. - * - * @param string|array|null $key - * @return array|null - */ - public function mode($key = null) - { - if ($this->count() === 0) { - return; - } - - $collection = isset($key) ? $this->pluck($key) : $this; - - $counts = new static; - - $collection->each(fn ($value) => $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1); - - $sorted = $counts->sort(); - - $highestValue = $sorted->last(); - - return $sorted->filter(fn ($value) => $value == $highestValue) - ->sort()->keys()->all(); - } - - /** - * Collapse the collection of items into a single array. - * - * @return static - */ - public function collapse() - { - return new static(Arr::collapse($this->items)); - } - - /** - * Determine if an item exists in the collection. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function contains($key, $operator = null, $value = null) - { - if (func_num_args() === 1) { - if ($this->useAsCallable($key)) { - $placeholder = new stdClass; - - return $this->first($key, $placeholder) !== $placeholder; - } - - return in_array($key, $this->items); - } - - return $this->contains($this->operatorForWhere(...func_get_args())); - } - - /** - * Determine if an item exists, using strict comparison. - * - * @param (callable(TValue): bool)|TValue|array-key $key - * @param TValue|null $value - * @return bool - */ - public function containsStrict($key, $value = null) - { - if (func_num_args() === 2) { - return $this->contains(fn ($item) => data_get($item, $key) === $value); - } - - if ($this->useAsCallable($key)) { - return ! is_null($this->first($key)); - } - - return in_array($key, $this->items, true); - } - - /** - * Determine if an item is not contained in the collection. - * - * @param mixed $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function doesntContain($key, $operator = null, $value = null) - { - return ! $this->contains(...func_get_args()); - } - - /** - * Cross join with the given lists, returning all possible permutations. - * - * @template TCrossJoinKey - * @template TCrossJoinValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable ...$lists - * @return static> - */ - public function crossJoin(...$lists) - { - return new static(Arr::crossJoin( - $this->items, ...array_map([$this, 'getArrayableItems'], $lists) - )); - } - - /** - * Get the items in the collection that are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diff($items) - { - return new static(array_diff($this->items, $this->getArrayableItems($items))); - } - - /** - * Get the items in the collection that are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TValue, TValue): int $callback - * @return static - */ - public function diffUsing($items, callable $callback) - { - return new static(array_udiff($this->items, $this->getArrayableItems($items), $callback)); - } - - /** - * Get the items in the collection whose keys and values are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diffAssoc($items) - { - return new static(array_diff_assoc($this->items, $this->getArrayableItems($items))); - } - - /** - * Get the items in the collection whose keys and values are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function diffAssocUsing($items, callable $callback) - { - return new static(array_diff_uassoc($this->items, $this->getArrayableItems($items), $callback)); - } - - /** - * Get the items in the collection whose keys are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diffKeys($items) - { - return new static(array_diff_key($this->items, $this->getArrayableItems($items))); - } - - /** - * Get the items in the collection whose keys are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function diffKeysUsing($items, callable $callback) - { - return new static(array_diff_ukey($this->items, $this->getArrayableItems($items), $callback)); - } - - /** - * Retrieve duplicate items from the collection. - * - * @param (callable(TValue): bool)|string|null $callback - * @param bool $strict - * @return static - */ - public function duplicates($callback = null, $strict = false) - { - $items = $this->map($this->valueRetriever($callback)); - - $uniqueItems = $items->unique(null, $strict); - - $compare = $this->duplicateComparator($strict); - - $duplicates = new static; - - foreach ($items as $key => $value) { - if ($uniqueItems->isNotEmpty() && $compare($value, $uniqueItems->first())) { - $uniqueItems->shift(); - } else { - $duplicates[$key] = $value; - } - } - - return $duplicates; - } - - /** - * Retrieve duplicate items from the collection using strict comparison. - * - * @param (callable(TValue): bool)|string|null $callback - * @return static - */ - public function duplicatesStrict($callback = null) - { - return $this->duplicates($callback, true); - } - - /** - * Get the comparison function to detect duplicates. - * - * @param bool $strict - * @return callable(TValue, TValue): bool - */ - protected function duplicateComparator($strict) - { - if ($strict) { - return function ($a, $b) { - return $a === $b; - }; - } - - return function ($a, $b) { - return $a == $b; - }; - } - - /** - * Get all items except for those with the specified keys. - * - * @param \Illuminate\Support\Enumerable|array $keys - * @return static - */ - public function except($keys) - { - if ($keys instanceof Enumerable) { - $keys = $keys->all(); - } elseif (! is_array($keys)) { - $keys = func_get_args(); - } - - return new static(Arr::except($this->items, $keys)); - } - - /** - * Run a filter over each of the items. - * - * @param (callable(TValue, TKey): bool)|null $callback - * @return static - */ - public function filter(callable $callback = null) - { - if ($callback) { - return new static(Arr::where($this->items, $callback)); - } - - return new static(array_filter($this->items)); - } - - /** - * Get the first item from the collection passing the given truth test. - * - * @template TFirstDefault - * - * @param (callable(TValue, TKey): bool)|null $callback - * @param TFirstDefault|(\Closure(): TFirstDefault) $default - * @return TValue|TFirstDefault - */ - public function first(callable $callback = null, $default = null) - { - return Arr::first($this->items, $callback, $default); - } - - /** - * Get a flattened array of the items in the collection. - * - * @param int $depth - * @return static - */ - public function flatten($depth = INF) - { - return new static(Arr::flatten($this->items, $depth)); - } - - /** - * Flip the items in the collection. - * - * @return static - */ - public function flip() - { - return new static(array_flip($this->items)); - } - - /** - * Remove an item from the collection by key. - * - * @param TKey|array $keys - * @return $this - */ - public function forget($keys) - { - foreach ((array) $keys as $key) { - $this->offsetUnset($key); - } - - return $this; - } - - /** - * Get an item from the collection by key. - * - * @template TGetDefault - * - * @param TKey $key - * @param TGetDefault|(\Closure(): TGetDefault) $default - * @return TValue|TGetDefault - */ - public function get($key, $default = null) - { - if (array_key_exists($key, $this->items)) { - return $this->items[$key]; - } - - return value($default); - } - - /** - * Get an item from the collection by key or add it to collection if it does not exist. - * - * @param mixed $key - * @param mixed $value - * @return mixed - */ - public function getOrPut($key, $value) - { - if (array_key_exists($key, $this->items)) { - return $this->items[$key]; - } - - $this->offsetSet($key, $value = value($value)); - - return $value; - } - - /** - * Group an associative array by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|array|string $groupBy - * @param bool $preserveKeys - * @return static> - */ - public function groupBy($groupBy, $preserveKeys = false) - { - if (! $this->useAsCallable($groupBy) && is_array($groupBy)) { - $nextGroups = $groupBy; - - $groupBy = array_shift($nextGroups); - } - - $groupBy = $this->valueRetriever($groupBy); - - $results = []; - - foreach ($this->items as $key => $value) { - $groupKeys = $groupBy($value, $key); - - if (! is_array($groupKeys)) { - $groupKeys = [$groupKeys]; - } - - foreach ($groupKeys as $groupKey) { - $groupKey = match (true) { - is_bool($groupKey) => (int) $groupKey, - $groupKey instanceof \Stringable => (string) $groupKey, - default => $groupKey, - }; - - if (! array_key_exists($groupKey, $results)) { - $results[$groupKey] = new static; - } - - $results[$groupKey]->offsetSet($preserveKeys ? $key : null, $value); - } - } - - $result = new static($results); - - if (! empty($nextGroups)) { - return $result->map->groupBy($nextGroups, $preserveKeys); - } - - return $result; - } - - /** - * Key an associative array by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|array|string $keyBy - * @return static - */ - public function keyBy($keyBy) - { - $keyBy = $this->valueRetriever($keyBy); - - $results = []; - - foreach ($this->items as $key => $item) { - $resolvedKey = $keyBy($item, $key); - - if (is_object($resolvedKey)) { - $resolvedKey = (string) $resolvedKey; - } - - $results[$resolvedKey] = $item; - } - - return new static($results); - } - - /** - * Determine if an item exists in the collection by key. - * - * @param TKey|array $key - * @return bool - */ - public function has($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $value) { - if (! array_key_exists($value, $this->items)) { - return false; - } - } - - return true; - } - - /** - * Determine if any of the keys exist in the collection. - * - * @param mixed $key - * @return bool - */ - public function hasAny($key) - { - if ($this->isEmpty()) { - return false; - } - - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $value) { - if ($this->has($value)) { - return true; - } - } - - return false; - } - - /** - * Concatenate values of a given key as a string. - * - * @param callable|string $value - * @param string|null $glue - * @return string - */ - public function implode($value, $glue = null) - { - if ($this->useAsCallable($value)) { - return implode($glue ?? '', $this->map($value)->all()); - } - - $first = $this->first(); - - if (is_array($first) || (is_object($first) && ! $first instanceof Stringable)) { - return implode($glue ?? '', $this->pluck($value)->all()); - } - - return implode($value ?? '', $this->items); - } - - /** - * Intersect the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function intersect($items) - { - return new static(array_intersect($this->items, $this->getArrayableItems($items))); - } - - /** - * Intersect the collection with the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TValue, TValue): int $callback - * @return static - */ - public function intersectUsing($items, callable $callback) - { - return new static(array_uintersect($this->items, $this->getArrayableItems($items), $callback)); - } - - /** - * Intersect the collection with the given items with additional index check. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function intersectAssoc($items) - { - return new static(array_intersect_assoc($this->items, $this->getArrayableItems($items))); - } - - /** - * Intersect the collection with the given items with additional index check, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TValue, TValue): int $callback - * @return static - */ - public function intersectAssocUsing($items, callable $callback) - { - return new static(array_intersect_uassoc($this->items, $this->getArrayableItems($items), $callback)); - } - - /** - * Intersect the collection with the given items by key. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function intersectByKeys($items) - { - return new static(array_intersect_key( - $this->items, $this->getArrayableItems($items) - )); - } - - /** - * Determine if the collection is empty or not. - * - * @return bool - */ - public function isEmpty() - { - return empty($this->items); - } - - /** - * Determine if the collection contains a single item. - * - * @return bool - */ - public function containsOneItem() - { - return $this->count() === 1; - } - - /** - * Join all items from the collection using a string. The final items can use a separate glue string. - * - * @param string $glue - * @param string $finalGlue - * @return string - */ - public function join($glue, $finalGlue = '') - { - if ($finalGlue === '') { - return $this->implode($glue); - } - - $count = $this->count(); - - if ($count === 0) { - return ''; - } - - if ($count === 1) { - return $this->last(); - } - - $collection = new static($this->items); - - $finalItem = $collection->pop(); - - return $collection->implode($glue).$finalGlue.$finalItem; - } - - /** - * Get the keys of the collection items. - * - * @return static - */ - public function keys() - { - return new static(array_keys($this->items)); - } - - /** - * Get the last item from the collection. - * - * @template TLastDefault - * - * @param (callable(TValue, TKey): bool)|null $callback - * @param TLastDefault|(\Closure(): TLastDefault) $default - * @return TValue|TLastDefault - */ - public function last(callable $callback = null, $default = null) - { - return Arr::last($this->items, $callback, $default); - } - - /** - * Get the values of a given key. - * - * @param string|int|array $value - * @param string|null $key - * @return static - */ - public function pluck($value, $key = null) - { - return new static(Arr::pluck($this->items, $value, $key)); - } - - /** - * Run a map over each of the items. - * - * @template TMapValue - * - * @param callable(TValue, TKey): TMapValue $callback - * @return static - */ - public function map(callable $callback) - { - return new static(Arr::map($this->items, $callback)); - } - - /** - * Run a dictionary map over the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @template TMapToDictionaryKey of array-key - * @template TMapToDictionaryValue - * - * @param callable(TValue, TKey): array $callback - * @return static> - */ - public function mapToDictionary(callable $callback) - { - $dictionary = []; - - foreach ($this->items as $key => $item) { - $pair = $callback($item, $key); - - $key = key($pair); - - $value = reset($pair); - - if (! isset($dictionary[$key])) { - $dictionary[$key] = []; - } - - $dictionary[$key][] = $value; - } - - return new static($dictionary); - } - - /** - * Run an associative map over each of the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @template TMapWithKeysKey of array-key - * @template TMapWithKeysValue - * - * @param callable(TValue, TKey): array $callback - * @return static - */ - public function mapWithKeys(callable $callback) - { - $result = []; - - foreach ($this->items as $key => $value) { - $assoc = $callback($value, $key); - - foreach ($assoc as $mapKey => $mapValue) { - $result[$mapKey] = $mapValue; - } - } - - return new static($result); - } - - /** - * Merge the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function merge($items) - { - return new static(array_merge($this->items, $this->getArrayableItems($items))); - } - - /** - * Recursively merge the collection with the given items. - * - * @template TMergeRecursiveValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function mergeRecursive($items) - { - return new static(array_merge_recursive($this->items, $this->getArrayableItems($items))); - } - - /** - * Create a collection by using this collection for keys and another for its values. - * - * @template TCombineValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function combine($values) - { - return new static(array_combine($this->all(), $this->getArrayableItems($values))); - } - - /** - * Union the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function union($items) - { - return new static($this->items + $this->getArrayableItems($items)); - } - - /** - * Create a new collection consisting of every n-th element. - * - * @param int $step - * @param int $offset - * @return static - */ - public function nth($step, $offset = 0) - { - $new = []; - - $position = 0; - - foreach ($this->slice($offset)->items as $item) { - if ($position % $step === 0) { - $new[] = $item; - } - - $position++; - } - - return new static($new); - } - - /** - * Get the items with the specified keys. - * - * @param \Illuminate\Support\Enumerable|array|string|null $keys - * @return static - */ - public function only($keys) - { - if (is_null($keys)) { - return new static($this->items); - } - - if ($keys instanceof Enumerable) { - $keys = $keys->all(); - } - - $keys = is_array($keys) ? $keys : func_get_args(); - - return new static(Arr::only($this->items, $keys)); - } - - /** - * Get and remove the last N items from the collection. - * - * @param int $count - * @return static|TValue|null - */ - public function pop($count = 1) - { - if ($count === 1) { - return array_pop($this->items); - } - - if ($this->isEmpty()) { - return new static; - } - - $results = []; - - $collectionCount = $this->count(); - - foreach (range(1, min($count, $collectionCount)) as $item) { - array_push($results, array_pop($this->items)); - } - - return new static($results); - } - - /** - * Push an item onto the beginning of the collection. - * - * @param TValue $value - * @param TKey $key - * @return $this - */ - public function prepend($value, $key = null) - { - $this->items = Arr::prepend($this->items, ...func_get_args()); - - return $this; - } - - /** - * Push one or more items onto the end of the collection. - * - * @param TValue ...$values - * @return $this - */ - public function push(...$values) - { - foreach ($values as $value) { - $this->items[] = $value; - } - - return $this; - } - - /** - * Push all of the given items onto the collection. - * - * @param iterable $source - * @return static - */ - public function concat($source) - { - $result = new static($this); - - foreach ($source as $item) { - $result->push($item); - } - - return $result; - } - - /** - * Get and remove an item from the collection. - * - * @template TPullDefault - * - * @param TKey $key - * @param TPullDefault|(\Closure(): TPullDefault) $default - * @return TValue|TPullDefault - */ - public function pull($key, $default = null) - { - return Arr::pull($this->items, $key, $default); - } - - /** - * Put an item in the collection by key. - * - * @param TKey $key - * @param TValue $value - * @return $this - */ - public function put($key, $value) - { - $this->offsetSet($key, $value); - - return $this; - } - - /** - * Get one or a specified number of items randomly from the collection. - * - * @param (callable(self): int)|int|null $number - * @return static|TValue - * - * @throws \InvalidArgumentException - */ - public function random($number = null) - { - if (is_null($number)) { - return Arr::random($this->items); - } - - if (is_callable($number)) { - return new static(Arr::random($this->items, $number($this))); - } - - return new static(Arr::random($this->items, $number)); - } - - /** - * Replace the collection items with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function replace($items) - { - return new static(array_replace($this->items, $this->getArrayableItems($items))); - } - - /** - * Recursively replace the collection items with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function replaceRecursive($items) - { - return new static(array_replace_recursive($this->items, $this->getArrayableItems($items))); - } - - /** - * Reverse items order. - * - * @return static - */ - public function reverse() - { - return new static(array_reverse($this->items, true)); - } - - /** - * Search the collection for a given value and return the corresponding key if successful. - * - * @param TValue|(callable(TValue,TKey): bool) $value - * @param bool $strict - * @return TKey|bool - */ - public function search($value, $strict = false) - { - if (! $this->useAsCallable($value)) { - return array_search($value, $this->items, $strict); - } - - foreach ($this->items as $key => $item) { - if ($value($item, $key)) { - return $key; - } - } - - return false; - } - - /** - * Get and remove the first N items from the collection. - * - * @param int $count - * @return static|TValue|null - */ - public function shift($count = 1) - { - if ($count === 1) { - return array_shift($this->items); - } - - if ($this->isEmpty()) { - return new static; - } - - $results = []; - - $collectionCount = $this->count(); - - foreach (range(1, min($count, $collectionCount)) as $item) { - array_push($results, array_shift($this->items)); - } - - return new static($results); - } - - /** - * Shuffle the items in the collection. - * - * @param int|null $seed - * @return static - */ - public function shuffle($seed = null) - { - return new static(Arr::shuffle($this->items, $seed)); - } - - /** - * Create chunks representing a "sliding window" view of the items in the collection. - * - * @param int $size - * @param int $step - * @return static - */ - public function sliding($size = 2, $step = 1) - { - $chunks = floor(($this->count() - $size) / $step) + 1; - - return static::times($chunks, function ($number) use ($size, $step) { - return $this->slice(($number - 1) * $step, $size); - }); - } - - /** - * Skip the first {$count} items. - * - * @param int $count - * @return static - */ - public function skip($count) - { - return $this->slice($count); - } - - /** - * Skip items in the collection until the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function skipUntil($value) - { - return new static($this->lazy()->skipUntil($value)->all()); - } - - /** - * Skip items in the collection while the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function skipWhile($value) - { - return new static($this->lazy()->skipWhile($value)->all()); - } - - /** - * Slice the underlying collection array. - * - * @param int $offset - * @param int|null $length - * @return static - */ - public function slice($offset, $length = null) - { - return new static(array_slice($this->items, $offset, $length, true)); - } - - /** - * Split a collection into a certain number of groups. - * - * @param int $numberOfGroups - * @return static - */ - public function split($numberOfGroups) - { - if ($this->isEmpty()) { - return new static; - } - - $groups = new static; - - $groupSize = floor($this->count() / $numberOfGroups); - - $remain = $this->count() % $numberOfGroups; - - $start = 0; - - for ($i = 0; $i < $numberOfGroups; $i++) { - $size = $groupSize; - - if ($i < $remain) { - $size++; - } - - if ($size) { - $groups->push(new static(array_slice($this->items, $start, $size))); - - $start += $size; - } - } - - return $groups; - } - - /** - * Split a collection into a certain number of groups, and fill the first groups completely. - * - * @param int $numberOfGroups - * @return static - */ - public function splitIn($numberOfGroups) - { - return $this->chunk(ceil($this->count() / $numberOfGroups)); - } - - /** - * Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception. - * - * @param (callable(TValue, TKey): bool)|string $key - * @param mixed $operator - * @param mixed $value - * @return TValue - * - * @throws \Illuminate\Support\ItemNotFoundException - * @throws \Illuminate\Support\MultipleItemsFoundException - */ - public function sole($key = null, $operator = null, $value = null) - { - $filter = func_num_args() > 1 - ? $this->operatorForWhere(...func_get_args()) - : $key; - - $items = $this->unless($filter == null)->filter($filter); - - $count = $items->count(); - - if ($count === 0) { - throw new ItemNotFoundException; - } - - if ($count > 1) { - throw new MultipleItemsFoundException($count); - } - - return $items->first(); - } - - /** - * Get the first item in the collection but throw an exception if no matching items exist. - * - * @param (callable(TValue, TKey): bool)|string $key - * @param mixed $operator - * @param mixed $value - * @return TValue - * - * @throws \Illuminate\Support\ItemNotFoundException - */ - public function firstOrFail($key = null, $operator = null, $value = null) - { - $filter = func_num_args() > 1 - ? $this->operatorForWhere(...func_get_args()) - : $key; - - $placeholder = new stdClass(); - - $item = $this->first($filter, $placeholder); - - if ($item === $placeholder) { - throw new ItemNotFoundException; - } - - return $item; - } - - /** - * Chunk the collection into chunks of the given size. - * - * @param int $size - * @return static - */ - public function chunk($size) - { - if ($size <= 0) { - return new static; - } - - $chunks = []; - - foreach (array_chunk($this->items, $size, true) as $chunk) { - $chunks[] = new static($chunk); - } - - return new static($chunks); - } - - /** - * Chunk the collection into chunks with a callback. - * - * @param callable(TValue, TKey, static): bool $callback - * @return static> - */ - public function chunkWhile(callable $callback) - { - return new static( - $this->lazy()->chunkWhile($callback)->mapInto(static::class) - ); - } - - /** - * Sort through each item with a callback. - * - * @param (callable(TValue, TValue): int)|null|int $callback - * @return static - */ - public function sort($callback = null) - { - $items = $this->items; - - $callback && is_callable($callback) - ? uasort($items, $callback) - : asort($items, $callback ?? SORT_REGULAR); - - return new static($items); - } - - /** - * Sort items in descending order. - * - * @param int $options - * @return static - */ - public function sortDesc($options = SORT_REGULAR) - { - $items = $this->items; - - arsort($items, $options); - - return new static($items); - } - - /** - * Sort the collection using the given callback. - * - * @param array|(callable(TValue, TKey): mixed)|string $callback - * @param int $options - * @param bool $descending - * @return static - */ - public function sortBy($callback, $options = SORT_REGULAR, $descending = false) - { - if (is_array($callback) && ! is_callable($callback)) { - return $this->sortByMany($callback); - } - - $results = []; - - $callback = $this->valueRetriever($callback); - - // First we will loop through the items and get the comparator from a callback - // function which we were given. Then, we will sort the returned values and - // grab all the corresponding values for the sorted keys from this array. - foreach ($this->items as $key => $value) { - $results[$key] = $callback($value, $key); - } - - $descending ? arsort($results, $options) - : asort($results, $options); - - // Once we have sorted all of the keys in the array, we will loop through them - // and grab the corresponding model so we can set the underlying items list - // to the sorted version. Then we'll just return the collection instance. - foreach (array_keys($results) as $key) { - $results[$key] = $this->items[$key]; - } - - return new static($results); - } - - /** - * Sort the collection using multiple comparisons. - * - * @param array $comparisons - * @return static - */ - protected function sortByMany(array $comparisons = []) - { - $items = $this->items; - - uasort($items, function ($a, $b) use ($comparisons) { - foreach ($comparisons as $comparison) { - $comparison = Arr::wrap($comparison); - - $prop = $comparison[0]; - - $ascending = Arr::get($comparison, 1, true) === true || - Arr::get($comparison, 1, true) === 'asc'; - - if (! is_string($prop) && is_callable($prop)) { - $result = $prop($a, $b); - } else { - $values = [data_get($a, $prop), data_get($b, $prop)]; - - if (! $ascending) { - $values = array_reverse($values); - } - - $result = $values[0] <=> $values[1]; - } - - if ($result === 0) { - continue; - } - - return $result; - } - }); - - return new static($items); - } - - /** - * Sort the collection in descending order using the given callback. - * - * @param array|(callable(TValue, TKey): mixed)|string $callback - * @param int $options - * @return static - */ - public function sortByDesc($callback, $options = SORT_REGULAR) - { - return $this->sortBy($callback, $options, true); - } - - /** - * Sort the collection keys. - * - * @param int $options - * @param bool $descending - * @return static - */ - public function sortKeys($options = SORT_REGULAR, $descending = false) - { - $items = $this->items; - - $descending ? krsort($items, $options) : ksort($items, $options); - - return new static($items); - } - - /** - * Sort the collection keys in descending order. - * - * @param int $options - * @return static - */ - public function sortKeysDesc($options = SORT_REGULAR) - { - return $this->sortKeys($options, true); - } - - /** - * Sort the collection keys using a callback. - * - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function sortKeysUsing(callable $callback) - { - $items = $this->items; - - uksort($items, $callback); - - return new static($items); - } - - /** - * Splice a portion of the underlying collection array. - * - * @param int $offset - * @param int|null $length - * @param array $replacement - * @return static - */ - public function splice($offset, $length = null, $replacement = []) - { - if (func_num_args() === 1) { - return new static(array_splice($this->items, $offset)); - } - - return new static(array_splice($this->items, $offset, $length, $this->getArrayableItems($replacement))); - } - - /** - * Take the first or last {$limit} items. - * - * @param int $limit - * @return static - */ - public function take($limit) - { - if ($limit < 0) { - return $this->slice($limit, abs($limit)); - } - - return $this->slice(0, $limit); - } - - /** - * Take items in the collection until the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function takeUntil($value) - { - return new static($this->lazy()->takeUntil($value)->all()); - } - - /** - * Take items in the collection while the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function takeWhile($value) - { - return new static($this->lazy()->takeWhile($value)->all()); - } - - /** - * Transform each item in the collection using a callback. - * - * @param callable(TValue, TKey): TValue $callback - * @return $this - */ - public function transform(callable $callback) - { - $this->items = $this->map($callback)->all(); - - return $this; - } - - /** - * Convert a flatten "dot" notation array into an expanded array. - * - * @return static - */ - public function undot() - { - return new static(Arr::undot($this->all())); - } - - /** - * Return only unique items from the collection array. - * - * @param (callable(TValue, TKey): mixed)|string|null $key - * @param bool $strict - * @return static - */ - public function unique($key = null, $strict = false) - { - if (is_null($key) && $strict === false) { - return new static(array_unique($this->items, SORT_REGULAR)); - } - - $callback = $this->valueRetriever($key); - - $exists = []; - - return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { - if (in_array($id = $callback($item, $key), $exists, $strict)) { - return true; - } - - $exists[] = $id; - }); - } - - /** - * Reset the keys on the underlying array. - * - * @return static - */ - public function values() - { - return new static(array_values($this->items)); - } - - /** - * Zip the collection together with one or more arrays. - * - * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); - * => [[1, 4], [2, 5], [3, 6]] - * - * @template TZipValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable ...$items - * @return static> - */ - public function zip($items) - { - $arrayableItems = array_map(function ($items) { - return $this->getArrayableItems($items); - }, func_get_args()); - - $params = array_merge([function () { - return new static(func_get_args()); - }, $this->items], $arrayableItems); - - return new static(array_map(...$params)); - } - - /** - * Pad collection to the specified length with a value. - * - * @template TPadValue - * - * @param int $size - * @param TPadValue $value - * @return static - */ - public function pad($size, $value) - { - return new static(array_pad($this->items, $size, $value)); - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->items); - } - - /** - * Count the number of items in the collection. - * - * @return int - */ - public function count(): int - { - return count($this->items); - } - - /** - * Count the number of items in the collection by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|string|null $countBy - * @return static - */ - public function countBy($countBy = null) - { - return new static($this->lazy()->countBy($countBy)->all()); - } - - /** - * Add an item to the collection. - * - * @param TValue $item - * @return $this - */ - public function add($item) - { - $this->items[] = $item; - - return $this; - } - - /** - * Get a base Support collection instance from this collection. - * - * @return \Illuminate\Support\Collection - */ - public function toBase() - { - return new self($this); - } - - /** - * Determine if an item exists at an offset. - * - * @param TKey $key - * @return bool - */ - public function offsetExists($key): bool - { - return isset($this->items[$key]); - } - - /** - * Get an item at a given offset. - * - * @param TKey $key - * @return TValue - */ - public function offsetGet($key): mixed - { - return $this->items[$key]; - } - - /** - * Set the item at a given offset. - * - * @param TKey|null $key - * @param TValue $value - * @return void - */ - public function offsetSet($key, $value): void - { - if (is_null($key)) { - $this->items[] = $value; - } else { - $this->items[$key] = $value; - } - } - - /** - * Unset the item at a given offset. - * - * @param TKey $key - * @return void - */ - public function offsetUnset($key): void - { - unset($this->items[$key]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Collections/Enumerable.php b/framework-9.50.2/src/Illuminate/Collections/Enumerable.php deleted file mode 100644 index cbf0141..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/Enumerable.php +++ /dev/null @@ -1,1258 +0,0 @@ - - * @extends \IteratorAggregate - */ -interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable -{ - /** - * Create a new collection instance if the value isn't one already. - * - * @template TMakeKey of array-key - * @template TMakeValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable|null $items - * @return static - */ - public static function make($items = []); - - /** - * Create a new instance by invoking the callback a given amount of times. - * - * @param int $number - * @param callable|null $callback - * @return static - */ - public static function times($number, callable $callback = null); - - /** - * Create a collection with the given range. - * - * @param int $from - * @param int $to - * @return static - */ - public static function range($from, $to); - - /** - * Wrap the given value in a collection if applicable. - * - * @template TWrapKey of array-key - * @template TWrapValue - * - * @param iterable $value - * @return static - */ - public static function wrap($value); - - /** - * Get the underlying items from the given collection if applicable. - * - * @template TUnwrapKey of array-key - * @template TUnwrapValue - * - * @param array|static $value - * @return array - */ - public static function unwrap($value); - - /** - * Create a new instance with no items. - * - * @return static - */ - public static function empty(); - - /** - * Get all items in the enumerable. - * - * @return array - */ - public function all(); - - /** - * Alias for the "avg" method. - * - * @param (callable(TValue): float|int)|string|null $callback - * @return float|int|null - */ - public function average($callback = null); - - /** - * Get the median of a given key. - * - * @param string|array|null $key - * @return float|int|null - */ - public function median($key = null); - - /** - * Get the mode of a given key. - * - * @param string|array|null $key - * @return array|null - */ - public function mode($key = null); - - /** - * Collapse the items into a single enumerable. - * - * @return static - */ - public function collapse(); - - /** - * Alias for the "contains" method. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function some($key, $operator = null, $value = null); - - /** - * Determine if an item exists, using strict comparison. - * - * @param (callable(TValue): bool)|TValue|array-key $key - * @param TValue|null $value - * @return bool - */ - public function containsStrict($key, $value = null); - - /** - * Get the average value of a given key. - * - * @param (callable(TValue): float|int)|string|null $callback - * @return float|int|null - */ - public function avg($callback = null); - - /** - * Determine if an item exists in the enumerable. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function contains($key, $operator = null, $value = null); - - /** - * Determine if an item is not contained in the collection. - * - * @param mixed $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function doesntContain($key, $operator = null, $value = null); - - /** - * Cross join with the given lists, returning all possible permutations. - * - * @template TCrossJoinKey - * @template TCrossJoinValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable ...$lists - * @return static> - */ - public function crossJoin(...$lists); - - /** - * Dump the collection and end the script. - * - * @param mixed ...$args - * @return never - */ - public function dd(...$args); - - /** - * Dump the collection. - * - * @return $this - */ - public function dump(); - - /** - * Get the items that are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diff($items); - - /** - * Get the items that are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TValue, TValue): int $callback - * @return static - */ - public function diffUsing($items, callable $callback); - - /** - * Get the items whose keys and values are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diffAssoc($items); - - /** - * Get the items whose keys and values are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function diffAssocUsing($items, callable $callback); - - /** - * Get the items whose keys are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diffKeys($items); - - /** - * Get the items whose keys are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function diffKeysUsing($items, callable $callback); - - /** - * Retrieve duplicate items. - * - * @param (callable(TValue): bool)|string|null $callback - * @param bool $strict - * @return static - */ - public function duplicates($callback = null, $strict = false); - - /** - * Retrieve duplicate items using strict comparison. - * - * @param (callable(TValue): bool)|string|null $callback - * @return static - */ - public function duplicatesStrict($callback = null); - - /** - * Execute a callback over each item. - * - * @param callable(TValue, TKey): mixed $callback - * @return $this - */ - public function each(callable $callback); - - /** - * Execute a callback over each nested chunk of items. - * - * @param callable $callback - * @return static - */ - public function eachSpread(callable $callback); - - /** - * Determine if all items pass the given truth test. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function every($key, $operator = null, $value = null); - - /** - * Get all items except for those with the specified keys. - * - * @param \Illuminate\Support\Enumerable|array $keys - * @return static - */ - public function except($keys); - - /** - * Run a filter over each of the items. - * - * @param (callable(TValue): bool)|null $callback - * @return static - */ - public function filter(callable $callback = null); - - /** - * Apply the callback if the given "value" is (or resolves to) truthy. - * - * @template TWhenReturnType as null - * - * @param bool $value - * @param (callable($this): TWhenReturnType)|null $callback - * @param (callable($this): TWhenReturnType)|null $default - * @return $this|TWhenReturnType - */ - public function when($value, callable $callback = null, callable $default = null); - - /** - * Apply the callback if the collection is empty. - * - * @template TWhenEmptyReturnType - * - * @param (callable($this): TWhenEmptyReturnType) $callback - * @param (callable($this): TWhenEmptyReturnType)|null $default - * @return $this|TWhenEmptyReturnType - */ - public function whenEmpty(callable $callback, callable $default = null); - - /** - * Apply the callback if the collection is not empty. - * - * @template TWhenNotEmptyReturnType - * - * @param callable($this): TWhenNotEmptyReturnType $callback - * @param (callable($this): TWhenNotEmptyReturnType)|null $default - * @return $this|TWhenNotEmptyReturnType - */ - public function whenNotEmpty(callable $callback, callable $default = null); - - /** - * Apply the callback if the given "value" is (or resolves to) truthy. - * - * @template TUnlessReturnType - * - * @param bool $value - * @param (callable($this): TUnlessReturnType) $callback - * @param (callable($this): TUnlessReturnType)|null $default - * @return $this|TUnlessReturnType - */ - public function unless($value, callable $callback, callable $default = null); - - /** - * Apply the callback unless the collection is empty. - * - * @template TUnlessEmptyReturnType - * - * @param callable($this): TUnlessEmptyReturnType $callback - * @param (callable($this): TUnlessEmptyReturnType)|null $default - * @return $this|TUnlessEmptyReturnType - */ - public function unlessEmpty(callable $callback, callable $default = null); - - /** - * Apply the callback unless the collection is not empty. - * - * @template TUnlessNotEmptyReturnType - * - * @param callable($this): TUnlessNotEmptyReturnType $callback - * @param (callable($this): TUnlessNotEmptyReturnType)|null $default - * @return $this|TUnlessNotEmptyReturnType - */ - public function unlessNotEmpty(callable $callback, callable $default = null); - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param mixed $operator - * @param mixed $value - * @return static - */ - public function where($key, $operator = null, $value = null); - - /** - * Filter items where the value for the given key is null. - * - * @param string|null $key - * @return static - */ - public function whereNull($key = null); - - /** - * Filter items where the value for the given key is not null. - * - * @param string|null $key - * @return static - */ - public function whereNotNull($key = null); - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param mixed $value - * @return static - */ - public function whereStrict($key, $value); - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @param bool $strict - * @return static - */ - public function whereIn($key, $values, $strict = false); - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function whereInStrict($key, $values); - - /** - * Filter items such that the value of the given key is between the given values. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function whereBetween($key, $values); - - /** - * Filter items such that the value of the given key is not between the given values. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function whereNotBetween($key, $values); - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @param bool $strict - * @return static - */ - public function whereNotIn($key, $values, $strict = false); - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function whereNotInStrict($key, $values); - - /** - * Filter the items, removing any items that don't match the given type(s). - * - * @template TWhereInstanceOf - * - * @param class-string|array> $type - * @return static - */ - public function whereInstanceOf($type); - - /** - * Get the first item from the enumerable passing the given truth test. - * - * @template TFirstDefault - * - * @param (callable(TValue,TKey): bool)|null $callback - * @param TFirstDefault|(\Closure(): TFirstDefault) $default - * @return TValue|TFirstDefault - */ - public function first(callable $callback = null, $default = null); - - /** - * Get the first item by the given key value pair. - * - * @param string $key - * @param mixed $operator - * @param mixed $value - * @return TValue|null - */ - public function firstWhere($key, $operator = null, $value = null); - - /** - * Get a flattened array of the items in the collection. - * - * @param int $depth - * @return static - */ - public function flatten($depth = INF); - - /** - * Flip the values with their keys. - * - * @return static - */ - public function flip(); - - /** - * Get an item from the collection by key. - * - * @template TGetDefault - * - * @param TKey $key - * @param TGetDefault|(\Closure(): TGetDefault) $default - * @return TValue|TGetDefault - */ - public function get($key, $default = null); - - /** - * Group an associative array by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|array|string $groupBy - * @param bool $preserveKeys - * @return static> - */ - public function groupBy($groupBy, $preserveKeys = false); - - /** - * Key an associative array by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|array|string $keyBy - * @return static - */ - public function keyBy($keyBy); - - /** - * Determine if an item exists in the collection by key. - * - * @param TKey|array $key - * @return bool - */ - public function has($key); - - /** - * Determine if any of the keys exist in the collection. - * - * @param mixed $key - * @return bool - */ - public function hasAny($key); - - /** - * Concatenate values of a given key as a string. - * - * @param string $value - * @param string|null $glue - * @return string - */ - public function implode($value, $glue = null); - - /** - * Intersect the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function intersect($items); - - /** - * Intersect the collection with the given items by key. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function intersectByKeys($items); - - /** - * Determine if the collection is empty or not. - * - * @return bool - */ - public function isEmpty(); - - /** - * Determine if the collection is not empty. - * - * @return bool - */ - public function isNotEmpty(); - - /** - * Determine if the collection contains a single item. - * - * @return bool - */ - public function containsOneItem(); - - /** - * Join all items from the collection using a string. The final items can use a separate glue string. - * - * @param string $glue - * @param string $finalGlue - * @return string - */ - public function join($glue, $finalGlue = ''); - - /** - * Get the keys of the collection items. - * - * @return static - */ - public function keys(); - - /** - * Get the last item from the collection. - * - * @template TLastDefault - * - * @param (callable(TValue, TKey): bool)|null $callback - * @param TLastDefault|(\Closure(): TLastDefault) $default - * @return TValue|TLastDefault - */ - public function last(callable $callback = null, $default = null); - - /** - * Run a map over each of the items. - * - * @template TMapValue - * - * @param callable(TValue, TKey): TMapValue $callback - * @return static - */ - public function map(callable $callback); - - /** - * Run a map over each nested chunk of items. - * - * @param callable $callback - * @return static - */ - public function mapSpread(callable $callback); - - /** - * Run a dictionary map over the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @template TMapToDictionaryKey of array-key - * @template TMapToDictionaryValue - * - * @param callable(TValue, TKey): array $callback - * @return static> - */ - public function mapToDictionary(callable $callback); - - /** - * Run a grouping map over the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @template TMapToGroupsKey of array-key - * @template TMapToGroupsValue - * - * @param callable(TValue, TKey): array $callback - * @return static> - */ - public function mapToGroups(callable $callback); - - /** - * Run an associative map over each of the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @template TMapWithKeysKey of array-key - * @template TMapWithKeysValue - * - * @param callable(TValue, TKey): array $callback - * @return static - */ - public function mapWithKeys(callable $callback); - - /** - * Map a collection and flatten the result by a single level. - * - * @template TFlatMapKey of array-key - * @template TFlatMapValue - * - * @param callable(TValue, TKey): (\Illuminate\Support\Collection|array) $callback - * @return static - */ - public function flatMap(callable $callback); - - /** - * Map the values into a new class. - * - * @template TMapIntoValue - * - * @param class-string $class - * @return static - */ - public function mapInto($class); - - /** - * Merge the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function merge($items); - - /** - * Recursively merge the collection with the given items. - * - * @template TMergeRecursiveValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function mergeRecursive($items); - - /** - * Create a collection by using this collection for keys and another for its values. - * - * @template TCombineValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function combine($values); - - /** - * Union the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function union($items); - - /** - * Get the min value of a given key. - * - * @param (callable(TValue):mixed)|string|null $callback - * @return mixed - */ - public function min($callback = null); - - /** - * Get the max value of a given key. - * - * @param (callable(TValue):mixed)|string|null $callback - * @return mixed - */ - public function max($callback = null); - - /** - * Create a new collection consisting of every n-th element. - * - * @param int $step - * @param int $offset - * @return static - */ - public function nth($step, $offset = 0); - - /** - * Get the items with the specified keys. - * - * @param \Illuminate\Support\Enumerable|array|string $keys - * @return static - */ - public function only($keys); - - /** - * "Paginate" the collection by slicing it into a smaller collection. - * - * @param int $page - * @param int $perPage - * @return static - */ - public function forPage($page, $perPage); - - /** - * Partition the collection into two arrays using the given callback or key. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param mixed $operator - * @param mixed $value - * @return static, static> - */ - public function partition($key, $operator = null, $value = null); - - /** - * Push all of the given items onto the collection. - * - * @param iterable $source - * @return static - */ - public function concat($source); - - /** - * Get one or a specified number of items randomly from the collection. - * - * @param int|null $number - * @return static|TValue - * - * @throws \InvalidArgumentException - */ - public function random($number = null); - - /** - * Reduce the collection to a single value. - * - * @template TReduceInitial - * @template TReduceReturnType - * - * @param callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType $callback - * @param TReduceInitial $initial - * @return TReduceReturnType - */ - public function reduce(callable $callback, $initial = null); - - /** - * Reduce the collection to multiple aggregate values. - * - * @param callable $callback - * @param mixed ...$initial - * @return array - * - * @throws \UnexpectedValueException - */ - public function reduceSpread(callable $callback, ...$initial); - - /** - * Replace the collection items with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function replace($items); - - /** - * Recursively replace the collection items with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function replaceRecursive($items); - - /** - * Reverse items order. - * - * @return static - */ - public function reverse(); - - /** - * Search the collection for a given value and return the corresponding key if successful. - * - * @param TValue|callable(TValue,TKey): bool $value - * @param bool $strict - * @return TKey|bool - */ - public function search($value, $strict = false); - - /** - * Shuffle the items in the collection. - * - * @param int|null $seed - * @return static - */ - public function shuffle($seed = null); - - /** - * Create chunks representing a "sliding window" view of the items in the collection. - * - * @param int $size - * @param int $step - * @return static - */ - public function sliding($size = 2, $step = 1); - - /** - * Skip the first {$count} items. - * - * @param int $count - * @return static - */ - public function skip($count); - - /** - * Skip items in the collection until the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function skipUntil($value); - - /** - * Skip items in the collection while the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function skipWhile($value); - - /** - * Get a slice of items from the enumerable. - * - * @param int $offset - * @param int|null $length - * @return static - */ - public function slice($offset, $length = null); - - /** - * Split a collection into a certain number of groups. - * - * @param int $numberOfGroups - * @return static - */ - public function split($numberOfGroups); - - /** - * Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception. - * - * @param (callable(TValue, TKey): bool)|string $key - * @param mixed $operator - * @param mixed $value - * @return TValue - * - * @throws \Illuminate\Support\ItemNotFoundException - * @throws \Illuminate\Support\MultipleItemsFoundException - */ - public function sole($key = null, $operator = null, $value = null); - - /** - * Get the first item in the collection but throw an exception if no matching items exist. - * - * @param (callable(TValue, TKey): bool)|string $key - * @param mixed $operator - * @param mixed $value - * @return TValue - * - * @throws \Illuminate\Support\ItemNotFoundException - */ - public function firstOrFail($key = null, $operator = null, $value = null); - - /** - * Chunk the collection into chunks of the given size. - * - * @param int $size - * @return static - */ - public function chunk($size); - - /** - * Chunk the collection into chunks with a callback. - * - * @param callable(TValue, TKey, static): bool $callback - * @return static> - */ - public function chunkWhile(callable $callback); - - /** - * Split a collection into a certain number of groups, and fill the first groups completely. - * - * @param int $numberOfGroups - * @return static - */ - public function splitIn($numberOfGroups); - - /** - * Sort through each item with a callback. - * - * @param (callable(TValue, TValue): int)|null|int $callback - * @return static - */ - public function sort($callback = null); - - /** - * Sort items in descending order. - * - * @param int $options - * @return static - */ - public function sortDesc($options = SORT_REGULAR); - - /** - * Sort the collection using the given callback. - * - * @param array|(callable(TValue, TKey): mixed)|string $callback - * @param int $options - * @param bool $descending - * @return static - */ - public function sortBy($callback, $options = SORT_REGULAR, $descending = false); - - /** - * Sort the collection in descending order using the given callback. - * - * @param array|(callable(TValue, TKey): mixed)|string $callback - * @param int $options - * @return static - */ - public function sortByDesc($callback, $options = SORT_REGULAR); - - /** - * Sort the collection keys. - * - * @param int $options - * @param bool $descending - * @return static - */ - public function sortKeys($options = SORT_REGULAR, $descending = false); - - /** - * Sort the collection keys in descending order. - * - * @param int $options - * @return static - */ - public function sortKeysDesc($options = SORT_REGULAR); - - /** - * Sort the collection keys using a callback. - * - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function sortKeysUsing(callable $callback); - - /** - * Get the sum of the given values. - * - * @param (callable(TValue): mixed)|string|null $callback - * @return mixed - */ - public function sum($callback = null); - - /** - * Take the first or last {$limit} items. - * - * @param int $limit - * @return static - */ - public function take($limit); - - /** - * Take items in the collection until the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function takeUntil($value); - - /** - * Take items in the collection while the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function takeWhile($value); - - /** - * Pass the collection to the given callback and then return it. - * - * @param callable(TValue): mixed $callback - * @return $this - */ - public function tap(callable $callback); - - /** - * Pass the enumerable to the given callback and return the result. - * - * @template TPipeReturnType - * - * @param callable($this): TPipeReturnType $callback - * @return TPipeReturnType - */ - public function pipe(callable $callback); - - /** - * Pass the collection into a new class. - * - * @param class-string $class - * @return mixed - */ - public function pipeInto($class); - - /** - * Pass the collection through a series of callable pipes and return the result. - * - * @param array $pipes - * @return mixed - */ - public function pipeThrough($pipes); - - /** - * Get the values of a given key. - * - * @param string|array $value - * @param string|null $key - * @return static - */ - public function pluck($value, $key = null); - - /** - * Create a collection of all elements that do not pass a given truth test. - * - * @param (callable(TValue, TKey): bool)|bool|TValue $callback - * @return static - */ - public function reject($callback = true); - - /** - * Convert a flatten "dot" notation array into an expanded array. - * - * @return static - */ - public function undot(); - - /** - * Return only unique items from the collection array. - * - * @param (callable(TValue, TKey): mixed)|string|null $key - * @param bool $strict - * @return static - */ - public function unique($key = null, $strict = false); - - /** - * Return only unique items from the collection array using strict comparison. - * - * @param (callable(TValue, TKey): mixed)|string|null $key - * @return static - */ - public function uniqueStrict($key = null); - - /** - * Reset the keys on the underlying array. - * - * @return static - */ - public function values(); - - /** - * Pad collection to the specified length with a value. - * - * @template TPadValue - * - * @param int $size - * @param TPadValue $value - * @return static - */ - public function pad($size, $value); - - /** - * Get the values iterator. - * - * @return \Traversable - */ - public function getIterator(): Traversable; - - /** - * Count the number of items in the collection. - * - * @return int - */ - public function count(): int; - - /** - * Count the number of items in the collection by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|string|null $countBy - * @return static - */ - public function countBy($countBy = null); - - /** - * Zip the collection together with one or more arrays. - * - * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); - * => [[1, 4], [2, 5], [3, 6]] - * - * @template TZipValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable ...$items - * @return static> - */ - public function zip($items); - - /** - * Collect the values into a collection. - * - * @return \Illuminate\Support\Collection - */ - public function collect(); - - /** - * Get the collection of items as a plain array. - * - * @return array - */ - public function toArray(); - - /** - * Convert the object into something JSON serializable. - * - * @return mixed - */ - public function jsonSerialize(): mixed; - - /** - * Get the collection of items as JSON. - * - * @param int $options - * @return string - */ - public function toJson($options = 0); - - /** - * Get a CachingIterator instance. - * - * @param int $flags - * @return \CachingIterator - */ - public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING); - - /** - * Convert the collection to its string representation. - * - * @return string - */ - public function __toString(); - - /** - * Indicate that the model's string representation should be escaped when __toString is invoked. - * - * @param bool $escape - * @return $this - */ - public function escapeWhenCastingToString($escape = true); - - /** - * Add a method to the list of proxied methods. - * - * @param string $method - * @return void - */ - public static function proxy($method); - - /** - * Dynamically access collection proxies. - * - * @param string $key - * @return mixed - * - * @throws \Exception - */ - public function __get($key); -} diff --git a/framework-9.50.2/src/Illuminate/Collections/HigherOrderCollectionProxy.php b/framework-9.50.2/src/Illuminate/Collections/HigherOrderCollectionProxy.php deleted file mode 100644 index 106356c..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/HigherOrderCollectionProxy.php +++ /dev/null @@ -1,63 +0,0 @@ -method = $method; - $this->collection = $collection; - } - - /** - * Proxy accessing an attribute onto the collection items. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->collection->{$this->method}(function ($value) use ($key) { - return is_array($value) ? $value[$key] : $value->{$key}; - }); - } - - /** - * Proxy a method call onto the collection items. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->collection->{$this->method}(function ($value) use ($method, $parameters) { - return $value->{$method}(...$parameters); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Collections/ItemNotFoundException.php b/framework-9.50.2/src/Illuminate/Collections/ItemNotFoundException.php deleted file mode 100644 index 05a51d9..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/ItemNotFoundException.php +++ /dev/null @@ -1,9 +0,0 @@ - - */ -class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable -{ - /** - * @use \Illuminate\Support\Traits\EnumeratesValues - */ - use EnumeratesValues, Macroable; - - /** - * The source from which to generate items. - * - * @var (Closure(): \Generator)|static|array - */ - public $source; - - /** - * Create a new lazy collection instance. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable|(Closure(): \Generator)|self|array|null $source - * @return void - */ - public function __construct($source = null) - { - if ($source instanceof Closure || $source instanceof self) { - $this->source = $source; - } elseif (is_null($source)) { - $this->source = static::empty(); - } elseif ($source instanceof Generator) { - throw new InvalidArgumentException( - 'Generators should not be passed directly to LazyCollection. Instead, pass a generator function.' - ); - } else { - $this->source = $this->getArrayableItems($source); - } - } - - /** - * Create a new collection instance if the value isn't one already. - * - * @template TMakeKey of array-key - * @template TMakeValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable|(Closure(): \Generator)|self|array|null $items - * @return static - */ - public static function make($items = []) - { - return new static($items); - } - - /** - * Create a collection with the given range. - * - * @param int $from - * @param int $to - * @return static - */ - public static function range($from, $to) - { - return new static(function () use ($from, $to) { - if ($from <= $to) { - for (; $from <= $to; $from++) { - yield $from; - } - } else { - for (; $from >= $to; $from--) { - yield $from; - } - } - }); - } - - /** - * Get all items in the enumerable. - * - * @return array - */ - public function all() - { - if (is_array($this->source)) { - return $this->source; - } - - return iterator_to_array($this->getIterator()); - } - - /** - * Eager load all items into a new lazy collection backed by an array. - * - * @return static - */ - public function eager() - { - return new static($this->all()); - } - - /** - * Cache values as they're enumerated. - * - * @return static - */ - public function remember() - { - $iterator = $this->getIterator(); - - $iteratorIndex = 0; - - $cache = []; - - return new static(function () use ($iterator, &$iteratorIndex, &$cache) { - for ($index = 0; true; $index++) { - if (array_key_exists($index, $cache)) { - yield $cache[$index][0] => $cache[$index][1]; - - continue; - } - - if ($iteratorIndex < $index) { - $iterator->next(); - - $iteratorIndex++; - } - - if (! $iterator->valid()) { - break; - } - - $cache[$index] = [$iterator->key(), $iterator->current()]; - - yield $cache[$index][0] => $cache[$index][1]; - } - }); - } - - /** - * Get the average value of a given key. - * - * @param (callable(TValue): float|int)|string|null $callback - * @return float|int|null - */ - public function avg($callback = null) - { - return $this->collect()->avg($callback); - } - - /** - * Get the median of a given key. - * - * @param string|array|null $key - * @return float|int|null - */ - public function median($key = null) - { - return $this->collect()->median($key); - } - - /** - * Get the mode of a given key. - * - * @param string|array|null $key - * @return array|null - */ - public function mode($key = null) - { - return $this->collect()->mode($key); - } - - /** - * Collapse the collection of items into a single array. - * - * @return static - */ - public function collapse() - { - return new static(function () { - foreach ($this as $values) { - if (is_array($values) || $values instanceof Enumerable) { - foreach ($values as $value) { - yield $value; - } - } - } - }); - } - - /** - * Determine if an item exists in the enumerable. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function contains($key, $operator = null, $value = null) - { - if (func_num_args() === 1 && $this->useAsCallable($key)) { - $placeholder = new stdClass; - - /** @var callable $key */ - return $this->first($key, $placeholder) !== $placeholder; - } - - if (func_num_args() === 1) { - $needle = $key; - - foreach ($this as $value) { - if ($value == $needle) { - return true; - } - } - - return false; - } - - return $this->contains($this->operatorForWhere(...func_get_args())); - } - - /** - * Determine if an item exists, using strict comparison. - * - * @param (callable(TValue): bool)|TValue|array-key $key - * @param TValue|null $value - * @return bool - */ - public function containsStrict($key, $value = null) - { - if (func_num_args() === 2) { - return $this->contains(fn ($item) => data_get($item, $key) === $value); - } - - if ($this->useAsCallable($key)) { - return ! is_null($this->first($key)); - } - - foreach ($this as $item) { - if ($item === $key) { - return true; - } - } - - return false; - } - - /** - * Determine if an item is not contained in the enumerable. - * - * @param mixed $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function doesntContain($key, $operator = null, $value = null) - { - return ! $this->contains(...func_get_args()); - } - - /** - * Cross join the given iterables, returning all possible permutations. - * - * @template TCrossJoinKey - * @template TCrossJoinValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable ...$arrays - * @return static> - */ - public function crossJoin(...$arrays) - { - return $this->passthru('crossJoin', func_get_args()); - } - - /** - * Count the number of items in the collection by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|string|null $countBy - * @return static - */ - public function countBy($countBy = null) - { - $countBy = is_null($countBy) - ? $this->identity() - : $this->valueRetriever($countBy); - - return new static(function () use ($countBy) { - $counts = []; - - foreach ($this as $key => $value) { - $group = $countBy($value, $key); - - if (empty($counts[$group])) { - $counts[$group] = 0; - } - - $counts[$group]++; - } - - yield from $counts; - }); - } - - /** - * Get the items that are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diff($items) - { - return $this->passthru('diff', func_get_args()); - } - - /** - * Get the items that are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TValue, TValue): int $callback - * @return static - */ - public function diffUsing($items, callable $callback) - { - return $this->passthru('diffUsing', func_get_args()); - } - - /** - * Get the items whose keys and values are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diffAssoc($items) - { - return $this->passthru('diffAssoc', func_get_args()); - } - - /** - * Get the items whose keys and values are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function diffAssocUsing($items, callable $callback) - { - return $this->passthru('diffAssocUsing', func_get_args()); - } - - /** - * Get the items whose keys are not present in the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function diffKeys($items) - { - return $this->passthru('diffKeys', func_get_args()); - } - - /** - * Get the items whose keys are not present in the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function diffKeysUsing($items, callable $callback) - { - return $this->passthru('diffKeysUsing', func_get_args()); - } - - /** - * Retrieve duplicate items. - * - * @param (callable(TValue): bool)|string|null $callback - * @param bool $strict - * @return static - */ - public function duplicates($callback = null, $strict = false) - { - return $this->passthru('duplicates', func_get_args()); - } - - /** - * Retrieve duplicate items using strict comparison. - * - * @param (callable(TValue): bool)|string|null $callback - * @return static - */ - public function duplicatesStrict($callback = null) - { - return $this->passthru('duplicatesStrict', func_get_args()); - } - - /** - * Get all items except for those with the specified keys. - * - * @param \Illuminate\Support\Enumerable|array $keys - * @return static - */ - public function except($keys) - { - return $this->passthru('except', func_get_args()); - } - - /** - * Run a filter over each of the items. - * - * @param (callable(TValue, TKey): bool)|null $callback - * @return static - */ - public function filter(callable $callback = null) - { - if (is_null($callback)) { - $callback = function ($value) { - return (bool) $value; - }; - } - - return new static(function () use ($callback) { - foreach ($this as $key => $value) { - if ($callback($value, $key)) { - yield $key => $value; - } - } - }); - } - - /** - * Get the first item from the enumerable passing the given truth test. - * - * @template TFirstDefault - * - * @param (callable(TValue): bool)|null $callback - * @param TFirstDefault|(\Closure(): TFirstDefault) $default - * @return TValue|TFirstDefault - */ - public function first(callable $callback = null, $default = null) - { - $iterator = $this->getIterator(); - - if (is_null($callback)) { - if (! $iterator->valid()) { - return value($default); - } - - return $iterator->current(); - } - - foreach ($iterator as $key => $value) { - if ($callback($value, $key)) { - return $value; - } - } - - return value($default); - } - - /** - * Get a flattened list of the items in the collection. - * - * @param int $depth - * @return static - */ - public function flatten($depth = INF) - { - $instance = new static(function () use ($depth) { - foreach ($this as $item) { - if (! is_array($item) && ! $item instanceof Enumerable) { - yield $item; - } elseif ($depth === 1) { - yield from $item; - } else { - yield from (new static($item))->flatten($depth - 1); - } - } - }); - - return $instance->values(); - } - - /** - * Flip the items in the collection. - * - * @return static - */ - public function flip() - { - return new static(function () { - foreach ($this as $key => $value) { - yield $value => $key; - } - }); - } - - /** - * Get an item by key. - * - * @template TGetDefault - * - * @param TKey|null $key - * @param TGetDefault|(\Closure(): TGetDefault) $default - * @return TValue|TGetDefault - */ - public function get($key, $default = null) - { - if (is_null($key)) { - return; - } - - foreach ($this as $outerKey => $outerValue) { - if ($outerKey == $key) { - return $outerValue; - } - } - - return value($default); - } - - /** - * Group an associative array by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|array|string $groupBy - * @param bool $preserveKeys - * @return static> - */ - public function groupBy($groupBy, $preserveKeys = false) - { - return $this->passthru('groupBy', func_get_args()); - } - - /** - * Key an associative array by a field or using a callback. - * - * @param (callable(TValue, TKey): array-key)|array|string $keyBy - * @return static - */ - public function keyBy($keyBy) - { - return new static(function () use ($keyBy) { - $keyBy = $this->valueRetriever($keyBy); - - foreach ($this as $key => $item) { - $resolvedKey = $keyBy($item, $key); - - if (is_object($resolvedKey)) { - $resolvedKey = (string) $resolvedKey; - } - - yield $resolvedKey => $item; - } - }); - } - - /** - * Determine if an item exists in the collection by key. - * - * @param mixed $key - * @return bool - */ - public function has($key) - { - $keys = array_flip(is_array($key) ? $key : func_get_args()); - $count = count($keys); - - foreach ($this as $key => $value) { - if (array_key_exists($key, $keys) && --$count == 0) { - return true; - } - } - - return false; - } - - /** - * Determine if any of the keys exist in the collection. - * - * @param mixed $key - * @return bool - */ - public function hasAny($key) - { - $keys = array_flip(is_array($key) ? $key : func_get_args()); - - foreach ($this as $key => $value) { - if (array_key_exists($key, $keys)) { - return true; - } - } - - return false; - } - - /** - * Concatenate values of a given key as a string. - * - * @param callable|string $value - * @param string|null $glue - * @return string - */ - public function implode($value, $glue = null) - { - return $this->collect()->implode(...func_get_args()); - } - - /** - * Intersect the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function intersect($items) - { - return $this->passthru('intersect', func_get_args()); - } - - /** - * Intersect the collection with the given items, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TValue, TValue): int $callback - * @return static - */ - public function intersectUsing() - { - return $this->passthru('intersectUsing', func_get_args()); - } - - /** - * Intersect the collection with the given items with additional index check. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function intersectAssoc($items) - { - return $this->passthru('intersectAssoc', func_get_args()); - } - - /** - * Intersect the collection with the given items with additional index check, using the callback. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @param callable(TValue, TValue): int $callback - * @return static - */ - public function intersectAssocUsing($items, callable $callback) - { - return $this->passthru('intersectAssocUsing', func_get_args()); - } - - /** - * Intersect the collection with the given items by key. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function intersectByKeys($items) - { - return $this->passthru('intersectByKeys', func_get_args()); - } - - /** - * Determine if the items are empty or not. - * - * @return bool - */ - public function isEmpty() - { - return ! $this->getIterator()->valid(); - } - - /** - * Determine if the collection contains a single item. - * - * @return bool - */ - public function containsOneItem() - { - return $this->take(2)->count() === 1; - } - - /** - * Join all items from the collection using a string. The final items can use a separate glue string. - * - * @param string $glue - * @param string $finalGlue - * @return string - */ - public function join($glue, $finalGlue = '') - { - return $this->collect()->join(...func_get_args()); - } - - /** - * Get the keys of the collection items. - * - * @return static - */ - public function keys() - { - return new static(function () { - foreach ($this as $key => $value) { - yield $key; - } - }); - } - - /** - * Get the last item from the collection. - * - * @template TLastDefault - * - * @param (callable(TValue, TKey): bool)|null $callback - * @param TLastDefault|(\Closure(): TLastDefault) $default - * @return TValue|TLastDefault - */ - public function last(callable $callback = null, $default = null) - { - $needle = $placeholder = new stdClass; - - foreach ($this as $key => $value) { - if (is_null($callback) || $callback($value, $key)) { - $needle = $value; - } - } - - return $needle === $placeholder ? value($default) : $needle; - } - - /** - * Get the values of a given key. - * - * @param string|array $value - * @param string|null $key - * @return static - */ - public function pluck($value, $key = null) - { - return new static(function () use ($value, $key) { - [$value, $key] = $this->explodePluckParameters($value, $key); - - foreach ($this as $item) { - $itemValue = data_get($item, $value); - - if (is_null($key)) { - yield $itemValue; - } else { - $itemKey = data_get($item, $key); - - if (is_object($itemKey) && method_exists($itemKey, '__toString')) { - $itemKey = (string) $itemKey; - } - - yield $itemKey => $itemValue; - } - } - }); - } - - /** - * Run a map over each of the items. - * - * @template TMapValue - * - * @param callable(TValue, TKey): TMapValue $callback - * @return static - */ - public function map(callable $callback) - { - return new static(function () use ($callback) { - foreach ($this as $key => $value) { - yield $key => $callback($value, $key); - } - }); - } - - /** - * Run a dictionary map over the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @template TMapToDictionaryKey of array-key - * @template TMapToDictionaryValue - * - * @param callable(TValue, TKey): array $callback - * @return static> - */ - public function mapToDictionary(callable $callback) - { - return $this->passthru('mapToDictionary', func_get_args()); - } - - /** - * Run an associative map over each of the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @template TMapWithKeysKey of array-key - * @template TMapWithKeysValue - * - * @param callable(TValue, TKey): array $callback - * @return static - */ - public function mapWithKeys(callable $callback) - { - return new static(function () use ($callback) { - foreach ($this as $key => $value) { - yield from $callback($value, $key); - } - }); - } - - /** - * Merge the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function merge($items) - { - return $this->passthru('merge', func_get_args()); - } - - /** - * Recursively merge the collection with the given items. - * - * @template TMergeRecursiveValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function mergeRecursive($items) - { - return $this->passthru('mergeRecursive', func_get_args()); - } - - /** - * Create a collection by using this collection for keys and another for its values. - * - * @template TCombineValue - * - * @param \IteratorAggregate|array|(callable(): \Generator) $values - * @return static - */ - public function combine($values) - { - return new static(function () use ($values) { - $values = $this->makeIterator($values); - - $errorMessage = 'Both parameters should have an equal number of elements'; - - foreach ($this as $key) { - if (! $values->valid()) { - trigger_error($errorMessage, E_USER_WARNING); - - break; - } - - yield $key => $values->current(); - - $values->next(); - } - - if ($values->valid()) { - trigger_error($errorMessage, E_USER_WARNING); - } - }); - } - - /** - * Union the collection with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function union($items) - { - return $this->passthru('union', func_get_args()); - } - - /** - * Create a new collection consisting of every n-th element. - * - * @param int $step - * @param int $offset - * @return static - */ - public function nth($step, $offset = 0) - { - return new static(function () use ($step, $offset) { - $position = 0; - - foreach ($this->slice($offset) as $item) { - if ($position % $step === 0) { - yield $item; - } - - $position++; - } - }); - } - - /** - * Get the items with the specified keys. - * - * @param \Illuminate\Support\Enumerable|array|string $keys - * @return static - */ - public function only($keys) - { - if ($keys instanceof Enumerable) { - $keys = $keys->all(); - } elseif (! is_null($keys)) { - $keys = is_array($keys) ? $keys : func_get_args(); - } - - return new static(function () use ($keys) { - if (is_null($keys)) { - yield from $this; - } else { - $keys = array_flip($keys); - - foreach ($this as $key => $value) { - if (array_key_exists($key, $keys)) { - yield $key => $value; - - unset($keys[$key]); - - if (empty($keys)) { - break; - } - } - } - } - }); - } - - /** - * Push all of the given items onto the collection. - * - * @param iterable $source - * @return static - */ - public function concat($source) - { - return (new static(function () use ($source) { - yield from $this; - yield from $source; - }))->values(); - } - - /** - * Get one or a specified number of items randomly from the collection. - * - * @param int|null $number - * @return static|TValue - * - * @throws \InvalidArgumentException - */ - public function random($number = null) - { - $result = $this->collect()->random(...func_get_args()); - - return is_null($number) ? $result : new static($result); - } - - /** - * Replace the collection items with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function replace($items) - { - return new static(function () use ($items) { - $items = $this->getArrayableItems($items); - - foreach ($this as $key => $value) { - if (array_key_exists($key, $items)) { - yield $key => $items[$key]; - - unset($items[$key]); - } else { - yield $key => $value; - } - } - - foreach ($items as $key => $value) { - yield $key => $value; - } - }); - } - - /** - * Recursively replace the collection items with the given items. - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable $items - * @return static - */ - public function replaceRecursive($items) - { - return $this->passthru('replaceRecursive', func_get_args()); - } - - /** - * Reverse items order. - * - * @return static - */ - public function reverse() - { - return $this->passthru('reverse', func_get_args()); - } - - /** - * Search the collection for a given value and return the corresponding key if successful. - * - * @param TValue|(callable(TValue,TKey): bool) $value - * @param bool $strict - * @return TKey|bool - */ - public function search($value, $strict = false) - { - /** @var (callable(TValue,TKey): bool) $predicate */ - $predicate = $this->useAsCallable($value) - ? $value - : function ($item) use ($value, $strict) { - return $strict ? $item === $value : $item == $value; - }; - - foreach ($this as $key => $item) { - if ($predicate($item, $key)) { - return $key; - } - } - - return false; - } - - /** - * Shuffle the items in the collection. - * - * @param int|null $seed - * @return static - */ - public function shuffle($seed = null) - { - return $this->passthru('shuffle', func_get_args()); - } - - /** - * Create chunks representing a "sliding window" view of the items in the collection. - * - * @param int $size - * @param int $step - * @return static - */ - public function sliding($size = 2, $step = 1) - { - return new static(function () use ($size, $step) { - $iterator = $this->getIterator(); - - $chunk = []; - - while ($iterator->valid()) { - $chunk[$iterator->key()] = $iterator->current(); - - if (count($chunk) == $size) { - yield (new static($chunk))->tap(function () use (&$chunk, $step) { - $chunk = array_slice($chunk, $step, null, true); - }); - - // If the $step between chunks is bigger than each chunk's $size - // we will skip the extra items (which should never be in any - // chunk) before we continue to the next chunk in the loop. - if ($step > $size) { - $skip = $step - $size; - - for ($i = 0; $i < $skip && $iterator->valid(); $i++) { - $iterator->next(); - } - } - } - - $iterator->next(); - } - }); - } - - /** - * Skip the first {$count} items. - * - * @param int $count - * @return static - */ - public function skip($count) - { - return new static(function () use ($count) { - $iterator = $this->getIterator(); - - while ($iterator->valid() && $count--) { - $iterator->next(); - } - - while ($iterator->valid()) { - yield $iterator->key() => $iterator->current(); - - $iterator->next(); - } - }); - } - - /** - * Skip items in the collection until the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function skipUntil($value) - { - $callback = $this->useAsCallable($value) ? $value : $this->equality($value); - - return $this->skipWhile($this->negate($callback)); - } - - /** - * Skip items in the collection while the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function skipWhile($value) - { - $callback = $this->useAsCallable($value) ? $value : $this->equality($value); - - return new static(function () use ($callback) { - $iterator = $this->getIterator(); - - while ($iterator->valid() && $callback($iterator->current(), $iterator->key())) { - $iterator->next(); - } - - while ($iterator->valid()) { - yield $iterator->key() => $iterator->current(); - - $iterator->next(); - } - }); - } - - /** - * Get a slice of items from the enumerable. - * - * @param int $offset - * @param int|null $length - * @return static - */ - public function slice($offset, $length = null) - { - if ($offset < 0 || $length < 0) { - return $this->passthru('slice', func_get_args()); - } - - $instance = $this->skip($offset); - - return is_null($length) ? $instance : $instance->take($length); - } - - /** - * Split a collection into a certain number of groups. - * - * @param int $numberOfGroups - * @return static - */ - public function split($numberOfGroups) - { - return $this->passthru('split', func_get_args()); - } - - /** - * Get the first item in the collection, but only if exactly one item exists. Otherwise, throw an exception. - * - * @param (callable(TValue, TKey): bool)|string $key - * @param mixed $operator - * @param mixed $value - * @return TValue - * - * @throws \Illuminate\Support\ItemNotFoundException - * @throws \Illuminate\Support\MultipleItemsFoundException - */ - public function sole($key = null, $operator = null, $value = null) - { - $filter = func_num_args() > 1 - ? $this->operatorForWhere(...func_get_args()) - : $key; - - return $this - ->unless($filter == null) - ->filter($filter) - ->take(2) - ->collect() - ->sole(); - } - - /** - * Get the first item in the collection but throw an exception if no matching items exist. - * - * @param (callable(TValue, TKey): bool)|string $key - * @param mixed $operator - * @param mixed $value - * @return TValue - * - * @throws \Illuminate\Support\ItemNotFoundException - */ - public function firstOrFail($key = null, $operator = null, $value = null) - { - $filter = func_num_args() > 1 - ? $this->operatorForWhere(...func_get_args()) - : $key; - - return $this - ->unless($filter == null) - ->filter($filter) - ->take(1) - ->collect() - ->firstOrFail(); - } - - /** - * Chunk the collection into chunks of the given size. - * - * @param int $size - * @return static - */ - public function chunk($size) - { - if ($size <= 0) { - return static::empty(); - } - - return new static(function () use ($size) { - $iterator = $this->getIterator(); - - while ($iterator->valid()) { - $chunk = []; - - while (true) { - $chunk[$iterator->key()] = $iterator->current(); - - if (count($chunk) < $size) { - $iterator->next(); - - if (! $iterator->valid()) { - break; - } - } else { - break; - } - } - - yield new static($chunk); - - $iterator->next(); - } - }); - } - - /** - * Split a collection into a certain number of groups, and fill the first groups completely. - * - * @param int $numberOfGroups - * @return static - */ - public function splitIn($numberOfGroups) - { - return $this->chunk(ceil($this->count() / $numberOfGroups)); - } - - /** - * Chunk the collection into chunks with a callback. - * - * @param callable(TValue, TKey, Collection): bool $callback - * @return static> - */ - public function chunkWhile(callable $callback) - { - return new static(function () use ($callback) { - $iterator = $this->getIterator(); - - $chunk = new Collection; - - if ($iterator->valid()) { - $chunk[$iterator->key()] = $iterator->current(); - - $iterator->next(); - } - - while ($iterator->valid()) { - if (! $callback($iterator->current(), $iterator->key(), $chunk)) { - yield new static($chunk); - - $chunk = new Collection; - } - - $chunk[$iterator->key()] = $iterator->current(); - - $iterator->next(); - } - - if ($chunk->isNotEmpty()) { - yield new static($chunk); - } - }); - } - - /** - * Sort through each item with a callback. - * - * @param (callable(TValue, TValue): int)|null|int $callback - * @return static - */ - public function sort($callback = null) - { - return $this->passthru('sort', func_get_args()); - } - - /** - * Sort items in descending order. - * - * @param int $options - * @return static - */ - public function sortDesc($options = SORT_REGULAR) - { - return $this->passthru('sortDesc', func_get_args()); - } - - /** - * Sort the collection using the given callback. - * - * @param array|(callable(TValue, TKey): mixed)|string $callback - * @param int $options - * @param bool $descending - * @return static - */ - public function sortBy($callback, $options = SORT_REGULAR, $descending = false) - { - return $this->passthru('sortBy', func_get_args()); - } - - /** - * Sort the collection in descending order using the given callback. - * - * @param array|(callable(TValue, TKey): mixed)|string $callback - * @param int $options - * @return static - */ - public function sortByDesc($callback, $options = SORT_REGULAR) - { - return $this->passthru('sortByDesc', func_get_args()); - } - - /** - * Sort the collection keys. - * - * @param int $options - * @param bool $descending - * @return static - */ - public function sortKeys($options = SORT_REGULAR, $descending = false) - { - return $this->passthru('sortKeys', func_get_args()); - } - - /** - * Sort the collection keys in descending order. - * - * @param int $options - * @return static - */ - public function sortKeysDesc($options = SORT_REGULAR) - { - return $this->passthru('sortKeysDesc', func_get_args()); - } - - /** - * Sort the collection keys using a callback. - * - * @param callable(TKey, TKey): int $callback - * @return static - */ - public function sortKeysUsing(callable $callback) - { - return $this->passthru('sortKeysUsing', func_get_args()); - } - - /** - * Take the first or last {$limit} items. - * - * @param int $limit - * @return static - */ - public function take($limit) - { - if ($limit < 0) { - return $this->passthru('take', func_get_args()); - } - - return new static(function () use ($limit) { - $iterator = $this->getIterator(); - - while ($limit--) { - if (! $iterator->valid()) { - break; - } - - yield $iterator->key() => $iterator->current(); - - if ($limit) { - $iterator->next(); - } - } - }); - } - - /** - * Take items in the collection until the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function takeUntil($value) - { - /** @var callable(TValue, TKey): bool $callback */ - $callback = $this->useAsCallable($value) ? $value : $this->equality($value); - - return new static(function () use ($callback) { - foreach ($this as $key => $item) { - if ($callback($item, $key)) { - break; - } - - yield $key => $item; - } - }); - } - - /** - * Take items in the collection until a given point in time. - * - * @param \DateTimeInterface $timeout - * @return static - */ - public function takeUntilTimeout(DateTimeInterface $timeout) - { - $timeout = $timeout->getTimestamp(); - - return new static(function () use ($timeout) { - if ($this->now() >= $timeout) { - return; - } - - foreach ($this as $key => $value) { - yield $key => $value; - - if ($this->now() >= $timeout) { - break; - } - } - }); - } - - /** - * Take items in the collection while the given condition is met. - * - * @param TValue|callable(TValue,TKey): bool $value - * @return static - */ - public function takeWhile($value) - { - /** @var callable(TValue, TKey): bool $callback */ - $callback = $this->useAsCallable($value) ? $value : $this->equality($value); - - return $this->takeUntil(function ($item, $key) use ($callback) { - return ! $callback($item, $key); - }); - } - - /** - * Pass each item in the collection to the given callback, lazily. - * - * @param callable(TValue, TKey): mixed $callback - * @return static - */ - public function tapEach(callable $callback) - { - return new static(function () use ($callback) { - foreach ($this as $key => $value) { - $callback($value, $key); - - yield $key => $value; - } - }); - } - - /** - * Convert a flatten "dot" notation array into an expanded array. - * - * @return static - */ - public function undot() - { - return $this->passthru('undot', []); - } - - /** - * Return only unique items from the collection array. - * - * @param (callable(TValue, TKey): mixed)|string|null $key - * @param bool $strict - * @return static - */ - public function unique($key = null, $strict = false) - { - $callback = $this->valueRetriever($key); - - return new static(function () use ($callback, $strict) { - $exists = []; - - foreach ($this as $key => $item) { - if (! in_array($id = $callback($item, $key), $exists, $strict)) { - yield $key => $item; - - $exists[] = $id; - } - } - }); - } - - /** - * Reset the keys on the underlying array. - * - * @return static - */ - public function values() - { - return new static(function () { - foreach ($this as $item) { - yield $item; - } - }); - } - - /** - * Zip the collection together with one or more arrays. - * - * e.g. new LazyCollection([1, 2, 3])->zip([4, 5, 6]); - * => [[1, 4], [2, 5], [3, 6]] - * - * @template TZipValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable ...$items - * @return static> - */ - public function zip($items) - { - $iterables = func_get_args(); - - return new static(function () use ($iterables) { - $iterators = Collection::make($iterables)->map(function ($iterable) { - return $this->makeIterator($iterable); - })->prepend($this->getIterator()); - - while ($iterators->contains->valid()) { - yield new static($iterators->map->current()); - - $iterators->each->next(); - } - }); - } - - /** - * Pad collection to the specified length with a value. - * - * @template TPadValue - * - * @param int $size - * @param TPadValue $value - * @return static - */ - public function pad($size, $value) - { - if ($size < 0) { - return $this->passthru('pad', func_get_args()); - } - - return new static(function () use ($size, $value) { - $yielded = 0; - - foreach ($this as $index => $item) { - yield $index => $item; - - $yielded++; - } - - while ($yielded++ < $size) { - yield $value; - } - }); - } - - /** - * Get the values iterator. - * - * @return \Traversable - */ - public function getIterator(): Traversable - { - return $this->makeIterator($this->source); - } - - /** - * Count the number of items in the collection. - * - * @return int - */ - public function count(): int - { - if (is_array($this->source)) { - return count($this->source); - } - - return iterator_count($this->getIterator()); - } - - /** - * Make an iterator from the given source. - * - * @template TIteratorKey of array-key - * @template TIteratorValue - * - * @param \IteratorAggregate|array|(callable(): \Generator) $source - * @return \Traversable - */ - protected function makeIterator($source) - { - if ($source instanceof IteratorAggregate) { - return $source->getIterator(); - } - - if (is_array($source)) { - return new ArrayIterator($source); - } - - if (is_callable($source)) { - $maybeTraversable = $source(); - - return $maybeTraversable instanceof Traversable - ? $maybeTraversable - : new ArrayIterator(Arr::wrap($maybeTraversable)); - } - - return new ArrayIterator((array) $source); - } - - /** - * Explode the "value" and "key" arguments passed to "pluck". - * - * @param string|string[] $value - * @param string|string[]|null $key - * @return array{string[],string[]|null} - */ - protected function explodePluckParameters($value, $key) - { - $value = is_string($value) ? explode('.', $value) : $value; - - $key = is_null($key) || is_array($key) ? $key : explode('.', $key); - - return [$value, $key]; - } - - /** - * Pass this lazy collection through a method on the collection class. - * - * @param string $method - * @param array $params - * @return static - */ - protected function passthru($method, array $params) - { - return new static(function () use ($method, $params) { - yield from $this->collect()->$method(...$params); - }); - } - - /** - * Get the current time. - * - * @return int - */ - protected function now() - { - return time(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Collections/MultipleItemsFoundException.php b/framework-9.50.2/src/Illuminate/Collections/MultipleItemsFoundException.php deleted file mode 100644 index d90d835..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/MultipleItemsFoundException.php +++ /dev/null @@ -1,40 +0,0 @@ -count = $count; - - parent::__construct("$count items were found.", $code, $previous); - } - - /** - * Get the number of items found. - * - * @return int - */ - public function getCount() - { - return $this->count; - } -} diff --git a/framework-9.50.2/src/Illuminate/Collections/Traits/EnumeratesValues.php b/framework-9.50.2/src/Illuminate/Collections/Traits/EnumeratesValues.php deleted file mode 100644 index c7803bf..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/Traits/EnumeratesValues.php +++ /dev/null @@ -1,1084 +0,0 @@ - - */ - protected static $proxies = [ - 'average', - 'avg', - 'contains', - 'doesntContain', - 'each', - 'every', - 'filter', - 'first', - 'flatMap', - 'groupBy', - 'keyBy', - 'map', - 'max', - 'min', - 'partition', - 'reject', - 'skipUntil', - 'skipWhile', - 'some', - 'sortBy', - 'sortByDesc', - 'sum', - 'takeUntil', - 'takeWhile', - 'unique', - 'unless', - 'until', - 'when', - ]; - - /** - * Create a new collection instance if the value isn't one already. - * - * @template TMakeKey of array-key - * @template TMakeValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable|null $items - * @return static - */ - public static function make($items = []) - { - return new static($items); - } - - /** - * Wrap the given value in a collection if applicable. - * - * @template TWrapKey of array-key - * @template TWrapValue - * - * @param iterable $value - * @return static - */ - public static function wrap($value) - { - return $value instanceof Enumerable - ? new static($value) - : new static(Arr::wrap($value)); - } - - /** - * Get the underlying items from the given collection if applicable. - * - * @template TUnwrapKey of array-key - * @template TUnwrapValue - * - * @param array|static $value - * @return array - */ - public static function unwrap($value) - { - return $value instanceof Enumerable ? $value->all() : $value; - } - - /** - * Create a new instance with no items. - * - * @return static - */ - public static function empty() - { - return new static([]); - } - - /** - * Create a new collection by invoking the callback a given amount of times. - * - * @template TTimesValue - * - * @param int $number - * @param (callable(int): TTimesValue)|null $callback - * @return static - */ - public static function times($number, callable $callback = null) - { - if ($number < 1) { - return new static; - } - - return static::range(1, $number) - ->unless($callback == null) - ->map($callback); - } - - /** - * Alias for the "avg" method. - * - * @param (callable(TValue): float|int)|string|null $callback - * @return float|int|null - */ - public function average($callback = null) - { - return $this->avg($callback); - } - - /** - * Alias for the "contains" method. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function some($key, $operator = null, $value = null) - { - return $this->contains(...func_get_args()); - } - - /** - * Dump the items and end the script. - * - * @param mixed ...$args - * @return never - */ - public function dd(...$args) - { - $this->dump(...$args); - - exit(1); - } - - /** - * Dump the items. - * - * @return $this - */ - public function dump() - { - (new Collection(func_get_args())) - ->push($this->all()) - ->each(function ($item) { - VarDumper::dump($item); - }); - - return $this; - } - - /** - * Execute a callback over each item. - * - * @param callable(TValue, TKey): mixed $callback - * @return $this - */ - public function each(callable $callback) - { - foreach ($this as $key => $item) { - if ($callback($item, $key) === false) { - break; - } - } - - return $this; - } - - /** - * Execute a callback over each nested chunk of items. - * - * @param callable(...mixed): mixed $callback - * @return static - */ - public function eachSpread(callable $callback) - { - return $this->each(function ($chunk, $key) use ($callback) { - $chunk[] = $key; - - return $callback(...$chunk); - }); - } - - /** - * Determine if all items pass the given truth test. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function every($key, $operator = null, $value = null) - { - if (func_num_args() === 1) { - $callback = $this->valueRetriever($key); - - foreach ($this as $k => $v) { - if (! $callback($v, $k)) { - return false; - } - } - - return true; - } - - return $this->every($this->operatorForWhere(...func_get_args())); - } - - /** - * Get the first item by the given key value pair. - * - * @param callable|string $key - * @param mixed $operator - * @param mixed $value - * @return TValue|null - */ - public function firstWhere($key, $operator = null, $value = null) - { - return $this->first($this->operatorForWhere(...func_get_args())); - } - - /** - * Get a single key's value from the first matching item in the collection. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function value($key, $default = null) - { - if ($value = $this->firstWhere($key)) { - return data_get($value, $key, $default); - } - - return value($default); - } - - /** - * Determine if the collection is not empty. - * - * @return bool - */ - public function isNotEmpty() - { - return ! $this->isEmpty(); - } - - /** - * Run a map over each nested chunk of items. - * - * @template TMapSpreadValue - * - * @param callable(mixed): TMapSpreadValue $callback - * @return static - */ - public function mapSpread(callable $callback) - { - return $this->map(function ($chunk, $key) use ($callback) { - $chunk[] = $key; - - return $callback(...$chunk); - }); - } - - /** - * Run a grouping map over the items. - * - * The callback should return an associative array with a single key/value pair. - * - * @template TMapToGroupsKey of array-key - * @template TMapToGroupsValue - * - * @param callable(TValue, TKey): array $callback - * @return static> - */ - public function mapToGroups(callable $callback) - { - $groups = $this->mapToDictionary($callback); - - return $groups->map([$this, 'make']); - } - - /** - * Map a collection and flatten the result by a single level. - * - * @template TFlatMapKey of array-key - * @template TFlatMapValue - * - * @param callable(TValue, TKey): (\Illuminate\Support\Collection|array) $callback - * @return static - */ - public function flatMap(callable $callback) - { - return $this->map($callback)->collapse(); - } - - /** - * Map the values into a new class. - * - * @template TMapIntoValue - * - * @param class-string $class - * @return static - */ - public function mapInto($class) - { - return $this->map(fn ($value, $key) => new $class($value, $key)); - } - - /** - * Get the min value of a given key. - * - * @param (callable(TValue):mixed)|string|null $callback - * @return mixed - */ - public function min($callback = null) - { - $callback = $this->valueRetriever($callback); - - return $this->map(fn ($value) => $callback($value)) - ->filter(fn ($value) => ! is_null($value)) - ->reduce(fn ($result, $value) => is_null($result) || $value < $result ? $value : $result); - } - - /** - * Get the max value of a given key. - * - * @param (callable(TValue):mixed)|string|null $callback - * @return mixed - */ - public function max($callback = null) - { - $callback = $this->valueRetriever($callback); - - return $this->filter(fn ($value) => ! is_null($value))->reduce(function ($result, $item) use ($callback) { - $value = $callback($item); - - return is_null($result) || $value > $result ? $value : $result; - }); - } - - /** - * "Paginate" the collection by slicing it into a smaller collection. - * - * @param int $page - * @param int $perPage - * @return static - */ - public function forPage($page, $perPage) - { - $offset = max(0, ($page - 1) * $perPage); - - return $this->slice($offset, $perPage); - } - - /** - * Partition the collection into two arrays using the given callback or key. - * - * @param (callable(TValue, TKey): bool)|TValue|string $key - * @param TValue|string|null $operator - * @param TValue|null $value - * @return static, static> - */ - public function partition($key, $operator = null, $value = null) - { - $passed = []; - $failed = []; - - $callback = func_num_args() === 1 - ? $this->valueRetriever($key) - : $this->operatorForWhere(...func_get_args()); - - foreach ($this as $key => $item) { - if ($callback($item, $key)) { - $passed[$key] = $item; - } else { - $failed[$key] = $item; - } - } - - return new static([new static($passed), new static($failed)]); - } - - /** - * Get the sum of the given values. - * - * @param (callable(TValue): mixed)|string|null $callback - * @return mixed - */ - public function sum($callback = null) - { - $callback = is_null($callback) - ? $this->identity() - : $this->valueRetriever($callback); - - return $this->reduce(fn ($result, $item) => $result + $callback($item), 0); - } - - /** - * Apply the callback if the collection is empty. - * - * @template TWhenEmptyReturnType - * - * @param (callable($this): TWhenEmptyReturnType) $callback - * @param (callable($this): TWhenEmptyReturnType)|null $default - * @return $this|TWhenEmptyReturnType - */ - public function whenEmpty(callable $callback, callable $default = null) - { - return $this->when($this->isEmpty(), $callback, $default); - } - - /** - * Apply the callback if the collection is not empty. - * - * @template TWhenNotEmptyReturnType - * - * @param callable($this): TWhenNotEmptyReturnType $callback - * @param (callable($this): TWhenNotEmptyReturnType)|null $default - * @return $this|TWhenNotEmptyReturnType - */ - public function whenNotEmpty(callable $callback, callable $default = null) - { - return $this->when($this->isNotEmpty(), $callback, $default); - } - - /** - * Apply the callback unless the collection is empty. - * - * @template TUnlessEmptyReturnType - * - * @param callable($this): TUnlessEmptyReturnType $callback - * @param (callable($this): TUnlessEmptyReturnType)|null $default - * @return $this|TUnlessEmptyReturnType - */ - public function unlessEmpty(callable $callback, callable $default = null) - { - return $this->whenNotEmpty($callback, $default); - } - - /** - * Apply the callback unless the collection is not empty. - * - * @template TUnlessNotEmptyReturnType - * - * @param callable($this): TUnlessNotEmptyReturnType $callback - * @param (callable($this): TUnlessNotEmptyReturnType)|null $default - * @return $this|TUnlessNotEmptyReturnType - */ - public function unlessNotEmpty(callable $callback, callable $default = null) - { - return $this->whenEmpty($callback, $default); - } - - /** - * Filter items by the given key value pair. - * - * @param callable|string $key - * @param mixed $operator - * @param mixed $value - * @return static - */ - public function where($key, $operator = null, $value = null) - { - return $this->filter($this->operatorForWhere(...func_get_args())); - } - - /** - * Filter items where the value for the given key is null. - * - * @param string|null $key - * @return static - */ - public function whereNull($key = null) - { - return $this->whereStrict($key, null); - } - - /** - * Filter items where the value for the given key is not null. - * - * @param string|null $key - * @return static - */ - public function whereNotNull($key = null) - { - return $this->where($key, '!==', null); - } - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param mixed $value - * @return static - */ - public function whereStrict($key, $value) - { - return $this->where($key, '===', $value); - } - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @param bool $strict - * @return static - */ - public function whereIn($key, $values, $strict = false) - { - $values = $this->getArrayableItems($values); - - return $this->filter(fn ($item) => in_array(data_get($item, $key), $values, $strict)); - } - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function whereInStrict($key, $values) - { - return $this->whereIn($key, $values, true); - } - - /** - * Filter items such that the value of the given key is between the given values. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function whereBetween($key, $values) - { - return $this->where($key, '>=', reset($values))->where($key, '<=', end($values)); - } - - /** - * Filter items such that the value of the given key is not between the given values. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function whereNotBetween($key, $values) - { - return $this->filter( - fn ($item) => data_get($item, $key) < reset($values) || data_get($item, $key) > end($values) - ); - } - - /** - * Filter items by the given key value pair. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @param bool $strict - * @return static - */ - public function whereNotIn($key, $values, $strict = false) - { - $values = $this->getArrayableItems($values); - - return $this->reject(fn ($item) => in_array(data_get($item, $key), $values, $strict)); - } - - /** - * Filter items by the given key value pair using strict comparison. - * - * @param string $key - * @param \Illuminate\Contracts\Support\Arrayable|iterable $values - * @return static - */ - public function whereNotInStrict($key, $values) - { - return $this->whereNotIn($key, $values, true); - } - - /** - * Filter the items, removing any items that don't match the given type(s). - * - * @template TWhereInstanceOf - * - * @param class-string|array> $type - * @return static - */ - public function whereInstanceOf($type) - { - return $this->filter(function ($value) use ($type) { - if (is_array($type)) { - foreach ($type as $classType) { - if ($value instanceof $classType) { - return true; - } - } - - return false; - } - - return $value instanceof $type; - }); - } - - /** - * Pass the collection to the given callback and return the result. - * - * @template TPipeReturnType - * - * @param callable($this): TPipeReturnType $callback - * @return TPipeReturnType - */ - public function pipe(callable $callback) - { - return $callback($this); - } - - /** - * Pass the collection into a new class. - * - * @param class-string $class - * @return mixed - */ - public function pipeInto($class) - { - return new $class($this); - } - - /** - * Pass the collection through a series of callable pipes and return the result. - * - * @param array $callbacks - * @return mixed - */ - public function pipeThrough($callbacks) - { - return Collection::make($callbacks)->reduce( - fn ($carry, $callback) => $callback($carry), - $this, - ); - } - - /** - * Reduce the collection to a single value. - * - * @template TReduceInitial - * @template TReduceReturnType - * - * @param callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType $callback - * @param TReduceInitial $initial - * @return TReduceReturnType - */ - public function reduce(callable $callback, $initial = null) - { - $result = $initial; - - foreach ($this as $key => $value) { - $result = $callback($result, $value, $key); - } - - return $result; - } - - /** - * Reduce the collection to multiple aggregate values. - * - * @param callable $callback - * @param mixed ...$initial - * @return array - * - * @throws \UnexpectedValueException - */ - public function reduceSpread(callable $callback, ...$initial) - { - $result = $initial; - - foreach ($this as $key => $value) { - $result = call_user_func_array($callback, array_merge($result, [$value, $key])); - - if (! is_array($result)) { - throw new UnexpectedValueException(sprintf( - "%s::reduceSpread expects reducer to return an array, but got a '%s' instead.", - class_basename(static::class), gettype($result) - )); - } - } - - return $result; - } - - /** - * Create a collection of all elements that do not pass a given truth test. - * - * @param (callable(TValue, TKey): bool)|bool|TValue $callback - * @return static - */ - public function reject($callback = true) - { - $useAsCallable = $this->useAsCallable($callback); - - return $this->filter(function ($value, $key) use ($callback, $useAsCallable) { - return $useAsCallable - ? ! $callback($value, $key) - : $value != $callback; - }); - } - - /** - * Pass the collection to the given callback and then return it. - * - * @param callable($this): mixed $callback - * @return $this - */ - public function tap(callable $callback) - { - $callback($this); - - return $this; - } - - /** - * Return only unique items from the collection array. - * - * @param (callable(TValue, TKey): mixed)|string|null $key - * @param bool $strict - * @return static - */ - public function unique($key = null, $strict = false) - { - $callback = $this->valueRetriever($key); - - $exists = []; - - return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { - if (in_array($id = $callback($item, $key), $exists, $strict)) { - return true; - } - - $exists[] = $id; - }); - } - - /** - * Return only unique items from the collection array using strict comparison. - * - * @param (callable(TValue, TKey): mixed)|string|null $key - * @return static - */ - public function uniqueStrict($key = null) - { - return $this->unique($key, true); - } - - /** - * Collect the values into a collection. - * - * @return \Illuminate\Support\Collection - */ - public function collect() - { - return new Collection($this->all()); - } - - /** - * Get the collection of items as a plain array. - * - * @return array - */ - public function toArray() - { - return $this->map(fn ($value) => $value instanceof Arrayable ? $value->toArray() : $value)->all(); - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize(): array - { - return array_map(function ($value) { - if ($value instanceof JsonSerializable) { - return $value->jsonSerialize(); - } elseif ($value instanceof Jsonable) { - return json_decode($value->toJson(), true); - } elseif ($value instanceof Arrayable) { - return $value->toArray(); - } - - return $value; - }, $this->all()); - } - - /** - * Get the collection of items as JSON. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->jsonSerialize(), $options); - } - - /** - * Get a CachingIterator instance. - * - * @param int $flags - * @return \CachingIterator - */ - public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) - { - return new CachingIterator($this->getIterator(), $flags); - } - - /** - * Convert the collection to its string representation. - * - * @return string - */ - public function __toString() - { - return $this->escapeWhenCastingToString - ? e($this->toJson()) - : $this->toJson(); - } - - /** - * Indicate that the model's string representation should be escaped when __toString is invoked. - * - * @param bool $escape - * @return $this - */ - public function escapeWhenCastingToString($escape = true) - { - $this->escapeWhenCastingToString = $escape; - - return $this; - } - - /** - * Add a method to the list of proxied methods. - * - * @param string $method - * @return void - */ - public static function proxy($method) - { - static::$proxies[] = $method; - } - - /** - * Dynamically access collection proxies. - * - * @param string $key - * @return mixed - * - * @throws \Exception - */ - public function __get($key) - { - if (! in_array($key, static::$proxies)) { - throw new Exception("Property [{$key}] does not exist on this collection instance."); - } - - return new HigherOrderCollectionProxy($this, $key); - } - - /** - * Results array of items from Collection or Arrayable. - * - * @param mixed $items - * @return array - */ - protected function getArrayableItems($items) - { - if (is_array($items)) { - return $items; - } elseif ($items instanceof Enumerable) { - return $items->all(); - } elseif ($items instanceof Arrayable) { - return $items->toArray(); - } elseif ($items instanceof Traversable) { - return iterator_to_array($items); - } elseif ($items instanceof Jsonable) { - return json_decode($items->toJson(), true); - } elseif ($items instanceof JsonSerializable) { - return (array) $items->jsonSerialize(); - } elseif ($items instanceof UnitEnum) { - return [$items]; - } - - return (array) $items; - } - - /** - * Get an operator checker callback. - * - * @param callable|string $key - * @param string|null $operator - * @param mixed $value - * @return \Closure - */ - protected function operatorForWhere($key, $operator = null, $value = null) - { - if ($this->useAsCallable($key)) { - return $key; - } - - if (func_num_args() === 1) { - $value = true; - - $operator = '='; - } - - if (func_num_args() === 2) { - $value = $operator; - - $operator = '='; - } - - return function ($item) use ($key, $operator, $value) { - $retrieved = data_get($item, $key); - - $strings = array_filter([$retrieved, $value], function ($value) { - return is_string($value) || (is_object($value) && method_exists($value, '__toString')); - }); - - if (count($strings) < 2 && count(array_filter([$retrieved, $value], 'is_object')) == 1) { - return in_array($operator, ['!=', '<>', '!==']); - } - - switch ($operator) { - default: - case '=': - case '==': return $retrieved == $value; - case '!=': - case '<>': return $retrieved != $value; - case '<': return $retrieved < $value; - case '>': return $retrieved > $value; - case '<=': return $retrieved <= $value; - case '>=': return $retrieved >= $value; - case '===': return $retrieved === $value; - case '!==': return $retrieved !== $value; - case '<=>': return $retrieved <=> $value; - } - }; - } - - /** - * Determine if the given value is callable, but not a string. - * - * @param mixed $value - * @return bool - */ - protected function useAsCallable($value) - { - return ! is_string($value) && is_callable($value); - } - - /** - * Get a value retrieving callback. - * - * @param callable|string|null $value - * @return callable - */ - protected function valueRetriever($value) - { - if ($this->useAsCallable($value)) { - return $value; - } - - return fn ($item) => data_get($item, $value); - } - - /** - * Make a function to check an item's equality. - * - * @param mixed $value - * @return \Closure(mixed): bool - */ - protected function equality($value) - { - return fn ($item) => $item === $value; - } - - /** - * Make a function using another function, by negating its result. - * - * @param \Closure $callback - * @return \Closure - */ - protected function negate(Closure $callback) - { - return fn (...$params) => ! $callback(...$params); - } - - /** - * Make a function that returns what's passed to it. - * - * @return \Closure(TValue): TValue - */ - protected function identity() - { - return fn ($value) => $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/Collections/composer.json b/framework-9.50.2/src/Illuminate/Collections/composer.json deleted file mode 100644 index cc9aad3..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/composer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "illuminate/collections", - "description": "The Illuminate Collections package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/conditionable": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "symfony/var-dumper": "Required to use the dump method (^6.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Collections/helpers.php b/framework-9.50.2/src/Illuminate/Collections/helpers.php deleted file mode 100644 index 9babf4e..0000000 --- a/framework-9.50.2/src/Illuminate/Collections/helpers.php +++ /dev/null @@ -1,190 +0,0 @@ -|iterable|null $value - * @return \Illuminate\Support\Collection - */ - function collect($value = []) - { - return new Collection($value); - } -} - -if (! function_exists('data_fill')) { - /** - * Fill in data where it's missing. - * - * @param mixed $target - * @param string|array $key - * @param mixed $value - * @return mixed - */ - function data_fill(&$target, $key, $value) - { - return data_set($target, $key, $value, false); - } -} - -if (! function_exists('data_get')) { - /** - * Get an item from an array or object using "dot" notation. - * - * @param mixed $target - * @param string|array|int|null $key - * @param mixed $default - * @return mixed - */ - function data_get($target, $key, $default = null) - { - if (is_null($key)) { - return $target; - } - - $key = is_array($key) ? $key : explode('.', $key); - - foreach ($key as $i => $segment) { - unset($key[$i]); - - if (is_null($segment)) { - return $target; - } - - if ($segment === '*') { - if ($target instanceof Collection) { - $target = $target->all(); - } elseif (! is_iterable($target)) { - return value($default); - } - - $result = []; - - foreach ($target as $item) { - $result[] = data_get($item, $key); - } - - return in_array('*', $key) ? Arr::collapse($result) : $result; - } - - if (Arr::accessible($target) && Arr::exists($target, $segment)) { - $target = $target[$segment]; - } elseif (is_object($target) && isset($target->{$segment})) { - $target = $target->{$segment}; - } else { - return value($default); - } - } - - return $target; - } -} - -if (! function_exists('data_set')) { - /** - * Set an item on an array or object using dot notation. - * - * @param mixed $target - * @param string|array $key - * @param mixed $value - * @param bool $overwrite - * @return mixed - */ - function data_set(&$target, $key, $value, $overwrite = true) - { - $segments = is_array($key) ? $key : explode('.', $key); - - if (($segment = array_shift($segments)) === '*') { - if (! Arr::accessible($target)) { - $target = []; - } - - if ($segments) { - foreach ($target as &$inner) { - data_set($inner, $segments, $value, $overwrite); - } - } elseif ($overwrite) { - foreach ($target as &$inner) { - $inner = $value; - } - } - } elseif (Arr::accessible($target)) { - if ($segments) { - if (! Arr::exists($target, $segment)) { - $target[$segment] = []; - } - - data_set($target[$segment], $segments, $value, $overwrite); - } elseif ($overwrite || ! Arr::exists($target, $segment)) { - $target[$segment] = $value; - } - } elseif (is_object($target)) { - if ($segments) { - if (! isset($target->{$segment})) { - $target->{$segment} = []; - } - - data_set($target->{$segment}, $segments, $value, $overwrite); - } elseif ($overwrite || ! isset($target->{$segment})) { - $target->{$segment} = $value; - } - } else { - $target = []; - - if ($segments) { - data_set($target[$segment], $segments, $value, $overwrite); - } elseif ($overwrite) { - $target[$segment] = $value; - } - } - - return $target; - } -} - -if (! function_exists('head')) { - /** - * Get the first element of an array. Useful for method chaining. - * - * @param array $array - * @return mixed - */ - function head($array) - { - return reset($array); - } -} - -if (! function_exists('last')) { - /** - * Get the last element from an array. - * - * @param array $array - * @return mixed - */ - function last($array) - { - return end($array); - } -} - -if (! function_exists('value')) { - /** - * Return the default value of the given value. - * - * @param mixed $value - * @param mixed ...$args - * @return mixed - */ - function value($value, ...$args) - { - return $value instanceof Closure ? $value(...$args) : $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/Conditionable/HigherOrderWhenProxy.php b/framework-9.50.2/src/Illuminate/Conditionable/HigherOrderWhenProxy.php deleted file mode 100644 index 579114c..0000000 --- a/framework-9.50.2/src/Illuminate/Conditionable/HigherOrderWhenProxy.php +++ /dev/null @@ -1,109 +0,0 @@ -target = $target; - } - - /** - * Set the condition on the proxy. - * - * @param bool $condition - * @return $this - */ - public function condition($condition) - { - [$this->condition, $this->hasCondition] = [$condition, true]; - - return $this; - } - - /** - * Indicate that the condition should be negated. - * - * @return $this - */ - public function negateConditionOnCapture() - { - $this->negateConditionOnCapture = true; - - return $this; - } - - /** - * Proxy accessing an attribute onto the target. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - if (! $this->hasCondition) { - $condition = $this->target->{$key}; - - return $this->condition($this->negateConditionOnCapture ? ! $condition : $condition); - } - - return $this->condition - ? $this->target->{$key} - : $this->target; - } - - /** - * Proxy a method call on the target. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (! $this->hasCondition) { - $condition = $this->target->{$method}(...$parameters); - - return $this->condition($this->negateConditionOnCapture ? ! $condition : $condition); - } - - return $this->condition - ? $this->target->{$method}(...$parameters) - : $this->target; - } -} diff --git a/framework-9.50.2/src/Illuminate/Conditionable/LICENSE.md b/framework-9.50.2/src/Illuminate/Conditionable/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Conditionable/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Conditionable/Traits/Conditionable.php b/framework-9.50.2/src/Illuminate/Conditionable/Traits/Conditionable.php deleted file mode 100644 index 1930743..0000000 --- a/framework-9.50.2/src/Illuminate/Conditionable/Traits/Conditionable.php +++ /dev/null @@ -1,73 +0,0 @@ -condition($value); - } - - if ($value) { - return $callback($this, $value) ?? $this; - } elseif ($default) { - return $default($this, $value) ?? $this; - } - - return $this; - } - - /** - * Apply the callback if the given "value" is (or resolves to) falsy. - * - * @template TUnlessParameter - * @template TUnlessReturnType - * - * @param (\Closure($this): TUnlessParameter)|TUnlessParameter|null $value - * @param (callable($this, TUnlessParameter): TUnlessReturnType)|null $callback - * @param (callable($this, TUnlessParameter): TUnlessReturnType)|null $default - * @return $this|TUnlessReturnType - */ - public function unless($value = null, callable $callback = null, callable $default = null) - { - $value = $value instanceof Closure ? $value($this) : $value; - - if (func_num_args() === 0) { - return (new HigherOrderWhenProxy($this))->negateConditionOnCapture(); - } - - if (func_num_args() === 1) { - return (new HigherOrderWhenProxy($this))->condition(! $value); - } - - if (! $value) { - return $callback($this, $value) ?? $this; - } elseif ($default) { - return $default($this, $value) ?? $this; - } - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Conditionable/composer.json b/framework-9.50.2/src/Illuminate/Conditionable/composer.json deleted file mode 100644 index a423aad..0000000 --- a/framework-9.50.2/src/Illuminate/Conditionable/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "illuminate/conditionable", - "description": "The Illuminate Conditionable package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2" - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Config/LICENSE.md b/framework-9.50.2/src/Illuminate/Config/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Config/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Config/Repository.php b/framework-9.50.2/src/Illuminate/Config/Repository.php deleted file mode 100644 index 640d673..0000000 --- a/framework-9.50.2/src/Illuminate/Config/Repository.php +++ /dev/null @@ -1,182 +0,0 @@ -items = $items; - } - - /** - * Determine if the given configuration value exists. - * - * @param string $key - * @return bool - */ - public function has($key) - { - return Arr::has($this->items, $key); - } - - /** - * Get the specified configuration value. - * - * @param array|string $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null) - { - if (is_array($key)) { - return $this->getMany($key); - } - - return Arr::get($this->items, $key, $default); - } - - /** - * Get many configuration values. - * - * @param array $keys - * @return array - */ - public function getMany($keys) - { - $config = []; - - foreach ($keys as $key => $default) { - if (is_numeric($key)) { - [$key, $default] = [$default, null]; - } - - $config[$key] = Arr::get($this->items, $key, $default); - } - - return $config; - } - - /** - * Set a given configuration value. - * - * @param array|string $key - * @param mixed $value - * @return void - */ - public function set($key, $value = null) - { - $keys = is_array($key) ? $key : [$key => $value]; - - foreach ($keys as $key => $value) { - Arr::set($this->items, $key, $value); - } - } - - /** - * Prepend a value onto an array configuration value. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function prepend($key, $value) - { - $array = $this->get($key, []); - - array_unshift($array, $value); - - $this->set($key, $array); - } - - /** - * Push a value onto an array configuration value. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function push($key, $value) - { - $array = $this->get($key, []); - - $array[] = $value; - - $this->set($key, $array); - } - - /** - * Get all of the configuration items for the application. - * - * @return array - */ - public function all() - { - return $this->items; - } - - /** - * Determine if the given configuration option exists. - * - * @param string $key - * @return bool - */ - public function offsetExists($key): bool - { - return $this->has($key); - } - - /** - * Get a configuration option. - * - * @param string $key - * @return mixed - */ - public function offsetGet($key): mixed - { - return $this->get($key); - } - - /** - * Set a configuration option. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value): void - { - $this->set($key, $value); - } - - /** - * Unset a configuration option. - * - * @param string $key - * @return void - */ - public function offsetUnset($key): void - { - $this->set($key, null); - } -} diff --git a/framework-9.50.2/src/Illuminate/Config/composer.json b/framework-9.50.2/src/Illuminate/Config/composer.json deleted file mode 100755 index bc2e8e5..0000000 --- a/framework-9.50.2/src/Illuminate/Config/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "illuminate/config", - "description": "The Illuminate Config package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Config\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Console/Application.php b/framework-9.50.2/src/Illuminate/Console/Application.php deleted file mode 100755 index 78a8c04..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Application.php +++ /dev/null @@ -1,347 +0,0 @@ -laravel = $laravel; - $this->events = $events; - $this->setAutoExit(false); - $this->setCatchExceptions(false); - - $this->events->dispatch(new ArtisanStarting($this)); - - $this->bootstrap(); - } - - /** - * {@inheritdoc} - * - * @return int - */ - public function run(InputInterface $input = null, OutputInterface $output = null): int - { - $commandName = $this->getCommandName( - $input = $input ?: new ArgvInput - ); - - $this->events->dispatch( - new CommandStarting( - $commandName, $input, $output = $output ?: new BufferedConsoleOutput - ) - ); - - $exitCode = parent::run($input, $output); - - $this->events->dispatch( - new 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 ProcessUtils::escapeArgument(defined('ARTISAN_BINARY') ? 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|null $outputBuffer - * @return int - * - * @throws \Symfony\Component\Console\Exception\CommandNotFoundException - */ - public function call($command, array $parameters = [], $outputBuffer = null) - { - [$command, $input] = $this->parseCommand($command, $parameters); - - if (! $this->has($command)) { - throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $command)); - } - - return $this->run( - $input, $this->lastOutput = $outputBuffer ?: new BufferedOutput - ); - } - - /** - * Parse the incoming Artisan command and its input. - * - * @param string $command - * @param array $parameters - * @return array - */ - protected function parseCommand($command, $parameters) - { - if (is_subclass_of($command, SymfonyCommand::class)) { - $callingClass = true; - - $command = $this->laravel->make($command)->getName(); - } - - if (! isset($callingClass) && empty($parameters)) { - $command = $this->getCommandName($input = new StringInput($command)); - } else { - array_unshift($parameters, $command); - - $input = new ArrayInput($parameters); - } - - return [$command, $input]; - } - - /** - * Get the output for the last run command. - * - * @return string - */ - public function output() - { - return $this->lastOutput && method_exists($this->lastOutput, 'fetch') - ? $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 \Illuminate\Console\Command|string $command - * @return \Symfony\Component\Console\Command\Command|null - */ - public function resolve($command) - { - if (is_subclass_of($command, SymfonyCommand::class) && ($commandName = $command::getDefaultName())) { - $this->commandMap[$commandName] = $command; - - return null; - } - - if ($command instanceof Command) { - return $this->add($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; - } - - /** - * Set the container command loader for lazy resolution. - * - * @return $this - */ - public function setContainerCommandLoader() - { - $this->setCommandLoader(new ContainerCommandLoader($this->laravel, $this->commandMap)); - - return $this; - } - - /** - * Get the default input definition for the application. - * - * This is used to add the --env option to every available command. - * - * @return \Symfony\Component\Console\Input\InputDefinition - */ - protected function getDefaultInputDefinition(): InputDefinition - { - 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; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/BufferedConsoleOutput.php b/framework-9.50.2/src/Illuminate/Console/BufferedConsoleOutput.php deleted file mode 100644 index 4bb5ca2..0000000 --- a/framework-9.50.2/src/Illuminate/Console/BufferedConsoleOutput.php +++ /dev/null @@ -1,41 +0,0 @@ -buffer, function () { - $this->buffer = ''; - }); - } - - /** - * {@inheritdoc} - */ - protected function doWrite(string $message, bool $newline) - { - $this->buffer .= $message; - - if ($newline) { - $this->buffer .= \PHP_EOL; - } - - return parent::doWrite($message, $newline); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/CacheCommandMutex.php b/framework-9.50.2/src/Illuminate/Console/CacheCommandMutex.php deleted file mode 100644 index 223174c..0000000 --- a/framework-9.50.2/src/Illuminate/Console/CacheCommandMutex.php +++ /dev/null @@ -1,98 +0,0 @@ -cache = $cache; - } - - /** - * Attempt to obtain a command mutex for the given command. - * - * @param \Illuminate\Console\Command $command - * @return bool - */ - public function create($command) - { - return $this->cache->store($this->store)->add( - $this->commandMutexName($command), - true, - method_exists($command, 'isolationLockExpiresAt') - ? $command->isolationLockExpiresAt() - : CarbonInterval::hour(), - ); - } - - /** - * Determine if a command mutex exists for the given command. - * - * @param \Illuminate\Console\Command $command - * @return bool - */ - public function exists($command) - { - return $this->cache->store($this->store)->has( - $this->commandMutexName($command) - ); - } - - /** - * Release the mutex for the given command. - * - * @param \Illuminate\Console\Command $command - * @return bool - */ - public function forget($command) - { - return $this->cache->store($this->store)->forget( - $this->commandMutexName($command) - ); - } - - /** - * @param \Illuminate\Console\Command $command - * @return string - */ - protected function commandMutexName($command) - { - return 'framework'.DIRECTORY_SEPARATOR.'command-'.$command->getName(); - } - - /** - * Specify the cache store that should be used. - * - * @param string|null $store - * @return $this - */ - public function useStore($store) - { - $this->store = $store; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Command.php b/framework-9.50.2/src/Illuminate/Console/Command.php deleted file mode 100755 index 6768474..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Command.php +++ /dev/null @@ -1,268 +0,0 @@ -signature)) { - $this->configureUsingFluentDefinition(); - } else { - parent::__construct($this->name); - } - - // Once we have constructed the command, we'll set the description and other - // related properties of the command. If a signature wasn't used to build - // the command we'll set the arguments and the options on this command. - if (! isset($this->description)) { - $this->setDescription((string) static::getDefaultDescription()); - } else { - $this->setDescription((string) $this->description); - } - - $this->setHelp((string) $this->help); - - $this->setHidden($this->isHidden()); - - if (! isset($this->signature)) { - $this->specifyParameters(); - } - - if ($this instanceof Isolatable) { - $this->configureIsolation(); - } - } - - /** - * Configure the console command using a fluent definition. - * - * @return void - */ - protected function configureUsingFluentDefinition() - { - [$name, $arguments, $options] = Parser::parse($this->signature); - - parent::__construct($this->name = $name); - - // After parsing the signature we will spin through the arguments and options - // and set them on this command. These will already be changed into proper - // instances of these "InputArgument" and "InputOption" Symfony classes. - $this->getDefinition()->addArguments($arguments); - $this->getDefinition()->addOptions($options); - } - - /** - * Configure the console command for isolation. - * - * @return void - */ - protected function configureIsolation() - { - $this->getDefinition()->addOption(new InputOption( - 'isolated', - null, - InputOption::VALUE_OPTIONAL, - 'Do not run the command if another instance of the command is already running', - false - )); - } - - /** - * Run the console command. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int - */ - public function run(InputInterface $input, OutputInterface $output): int - { - $this->output = $this->laravel->make( - OutputStyle::class, ['input' => $input, 'output' => $output] - ); - - $this->components = $this->laravel->make(Factory::class, ['output' => $this->output]); - - try { - return parent::run( - $this->input = $input, $this->output - ); - } finally { - $this->untrap(); - } - } - - /** - * Execute the console command. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - if ($this instanceof Isolatable && $this->option('isolated') !== false && - ! $this->commandIsolationMutex()->create($this)) { - $this->comment(sprintf( - 'The [%s] command is already running.', $this->getName() - )); - - return (int) (is_numeric($this->option('isolated')) - ? $this->option('isolated') - : self::SUCCESS); - } - - $method = method_exists($this, 'handle') ? 'handle' : '__invoke'; - - try { - return (int) $this->laravel->call([$this, $method]); - } finally { - if ($this instanceof Isolatable && $this->option('isolated') !== false) { - $this->commandIsolationMutex()->forget($this); - } - } - } - - /** - * Get a command isolation mutex instance for the command. - * - * @return \Illuminate\Console\CommandMutex - */ - protected function commandIsolationMutex() - { - return $this->laravel->bound(CommandMutex::class) - ? $this->laravel->make(CommandMutex::class) - : $this->laravel->make(CacheCommandMutex::class); - } - - /** - * Resolve the console command instance for the given command. - * - * @param \Symfony\Component\Console\Command\Command|string $command - * @return \Symfony\Component\Console\Command\Command - */ - protected function resolveCommand($command) - { - if (! class_exists($command)) { - return $this->getApplication()->find($command); - } - - $command = $this->laravel->make($command); - - if ($command instanceof SymfonyCommand) { - $command->setApplication($this->getApplication()); - } - - if ($command instanceof self) { - $command->setLaravel($this->getLaravel()); - } - - return $command; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function isHidden(): bool - { - return $this->hidden; - } - - /** - * {@inheritdoc} - */ - public function setHidden(bool $hidden = true): static - { - parent::setHidden($this->hidden = $hidden); - - return $this; - } - - /** - * Get the Laravel application instance. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public function getLaravel() - { - return $this->laravel; - } - - /** - * Set the Laravel application instance. - * - * @param \Illuminate\Contracts\Container\Container $laravel - * @return void - */ - public function setLaravel($laravel) - { - $this->laravel = $laravel; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/CommandMutex.php b/framework-9.50.2/src/Illuminate/Console/CommandMutex.php deleted file mode 100644 index 7196128..0000000 --- a/framework-9.50.2/src/Illuminate/Console/CommandMutex.php +++ /dev/null @@ -1,30 +0,0 @@ -runCommand($command, $arguments, $this->output); - } - - /** - * Call another console command without output. - * - * @param \Symfony\Component\Console\Command\Command|string $command - * @param array $arguments - * @return int - */ - public function callSilent($command, array $arguments = []) - { - return $this->runCommand($command, $arguments, new NullOutput); - } - - /** - * Call another console command without output. - * - * @param \Symfony\Component\Console\Command\Command|string $command - * @param array $arguments - * @return int - */ - public function callSilently($command, array $arguments = []) - { - return $this->callSilent($command, $arguments); - } - - /** - * Run the given the console command. - * - * @param \Symfony\Component\Console\Command\Command|string $command - * @param array $arguments - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int - */ - protected function runCommand($command, array $arguments, OutputInterface $output) - { - $arguments['command'] = $command; - - return $this->resolveCommand($command)->run( - $this->createInputFromArguments($arguments), $output - ); - } - - /** - * Create an input instance from the given arguments. - * - * @param array $arguments - * @return \Symfony\Component\Console\Input\ArrayInput - */ - protected function createInputFromArguments(array $arguments) - { - return tap(new ArrayInput(array_merge($this->context(), $arguments)), function ($input) { - if ($input->getParameterOption('--no-interaction')) { - $input->setInteractive(false); - } - }); - } - - /** - * Get all of the context passed to the command. - * - * @return array - */ - protected function context() - { - return collect($this->option())->only([ - 'ansi', - 'no-ansi', - 'no-interaction', - 'quiet', - 'verbose', - ])->filter()->mapWithKeys(function ($value, $key) { - return ["--{$key}" => $value]; - })->all(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Concerns/CreatesMatchingTest.php b/framework-9.50.2/src/Illuminate/Console/Concerns/CreatesMatchingTest.php deleted file mode 100644 index 4182a00..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Concerns/CreatesMatchingTest.php +++ /dev/null @@ -1,44 +0,0 @@ - 'PHPUnit', 'pest' => 'Pest'] as $option => $name) { - $this->getDefinition()->addOption(new InputOption( - $option, - null, - InputOption::VALUE_NONE, - "Generate an accompanying {$name} test for the {$this->type}" - )); - } - } - - /** - * Create the matching test case if requested. - * - * @param string $path - * @return bool - */ - protected function handleTestCreation($path) - { - if (! $this->option('test') && ! $this->option('pest')) { - return false; - } - - return $this->callSilent('make:test', [ - 'name' => Str::of($path)->after($this->laravel['path'])->beforeLast('.php')->append('Test')->replace('\\', '/'), - '--pest' => $this->option('pest'), - ]) == 0; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Concerns/HasParameters.php b/framework-9.50.2/src/Illuminate/Console/Concerns/HasParameters.php deleted file mode 100644 index 157cb19..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Concerns/HasParameters.php +++ /dev/null @@ -1,56 +0,0 @@ -getArguments() as $arguments) { - if ($arguments instanceof InputArgument) { - $this->getDefinition()->addArgument($arguments); - } else { - $this->addArgument(...$arguments); - } - } - - foreach ($this->getOptions() as $options) { - if ($options instanceof InputOption) { - $this->getDefinition()->addOption($options); - } else { - $this->addOption(...$options); - } - } - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return []; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return []; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Concerns/InteractsWithIO.php b/framework-9.50.2/src/Illuminate/Console/Concerns/InteractsWithIO.php deleted file mode 100644 index 13f6197..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Concerns/InteractsWithIO.php +++ /dev/null @@ -1,453 +0,0 @@ - OutputInterface::VERBOSITY_VERBOSE, - 'vv' => OutputInterface::VERBOSITY_VERY_VERBOSE, - 'vvv' => OutputInterface::VERBOSITY_DEBUG, - 'quiet' => OutputInterface::VERBOSITY_QUIET, - 'normal' => OutputInterface::VERBOSITY_NORMAL, - ]; - - /** - * Determine if the given argument is present. - * - * @param string|int $name - * @return bool - */ - public function hasArgument($name) - { - return $this->input->hasArgument($name); - } - - /** - * Get the value of a command argument. - * - * @param string|null $key - * @return array|string|bool|null - */ - public function argument($key = null) - { - if (is_null($key)) { - return $this->input->getArguments(); - } - - return $this->input->getArgument($key); - } - - /** - * Get all of the arguments passed to the command. - * - * @return array - */ - public function arguments() - { - return $this->argument(); - } - - /** - * Determine if the given option is present. - * - * @param string $name - * @return bool - */ - public function hasOption($name) - { - return $this->input->hasOption($name); - } - - /** - * Get the value of a command option. - * - * @param string|null $key - * @return string|array|bool|null - */ - public function option($key = null) - { - if (is_null($key)) { - return $this->input->getOptions(); - } - - return $this->input->getOption($key); - } - - /** - * Get all of the options passed to the command. - * - * @return array - */ - public function options() - { - return $this->option(); - } - - /** - * Confirm a question with the user. - * - * @param string $question - * @param bool $default - * @return bool - */ - public function confirm($question, $default = false) - { - return $this->output->confirm($question, $default); - } - - /** - * Prompt the user for input. - * - * @param string $question - * @param string|null $default - * @return mixed - */ - public function ask($question, $default = null) - { - return $this->output->ask($question, $default); - } - - /** - * Prompt the user for input with auto completion. - * - * @param string $question - * @param array|callable $choices - * @param string|null $default - * @return mixed - */ - public function anticipate($question, $choices, $default = null) - { - return $this->askWithCompletion($question, $choices, $default); - } - - /** - * Prompt the user for input with auto completion. - * - * @param string $question - * @param array|callable $choices - * @param string|null $default - * @return mixed - */ - public function askWithCompletion($question, $choices, $default = null) - { - $question = new Question($question, $default); - - is_callable($choices) - ? $question->setAutocompleterCallback($choices) - : $question->setAutocompleterValues($choices); - - return $this->output->askQuestion($question); - } - - /** - * Prompt the user for input but hide the answer from the console. - * - * @param string $question - * @param bool $fallback - * @return mixed - */ - public function secret($question, $fallback = true) - { - $question = new Question($question); - - $question->setHidden(true)->setHiddenFallback($fallback); - - return $this->output->askQuestion($question); - } - - /** - * Give the user a single choice from an array of answers. - * - * @param string $question - * @param array $choices - * @param string|int|null $default - * @param mixed|null $attempts - * @param bool $multiple - * @return string|array - */ - public function choice($question, array $choices, $default = null, $attempts = null, $multiple = false) - { - $question = new ChoiceQuestion($question, $choices, $default); - - $question->setMaxAttempts($attempts)->setMultiselect($multiple); - - return $this->output->askQuestion($question); - } - - /** - * Format input to textual table. - * - * @param array $headers - * @param \Illuminate\Contracts\Support\Arrayable|array $rows - * @param \Symfony\Component\Console\Helper\TableStyle|string $tableStyle - * @param array $columnStyles - * @return void - */ - public function table($headers, $rows, $tableStyle = 'default', array $columnStyles = []) - { - $table = new Table($this->output); - - if ($rows instanceof Arrayable) { - $rows = $rows->toArray(); - } - - $table->setHeaders((array) $headers)->setRows($rows)->setStyle($tableStyle); - - foreach ($columnStyles as $columnIndex => $columnStyle) { - $table->setColumnStyle($columnIndex, $columnStyle); - } - - $table->render(); - } - - /** - * Execute a given callback while advancing a progress bar. - * - * @param iterable|int $totalSteps - * @param \Closure $callback - * @return mixed|void - */ - public function withProgressBar($totalSteps, Closure $callback) - { - $bar = $this->output->createProgressBar( - is_iterable($totalSteps) ? count($totalSteps) : $totalSteps - ); - - $bar->start(); - - if (is_iterable($totalSteps)) { - foreach ($totalSteps as $value) { - $callback($value, $bar); - - $bar->advance(); - } - } else { - $callback($bar); - } - - $bar->finish(); - - if (is_iterable($totalSteps)) { - return $totalSteps; - } - } - - /** - * Write a string as information output. - * - * @param string $string - * @param int|string|null $verbosity - * @return void - */ - public function info($string, $verbosity = null) - { - $this->line($string, 'info', $verbosity); - } - - /** - * Write a string as standard output. - * - * @param string $string - * @param string|null $style - * @param int|string|null $verbosity - * @return void - */ - public function line($string, $style = null, $verbosity = null) - { - $styled = $style ? "<$style>$string" : $string; - - $this->output->writeln($styled, $this->parseVerbosity($verbosity)); - } - - /** - * Write a string as comment output. - * - * @param string $string - * @param int|string|null $verbosity - * @return void - */ - public function comment($string, $verbosity = null) - { - $this->line($string, 'comment', $verbosity); - } - - /** - * Write a string as question output. - * - * @param string $string - * @param int|string|null $verbosity - * @return void - */ - public function question($string, $verbosity = null) - { - $this->line($string, 'question', $verbosity); - } - - /** - * Write a string as error output. - * - * @param string $string - * @param int|string|null $verbosity - * @return void - */ - public function error($string, $verbosity = null) - { - $this->line($string, 'error', $verbosity); - } - - /** - * Write a string as warning output. - * - * @param string $string - * @param int|string|null $verbosity - * @return void - */ - public function warn($string, $verbosity = null) - { - if (! $this->output->getFormatter()->hasStyle('warning')) { - $style = new OutputFormatterStyle('yellow'); - - $this->output->getFormatter()->setStyle('warning', $style); - } - - $this->line($string, 'warning', $verbosity); - } - - /** - * Write a string in an alert box. - * - * @param string $string - * @param int|string|null $verbosity - * @return void - */ - public function alert($string, $verbosity = null) - { - $length = Str::length(strip_tags($string)) + 12; - - $this->comment(str_repeat('*', $length), $verbosity); - $this->comment('* '.$string.' *', $verbosity); - $this->comment(str_repeat('*', $length), $verbosity); - - $this->comment('', $verbosity); - } - - /** - * Write a blank line. - * - * @param int $count - * @return $this - */ - public function newLine($count = 1) - { - $this->output->newLine($count); - - return $this; - } - - /** - * Set the input interface implementation. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @return void - */ - public function setInput(InputInterface $input) - { - $this->input = $input; - } - - /** - * Set the output interface implementation. - * - * @param \Illuminate\Console\OutputStyle $output - * @return void - */ - public function setOutput(OutputStyle $output) - { - $this->output = $output; - } - - /** - * Set the verbosity level. - * - * @param string|int $level - * @return void - */ - protected function setVerbosity($level) - { - $this->verbosity = $this->parseVerbosity($level); - } - - /** - * Get the verbosity level in terms of Symfony's OutputInterface level. - * - * @param string|int|null $level - * @return int - */ - protected function parseVerbosity($level = null) - { - if (isset($this->verbosityMap[$level])) { - $level = $this->verbosityMap[$level]; - } elseif (! is_int($level)) { - $level = $this->verbosity; - } - - return $level; - } - - /** - * Get the output implementation. - * - * @return \Illuminate\Console\OutputStyle - */ - public function getOutput() - { - return $this->output; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Concerns/InteractsWithSignals.php b/framework-9.50.2/src/Illuminate/Console/Concerns/InteractsWithSignals.php deleted file mode 100644 index 895072c..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Concerns/InteractsWithSignals.php +++ /dev/null @@ -1,51 +0,0 @@ -|int $signals - * @param callable(int $signal): void $callback - * @return void - */ - public function trap($signals, $callback) - { - Signals::whenAvailable(function () use ($signals, $callback) { - $this->signals ??= new Signals( - $this->getApplication()->getSignalRegistry(), - ); - - collect(Arr::wrap($signals)) - ->each(fn ($signal) => $this->signals->register($signal, $callback)); - }); - } - - /** - * Untrap signal handlers set within the command's handler. - * - * @return void - * - * @internal - */ - public function untrap() - { - if (! is_null($this->signals)) { - $this->signals->unregister(); - - $this->signals = null; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Concerns/PromptsForMissingInput.php b/framework-9.50.2/src/Illuminate/Console/Concerns/PromptsForMissingInput.php deleted file mode 100644 index ef1186e..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Concerns/PromptsForMissingInput.php +++ /dev/null @@ -1,108 +0,0 @@ -promptForMissingArguments($input, $output); - } - } - - /** - * Prompt the user for any missing arguments. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return void - */ - protected function promptForMissingArguments(InputInterface $input, OutputInterface $output) - { - $prompted = collect($this->getDefinition()->getArguments()) - ->filter(fn ($argument) => $argument->isRequired() && is_null($input->getArgument($argument->getName()))) - ->filter(fn ($argument) => $argument->getName() !== 'command') - ->each(fn ($argument) => $input->setArgument( - $argument->getName(), - $this->askPersistently( - $this->promptForMissingArgumentsUsing()[$argument->getName()] ?? - 'What is '.lcfirst($argument->getDescription()).'?' - ) - )) - ->isNotEmpty(); - - if ($prompted) { - $this->afterPromptingForMissingArguments($input, $output); - } - } - - /** - * Prompt for missing input arguments using the returned questions. - * - * @return array - */ - protected function promptForMissingArgumentsUsing() - { - return []; - } - - /** - * Perform actions after the user was prompted for missing arguments. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return void - */ - protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) - { - // - } - - /** - * Whether the input contains any options that differ from the default values. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @return bool - */ - protected function didReceiveOptions(InputInterface $input) - { - return collect($this->getDefinition()->getOptions()) - ->reject(fn ($option) => $input->getOption($option->getName()) === $option->getDefault()) - ->isNotEmpty(); - } - - /** - * Continue asking a question until an answer is provided. - * - * @param string $question - * @return string - */ - private function askPersistently($question) - { - $answer = null; - - while ($answer === null) { - $answer = $this->components->ask($question); - - if ($answer === null) { - $this->components->error('The answer is required.'); - } - } - - return $answer; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/ConfirmableTrait.php b/framework-9.50.2/src/Illuminate/Console/ConfirmableTrait.php deleted file mode 100644 index bf63970..0000000 --- a/framework-9.50.2/src/Illuminate/Console/ConfirmableTrait.php +++ /dev/null @@ -1,54 +0,0 @@ -getDefaultConfirmCallback() : $callback; - - $shouldConfirm = value($callback); - - if ($shouldConfirm) { - if ($this->hasOption('force') && $this->option('force')) { - return true; - } - - $this->components->alert($warning); - - $confirmed = $this->components->confirm('Do you really wish to run this command?'); - - if (! $confirmed) { - $this->newLine(); - - $this->components->warn('Command canceled.'); - - return false; - } - } - - return true; - } - - /** - * Get the default confirmation callback. - * - * @return \Closure - */ - protected function getDefaultConfirmCallback() - { - return function () { - return $this->getLaravel()->environment() === 'production'; - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/ContainerCommandLoader.php b/framework-9.50.2/src/Illuminate/Console/ContainerCommandLoader.php deleted file mode 100644 index f770f6c..0000000 --- a/framework-9.50.2/src/Illuminate/Console/ContainerCommandLoader.php +++ /dev/null @@ -1,76 +0,0 @@ -container = $container; - $this->commandMap = $commandMap; - } - - /** - * Resolve a command from the container. - * - * @param string $name - * @return \Symfony\Component\Console\Command\Command - * - * @throws \Symfony\Component\Console\Exception\CommandNotFoundException - */ - public function get(string $name): Command - { - if (! $this->has($name)) { - throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name)); - } - - return $this->container->get($this->commandMap[$name]); - } - - /** - * Determines if a command exists. - * - * @param string $name - * @return bool - */ - public function has(string $name): bool - { - return $name && isset($this->commandMap[$name]); - } - - /** - * Get the command names. - * - * @return string[] - */ - public function getNames(): array - { - return array_keys($this->commandMap); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Contracts/NewLineAware.php b/framework-9.50.2/src/Illuminate/Console/Contracts/NewLineAware.php deleted file mode 100644 index 135cecb..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Contracts/NewLineAware.php +++ /dev/null @@ -1,13 +0,0 @@ -artisan = $artisan; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Events/CommandFinished.php b/framework-9.50.2/src/Illuminate/Console/Events/CommandFinished.php deleted file mode 100644 index ef066af..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Events/CommandFinished.php +++ /dev/null @@ -1,54 +0,0 @@ -input = $input; - $this->output = $output; - $this->command = $command; - $this->exitCode = $exitCode; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Events/CommandStarting.php b/framework-9.50.2/src/Illuminate/Console/Events/CommandStarting.php deleted file mode 100644 index c6238b5..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Events/CommandStarting.php +++ /dev/null @@ -1,45 +0,0 @@ -input = $input; - $this->output = $output; - $this->command = $command; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledBackgroundTaskFinished.php b/framework-9.50.2/src/Illuminate/Console/Events/ScheduledBackgroundTaskFinished.php deleted file mode 100644 index d9e63c2..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledBackgroundTaskFinished.php +++ /dev/null @@ -1,26 +0,0 @@ -task = $task; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskFailed.php b/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskFailed.php deleted file mode 100644 index 46857ad..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskFailed.php +++ /dev/null @@ -1,36 +0,0 @@ -task = $task; - $this->exception = $exception; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskFinished.php b/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskFinished.php deleted file mode 100644 index 6146966..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskFinished.php +++ /dev/null @@ -1,35 +0,0 @@ -task = $task; - $this->runtime = $runtime; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskSkipped.php b/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskSkipped.php deleted file mode 100644 index cfa7141..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskSkipped.php +++ /dev/null @@ -1,26 +0,0 @@ -task = $task; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskStarting.php b/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskStarting.php deleted file mode 100644 index 66aaaa4..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Events/ScheduledTaskStarting.php +++ /dev/null @@ -1,26 +0,0 @@ -task = $task; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/GeneratorCommand.php b/framework-9.50.2/src/Illuminate/Console/GeneratorCommand.php deleted file mode 100644 index 37607c9..0000000 --- a/framework-9.50.2/src/Illuminate/Console/GeneratorCommand.php +++ /dev/null @@ -1,490 +0,0 @@ -addTestOptions(); - } - - $this->files = $files; - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - abstract protected function getStub(); - - /** - * Execute the console command. - * - * @return bool|null - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function handle() - { - // First we need to ensure that the given name is not a reserved word within the PHP - // language and that the class name will actually be valid. If it is not valid we - // can error now and prevent from polluting the filesystem using invalid files. - if ($this->isReservedName($this->getNameInput())) { - $this->components->error('The name "'.$this->getNameInput().'" is reserved by PHP.'); - - return false; - } - - $name = $this->qualifyClass($this->getNameInput()); - - $path = $this->getPath($name); - - // Next, We will check to see if the class already exists. If it does, we don't want - // to create the class and overwrite the user's code. So, we will bail out so the - // code is untouched. Otherwise, we will continue generating this class' files. - if ((! $this->hasOption('force') || - ! $this->option('force')) && - $this->alreadyExists($this->getNameInput())) { - $this->components->error($this->type.' already exists.'); - - return false; - } - - // Next, we will generate the path to the location where this class' file should get - // written. Then, we will build the class and make the proper replacements on the - // stub files so that it gets the correctly formatted namespace and class name. - $this->makeDirectory($path); - - $this->files->put($path, $this->sortImports($this->buildClass($name))); - - $info = $this->type; - - if (in_array(CreatesMatchingTest::class, class_uses_recursive($this))) { - if ($this->handleTestCreation($path)) { - $info .= ' and test'; - } - } - - $this->components->info(sprintf('%s [%s] created successfully.', $info, $path)); - } - - /** - * Parse the class name and format according to the root namespace. - * - * @param string $name - * @return string - */ - protected function qualifyClass($name) - { - $name = ltrim($name, '\\/'); - - $name = str_replace('/', '\\', $name); - - $rootNamespace = $this->rootNamespace(); - - if (Str::startsWith($name, $rootNamespace)) { - return $name; - } - - return $this->qualifyClass( - $this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name - ); - } - - /** - * Qualify the given model class base name. - * - * @param string $model - * @return string - */ - protected function qualifyModel(string $model) - { - $model = ltrim($model, '\\/'); - - $model = str_replace('/', '\\', $model); - - $rootNamespace = $this->rootNamespace(); - - if (Str::startsWith($model, $rootNamespace)) { - return $model; - } - - return is_dir(app_path('Models')) - ? $rootNamespace.'Models\\'.$model - : $rootNamespace.$model; - } - - /** - * Get a list of possible model names. - * - * @return array - */ - protected function possibleModels() - { - $modelPath = is_dir(app_path('Models')) ? app_path('Models') : app_path(); - - return collect((new Finder)->files()->depth(0)->in($modelPath)) - ->map(fn ($file) => $file->getBasename('.php')) - ->values() - ->all(); - } - - /** - * Get a list of possible event names. - * - * @return array - */ - protected function possibleEvents() - { - $eventPath = app_path('Events'); - - if (! is_dir($eventPath)) { - return []; - } - - return collect((new Finder)->files()->depth(0)->in($eventPath)) - ->map(fn ($file) => $file->getBasename('.php')) - ->values() - ->all(); - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace; - } - - /** - * Determine if the class already exists. - * - * @param string $rawName - * @return bool - */ - protected function alreadyExists($rawName) - { - return $this->files->exists($this->getPath($this->qualifyClass($rawName))); - } - - /** - * Get the destination class path. - * - * @param string $name - * @return string - */ - protected function getPath($name) - { - $name = Str::replaceFirst($this->rootNamespace(), '', $name); - - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php'; - } - - /** - * Build the directory for the class if necessary. - * - * @param string $path - * @return string - */ - protected function makeDirectory($path) - { - if (! $this->files->isDirectory(dirname($path))) { - $this->files->makeDirectory(dirname($path), 0777, true, true); - } - - return $path; - } - - /** - * Build the class with the given name. - * - * @param string $name - * @return string - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - protected function buildClass($name) - { - $stub = $this->files->get($this->getStub()); - - return $this->replaceNamespace($stub, $name)->replaceClass($stub, $name); - } - - /** - * Replace the namespace for the given stub. - * - * @param string $stub - * @param string $name - * @return $this - */ - protected function replaceNamespace(&$stub, $name) - { - $searches = [ - ['DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel'], - ['{{ namespace }}', '{{ rootNamespace }}', '{{ namespacedUserModel }}'], - ['{{namespace}}', '{{rootNamespace}}', '{{namespacedUserModel}}'], - ]; - - foreach ($searches as $search) { - $stub = str_replace( - $search, - [$this->getNamespace($name), $this->rootNamespace(), $this->userProviderModel()], - $stub - ); - } - - return $this; - } - - /** - * Get the full namespace for a given class, without the class name. - * - * @param string $name - * @return string - */ - protected function getNamespace($name) - { - return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); - } - - /** - * Replace the class name for the given stub. - * - * @param string $stub - * @param string $name - * @return string - */ - protected function replaceClass($stub, $name) - { - $class = str_replace($this->getNamespace($name).'\\', '', $name); - - return str_replace(['DummyClass', '{{ class }}', '{{class}}'], $class, $stub); - } - - /** - * Alphabetically sorts the imports for the given stub. - * - * @param string $stub - * @return string - */ - protected function sortImports($stub) - { - if (preg_match('/(?P(?:^use [^;{]+;$\n?)+)/m', $stub, $match)) { - $imports = explode("\n", trim($match['imports'])); - - sort($imports); - - return str_replace(trim($match['imports']), implode("\n", $imports), $stub); - } - - return $stub; - } - - /** - * Get the desired class name from the input. - * - * @return string - */ - protected function getNameInput() - { - return trim($this->argument('name')); - } - - /** - * Get the root namespace for the class. - * - * @return string - */ - protected function rootNamespace() - { - return $this->laravel->getNamespace(); - } - - /** - * Get the model for the default guard's user provider. - * - * @return string|null - */ - protected function userProviderModel() - { - $config = $this->laravel['config']; - - $provider = $config->get('auth.guards.'.$config->get('auth.defaults.guard').'.provider'); - - return $config->get("auth.providers.{$provider}.model"); - } - - /** - * Checks whether the given name is reserved. - * - * @param string $name - * @return bool - */ - protected function isReservedName($name) - { - $name = strtolower($name); - - return in_array($name, $this->reservedNames); - } - - /** - * Get the first view directory path from the application configuration. - * - * @param string $path - * @return string - */ - protected function viewPath($path = '') - { - $views = $this->laravel['config']['view.paths'][0] ?? resource_path('views'); - - return $views.($path ? DIRECTORY_SEPARATOR.$path : $path); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['name', InputArgument::REQUIRED, 'The name of the '.strtolower($this->type)], - ]; - } - - /** - * Prompt for missing input arguments using the returned questions. - * - * @return array - */ - protected function promptForMissingArgumentsUsing() - { - return [ - 'name' => 'What should the '.strtolower($this->type).' be named?', - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/LICENSE.md b/framework-9.50.2/src/Illuminate/Console/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Console/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Console/OutputStyle.php b/framework-9.50.2/src/Illuminate/Console/OutputStyle.php deleted file mode 100644 index 06eeef1..0000000 --- a/framework-9.50.2/src/Illuminate/Console/OutputStyle.php +++ /dev/null @@ -1,131 +0,0 @@ -output = $output; - - parent::__construct($input, $output); - } - - /** - * {@inheritdoc} - */ - public function write(string|iterable $messages, bool $newline = false, int $options = 0) - { - $this->newLineWritten = $newline; - - parent::write($messages, $newline, $options); - } - - /** - * {@inheritdoc} - */ - public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL) - { - $this->newLineWritten = true; - - parent::writeln($messages, $type); - } - - /** - * {@inheritdoc} - */ - public function newLine(int $count = 1) - { - $this->newLineWritten = $count > 0; - - parent::newLine($count); - } - - /** - * {@inheritdoc} - */ - public function newLineWritten() - { - if ($this->output instanceof static && $this->output->newLineWritten()) { - return true; - } - - return $this->newLineWritten; - } - - /** - * Returns whether verbosity is quiet (-q). - * - * @return bool - */ - public function isQuiet(): bool - { - return $this->output->isQuiet(); - } - - /** - * Returns whether verbosity is verbose (-v). - * - * @return bool - */ - public function isVerbose(): bool - { - return $this->output->isVerbose(); - } - - /** - * Returns whether verbosity is very verbose (-vv). - * - * @return bool - */ - public function isVeryVerbose(): bool - { - return $this->output->isVeryVerbose(); - } - - /** - * Returns whether verbosity is debug (-vvv). - * - * @return bool - */ - public function isDebug(): bool - { - return $this->output->isDebug(); - } - - /** - * Get the underlying Symfony output implementation. - * - * @return \Symfony\Component\Console\Output\OutputInterface - */ - public function getOutput() - { - return $this->output; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Parser.php b/framework-9.50.2/src/Illuminate/Console/Parser.php deleted file mode 100644 index 552400d..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Parser.php +++ /dev/null @@ -1,141 +0,0 @@ -getQuestion()); - - $text = $this->ensureEndsWithPunctuation($text); - - $text = " $text"; - - $default = $question->getDefault(); - - if ($question->isMultiline()) { - $text .= sprintf(' (press %s to continue)', 'Windows' == PHP_OS_FAMILY - ? 'Ctrl+Z then Enter' - : 'Ctrl+D'); - } - - switch (true) { - case null === $default: - $text = sprintf('%s', $text); - - break; - - case $question instanceof ConfirmationQuestion: - $text = sprintf('%s (yes/no) [%s]', $text, $default ? 'yes' : 'no'); - - break; - - case $question instanceof ChoiceQuestion: - $choices = $question->getChoices(); - $text = sprintf('%s [%s]', $text, OutputFormatter::escape($choices[$default] ?? $default)); - - break; - - default: - $text = sprintf('%s [%s]', $text, OutputFormatter::escape($default)); - - break; - } - - $output->writeln($text); - - if ($question instanceof ChoiceQuestion) { - foreach ($question->getChoices() as $key => $value) { - with(new TwoColumnDetail($output))->render($value, $key); - } - } - - $output->write('❯ '); - } - - /** - * Ensures the given string ends with punctuation. - * - * @param string $string - * @return string - */ - protected function ensureEndsWithPunctuation($string) - { - if (! str($string)->endsWith(['?', ':', '!', '.'])) { - return "$string:"; - } - - return $string; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/CacheAware.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/CacheAware.php deleted file mode 100644 index 862c47f..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/CacheAware.php +++ /dev/null @@ -1,14 +0,0 @@ -cache = $cache; - } - - /** - * Attempt to obtain an event mutex for the given event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @return bool - */ - public function create(Event $event) - { - return $this->cache->store($this->store)->add( - $event->mutexName(), true, $event->expiresAt * 60 - ); - } - - /** - * Determine if an event mutex exists for the given event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @return bool - */ - public function exists(Event $event) - { - return $this->cache->store($this->store)->has($event->mutexName()); - } - - /** - * Clear the event mutex for the given event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @return void - */ - public function forget(Event $event) - { - $this->cache->store($this->store)->forget($event->mutexName()); - } - - /** - * Specify the cache store that should be used. - * - * @param string $store - * @return $this - */ - public function useStore($store) - { - $this->store = $store; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php deleted file mode 100644 index ca8e2cb..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php +++ /dev/null @@ -1,75 +0,0 @@ -cache = $cache; - } - - /** - * Attempt to obtain a scheduling mutex for the given event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @param \DateTimeInterface $time - * @return bool - */ - public function create(Event $event, DateTimeInterface $time) - { - return $this->cache->store($this->store)->add( - $event->mutexName().$time->format('Hi'), true, 3600 - ); - } - - /** - * Determine if a scheduling mutex exists for the given event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @param \DateTimeInterface $time - * @return bool - */ - public function exists(Event $event, DateTimeInterface $time) - { - return $this->cache->store($this->store)->has( - $event->mutexName().$time->format('Hi') - ); - } - - /** - * Specify the cache store that should be used. - * - * @param string $store - * @return $this - */ - public function useStore($store) - { - $this->store = $store; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/CallbackEvent.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/CallbackEvent.php deleted file mode 100644 index db5e029..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/CallbackEvent.php +++ /dev/null @@ -1,201 +0,0 @@ -mutex = $mutex; - $this->callback = $callback; - $this->parameters = $parameters; - $this->timezone = $timezone; - } - - /** - * Run the callback event. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return mixed - * - * @throws \Throwable - */ - public function run(Container $container) - { - parent::run($container); - - if ($this->exception) { - throw $this->exception; - } - - return $this->result; - } - - /** - * Determine if the event should skip because another process is overlapping. - * - * @return bool - */ - public function shouldSkipDueToOverlapping() - { - return $this->description && parent::shouldSkipDueToOverlapping(); - } - - /** - * Indicate that the callback should run in the background. - * - * @return void - * - * @throws \RuntimeException - */ - public function runInBackground() - { - throw new RuntimeException('Scheduled closures can not be run in the background.'); - } - - /** - * Run the callback. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return int - */ - protected function execute($container) - { - try { - $this->result = is_object($this->callback) - ? $container->call([$this->callback, '__invoke'], $this->parameters) - : $container->call($this->callback, $this->parameters); - - return $this->result === false ? 1 : 0; - } catch (Throwable $e) { - $this->exception = $e; - - return 1; - } - } - - /** - * Do not allow the event to overlap each other. - * - * @param int $expiresAt - * @return $this - * - * @throws \LogicException - */ - public function withoutOverlapping($expiresAt = 1440) - { - if (! isset($this->description)) { - throw new LogicException( - "A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'." - ); - } - - return parent::withoutOverlapping($expiresAt); - } - - /** - * Allow the event to only run on one server for each cron expression. - * - * @return $this - * - * @throws \LogicException - */ - public function onOneServer() - { - if (! isset($this->description)) { - throw new LogicException( - "A scheduled event name is required to only run on one server. Use the 'name' method before 'onOneServer'." - ); - } - - return parent::onOneServer(); - } - - /** - * Get the summary of the event for display. - * - * @return string - */ - public function getSummaryForDisplay() - { - if (is_string($this->description)) { - return $this->description; - } - - return is_string($this->callback) ? $this->callback : 'Callback'; - } - - /** - * Get the mutex name for the scheduled command. - * - * @return string - */ - public function mutexName() - { - return 'framework/schedule-'.sha1($this->description ?? ''); - } - - /** - * Clear the mutex for the event. - * - * @return void - */ - protected function removeMutex() - { - if ($this->description) { - parent::removeMutex(); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/CommandBuilder.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/CommandBuilder.php deleted file mode 100644 index ee13c5e..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/CommandBuilder.php +++ /dev/null @@ -1,75 +0,0 @@ -runInBackground) { - return $this->buildBackgroundCommand($event); - } - - return $this->buildForegroundCommand($event); - } - - /** - * Build the command for running the event in the foreground. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @return string - */ - protected function buildForegroundCommand(Event $event) - { - $output = ProcessUtils::escapeArgument($event->output); - - return $this->ensureCorrectUser( - $event, $event->command.($event->shouldAppendOutput ? ' >> ' : ' > ').$output.' 2>&1' - ); - } - - /** - * Build the command for running the event in the background. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @return string - */ - protected function buildBackgroundCommand(Event $event) - { - $output = ProcessUtils::escapeArgument($event->output); - - $redirect = $event->shouldAppendOutput ? ' >> ' : ' > '; - - $finished = Application::formatCommandString('schedule:finish').' "'.$event->mutexName().'"'; - - if (windows_os()) { - return 'start /b cmd /v:on /c "('.$event->command.' & '.$finished.' ^!ERRORLEVEL^!)'.$redirect.$output.' 2>&1"'; - } - - return $this->ensureCorrectUser($event, - '('.$event->command.$redirect.$output.' 2>&1 ; '.$finished.' "$?") > ' - .ProcessUtils::escapeArgument($event->getDefaultOutput()).' 2>&1 &' - ); - } - - /** - * Finalize the event's command syntax with the correct user. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @param string $command - * @return string - */ - protected function ensureCorrectUser(Event $event, $command) - { - return $event->user && ! windows_os() ? 'sudo -u '.$event->user.' -- sh -c \''.$command.'\'' : $command; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/Event.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/Event.php deleted file mode 100644 index 36c180b..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/Event.php +++ /dev/null @@ -1,978 +0,0 @@ -mutex = $mutex; - $this->command = $command; - $this->timezone = $timezone; - - $this->output = $this->getDefaultOutput(); - } - - /** - * Get the default output depending on the OS. - * - * @return string - */ - public function getDefaultOutput() - { - return (DIRECTORY_SEPARATOR === '\\') ? 'NUL' : '/dev/null'; - } - - /** - * Run the given event. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - * - * @throws \Throwable - */ - public function run(Container $container) - { - if ($this->shouldSkipDueToOverlapping()) { - return; - } - - $exitCode = $this->start($container); - - if (! $this->runInBackground) { - $this->finish($container, $exitCode); - } - } - - /** - * Determine if the event should skip because another process is overlapping. - * - * @return bool - */ - public function shouldSkipDueToOverlapping() - { - return $this->withoutOverlapping && ! $this->mutex->create($this); - } - - /** - * Run the command process. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return int - * - * @throws \Throwable - */ - protected function start($container) - { - try { - $this->callBeforeCallbacks($container); - - return $this->execute($container); - } catch (Throwable $exception) { - $this->removeMutex(); - - throw $exception; - } - } - - /** - * Run the command process. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return int - */ - protected function execute($container) - { - return Process::fromShellCommandline( - $this->buildCommand(), base_path(), null, null, null - )->run(); - } - - /** - * Mark the command process as finished and run callbacks/cleanup. - * - * @param \Illuminate\Contracts\Container\Container $container - * @param int $exitCode - * @return void - */ - public function finish(Container $container, $exitCode) - { - $this->exitCode = (int) $exitCode; - - try { - $this->callAfterCallbacks($container); - } finally { - $this->removeMutex(); - } - } - - /** - * Call all of the "before" callbacks for the event. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function callBeforeCallbacks(Container $container) - { - foreach ($this->beforeCallbacks as $callback) { - $container->call($callback); - } - } - - /** - * Call all of the "after" callbacks for the event. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function callAfterCallbacks(Container $container) - { - foreach ($this->afterCallbacks as $callback) { - $container->call($callback); - } - } - - /** - * Build the command string. - * - * @return string - */ - public function buildCommand() - { - return (new CommandBuilder)->buildCommand($this); - } - - /** - * Determine if the given event should run based on the Cron expression. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return bool - */ - public function isDue($app) - { - if (! $this->runsInMaintenanceMode() && $app->isDownForMaintenance()) { - return false; - } - - return $this->expressionPasses() && - $this->runsInEnvironment($app->environment()); - } - - /** - * Determine if the event runs in maintenance mode. - * - * @return bool - */ - public function runsInMaintenanceMode() - { - return $this->evenInMaintenanceMode; - } - - /** - * Determine if the Cron expression passes. - * - * @return bool - */ - protected function expressionPasses() - { - $date = Date::now(); - - if ($this->timezone) { - $date = $date->setTimezone($this->timezone); - } - - return (new CronExpression($this->expression))->isDue($date->toDateTimeString()); - } - - /** - * Determine if the event runs in the given environment. - * - * @param string $environment - * @return bool - */ - public function runsInEnvironment($environment) - { - return empty($this->environments) || in_array($environment, $this->environments); - } - - /** - * Determine if the filters pass for the event. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return bool - */ - public function filtersPass($app) - { - foreach ($this->filters as $callback) { - if (! $app->call($callback)) { - return false; - } - } - - foreach ($this->rejects as $callback) { - if ($app->call($callback)) { - return false; - } - } - - return true; - } - - /** - * Ensure that the output is stored on disk in a log file. - * - * @return $this - */ - public function storeOutput() - { - $this->ensureOutputIsBeingCaptured(); - - return $this; - } - - /** - * Send the output of the command to a given location. - * - * @param string $location - * @param bool $append - * @return $this - */ - public function sendOutputTo($location, $append = false) - { - $this->output = $location; - - $this->shouldAppendOutput = $append; - - return $this; - } - - /** - * Append the output of the command to a given location. - * - * @param string $location - * @return $this - */ - public function appendOutputTo($location) - { - return $this->sendOutputTo($location, true); - } - - /** - * E-mail the results of the scheduled operation. - * - * @param array|mixed $addresses - * @param bool $onlyIfOutputExists - * @return $this - * - * @throws \LogicException - */ - public function emailOutputTo($addresses, $onlyIfOutputExists = false) - { - $this->ensureOutputIsBeingCaptured(); - - $addresses = Arr::wrap($addresses); - - return $this->then(function (Mailer $mailer) use ($addresses, $onlyIfOutputExists) { - $this->emailOutput($mailer, $addresses, $onlyIfOutputExists); - }); - } - - /** - * E-mail the results of the scheduled operation if it produces output. - * - * @param array|mixed $addresses - * @return $this - * - * @throws \LogicException - */ - public function emailWrittenOutputTo($addresses) - { - return $this->emailOutputTo($addresses, true); - } - - /** - * E-mail the results of the scheduled operation if it fails. - * - * @param array|mixed $addresses - * @return $this - */ - public function emailOutputOnFailure($addresses) - { - $this->ensureOutputIsBeingCaptured(); - - $addresses = Arr::wrap($addresses); - - return $this->onFailure(function (Mailer $mailer) use ($addresses) { - $this->emailOutput($mailer, $addresses, false); - }); - } - - /** - * Ensure that the command output is being captured. - * - * @return void - */ - protected function ensureOutputIsBeingCaptured() - { - if (is_null($this->output) || $this->output == $this->getDefaultOutput()) { - $this->sendOutputTo(storage_path('logs/schedule-'.sha1($this->mutexName()).'.log')); - } - } - - /** - * E-mail the output of the event to the recipients. - * - * @param \Illuminate\Contracts\Mail\Mailer $mailer - * @param array $addresses - * @param bool $onlyIfOutputExists - * @return void - */ - protected function emailOutput(Mailer $mailer, $addresses, $onlyIfOutputExists = false) - { - $text = is_file($this->output) ? file_get_contents($this->output) : ''; - - if ($onlyIfOutputExists && empty($text)) { - return; - } - - $mailer->raw($text, function ($m) use ($addresses) { - $m->to($addresses)->subject($this->getEmailSubject()); - }); - } - - /** - * Get the e-mail subject line for output results. - * - * @return string - */ - protected function getEmailSubject() - { - if ($this->description) { - return $this->description; - } - - return "Scheduled Job Output For [{$this->command}]"; - } - - /** - * Register a callback to ping a given URL before the job runs. - * - * @param string $url - * @return $this - */ - public function pingBefore($url) - { - return $this->before($this->pingCallback($url)); - } - - /** - * Register a callback to ping a given URL before the job runs if the given condition is true. - * - * @param bool $value - * @param string $url - * @return $this - */ - public function pingBeforeIf($value, $url) - { - return $value ? $this->pingBefore($url) : $this; - } - - /** - * Register a callback to ping a given URL after the job runs. - * - * @param string $url - * @return $this - */ - public function thenPing($url) - { - return $this->then($this->pingCallback($url)); - } - - /** - * Register a callback to ping a given URL after the job runs if the given condition is true. - * - * @param bool $value - * @param string $url - * @return $this - */ - public function thenPingIf($value, $url) - { - return $value ? $this->thenPing($url) : $this; - } - - /** - * Register a callback to ping a given URL if the operation succeeds. - * - * @param string $url - * @return $this - */ - public function pingOnSuccess($url) - { - return $this->onSuccess($this->pingCallback($url)); - } - - /** - * Register a callback to ping a given URL if the operation fails. - * - * @param string $url - * @return $this - */ - public function pingOnFailure($url) - { - return $this->onFailure($this->pingCallback($url)); - } - - /** - * Get the callback that pings the given URL. - * - * @param string $url - * @return \Closure - */ - protected function pingCallback($url) - { - return function (Container $container, HttpClient $http) use ($url) { - try { - $http->request('GET', $url); - } catch (ClientExceptionInterface|TransferException $e) { - $container->make(ExceptionHandler::class)->report($e); - } - }; - } - - /** - * State that the command should run in the background. - * - * @return $this - */ - public function runInBackground() - { - $this->runInBackground = true; - - return $this; - } - - /** - * Set which user the command should run as. - * - * @param string $user - * @return $this - */ - public function user($user) - { - $this->user = $user; - - return $this; - } - - /** - * Limit the environments the command should run in. - * - * @param array|mixed $environments - * @return $this - */ - public function environments($environments) - { - $this->environments = is_array($environments) ? $environments : func_get_args(); - - return $this; - } - - /** - * State that the command should run even in maintenance mode. - * - * @return $this - */ - public function evenInMaintenanceMode() - { - $this->evenInMaintenanceMode = true; - - return $this; - } - - /** - * Do not allow the event to overlap each other. - * - * @param int $expiresAt - * @return $this - */ - public function withoutOverlapping($expiresAt = 1440) - { - $this->withoutOverlapping = true; - - $this->expiresAt = $expiresAt; - - return $this->skip(function () { - return $this->mutex->exists($this); - }); - } - - /** - * Allow the event to only run on one server for each cron expression. - * - * @return $this - */ - public function onOneServer() - { - $this->onOneServer = true; - - return $this; - } - - /** - * Register a callback to further filter the schedule. - * - * @param \Closure|bool $callback - * @return $this - */ - public function when($callback) - { - $this->filters[] = Reflector::isCallable($callback) ? $callback : function () use ($callback) { - return $callback; - }; - - return $this; - } - - /** - * Register a callback to further filter the schedule. - * - * @param \Closure|bool $callback - * @return $this - */ - public function skip($callback) - { - $this->rejects[] = Reflector::isCallable($callback) ? $callback : function () use ($callback) { - return $callback; - }; - - return $this; - } - - /** - * Register a callback to be called before the operation. - * - * @param \Closure $callback - * @return $this - */ - public function before(Closure $callback) - { - $this->beforeCallbacks[] = $callback; - - return $this; - } - - /** - * Register a callback to be called after the operation. - * - * @param \Closure $callback - * @return $this - */ - public function after(Closure $callback) - { - return $this->then($callback); - } - - /** - * Register a callback to be called after the operation. - * - * @param \Closure $callback - * @return $this - */ - public function then(Closure $callback) - { - $parameters = $this->closureParameterTypes($callback); - - if (Arr::get($parameters, 'output') === Stringable::class) { - return $this->thenWithOutput($callback); - } - - $this->afterCallbacks[] = $callback; - - return $this; - } - - /** - * Register a callback that uses the output after the job runs. - * - * @param \Closure $callback - * @param bool $onlyIfOutputExists - * @return $this - */ - public function thenWithOutput(Closure $callback, $onlyIfOutputExists = false) - { - $this->ensureOutputIsBeingCaptured(); - - return $this->then($this->withOutputCallback($callback, $onlyIfOutputExists)); - } - - /** - * Register a callback to be called if the operation succeeds. - * - * @param \Closure $callback - * @return $this - */ - public function onSuccess(Closure $callback) - { - $parameters = $this->closureParameterTypes($callback); - - if (Arr::get($parameters, 'output') === Stringable::class) { - return $this->onSuccessWithOutput($callback); - } - - return $this->then(function (Container $container) use ($callback) { - if ($this->exitCode === 0) { - $container->call($callback); - } - }); - } - - /** - * Register a callback that uses the output if the operation succeeds. - * - * @param \Closure $callback - * @param bool $onlyIfOutputExists - * @return $this - */ - public function onSuccessWithOutput(Closure $callback, $onlyIfOutputExists = false) - { - $this->ensureOutputIsBeingCaptured(); - - return $this->onSuccess($this->withOutputCallback($callback, $onlyIfOutputExists)); - } - - /** - * Register a callback to be called if the operation fails. - * - * @param \Closure $callback - * @return $this - */ - public function onFailure(Closure $callback) - { - $parameters = $this->closureParameterTypes($callback); - - if (Arr::get($parameters, 'output') === Stringable::class) { - return $this->onFailureWithOutput($callback); - } - - return $this->then(function (Container $container) use ($callback) { - if ($this->exitCode !== 0) { - $container->call($callback); - } - }); - } - - /** - * Register a callback that uses the output if the operation fails. - * - * @param \Closure $callback - * @param bool $onlyIfOutputExists - * @return $this - */ - public function onFailureWithOutput(Closure $callback, $onlyIfOutputExists = false) - { - $this->ensureOutputIsBeingCaptured(); - - return $this->onFailure($this->withOutputCallback($callback, $onlyIfOutputExists)); - } - - /** - * Get a callback that provides output. - * - * @param \Closure $callback - * @param bool $onlyIfOutputExists - * @return \Closure - */ - protected function withOutputCallback(Closure $callback, $onlyIfOutputExists = false) - { - return function (Container $container) use ($callback, $onlyIfOutputExists) { - $output = $this->output && is_file($this->output) ? file_get_contents($this->output) : ''; - - return $onlyIfOutputExists && empty($output) - ? null - : $container->call($callback, ['output' => new Stringable($output)]); - }; - } - - /** - * Set the human-friendly description of the event. - * - * @param string $description - * @return $this - */ - public function name($description) - { - return $this->description($description); - } - - /** - * Set the human-friendly description of the event. - * - * @param string $description - * @return $this - */ - public function description($description) - { - $this->description = $description; - - return $this; - } - - /** - * Get the summary of the event for display. - * - * @return string - */ - public function getSummaryForDisplay() - { - if (is_string($this->description)) { - return $this->description; - } - - return $this->buildCommand(); - } - - /** - * Determine the next due date for an event. - * - * @param \DateTimeInterface|string $currentTime - * @param int $nth - * @param bool $allowCurrentDate - * @return \Illuminate\Support\Carbon - */ - public function nextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) - { - return Date::instance((new CronExpression($this->getExpression())) - ->getNextRunDate($currentTime, $nth, $allowCurrentDate, $this->timezone)); - } - - /** - * Get the Cron expression for the event. - * - * @return string - */ - public function getExpression() - { - return $this->expression; - } - - /** - * Set the event mutex implementation to be used. - * - * @param \Illuminate\Console\Scheduling\EventMutex $mutex - * @return $this - */ - public function preventOverlapsUsing(EventMutex $mutex) - { - $this->mutex = $mutex; - - return $this; - } - - /** - * Get the mutex name for the scheduled command. - * - * @return string - */ - public function mutexName() - { - $mutexNameResolver = $this->mutexNameResolver; - - if (! is_null($mutexNameResolver) && is_callable($mutexNameResolver)) { - return $mutexNameResolver($this); - } - - return 'framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command); - } - - /** - * Set the mutex name or name resolver callback. - * - * @param \Closure|string $mutexName - * @return $this - */ - public function createMutexNameUsing(Closure|string $mutexName) - { - $this->mutexNameResolver = is_string($mutexName) ? fn () => $mutexName : $mutexName; - - return $this; - } - - /** - * Delete the mutex for the event. - * - * @return void - */ - protected function removeMutex() - { - if ($this->withoutOverlapping) { - $this->mutex->forget($this); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/EventMutex.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/EventMutex.php deleted file mode 100644 index 1840e24..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/EventMutex.php +++ /dev/null @@ -1,30 +0,0 @@ -expression = $expression; - - return $this; - } - - /** - * Schedule the event to run between start and end time. - * - * @param string $startTime - * @param string $endTime - * @return $this - */ - public function between($startTime, $endTime) - { - return $this->when($this->inTimeInterval($startTime, $endTime)); - } - - /** - * Schedule the event to not run between start and end time. - * - * @param string $startTime - * @param string $endTime - * @return $this - */ - public function unlessBetween($startTime, $endTime) - { - return $this->skip($this->inTimeInterval($startTime, $endTime)); - } - - /** - * Schedule the event to run between start and end time. - * - * @param string $startTime - * @param string $endTime - * @return \Closure - */ - private function inTimeInterval($startTime, $endTime) - { - [$now, $startTime, $endTime] = [ - Carbon::now($this->timezone), - Carbon::parse($startTime, $this->timezone), - Carbon::parse($endTime, $this->timezone), - ]; - - if ($endTime->lessThan($startTime)) { - if ($startTime->greaterThan($now)) { - $startTime = $startTime->subDay(1); - } else { - $endTime = $endTime->addDay(1); - } - } - - return function () use ($now, $startTime, $endTime) { - return $now->between($startTime, $endTime); - }; - } - - /** - * Schedule the event to run every minute. - * - * @return $this - */ - public function everyMinute() - { - return $this->spliceIntoPosition(1, '*'); - } - - /** - * Schedule the event to run every two minutes. - * - * @return $this - */ - public function everyTwoMinutes() - { - return $this->spliceIntoPosition(1, '*/2'); - } - - /** - * Schedule the event to run every three minutes. - * - * @return $this - */ - public function everyThreeMinutes() - { - return $this->spliceIntoPosition(1, '*/3'); - } - - /** - * Schedule the event to run every four minutes. - * - * @return $this - */ - public function everyFourMinutes() - { - return $this->spliceIntoPosition(1, '*/4'); - } - - /** - * Schedule the event to run every five minutes. - * - * @return $this - */ - public function everyFiveMinutes() - { - return $this->spliceIntoPosition(1, '*/5'); - } - - /** - * Schedule the event to run every ten minutes. - * - * @return $this - */ - public function everyTenMinutes() - { - return $this->spliceIntoPosition(1, '*/10'); - } - - /** - * Schedule the event to run every fifteen minutes. - * - * @return $this - */ - public function everyFifteenMinutes() - { - return $this->spliceIntoPosition(1, '*/15'); - } - - /** - * Schedule the event to run every thirty minutes. - * - * @return $this - */ - public function everyThirtyMinutes() - { - return $this->spliceIntoPosition(1, '0,30'); - } - - /** - * Schedule the event to run hourly. - * - * @return $this - */ - public function hourly() - { - return $this->spliceIntoPosition(1, 0); - } - - /** - * Schedule the event to run hourly at a given offset in the hour. - * - * @param array|int $offset - * @return $this - */ - public function hourlyAt($offset) - { - $offset = is_array($offset) ? implode(',', $offset) : $offset; - - return $this->spliceIntoPosition(1, $offset); - } - - /** - * Schedule the event to run every odd hour. - * - * @return $this - */ - public function everyOddHour() - { - return $this->spliceIntoPosition(1, 0)->spliceIntoPosition(2, '1-23/2'); - } - - /** - * Schedule the event to run every two hours. - * - * @return $this - */ - public function everyTwoHours() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, '*/2'); - } - - /** - * Schedule the event to run every three hours. - * - * @return $this - */ - public function everyThreeHours() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, '*/3'); - } - - /** - * Schedule the event to run every four hours. - * - * @return $this - */ - public function everyFourHours() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, '*/4'); - } - - /** - * Schedule the event to run every six hours. - * - * @return $this - */ - public function everySixHours() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, '*/6'); - } - - /** - * Schedule the event to run daily. - * - * @return $this - */ - public function daily() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0); - } - - /** - * Schedule the command at a given time. - * - * @param string $time - * @return $this - */ - public function at($time) - { - return $this->dailyAt($time); - } - - /** - * Schedule the event to run daily at a given time (10:00, 19:30, etc). - * - * @param string $time - * @return $this - */ - public function dailyAt($time) - { - $segments = explode(':', $time); - - return $this->spliceIntoPosition(2, (int) $segments[0]) - ->spliceIntoPosition(1, count($segments) === 2 ? (int) $segments[1] : '0'); - } - - /** - * Schedule the event to run twice daily. - * - * @param int $first - * @param int $second - * @return $this - */ - public function twiceDaily($first = 1, $second = 13) - { - return $this->twiceDailyAt($first, $second, 0); - } - - /** - * Schedule the event to run twice daily at a given offset. - * - * @param int $first - * @param int $second - * @param int $offset - * @return $this - */ - public function twiceDailyAt($first = 1, $second = 13, $offset = 0) - { - $hours = $first.','.$second; - - return $this->spliceIntoPosition(1, $offset) - ->spliceIntoPosition(2, $hours); - } - - /** - * Schedule the event to run only on weekdays. - * - * @return $this - */ - public function weekdays() - { - return $this->days(Schedule::MONDAY.'-'.Schedule::FRIDAY); - } - - /** - * Schedule the event to run only on weekends. - * - * @return $this - */ - public function weekends() - { - return $this->days(Schedule::SATURDAY.','.Schedule::SUNDAY); - } - - /** - * Schedule the event to run only on Mondays. - * - * @return $this - */ - public function mondays() - { - return $this->days(Schedule::MONDAY); - } - - /** - * Schedule the event to run only on Tuesdays. - * - * @return $this - */ - public function tuesdays() - { - return $this->days(Schedule::TUESDAY); - } - - /** - * Schedule the event to run only on Wednesdays. - * - * @return $this - */ - public function wednesdays() - { - return $this->days(Schedule::WEDNESDAY); - } - - /** - * Schedule the event to run only on Thursdays. - * - * @return $this - */ - public function thursdays() - { - return $this->days(Schedule::THURSDAY); - } - - /** - * Schedule the event to run only on Fridays. - * - * @return $this - */ - public function fridays() - { - return $this->days(Schedule::FRIDAY); - } - - /** - * Schedule the event to run only on Saturdays. - * - * @return $this - */ - public function saturdays() - { - return $this->days(Schedule::SATURDAY); - } - - /** - * Schedule the event to run only on Sundays. - * - * @return $this - */ - public function sundays() - { - return $this->days(Schedule::SUNDAY); - } - - /** - * Schedule the event to run weekly. - * - * @return $this - */ - public function weekly() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(5, 0); - } - - /** - * Schedule the event to run weekly on a given day and time. - * - * @param array|mixed $dayOfWeek - * @param string $time - * @return $this - */ - public function weeklyOn($dayOfWeek, $time = '0:0') - { - $this->dailyAt($time); - - return $this->days($dayOfWeek); - } - - /** - * Schedule the event to run monthly. - * - * @return $this - */ - public function monthly() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(3, 1); - } - - /** - * Schedule the event to run monthly on a given day and time. - * - * @param int $dayOfMonth - * @param string $time - * @return $this - */ - public function monthlyOn($dayOfMonth = 1, $time = '0:0') - { - $this->dailyAt($time); - - return $this->spliceIntoPosition(3, $dayOfMonth); - } - - /** - * Schedule the event to run twice monthly at a given time. - * - * @param int $first - * @param int $second - * @param string $time - * @return $this - */ - public function twiceMonthly($first = 1, $second = 16, $time = '0:0') - { - $daysOfMonth = $first.','.$second; - - $this->dailyAt($time); - - return $this->spliceIntoPosition(3, $daysOfMonth); - } - - /** - * Schedule the event to run on the last day of the month. - * - * @param string $time - * @return $this - */ - public function lastDayOfMonth($time = '0:0') - { - $this->dailyAt($time); - - return $this->spliceIntoPosition(3, Carbon::now()->endOfMonth()->day); - } - - /** - * Schedule the event to run quarterly. - * - * @return $this - */ - public function quarterly() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(3, 1) - ->spliceIntoPosition(4, '1-12/3'); - } - - /** - * Schedule the event to run quarterly on a given day and time. - * - * @param int $dayOfQuarter - * @param int $time - * @return $this - */ - public function quarterlyOn($dayOfQuarter = 1, $time = '0:0') - { - $this->dailyAt($time); - - return $this->spliceIntoPosition(3, $dayOfQuarter) - ->spliceIntoPosition(4, '1-12/3'); - } - - /** - * Schedule the event to run yearly. - * - * @return $this - */ - public function yearly() - { - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(3, 1) - ->spliceIntoPosition(4, 1); - } - - /** - * Schedule the event to run yearly on a given month, day, and time. - * - * @param int $month - * @param int|string $dayOfMonth - * @param string $time - * @return $this - */ - public function yearlyOn($month = 1, $dayOfMonth = 1, $time = '0:0') - { - $this->dailyAt($time); - - return $this->spliceIntoPosition(3, $dayOfMonth) - ->spliceIntoPosition(4, $month); - } - - /** - * Set the days of the week the command should run on. - * - * @param array|mixed $days - * @return $this - */ - public function days($days) - { - $days = is_array($days) ? $days : func_get_args(); - - return $this->spliceIntoPosition(5, implode(',', $days)); - } - - /** - * Set the timezone the date should be evaluated on. - * - * @param \DateTimeZone|string $timezone - * @return $this - */ - public function timezone($timezone) - { - $this->timezone = $timezone; - - return $this; - } - - /** - * Splice the given value into the given position of the expression. - * - * @param int $position - * @param string $value - * @return $this - */ - protected function spliceIntoPosition($position, $value) - { - $segments = preg_split("/\s+/", $this->expression); - - $segments[$position - 1] = $value; - - return $this->cron(implode(' ', $segments)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/Schedule.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/Schedule.php deleted file mode 100644 index 2f62bf9..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/Schedule.php +++ /dev/null @@ -1,367 +0,0 @@ -timezone = $timezone; - - if (! class_exists(Container::class)) { - throw new RuntimeException( - 'A container implementation is required to use the scheduler. Please install the illuminate/container package.' - ); - } - - $container = Container::getInstance(); - - $this->eventMutex = $container->bound(EventMutex::class) - ? $container->make(EventMutex::class) - : $container->make(CacheEventMutex::class); - - $this->schedulingMutex = $container->bound(SchedulingMutex::class) - ? $container->make(SchedulingMutex::class) - : $container->make(CacheSchedulingMutex::class); - } - - /** - * Add a new callback event to the schedule. - * - * @param string|callable $callback - * @param array $parameters - * @return \Illuminate\Console\Scheduling\CallbackEvent - */ - public function call($callback, array $parameters = []) - { - $this->events[] = $event = new CallbackEvent( - $this->eventMutex, $callback, $parameters, $this->timezone - ); - - return $event; - } - - /** - * Add a new Artisan command event to the schedule. - * - * @param string $command - * @param array $parameters - * @return \Illuminate\Console\Scheduling\Event - */ - public function command($command, array $parameters = []) - { - if (class_exists($command)) { - $command = Container::getInstance()->make($command); - - return $this->exec( - Application::formatCommandString($command->getName()), $parameters, - )->description($command->getDescription()); - } - - return $this->exec( - Application::formatCommandString($command), $parameters - ); - } - - /** - * Add a new job callback event to the schedule. - * - * @param object|string $job - * @param string|null $queue - * @param string|null $connection - * @return \Illuminate\Console\Scheduling\CallbackEvent - */ - public function job($job, $queue = null, $connection = null) - { - return $this->call(function () use ($job, $queue, $connection) { - $job = is_string($job) ? Container::getInstance()->make($job) : $job; - - if ($job instanceof ShouldQueue) { - $this->dispatchToQueue($job, $queue ?? $job->queue, $connection ?? $job->connection); - } else { - $this->dispatchNow($job); - } - })->name(is_string($job) ? $job : get_class($job)); - } - - /** - * Dispatch the given job to the queue. - * - * @param object $job - * @param string|null $queue - * @param string|null $connection - * @return void - * - * @throws \RuntimeException - */ - protected function dispatchToQueue($job, $queue, $connection) - { - if ($job instanceof Closure) { - if (! class_exists(CallQueuedClosure::class)) { - throw new RuntimeException( - 'To enable support for closure jobs, please install the illuminate/queue package.' - ); - } - - $job = CallQueuedClosure::create($job); - } - - if ($job instanceof ShouldBeUnique) { - return $this->dispatchUniqueJobToQueue($job, $queue, $connection); - } - - $this->getDispatcher()->dispatch( - $job->onConnection($connection)->onQueue($queue) - ); - } - - /** - * Dispatch the given unique job to the queue. - * - * @param object $job - * @param string|null $queue - * @param string|null $connection - * @return void - * - * @throws \RuntimeException - */ - protected function dispatchUniqueJobToQueue($job, $queue, $connection) - { - if (! Container::getInstance()->bound(Cache::class)) { - throw new RuntimeException('Cache driver not available. Scheduling unique jobs not supported.'); - } - - if (! (new UniqueLock(Container::getInstance()->make(Cache::class)))->acquire($job)) { - return; - } - - $this->getDispatcher()->dispatch( - $job->onConnection($connection)->onQueue($queue) - ); - } - - /** - * Dispatch the given job right now. - * - * @param object $job - * @return void - */ - protected function dispatchNow($job) - { - $this->getDispatcher()->dispatchNow($job); - } - - /** - * Add a new command event to the schedule. - * - * @param string $command - * @param array $parameters - * @return \Illuminate\Console\Scheduling\Event - */ - public function exec($command, array $parameters = []) - { - if (count($parameters)) { - $command .= ' '.$this->compileParameters($parameters); - } - - $this->events[] = $event = new Event($this->eventMutex, $command, $this->timezone); - - return $event; - } - - /** - * Compile parameters for a command. - * - * @param array $parameters - * @return string - */ - protected function compileParameters(array $parameters) - { - return collect($parameters)->map(function ($value, $key) { - if (is_array($value)) { - return $this->compileArrayInput($key, $value); - } - - if (! is_numeric($value) && ! preg_match('/^(-.$|--.*)/i', $value)) { - $value = ProcessUtils::escapeArgument($value); - } - - return is_numeric($key) ? $value : "{$key}={$value}"; - })->implode(' '); - } - - /** - * Compile array input for a command. - * - * @param string|int $key - * @param array $value - * @return string - */ - public function compileArrayInput($key, $value) - { - $value = collect($value)->map(function ($value) { - return ProcessUtils::escapeArgument($value); - }); - - if (str_starts_with($key, '--')) { - $value = $value->map(function ($value) use ($key) { - return "{$key}={$value}"; - }); - } elseif (str_starts_with($key, '-')) { - $value = $value->map(function ($value) use ($key) { - return "{$key} {$value}"; - }); - } - - return $value->implode(' '); - } - - /** - * Determine if the server is allowed to run this event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @param \DateTimeInterface $time - * @return bool - */ - public function serverShouldRun(Event $event, DateTimeInterface $time) - { - return $this->schedulingMutex->create($event, $time); - } - - /** - * Get all of the events on the schedule that are due. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return \Illuminate\Support\Collection - */ - public function dueEvents($app) - { - return collect($this->events)->filter->isDue($app); - } - - /** - * Get all of the events on the schedule. - * - * @return \Illuminate\Console\Scheduling\Event[] - */ - public function events() - { - return $this->events; - } - - /** - * Specify the cache store that should be used to store mutexes. - * - * @param string $store - * @return $this - */ - public function useCache($store) - { - if ($this->eventMutex instanceof CacheAware) { - $this->eventMutex->useStore($store); - } - - if ($this->schedulingMutex instanceof CacheAware) { - $this->schedulingMutex->useStore($store); - } - - return $this; - } - - /** - * Get the job dispatcher, if available. - * - * @return \Illuminate\Contracts\Bus\Dispatcher - * - * @throws \RuntimeException - */ - protected function getDispatcher() - { - if ($this->dispatcher === null) { - try { - $this->dispatcher = Container::getInstance()->make(Dispatcher::class); - } catch (BindingResolutionException $e) { - throw new RuntimeException( - 'Unable to resolve the dispatcher from the service container. Please bind it or install the illuminate/bus package.', - is_int($e->getCode()) ? $e->getCode() : 0, $e - ); - } - } - - return $this->dispatcher; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleClearCacheCommand.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleClearCacheCommand.php deleted file mode 100644 index 3deb1c6..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleClearCacheCommand.php +++ /dev/null @@ -1,47 +0,0 @@ -events($this->laravel) as $event) { - if ($event->mutex->exists($event)) { - $this->components->info(sprintf('Deleting mutex for [%s]', $event->command)); - - $event->mutex->forget($event); - - $mutexCleared = true; - } - } - - if (! $mutexCleared) { - $this->components->info('No mutex files were found.'); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php deleted file mode 100644 index 5494353..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php +++ /dev/null @@ -1,61 +0,0 @@ -events())->filter(function ($value) { - return $value->mutexName() == $this->argument('id'); - })->each(function ($event) { - $event->finish($this->laravel, $this->argument('code')); - - $this->laravel->make(Dispatcher::class)->dispatch(new ScheduledBackgroundTaskFinished($event)); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleListCommand.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleListCommand.php deleted file mode 100644 index 9f26f09..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleListCommand.php +++ /dev/null @@ -1,259 +0,0 @@ -events()); - - if ($events->isEmpty()) { - $this->components->info('No scheduled tasks have been defined.'); - - return; - } - - $terminalWidth = self::getTerminalWidth(); - - $expressionSpacing = $this->getCronExpressionSpacing($events); - - $timezone = new DateTimeZone($this->option('timezone') ?? config('app.timezone')); - - $events = $this->sortEvents($events, $timezone); - - $events = $events->map(function ($event) use ($terminalWidth, $expressionSpacing, $timezone) { - $expression = $this->formatCronExpression($event->expression, $expressionSpacing); - - $command = $event->command ?? ''; - - $description = $event->description ?? ''; - - if (! $this->output->isVerbose()) { - $command = str_replace([Application::phpBinary(), Application::artisanBinary()], [ - 'php', - preg_replace("#['\"]#", '', Application::artisanBinary()), - ], $command); - } - - if ($event instanceof CallbackEvent) { - if (class_exists($description)) { - $command = $description; - $description = ''; - } else { - $command = 'Closure at: '.$this->getClosureLocation($event); - } - } - - $command = mb_strlen($command) > 1 ? "{$command} " : ''; - - $nextDueDateLabel = 'Next Due:'; - - $nextDueDate = $this->getNextDueDateForEvent($event, $timezone); - - $nextDueDate = $this->output->isVerbose() - ? $nextDueDate->format('Y-m-d H:i:s P') - : $nextDueDate->diffForHumans(); - - $hasMutex = $event->mutex->exists($event) ? 'Has Mutex › ' : ''; - - $dots = str_repeat('.', max( - $terminalWidth - mb_strlen($expression.$command.$nextDueDateLabel.$nextDueDate.$hasMutex) - 8, 0 - )); - - // Highlight the parameters... - $command = preg_replace("#(php artisan [\w\-:]+) (.+)#", '$1 $2', $command); - - return [sprintf( - ' %s %s%s %s%s %s', - $expression, - $command, - $dots, - $hasMutex, - $nextDueDateLabel, - $nextDueDate - ), $this->output->isVerbose() && mb_strlen($description) > 1 ? sprintf( - ' %s%s %s', - str_repeat(' ', mb_strlen($expression) + 2), - '⇁', - $description - ) : '']; - }); - - $this->line( - $events->flatten()->filter()->prepend('')->push('')->toArray() - ); - } - - /** - * Gets the spacing to be used on each event row. - * - * @param \Illuminate\Support\Collection $events - * @return array - */ - private function getCronExpressionSpacing($events) - { - $rows = $events->map(fn ($event) => array_map('mb_strlen', preg_split("/\s+/", $event->expression))); - - return collect($rows[0] ?? [])->keys()->map(fn ($key) => $rows->max($key))->all(); - } - - /** - * Sorts the events by due date if option set. - * - * @param \Illuminate\Support\Collection $events - * @param \DateTimeZone $timezone - * @return \Illuminate\Support\Collection - */ - private function sortEvents(\Illuminate\Support\Collection $events, DateTimeZone $timezone) - { - return $this->option('next') - ? $events->sortBy(fn ($event) => $this->getNextDueDateForEvent($event, $timezone)) - : $events; - } - - /** - * Get the next due date for an event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @param \DateTimeZone $timezone - * @return \Illuminate\Support\Carbon - */ - private function getNextDueDateForEvent($event, DateTimeZone $timezone) - { - return Carbon::instance( - (new CronExpression($event->expression)) - ->getNextRunDate(Carbon::now()->setTimezone($event->timezone)) - ->setTimezone($timezone) - ); - } - - /** - * Formats the cron expression based on the spacing provided. - * - * @param string $expression - * @param array $spacing - * @return string - */ - private function formatCronExpression($expression, $spacing) - { - $expressions = preg_split("/\s+/", $expression); - - return collect($spacing) - ->map(fn ($length, $index) => str_pad($expressions[$index], $length)) - ->implode(' '); - } - - /** - * Get the file and line number for the event closure. - * - * @param \Illuminate\Console\Scheduling\CallbackEvent $event - * @return string - */ - private function getClosureLocation(CallbackEvent $event) - { - $callback = tap((new ReflectionClass($event))->getProperty('callback')) - ->setAccessible(true) - ->getValue($event); - - if ($callback instanceof Closure) { - $function = new ReflectionFunction($callback); - - return sprintf( - '%s:%s', - str_replace($this->laravel->basePath().DIRECTORY_SEPARATOR, '', $function->getFileName() ?: ''), - $function->getStartLine() - ); - } - - if (is_string($callback)) { - return $callback; - } - - if (is_array($callback)) { - $className = is_string($callback[0]) ? $callback[0] : $callback[0]::class; - - return sprintf('%s::%s', $className, $callback[1]); - } - - return sprintf('%s::__invoke', $callback::class); - } - - /** - * Get the terminal width. - * - * @return int - */ - public static function getTerminalWidth() - { - return is_null(static::$terminalWidthResolver) - ? (new Terminal)->getWidth() - : call_user_func(static::$terminalWidthResolver); - } - - /** - * Set a callback that should be used when resolving the terminal width. - * - * @param \Closure|null $resolver - * @return void - */ - public static function resolveTerminalWidthUsing($resolver) - { - static::$terminalWidthResolver = $resolver; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php deleted file mode 100644 index 067aebd..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php +++ /dev/null @@ -1,207 +0,0 @@ -startedAt = Date::now(); - - parent::__construct(); - } - - /** - * Execute the console command. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @param \Illuminate\Contracts\Debug\ExceptionHandler $handler - * @return void - */ - public function handle(Schedule $schedule, Dispatcher $dispatcher, ExceptionHandler $handler) - { - $this->schedule = $schedule; - $this->dispatcher = $dispatcher; - $this->handler = $handler; - $this->phpBinary = Application::phpBinary(); - - $this->newLine(); - - foreach ($this->schedule->dueEvents($this->laravel) as $event) { - if (! $event->filtersPass($this->laravel)) { - $this->dispatcher->dispatch(new ScheduledTaskSkipped($event)); - - continue; - } - - if ($event->onOneServer) { - $this->runSingleServerEvent($event); - } else { - $this->runEvent($event); - } - - $this->eventsRan = true; - } - - if (! $this->eventsRan) { - $this->components->info('No scheduled commands are ready to run.'); - } else { - $this->newLine(); - } - } - - /** - * Run the given single server event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @return void - */ - protected function runSingleServerEvent($event) - { - if ($this->schedule->serverShouldRun($event, $this->startedAt)) { - $this->runEvent($event); - } else { - $this->components->info(sprintf( - 'Skipping [%s], as command already run on another server.', $event->getSummaryForDisplay() - )); - } - } - - /** - * Run the given event. - * - * @param \Illuminate\Console\Scheduling\Event $event - * @return void - */ - protected function runEvent($event) - { - $summary = $event->getSummaryForDisplay(); - - $command = $event instanceof CallbackEvent - ? $summary - : trim(str_replace($this->phpBinary, '', $event->command)); - - $description = sprintf( - '%s Running [%s]%s', - Carbon::now()->format('Y-m-d H:i:s'), - $command, - $event->runInBackground ? ' in background' : '', - ); - - $this->components->task($description, function () use ($event) { - $this->dispatcher->dispatch(new ScheduledTaskStarting($event)); - - $start = microtime(true); - - try { - $event->run($this->laravel); - - $this->dispatcher->dispatch(new ScheduledTaskFinished( - $event, - round(microtime(true) - $start, 2) - )); - - $this->eventsRan = true; - } catch (Throwable $e) { - $this->dispatcher->dispatch(new ScheduledTaskFailed($event, $e)); - - $this->handler->report($e); - } - - return $event->exitCode == 0; - }); - - if (! $event instanceof CallbackEvent) { - $this->components->bulletList([ - $event->getSummaryForDisplay(), - ]); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php deleted file mode 100644 index a8a1a59..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php +++ /dev/null @@ -1,99 +0,0 @@ -events(); - - $commandNames = []; - - foreach ($commands as $command) { - $commandNames[] = $command->command ?? $command->getSummaryForDisplay(); - } - - if (empty($commandNames)) { - return $this->components->info('No scheduled commands have been defined.'); - } - - if (! empty($name = $this->option('name'))) { - $commandBinary = $phpBinary.' '.Application::artisanBinary(); - - $matches = array_filter($commandNames, function ($commandName) use ($commandBinary, $name) { - return trim(str_replace($commandBinary, '', $commandName)) === $name; - }); - - if (count($matches) !== 1) { - $this->components->info('No matching scheduled command found.'); - - return; - } - - $index = key($matches); - } else { - $index = array_search($this->components->choice('Which command would you like to run?', $commandNames), $commandNames); - } - - $event = $commands[$index]; - - $summary = $event->getSummaryForDisplay(); - - $command = $event instanceof CallbackEvent - ? $summary - : trim(str_replace($phpBinary, '', $event->command)); - - $description = sprintf( - 'Running [%s]%s', - $command, - $event->runInBackground ? ' in background' : '', - ); - - $this->components->task($description, fn () => $event->run($this->laravel)); - - if (! $event instanceof CallbackEvent) { - $this->components->bulletList([$event->getSummaryForDisplay()]); - } - - $this->newLine(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php deleted file mode 100644 index de3ce94..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php +++ /dev/null @@ -1,77 +0,0 @@ -components->info('Running schedule tasks every minute.'); - - [$lastExecutionStartedAt, $executions] = [null, []]; - - while (true) { - usleep(100 * 1000); - - if (Carbon::now()->second === 0 && - ! Carbon::now()->startOfMinute()->equalTo($lastExecutionStartedAt)) { - $executions[] = $execution = new Process([ - PHP_BINARY, - defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan', - 'schedule:run', - ]); - - $execution->start(); - - $lastExecutionStartedAt = Carbon::now()->startOfMinute(); - } - - foreach ($executions as $key => $execution) { - $output = $execution->getIncrementalOutput(). - $execution->getIncrementalErrorOutput(); - - $this->output->write(ltrim($output, "\n")); - - if (! $execution->isRunning()) { - unset($executions[$key]); - } - } - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/Scheduling/SchedulingMutex.php b/framework-9.50.2/src/Illuminate/Console/Scheduling/SchedulingMutex.php deleted file mode 100644 index ab4e87d..0000000 --- a/framework-9.50.2/src/Illuminate/Console/Scheduling/SchedulingMutex.php +++ /dev/null @@ -1,26 +0,0 @@ ->|null - */ - protected $previousHandlers; - - /** - * The current availability resolver, if any. - * - * @var (callable(): bool)|null - */ - protected static $availabilityResolver; - - /** - * Create a new signal registrar instance. - * - * @param \Symfony\Component\Console\SignalRegistry\SignalRegistry $registry - * @return void - */ - public function __construct($registry) - { - $this->registry = $registry; - - $this->previousHandlers = $this->getHandlers(); - } - - /** - * Register a new signal handler. - * - * @param int $signal - * @param callable(int $signal): void $callback - * @return void - */ - public function register($signal, $callback) - { - $this->previousHandlers[$signal] ??= $this->initializeSignal($signal); - - with($this->getHandlers(), function ($handlers) use ($signal) { - $handlers[$signal] ??= $this->initializeSignal($signal); - - $this->setHandlers($handlers); - }); - - $this->registry->register($signal, $callback); - - with($this->getHandlers(), function ($handlers) use ($signal) { - $lastHandlerInserted = array_pop($handlers[$signal]); - - array_unshift($handlers[$signal], $lastHandlerInserted); - - $this->setHandlers($handlers); - }); - } - - /** - * Gets the signal's existing handler in array format. - * - * @return array - */ - protected function initializeSignal($signal) - { - return is_callable($existingHandler = pcntl_signal_get_handler($signal)) - ? [$existingHandler] - : null; - } - - /** - * Unregister the current signal handlers. - * - * @return array> - */ - public function unregister() - { - $previousHandlers = $this->previousHandlers; - - foreach ($previousHandlers as $signal => $handler) { - if (is_null($handler)) { - pcntl_signal($signal, SIG_DFL); - - unset($previousHandlers[$signal]); - } - } - - $this->setHandlers($previousHandlers); - } - - /** - * Execute the given callback if "signals" should be used and are available. - * - * @param callable $callback - * @return void - */ - public static function whenAvailable($callback) - { - $resolver = static::$availabilityResolver; - - if ($resolver()) { - $callback(); - } - } - - /** - * Get the registry's handlers. - * - * @return array> - */ - protected function getHandlers() - { - return (fn () => $this->signalHandlers) - ->call($this->registry); - } - - /** - * Set the registry's handlers. - * - * @param array> $handlers - * @return void - */ - protected function setHandlers($handlers) - { - (fn () => $this->signalHandlers = $handlers) - ->call($this->registry); - } - - /** - * Set the availability resolver. - * - * @param callable(): bool - * @return void - */ - public static function resolveAvailabilityUsing($resolver) - { - static::$availabilityResolver = $resolver; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Alert.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Alert.php deleted file mode 100644 index a975aaf..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Alert.php +++ /dev/null @@ -1,28 +0,0 @@ -mutate($string, [ - Mutators\EnsureDynamicContentIsHighlighted::class, - Mutators\EnsurePunctuation::class, - Mutators\EnsureRelativePaths::class, - ]); - - $this->renderView('alert', [ - 'content' => $string, - ], $verbosity); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Ask.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Ask.php deleted file mode 100644 index 9d359b1..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Ask.php +++ /dev/null @@ -1,18 +0,0 @@ -usingQuestionHelper(fn () => $this->output->ask($question, $default)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/AskWithCompletion.php b/framework-9.50.2/src/Illuminate/Console/View/Components/AskWithCompletion.php deleted file mode 100644 index 103d730..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/AskWithCompletion.php +++ /dev/null @@ -1,29 +0,0 @@ -setAutocompleterCallback($choices) - : $question->setAutocompleterValues($choices); - - return $this->usingQuestionHelper( - fn () => $this->output->askQuestion($question) - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/BulletList.php b/framework-9.50.2/src/Illuminate/Console/View/Components/BulletList.php deleted file mode 100644 index da3d881..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/BulletList.php +++ /dev/null @@ -1,28 +0,0 @@ - $elements - * @param int $verbosity - * @return void - */ - public function render($elements, $verbosity = OutputInterface::VERBOSITY_NORMAL) - { - $elements = $this->mutate($elements, [ - Mutators\EnsureDynamicContentIsHighlighted::class, - Mutators\EnsureNoPunctuation::class, - Mutators\EnsureRelativePaths::class, - ]); - - $this->renderView('bullet-list', [ - 'elements' => $elements, - ], $verbosity); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Choice.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Choice.php deleted file mode 100644 index 8ef25be..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Choice.php +++ /dev/null @@ -1,29 +0,0 @@ - $choices - * @param mixed $default - * @param int $attempts - * @param bool $multiple - * @return mixed - */ - public function render($question, $choices, $default = null, $attempts = null, $multiple = false) - { - return $this->usingQuestionHelper( - fn () => $this->output->askQuestion( - (new ChoiceQuestion($question, $choices, $default)) - ->setMaxAttempts($attempts) - ->setMultiselect($multiple) - ), - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Component.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Component.php deleted file mode 100644 index 263d003..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Component.php +++ /dev/null @@ -1,124 +0,0 @@ - - */ - protected $mutators; - - /** - * Creates a new component instance. - * - * @param \Illuminate\Console\OutputStyle $output - * @return void - */ - public function __construct($output) - { - $this->output = $output; - } - - /** - * Renders the given view. - * - * @param string $view - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @param int $verbosity - * @return void - */ - protected function renderView($view, $data, $verbosity) - { - renderUsing($this->output); - - render((string) $this->compile($view, $data), $verbosity); - } - - /** - * Compile the given view contents. - * - * @param string $view - * @param array $data - * @return void - */ - protected function compile($view, $data) - { - extract($data); - - ob_start(); - - include __DIR__."/../../resources/views/components/$view.php"; - - return tap(ob_get_contents(), function () { - ob_end_clean(); - }); - } - - /** - * Mutates the given data with the given set of mutators. - * - * @param array|string $data - * @param array $mutators - * @return array|string - */ - protected function mutate($data, $mutators) - { - foreach ($mutators as $mutator) { - $mutator = new $mutator; - - if (is_iterable($data)) { - foreach ($data as $key => $value) { - $data[$key] = $mutator($value); - } - } else { - $data = $mutator($data); - } - } - - return $data; - } - - /** - * Eventually performs a question using the component's question helper. - * - * @param callable $callable - * @return mixed - */ - protected function usingQuestionHelper($callable) - { - $property = with(new ReflectionClass(OutputStyle::class)) - ->getParentClass() - ->getProperty('questionHelper'); - - $property->setAccessible(true); - - $currentHelper = $property->isInitialized($this->output) - ? $property->getValue($this->output) - : new SymfonyQuestionHelper(); - - $property->setValue($this->output, new QuestionHelper); - - try { - return $callable(); - } finally { - $property->setValue($this->output, $currentHelper); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Confirm.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Confirm.php deleted file mode 100644 index 1e98c1e..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Confirm.php +++ /dev/null @@ -1,20 +0,0 @@ -usingQuestionHelper( - fn () => $this->output->confirm($question, $default), - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Error.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Error.php deleted file mode 100644 index 73196cc..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Error.php +++ /dev/null @@ -1,20 +0,0 @@ -output))->render('error', $string, $verbosity); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Factory.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Factory.php deleted file mode 100644 index a14a0b6..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Factory.php +++ /dev/null @@ -1,60 +0,0 @@ -output = $output; - } - - /** - * Dynamically handle calls into the component instance. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \InvalidArgumentException - */ - public function __call($method, $parameters) - { - $component = '\Illuminate\Console\View\Components\\'.ucfirst($method); - - throw_unless(class_exists($component), new InvalidArgumentException(sprintf( - 'Console component [%s] not found.', $method - ))); - - return with(new $component($this->output))->render(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Info.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Info.php deleted file mode 100644 index 7651422..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Info.php +++ /dev/null @@ -1,20 +0,0 @@ -output))->render('info', $string, $verbosity); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Line.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Line.php deleted file mode 100644 index 5c701ee..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Line.php +++ /dev/null @@ -1,54 +0,0 @@ -> - */ - protected static $styles = [ - 'info' => [ - 'bgColor' => 'blue', - 'fgColor' => 'white', - 'title' => 'info', - ], - 'warn' => [ - 'bgColor' => 'yellow', - 'fgColor' => 'black', - 'title' => 'warn', - ], - 'error' => [ - 'bgColor' => 'red', - 'fgColor' => 'white', - 'title' => 'error', - ], - ]; - - /** - * Renders the component using the given arguments. - * - * @param string $style - * @param string $string - * @param int $verbosity - * @return void - */ - public function render($style, $string, $verbosity = OutputInterface::VERBOSITY_NORMAL) - { - $string = $this->mutate($string, [ - Mutators\EnsureDynamicContentIsHighlighted::class, - Mutators\EnsurePunctuation::class, - Mutators\EnsureRelativePaths::class, - ]); - - $this->renderView('line', array_merge(static::$styles[$style], [ - 'marginTop' => ($this->output instanceof NewLineAware && $this->output->newLineWritten()) ? 0 : 1, - 'content' => $string, - ]), $verbosity); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureDynamicContentIsHighlighted.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureDynamicContentIsHighlighted.php deleted file mode 100644 index 225e9f0..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureDynamicContentIsHighlighted.php +++ /dev/null @@ -1,17 +0,0 @@ -[$1]', (string) $string); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureNoPunctuation.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureNoPunctuation.php deleted file mode 100644 index 5f34936..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureNoPunctuation.php +++ /dev/null @@ -1,21 +0,0 @@ -endsWith(['.', '?', '!', ':'])) { - return substr_replace($string, '', -1); - } - - return $string; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsurePunctuation.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsurePunctuation.php deleted file mode 100644 index c99fecf..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsurePunctuation.php +++ /dev/null @@ -1,21 +0,0 @@ -endsWith(['.', '?', '!', ':'])) { - return "$string."; - } - - return $string; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php deleted file mode 100644 index babd034..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Mutators/EnsureRelativePaths.php +++ /dev/null @@ -1,21 +0,0 @@ -has('path.base')) { - $string = str_replace(base_path().'/', '', $string); - } - - return $string; - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Task.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Task.php deleted file mode 100644 index cac979d..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Task.php +++ /dev/null @@ -1,57 +0,0 @@ -mutate($description, [ - Mutators\EnsureDynamicContentIsHighlighted::class, - Mutators\EnsureNoPunctuation::class, - Mutators\EnsureRelativePaths::class, - ]); - - $descriptionWidth = mb_strlen(preg_replace("/\<[\w=#\/\;,:.&,%?]+\>|\\e\[\d+m/", '$1', $description) ?? ''); - - $this->output->write(" $description ", false, $verbosity); - - $startTime = microtime(true); - - $result = false; - - try { - $result = ($task ?: fn () => true)(); - } catch (Throwable $e) { - throw $e; - } finally { - $runTime = $task - ? (' '.number_format((microtime(true) - $startTime) * 1000).'ms') - : ''; - - $runTimeWidth = mb_strlen($runTime); - $width = min(terminal()->width(), 150); - $dots = max($width - $descriptionWidth - $runTimeWidth - 10, 0); - - $this->output->write(str_repeat('.', $dots), false, $verbosity); - $this->output->write("$runTime", false, $verbosity); - - $this->output->writeln( - $result !== false ? ' DONE' : ' FAIL', - $verbosity, - ); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/TwoColumnDetail.php b/framework-9.50.2/src/Illuminate/Console/View/Components/TwoColumnDetail.php deleted file mode 100644 index 1ffa089..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/TwoColumnDetail.php +++ /dev/null @@ -1,36 +0,0 @@ -mutate($first, [ - Mutators\EnsureDynamicContentIsHighlighted::class, - Mutators\EnsureNoPunctuation::class, - Mutators\EnsureRelativePaths::class, - ]); - - $second = $this->mutate($second, [ - Mutators\EnsureDynamicContentIsHighlighted::class, - Mutators\EnsureNoPunctuation::class, - Mutators\EnsureRelativePaths::class, - ]); - - $this->renderView('two-column-detail', [ - 'first' => $first, - 'second' => $second, - ], $verbosity); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/View/Components/Warn.php b/framework-9.50.2/src/Illuminate/Console/View/Components/Warn.php deleted file mode 100644 index 20adb1f..0000000 --- a/framework-9.50.2/src/Illuminate/Console/View/Components/Warn.php +++ /dev/null @@ -1,21 +0,0 @@ -output)) - ->render('warn', $string, $verbosity); - } -} diff --git a/framework-9.50.2/src/Illuminate/Console/composer.json b/framework-9.50.2/src/Illuminate/Console/composer.json deleted file mode 100755 index 93b8b57..0000000 --- a/framework-9.50.2/src/Illuminate/Console/composer.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "illuminate/console", - "description": "The Illuminate Console package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0", - "illuminate/view": "^9.0", - "nunomaduro/termwind": "^1.13", - "symfony/console": "^6.0.9", - "symfony/process": "^6.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Console\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "dragonmantank/cron-expression": "Required to use scheduler (^3.3.2).", - "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^7.5).", - "illuminate/bus": "Required to use the scheduled job dispatcher (^9.0).", - "illuminate/container": "Required to use the scheduler (^9.0).", - "illuminate/filesystem": "Required to use the generator command (^9.0).", - "illuminate/queue": "Required to use closures for scheduled jobs (^9.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Console/resources/views/components/alert.php b/framework-9.50.2/src/Illuminate/Console/resources/views/components/alert.php deleted file mode 100644 index bddcb21..0000000 --- a/framework-9.50.2/src/Illuminate/Console/resources/views/components/alert.php +++ /dev/null @@ -1,3 +0,0 @@ -
- -
diff --git a/framework-9.50.2/src/Illuminate/Console/resources/views/components/bullet-list.php b/framework-9.50.2/src/Illuminate/Console/resources/views/components/bullet-list.php deleted file mode 100644 index a016a91..0000000 --- a/framework-9.50.2/src/Illuminate/Console/resources/views/components/bullet-list.php +++ /dev/null @@ -1,7 +0,0 @@ -
- -
- ⇂ -
- -
diff --git a/framework-9.50.2/src/Illuminate/Console/resources/views/components/line.php b/framework-9.50.2/src/Illuminate/Console/resources/views/components/line.php deleted file mode 100644 index a6c38cf..0000000 --- a/framework-9.50.2/src/Illuminate/Console/resources/views/components/line.php +++ /dev/null @@ -1,8 +0,0 @@ -
- - - - -
diff --git a/framework-9.50.2/src/Illuminate/Console/resources/views/components/two-column-detail.php b/framework-9.50.2/src/Illuminate/Console/resources/views/components/two-column-detail.php deleted file mode 100644 index 1aeed49..0000000 --- a/framework-9.50.2/src/Illuminate/Console/resources/views/components/two-column-detail.php +++ /dev/null @@ -1,11 +0,0 @@ -
- - - - - - - - - -
diff --git a/framework-9.50.2/src/Illuminate/Container/BoundMethod.php b/framework-9.50.2/src/Illuminate/Container/BoundMethod.php deleted file mode 100644 index 0bac7fa..0000000 --- a/framework-9.50.2/src/Illuminate/Container/BoundMethod.php +++ /dev/null @@ -1,202 +0,0 @@ -make($segments[0]), $method], $parameters - ); - } - - /** - * Call a method that has been bound to the container. - * - * @param \Illuminate\Container\Container $container - * @param callable $callback - * @param mixed $default - * @return mixed - */ - protected static function callBoundMethod($container, $callback, $default) - { - if (! is_array($callback)) { - return Util::unwrapIfClosure($default); - } - - // Here we need to turn the array callable into a Class@method string we can use to - // examine the container and see if there are any method bindings for this given - // method. If there are, we can call this method binding callback immediately. - $method = static::normalizeMethod($callback); - - if ($container->hasMethodBinding($method)) { - return $container->callMethodBinding($method, $callback[0]); - } - - return Util::unwrapIfClosure($default); - } - - /** - * Normalize the given callback into a Class@method string. - * - * @param callable $callback - * @return string - */ - protected static function normalizeMethod($callback) - { - $class = is_string($callback[0]) ? $callback[0] : get_class($callback[0]); - - return "{$class}@{$callback[1]}"; - } - - /** - * Get all dependencies for a given method. - * - * @param \Illuminate\Container\Container $container - * @param callable|string $callback - * @param array $parameters - * @return array - * - * @throws \ReflectionException - */ - protected static function getMethodDependencies($container, $callback, array $parameters = []) - { - $dependencies = []; - - foreach (static::getCallReflector($callback)->getParameters() as $parameter) { - static::addDependencyForCallParameter($container, $parameter, $parameters, $dependencies); - } - - return array_merge($dependencies, array_values($parameters)); - } - - /** - * Get the proper reflection instance for the given callback. - * - * @param callable|string $callback - * @return \ReflectionFunctionAbstract - * - * @throws \ReflectionException - */ - protected static function getCallReflector($callback) - { - if (is_string($callback) && str_contains($callback, '::')) { - $callback = explode('::', $callback); - } elseif (is_object($callback) && ! $callback instanceof Closure) { - $callback = [$callback, '__invoke']; - } - - return is_array($callback) - ? new ReflectionMethod($callback[0], $callback[1]) - : new ReflectionFunction($callback); - } - - /** - * Get the dependency for the given call parameter. - * - * @param \Illuminate\Container\Container $container - * @param \ReflectionParameter $parameter - * @param array $parameters - * @param array $dependencies - * @return void - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected static function addDependencyForCallParameter($container, $parameter, - array &$parameters, &$dependencies) - { - if (array_key_exists($paramName = $parameter->getName(), $parameters)) { - $dependencies[] = $parameters[$paramName]; - - unset($parameters[$paramName]); - } elseif (! is_null($className = Util::getParameterClassName($parameter))) { - if (array_key_exists($className, $parameters)) { - $dependencies[] = $parameters[$className]; - - unset($parameters[$className]); - } elseif ($parameter->isVariadic()) { - $variadicDependencies = $container->make($className); - - $dependencies = array_merge($dependencies, is_array($variadicDependencies) - ? $variadicDependencies - : [$variadicDependencies]); - } else { - $dependencies[] = $container->make($className); - } - } elseif ($parameter->isDefaultValueAvailable()) { - $dependencies[] = $parameter->getDefaultValue(); - } elseif (! $parameter->isOptional() && ! array_key_exists($paramName, $parameters)) { - $message = "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}"; - - throw new BindingResolutionException($message); - } - } - - /** - * Determine if the given string is in Class@method syntax. - * - * @param mixed $callback - * @return bool - */ - protected static function isCallableWithAtSign($callback) - { - return is_string($callback) && str_contains($callback, '@'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Container/Container.php b/framework-9.50.2/src/Illuminate/Container/Container.php deleted file mode 100755 index 519fcdf..0000000 --- a/framework-9.50.2/src/Illuminate/Container/Container.php +++ /dev/null @@ -1,1479 +0,0 @@ -getAlias($c); - } - - return new ContextualBindingBuilder($this, $aliases); - } - - /** - * Determine if the given abstract type has been bound. - * - * @param string $abstract - * @return bool - */ - public function bound($abstract) - { - return isset($this->bindings[$abstract]) || - isset($this->instances[$abstract]) || - $this->isAlias($abstract); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function has(string $id): bool - { - return $this->bound($id); - } - - /** - * Determine if the given abstract type has been resolved. - * - * @param string $abstract - * @return bool - */ - public function resolved($abstract) - { - if ($this->isAlias($abstract)) { - $abstract = $this->getAlias($abstract); - } - - return isset($this->resolved[$abstract]) || - isset($this->instances[$abstract]); - } - - /** - * Determine if a given type is shared. - * - * @param string $abstract - * @return bool - */ - public function isShared($abstract) - { - return isset($this->instances[$abstract]) || - (isset($this->bindings[$abstract]['shared']) && - $this->bindings[$abstract]['shared'] === true); - } - - /** - * Determine if a given string is an alias. - * - * @param string $name - * @return bool - */ - public function isAlias($name) - { - return isset($this->aliases[$name]); - } - - /** - * Register a binding with the container. - * - * @param string $abstract - * @param \Closure|string|null $concrete - * @param bool $shared - * @return void - * - * @throws \TypeError - */ - public function bind($abstract, $concrete = null, $shared = false) - { - $this->dropStaleInstances($abstract); - - // If no concrete type was given, we will simply set the concrete type to the - // abstract type. After that, the concrete type to be registered as shared - // without being forced to state their classes in both of the parameters. - if (is_null($concrete)) { - $concrete = $abstract; - } - - // If the factory is not a Closure, it means it is just a class name which is - // bound into this container to the abstract type and we will just wrap it - // up inside its own Closure to give us more convenience when extending. - if (! $concrete instanceof Closure) { - if (! is_string($concrete)) { - throw new TypeError(self::class.'::bind(): Argument #2 ($concrete) must be of type Closure|string|null'); - } - - $concrete = $this->getClosure($abstract, $concrete); - } - - $this->bindings[$abstract] = compact('concrete', 'shared'); - - // If the abstract type was already resolved in this container we'll fire the - // rebound listener so that any objects which have already gotten resolved - // can have their copy of the object updated via the listener callbacks. - if ($this->resolved($abstract)) { - $this->rebound($abstract); - } - } - - /** - * Get the Closure to be used when building a type. - * - * @param string $abstract - * @param string $concrete - * @return \Closure - */ - protected function getClosure($abstract, $concrete) - { - return function ($container, $parameters = []) use ($abstract, $concrete) { - if ($abstract == $concrete) { - return $container->build($concrete); - } - - return $container->resolve( - $concrete, $parameters, $raiseEvents = false - ); - }; - } - - /** - * Determine if the container has a method binding. - * - * @param string $method - * @return bool - */ - public function hasMethodBinding($method) - { - return isset($this->methodBindings[$method]); - } - - /** - * Bind a callback to resolve with Container::call. - * - * @param array|string $method - * @param \Closure $callback - * @return void - */ - public function bindMethod($method, $callback) - { - $this->methodBindings[$this->parseBindMethod($method)] = $callback; - } - - /** - * Get the method to be bound in class@method format. - * - * @param array|string $method - * @return string - */ - protected function parseBindMethod($method) - { - if (is_array($method)) { - return $method[0].'@'.$method[1]; - } - - return $method; - } - - /** - * Get the method binding for the given method. - * - * @param string $method - * @param mixed $instance - * @return mixed - */ - public function callMethodBinding($method, $instance) - { - return call_user_func($this->methodBindings[$method], $instance, $this); - } - - /** - * Add a contextual binding to the container. - * - * @param string $concrete - * @param string $abstract - * @param \Closure|string $implementation - * @return void - */ - public function addContextualBinding($concrete, $abstract, $implementation) - { - $this->contextual[$concrete][$this->getAlias($abstract)] = $implementation; - } - - /** - * Register a binding if it hasn't already been registered. - * - * @param string $abstract - * @param \Closure|string|null $concrete - * @param bool $shared - * @return void - */ - public function bindIf($abstract, $concrete = null, $shared = false) - { - if (! $this->bound($abstract)) { - $this->bind($abstract, $concrete, $shared); - } - } - - /** - * Register a shared binding in the container. - * - * @param string $abstract - * @param \Closure|string|null $concrete - * @return void - */ - public function singleton($abstract, $concrete = null) - { - $this->bind($abstract, $concrete, true); - } - - /** - * Register a shared binding if it hasn't already been registered. - * - * @param string $abstract - * @param \Closure|string|null $concrete - * @return void - */ - public function singletonIf($abstract, $concrete = null) - { - if (! $this->bound($abstract)) { - $this->singleton($abstract, $concrete); - } - } - - /** - * Register a scoped binding in the container. - * - * @param string $abstract - * @param \Closure|string|null $concrete - * @return void - */ - public function scoped($abstract, $concrete = null) - { - $this->scopedInstances[] = $abstract; - - $this->singleton($abstract, $concrete); - } - - /** - * Register a scoped binding if it hasn't already been registered. - * - * @param string $abstract - * @param \Closure|string|null $concrete - * @return void - */ - public function scopedIf($abstract, $concrete = null) - { - if (! $this->bound($abstract)) { - $this->scoped($abstract, $concrete); - } - } - - /** - * "Extend" an abstract type in the container. - * - * @param string $abstract - * @param \Closure $closure - * @return void - * - * @throws \InvalidArgumentException - */ - public function extend($abstract, Closure $closure) - { - $abstract = $this->getAlias($abstract); - - if (isset($this->instances[$abstract])) { - $this->instances[$abstract] = $closure($this->instances[$abstract], $this); - - $this->rebound($abstract); - } else { - $this->extenders[$abstract][] = $closure; - - if ($this->resolved($abstract)) { - $this->rebound($abstract); - } - } - } - - /** - * Register an existing instance as shared in the container. - * - * @param string $abstract - * @param mixed $instance - * @return mixed - */ - public function instance($abstract, $instance) - { - $this->removeAbstractAlias($abstract); - - $isBound = $this->bound($abstract); - - unset($this->aliases[$abstract]); - - // We'll check to determine if this type has been bound before, and if it has - // we will fire the rebound callbacks registered with the container and it - // can be updated with consuming classes that have gotten resolved here. - $this->instances[$abstract] = $instance; - - if ($isBound) { - $this->rebound($abstract); - } - - return $instance; - } - - /** - * Remove an alias from the contextual binding alias cache. - * - * @param string $searched - * @return void - */ - protected function removeAbstractAlias($searched) - { - if (! isset($this->aliases[$searched])) { - return; - } - - foreach ($this->abstractAliases as $abstract => $aliases) { - foreach ($aliases as $index => $alias) { - if ($alias == $searched) { - unset($this->abstractAliases[$abstract][$index]); - } - } - } - } - - /** - * Assign a set of tags to a given binding. - * - * @param array|string $abstracts - * @param array|mixed ...$tags - * @return void - */ - public function tag($abstracts, $tags) - { - $tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1); - - foreach ($tags as $tag) { - if (! isset($this->tags[$tag])) { - $this->tags[$tag] = []; - } - - foreach ((array) $abstracts as $abstract) { - $this->tags[$tag][] = $abstract; - } - } - } - - /** - * Resolve all of the bindings for a given tag. - * - * @param string $tag - * @return iterable - */ - public function tagged($tag) - { - if (! isset($this->tags[$tag])) { - return []; - } - - return new RewindableGenerator(function () use ($tag) { - foreach ($this->tags[$tag] as $abstract) { - yield $this->make($abstract); - } - }, count($this->tags[$tag])); - } - - /** - * Alias a type to a different name. - * - * @param string $abstract - * @param string $alias - * @return void - * - * @throws \LogicException - */ - public function alias($abstract, $alias) - { - if ($alias === $abstract) { - throw new LogicException("[{$abstract}] is aliased to itself."); - } - - $this->aliases[$alias] = $abstract; - - $this->abstractAliases[$abstract][] = $alias; - } - - /** - * Bind a new callback to an abstract's rebind event. - * - * @param string $abstract - * @param \Closure $callback - * @return mixed - */ - public function rebinding($abstract, Closure $callback) - { - $this->reboundCallbacks[$abstract = $this->getAlias($abstract)][] = $callback; - - if ($this->bound($abstract)) { - return $this->make($abstract); - } - } - - /** - * Refresh an instance on the given target and method. - * - * @param string $abstract - * @param mixed $target - * @param string $method - * @return mixed - */ - public function refresh($abstract, $target, $method) - { - return $this->rebinding($abstract, function ($app, $instance) use ($target, $method) { - $target->{$method}($instance); - }); - } - - /** - * Fire the "rebound" callbacks for the given abstract type. - * - * @param string $abstract - * @return void - */ - protected function rebound($abstract) - { - $instance = $this->make($abstract); - - foreach ($this->getReboundCallbacks($abstract) as $callback) { - $callback($this, $instance); - } - } - - /** - * Get the rebound callbacks for a given type. - * - * @param string $abstract - * @return array - */ - protected function getReboundCallbacks($abstract) - { - return $this->reboundCallbacks[$abstract] ?? []; - } - - /** - * Wrap the given closure such that its dependencies will be injected when executed. - * - * @param \Closure $callback - * @param array $parameters - * @return \Closure - */ - public function wrap(Closure $callback, array $parameters = []) - { - return fn () => $this->call($callback, $parameters); - } - - /** - * Call the given Closure / class@method and inject its dependencies. - * - * @param callable|string $callback - * @param array $parameters - * @param string|null $defaultMethod - * @return mixed - * - * @throws \InvalidArgumentException - */ - public function call($callback, array $parameters = [], $defaultMethod = null) - { - $pushedToBuildStack = false; - - if (is_array($callback) && ! in_array( - $className = (is_string($callback[0]) ? $callback[0] : get_class($callback[0])), - $this->buildStack, - true - )) { - $this->buildStack[] = $className; - - $pushedToBuildStack = true; - } - - $result = BoundMethod::call($this, $callback, $parameters, $defaultMethod); - - if ($pushedToBuildStack) { - array_pop($this->buildStack); - } - - return $result; - } - - /** - * Get a closure to resolve the given type from the container. - * - * @param string $abstract - * @return \Closure - */ - public function factory($abstract) - { - return fn () => $this->make($abstract); - } - - /** - * An alias function name for make(). - * - * @param string|callable $abstract - * @param array $parameters - * @return mixed - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - public function makeWith($abstract, array $parameters = []) - { - return $this->make($abstract, $parameters); - } - - /** - * Resolve the given type from the container. - * - * @param string|callable $abstract - * @param array $parameters - * @return mixed - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - public function make($abstract, array $parameters = []) - { - return $this->resolve($abstract, $parameters); - } - - /** - * {@inheritdoc} - * - * @return mixed - */ - public function get(string $id) - { - try { - return $this->resolve($id); - } catch (Exception $e) { - if ($this->has($id) || $e instanceof CircularDependencyException) { - throw $e; - } - - throw new EntryNotFoundException($id, is_int($e->getCode()) ? $e->getCode() : 0, $e); - } - } - - /** - * Resolve the given type from the container. - * - * @param string|callable $abstract - * @param array $parameters - * @param bool $raiseEvents - * @return mixed - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - * @throws \Illuminate\Contracts\Container\CircularDependencyException - */ - protected function resolve($abstract, $parameters = [], $raiseEvents = true) - { - $abstract = $this->getAlias($abstract); - - // First we'll fire any event handlers which handle the "before" resolving of - // specific types. This gives some hooks the chance to add various extends - // calls to change the resolution of objects that they're interested in. - if ($raiseEvents) { - $this->fireBeforeResolvingCallbacks($abstract, $parameters); - } - - $concrete = $this->getContextualConcrete($abstract); - - $needsContextualBuild = ! empty($parameters) || ! is_null($concrete); - - // If an instance of the type is currently being managed as a singleton we'll - // just return an existing instance instead of instantiating new instances - // so the developer can keep using the same objects instance every time. - if (isset($this->instances[$abstract]) && ! $needsContextualBuild) { - return $this->instances[$abstract]; - } - - $this->with[] = $parameters; - - if (is_null($concrete)) { - $concrete = $this->getConcrete($abstract); - } - - // We're ready to instantiate an instance of the concrete type registered for - // the binding. This will instantiate the types, as well as resolve any of - // its "nested" dependencies recursively until all have gotten resolved. - if ($this->isBuildable($concrete, $abstract)) { - $object = $this->build($concrete); - } else { - $object = $this->make($concrete); - } - - // If we defined any extenders for this type, we'll need to spin through them - // and apply them to the object being built. This allows for the extension - // of services, such as changing configuration or decorating the object. - foreach ($this->getExtenders($abstract) as $extender) { - $object = $extender($object, $this); - } - - // If the requested type is registered as a singleton we'll want to cache off - // the instances in "memory" so we can return it later without creating an - // entirely new instance of an object on each subsequent request for it. - if ($this->isShared($abstract) && ! $needsContextualBuild) { - $this->instances[$abstract] = $object; - } - - if ($raiseEvents) { - $this->fireResolvingCallbacks($abstract, $object); - } - - // Before returning, we will also set the resolved flag to "true" and pop off - // the parameter overrides for this build. After those two things are done - // we will be ready to return back the fully constructed class instance. - $this->resolved[$abstract] = true; - - array_pop($this->with); - - return $object; - } - - /** - * Get the concrete type for a given abstract. - * - * @param string|callable $abstract - * @return mixed - */ - protected function getConcrete($abstract) - { - // If we don't have a registered resolver or concrete for the type, we'll just - // assume each type is a concrete name and will attempt to resolve it as is - // since the container should be able to resolve concretes automatically. - if (isset($this->bindings[$abstract])) { - return $this->bindings[$abstract]['concrete']; - } - - return $abstract; - } - - /** - * Get the contextual concrete binding for the given abstract. - * - * @param string|callable $abstract - * @return \Closure|string|array|null - */ - protected function getContextualConcrete($abstract) - { - if (! is_null($binding = $this->findInContextualBindings($abstract))) { - return $binding; - } - - // Next we need to see if a contextual binding might be bound under an alias of the - // given abstract type. So, we will need to check if any aliases exist with this - // type and then spin through them and check for contextual bindings on these. - if (empty($this->abstractAliases[$abstract])) { - return; - } - - foreach ($this->abstractAliases[$abstract] as $alias) { - if (! is_null($binding = $this->findInContextualBindings($alias))) { - return $binding; - } - } - } - - /** - * Find the concrete binding for the given abstract in the contextual binding array. - * - * @param string|callable $abstract - * @return \Closure|string|null - */ - protected function findInContextualBindings($abstract) - { - return $this->contextual[end($this->buildStack)][$abstract] ?? null; - } - - /** - * Determine if the given concrete is buildable. - * - * @param mixed $concrete - * @param string $abstract - * @return bool - */ - protected function isBuildable($concrete, $abstract) - { - return $concrete === $abstract || $concrete instanceof Closure; - } - - /** - * Instantiate a concrete instance of the given type. - * - * @param \Closure|string $concrete - * @return mixed - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - * @throws \Illuminate\Contracts\Container\CircularDependencyException - */ - public function build($concrete) - { - // If the concrete type is actually a Closure, we will just execute it and - // hand back the results of the functions, which allows functions to be - // used as resolvers for more fine-tuned resolution of these objects. - if ($concrete instanceof Closure) { - return $concrete($this, $this->getLastParameterOverride()); - } - - try { - $reflector = new ReflectionClass($concrete); - } catch (ReflectionException $e) { - throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); - } - - // If the type is not instantiable, the developer is attempting to resolve - // an abstract type such as an Interface or Abstract Class and there is - // no binding registered for the abstractions so we need to bail out. - if (! $reflector->isInstantiable()) { - return $this->notInstantiable($concrete); - } - - $this->buildStack[] = $concrete; - - $constructor = $reflector->getConstructor(); - - // If there are no constructors, that means there are no dependencies then - // we can just resolve the instances of the objects right away, without - // resolving any other types or dependencies out of these containers. - if (is_null($constructor)) { - array_pop($this->buildStack); - - return new $concrete; - } - - $dependencies = $constructor->getParameters(); - - // Once we have all the constructor's parameters we can create each of the - // dependency instances and then use the reflection instances to make a - // new instance of this class, injecting the created dependencies in. - try { - $instances = $this->resolveDependencies($dependencies); - } catch (BindingResolutionException $e) { - array_pop($this->buildStack); - - throw $e; - } - - array_pop($this->buildStack); - - return $reflector->newInstanceArgs($instances); - } - - /** - * Resolve all of the dependencies from the ReflectionParameters. - * - * @param \ReflectionParameter[] $dependencies - * @return array - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected function resolveDependencies(array $dependencies) - { - $results = []; - - foreach ($dependencies as $dependency) { - // If the dependency has an override for this particular build we will use - // that instead as the value. Otherwise, we will continue with this run - // of resolutions and let reflection attempt to determine the result. - if ($this->hasParameterOverride($dependency)) { - $results[] = $this->getParameterOverride($dependency); - - continue; - } - - // If the class is null, it means the dependency is a string or some other - // primitive type which we can not resolve since it is not a class and - // we will just bomb out with an error since we have no-where to go. - $result = is_null(Util::getParameterClassName($dependency)) - ? $this->resolvePrimitive($dependency) - : $this->resolveClass($dependency); - - if ($dependency->isVariadic()) { - $results = array_merge($results, $result); - } else { - $results[] = $result; - } - } - - return $results; - } - - /** - * Determine if the given dependency has a parameter override. - * - * @param \ReflectionParameter $dependency - * @return bool - */ - protected function hasParameterOverride($dependency) - { - return array_key_exists( - $dependency->name, $this->getLastParameterOverride() - ); - } - - /** - * Get a parameter override for a dependency. - * - * @param \ReflectionParameter $dependency - * @return mixed - */ - protected function getParameterOverride($dependency) - { - return $this->getLastParameterOverride()[$dependency->name]; - } - - /** - * Get the last parameter override. - * - * @return array - */ - protected function getLastParameterOverride() - { - return count($this->with) ? end($this->with) : []; - } - - /** - * Resolve a non-class hinted primitive dependency. - * - * @param \ReflectionParameter $parameter - * @return mixed - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected function resolvePrimitive(ReflectionParameter $parameter) - { - if (! is_null($concrete = $this->getContextualConcrete('$'.$parameter->getName()))) { - return Util::unwrapIfClosure($concrete, $this); - } - - if ($parameter->isDefaultValueAvailable()) { - return $parameter->getDefaultValue(); - } - - if ($parameter->isVariadic()) { - return []; - } - - $this->unresolvablePrimitive($parameter); - } - - /** - * Resolve a class based dependency from the container. - * - * @param \ReflectionParameter $parameter - * @return mixed - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected function resolveClass(ReflectionParameter $parameter) - { - try { - return $parameter->isVariadic() - ? $this->resolveVariadicClass($parameter) - : $this->make(Util::getParameterClassName($parameter)); - } - - // If we can not resolve the class instance, we will check to see if the value - // is optional, and if it is we will return the optional parameter value as - // the value of the dependency, similarly to how we do this with scalars. - catch (BindingResolutionException $e) { - if ($parameter->isDefaultValueAvailable()) { - array_pop($this->with); - - return $parameter->getDefaultValue(); - } - - if ($parameter->isVariadic()) { - array_pop($this->with); - - return []; - } - - throw $e; - } - } - - /** - * Resolve a class based variadic dependency from the container. - * - * @param \ReflectionParameter $parameter - * @return mixed - */ - protected function resolveVariadicClass(ReflectionParameter $parameter) - { - $className = Util::getParameterClassName($parameter); - - $abstract = $this->getAlias($className); - - if (! is_array($concrete = $this->getContextualConcrete($abstract))) { - return $this->make($className); - } - - return array_map(fn ($abstract) => $this->resolve($abstract), $concrete); - } - - /** - * Throw an exception that the concrete is not instantiable. - * - * @param string $concrete - * @return void - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected function notInstantiable($concrete) - { - if (! empty($this->buildStack)) { - $previous = implode(', ', $this->buildStack); - - $message = "Target [$concrete] is not instantiable while building [$previous]."; - } else { - $message = "Target [$concrete] is not instantiable."; - } - - throw new BindingResolutionException($message); - } - - /** - * Throw an exception for an unresolvable primitive. - * - * @param \ReflectionParameter $parameter - * @return void - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected function unresolvablePrimitive(ReflectionParameter $parameter) - { - $message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; - - throw new BindingResolutionException($message); - } - - /** - * Register a new before resolving callback for all types. - * - * @param \Closure|string $abstract - * @param \Closure|null $callback - * @return void - */ - public function beforeResolving($abstract, Closure $callback = null) - { - if (is_string($abstract)) { - $abstract = $this->getAlias($abstract); - } - - if ($abstract instanceof Closure && is_null($callback)) { - $this->globalBeforeResolvingCallbacks[] = $abstract; - } else { - $this->beforeResolvingCallbacks[$abstract][] = $callback; - } - } - - /** - * Register a new resolving callback. - * - * @param \Closure|string $abstract - * @param \Closure|null $callback - * @return void - */ - public function resolving($abstract, Closure $callback = null) - { - if (is_string($abstract)) { - $abstract = $this->getAlias($abstract); - } - - if (is_null($callback) && $abstract instanceof Closure) { - $this->globalResolvingCallbacks[] = $abstract; - } else { - $this->resolvingCallbacks[$abstract][] = $callback; - } - } - - /** - * Register a new after resolving callback for all types. - * - * @param \Closure|string $abstract - * @param \Closure|null $callback - * @return void - */ - public function afterResolving($abstract, Closure $callback = null) - { - if (is_string($abstract)) { - $abstract = $this->getAlias($abstract); - } - - if ($abstract instanceof Closure && is_null($callback)) { - $this->globalAfterResolvingCallbacks[] = $abstract; - } else { - $this->afterResolvingCallbacks[$abstract][] = $callback; - } - } - - /** - * Fire all of the before resolving callbacks. - * - * @param string $abstract - * @param array $parameters - * @return void - */ - protected function fireBeforeResolvingCallbacks($abstract, $parameters = []) - { - $this->fireBeforeCallbackArray($abstract, $parameters, $this->globalBeforeResolvingCallbacks); - - foreach ($this->beforeResolvingCallbacks as $type => $callbacks) { - if ($type === $abstract || is_subclass_of($abstract, $type)) { - $this->fireBeforeCallbackArray($abstract, $parameters, $callbacks); - } - } - } - - /** - * Fire an array of callbacks with an object. - * - * @param string $abstract - * @param array $parameters - * @param array $callbacks - * @return void - */ - protected function fireBeforeCallbackArray($abstract, $parameters, array $callbacks) - { - foreach ($callbacks as $callback) { - $callback($abstract, $parameters, $this); - } - } - - /** - * Fire all of the resolving callbacks. - * - * @param string $abstract - * @param mixed $object - * @return void - */ - protected function fireResolvingCallbacks($abstract, $object) - { - $this->fireCallbackArray($object, $this->globalResolvingCallbacks); - - $this->fireCallbackArray( - $object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks) - ); - - $this->fireAfterResolvingCallbacks($abstract, $object); - } - - /** - * Fire all of the after resolving callbacks. - * - * @param string $abstract - * @param mixed $object - * @return void - */ - protected function fireAfterResolvingCallbacks($abstract, $object) - { - $this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks); - - $this->fireCallbackArray( - $object, $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks) - ); - } - - /** - * Get all callbacks for a given type. - * - * @param string $abstract - * @param object $object - * @param array $callbacksPerType - * @return array - */ - protected function getCallbacksForType($abstract, $object, array $callbacksPerType) - { - $results = []; - - foreach ($callbacksPerType as $type => $callbacks) { - if ($type === $abstract || $object instanceof $type) { - $results = array_merge($results, $callbacks); - } - } - - return $results; - } - - /** - * Fire an array of callbacks with an object. - * - * @param mixed $object - * @param array $callbacks - * @return void - */ - protected function fireCallbackArray($object, array $callbacks) - { - foreach ($callbacks as $callback) { - $callback($object, $this); - } - } - - /** - * Get the container's bindings. - * - * @return array - */ - public function getBindings() - { - return $this->bindings; - } - - /** - * Get the alias for an abstract if available. - * - * @param string $abstract - * @return string - */ - public function getAlias($abstract) - { - return isset($this->aliases[$abstract]) - ? $this->getAlias($this->aliases[$abstract]) - : $abstract; - } - - /** - * Get the extender callbacks for a given type. - * - * @param string $abstract - * @return array - */ - protected function getExtenders($abstract) - { - return $this->extenders[$this->getAlias($abstract)] ?? []; - } - - /** - * Remove all of the extender callbacks for a given type. - * - * @param string $abstract - * @return void - */ - public function forgetExtenders($abstract) - { - unset($this->extenders[$this->getAlias($abstract)]); - } - - /** - * Drop all of the stale instances and aliases. - * - * @param string $abstract - * @return void - */ - protected function dropStaleInstances($abstract) - { - unset($this->instances[$abstract], $this->aliases[$abstract]); - } - - /** - * Remove a resolved instance from the instance cache. - * - * @param string $abstract - * @return void - */ - public function forgetInstance($abstract) - { - unset($this->instances[$abstract]); - } - - /** - * Clear all of the instances from the container. - * - * @return void - */ - public function forgetInstances() - { - $this->instances = []; - } - - /** - * Clear all of the scoped instances from the container. - * - * @return void - */ - public function forgetScopedInstances() - { - foreach ($this->scopedInstances as $scoped) { - unset($this->instances[$scoped]); - } - } - - /** - * Flush the container of all bindings and resolved instances. - * - * @return void - */ - public function flush() - { - $this->aliases = []; - $this->resolved = []; - $this->bindings = []; - $this->instances = []; - $this->abstractAliases = []; - $this->scopedInstances = []; - } - - /** - * Get the globally available instance of the container. - * - * @return static - */ - public static function getInstance() - { - if (is_null(static::$instance)) { - static::$instance = new static; - } - - return static::$instance; - } - - /** - * Set the shared instance of the container. - * - * @param \Illuminate\Contracts\Container\Container|null $container - * @return \Illuminate\Contracts\Container\Container|static - */ - public static function setInstance(ContainerContract $container = null) - { - return static::$instance = $container; - } - - /** - * Determine if a given offset exists. - * - * @param string $key - * @return bool - */ - public function offsetExists($key): bool - { - return $this->bound($key); - } - - /** - * Get the value at a given offset. - * - * @param string $key - * @return mixed - */ - public function offsetGet($key): mixed - { - return $this->make($key); - } - - /** - * Set the value at a given offset. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value): void - { - $this->bind($key, $value instanceof Closure ? $value : fn () => $value); - } - - /** - * Unset the value at a given offset. - * - * @param string $key - * @return void - */ - public function offsetUnset($key): void - { - unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]); - } - - /** - * Dynamically access container services. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this[$key]; - } - - /** - * Dynamically set container services. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this[$key] = $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/Container/ContextualBindingBuilder.php b/framework-9.50.2/src/Illuminate/Container/ContextualBindingBuilder.php deleted file mode 100644 index 707b74c..0000000 --- a/framework-9.50.2/src/Illuminate/Container/ContextualBindingBuilder.php +++ /dev/null @@ -1,96 +0,0 @@ -concrete = $concrete; - $this->container = $container; - } - - /** - * Define the abstract target that depends on the context. - * - * @param string $abstract - * @return $this - */ - public function needs($abstract) - { - $this->needs = $abstract; - - return $this; - } - - /** - * Define the implementation for the contextual binding. - * - * @param \Closure|string|array $implementation - * @return void - */ - public function give($implementation) - { - foreach (Util::arrayWrap($this->concrete) as $concrete) { - $this->container->addContextualBinding($concrete, $this->needs, $implementation); - } - } - - /** - * Define tagged services to be used as the implementation for the contextual binding. - * - * @param string $tag - * @return void - */ - public function giveTagged($tag) - { - $this->give(function ($container) use ($tag) { - $taggedServices = $container->tagged($tag); - - return is_array($taggedServices) ? $taggedServices : iterator_to_array($taggedServices); - }); - } - - /** - * Specify the configuration item to bind as a primitive. - * - * @param string $key - * @param mixed $default - * @return void - */ - public function giveConfig($key, $default = null) - { - $this->give(fn ($container) => $container->get('config')->get($key, $default)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Container/EntryNotFoundException.php b/framework-9.50.2/src/Illuminate/Container/EntryNotFoundException.php deleted file mode 100644 index 4266921..0000000 --- a/framework-9.50.2/src/Illuminate/Container/EntryNotFoundException.php +++ /dev/null @@ -1,11 +0,0 @@ -count = $count; - $this->generator = $generator; - } - - /** - * Get an iterator from the generator. - * - * @return \Traversable - */ - public function getIterator(): Traversable - { - return ($this->generator)(); - } - - /** - * Get the total number of tagged services. - * - * @return int - */ - public function count(): int - { - if (is_callable($count = $this->count)) { - $this->count = $count(); - } - - return $this->count; - } -} diff --git a/framework-9.50.2/src/Illuminate/Container/Util.php b/framework-9.50.2/src/Illuminate/Container/Util.php deleted file mode 100644 index 8d5023b..0000000 --- a/framework-9.50.2/src/Illuminate/Container/Util.php +++ /dev/null @@ -1,74 +0,0 @@ -getType(); - - if (! $type instanceof ReflectionNamedType || $type->isBuiltin()) { - return null; - } - - $name = $type->getName(); - - if (! is_null($class = $parameter->getDeclaringClass())) { - if ($name === 'self') { - return $class->getName(); - } - - if ($name === 'parent' && $parent = $class->getParentClass()) { - return $parent->getName(); - } - } - - return $name; - } -} diff --git a/framework-9.50.2/src/Illuminate/Container/composer.json b/framework-9.50.2/src/Illuminate/Container/composer.json deleted file mode 100755 index 8944b5b..0000000 --- a/framework-9.50.2/src/Illuminate/Container/composer.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "illuminate/container", - "description": "The Illuminate Container package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/contracts": "^9.0", - "psr/container": "^1.1.1|^2.0.1" - }, - "provide": { - "psr/container-implementation": "1.1|2.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Container\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Contracts/Auth/Access/Authorizable.php b/framework-9.50.2/src/Illuminate/Contracts/Auth/Access/Authorizable.php deleted file mode 100644 index cedeb6e..0000000 --- a/framework-9.50.2/src/Illuminate/Contracts/Auth/Access/Authorizable.php +++ /dev/null @@ -1,15 +0,0 @@ -|CastsAttributes|CastsInboundAttributes - */ - public static function castUsing(array $arguments); -} diff --git a/framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/CastsAttributes.php b/framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/CastsAttributes.php deleted file mode 100644 index 878169c..0000000 --- a/framework-9.50.2/src/Illuminate/Contracts/Database/Eloquent/CastsAttributes.php +++ /dev/null @@ -1,32 +0,0 @@ -id = $id; - $this->class = $class; - $this->relations = $relations; - $this->connection = $connection; - } - - /** - * Specify the collection class that should be used when serializing / restoring collections. - * - * @param string|null $collectionClass - * @return $this - */ - public function useCollectionClass(?string $collectionClass) - { - $this->collectionClass = $collectionClass; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Contracts/Database/Query/Builder.php b/framework-9.50.2/src/Illuminate/Contracts/Database/Query/Builder.php deleted file mode 100644 index e116ebf..0000000 --- a/framework-9.50.2/src/Illuminate/Contracts/Database/Query/Builder.php +++ /dev/null @@ -1,12 +0,0 @@ - - */ - public function getQueueableIds(); - - /** - * Get the relationships of the entities being queued. - * - * @return array - */ - public function getQueueableRelations(); - - /** - * Get the connection of the entities being queued. - * - * @return string|null - */ - public function getQueueableConnection(); -} diff --git a/framework-9.50.2/src/Illuminate/Contracts/Queue/QueueableEntity.php b/framework-9.50.2/src/Illuminate/Contracts/Queue/QueueableEntity.php deleted file mode 100644 index 366f0c8..0000000 --- a/framework-9.50.2/src/Illuminate/Contracts/Queue/QueueableEntity.php +++ /dev/null @@ -1,27 +0,0 @@ - - */ - public function toArray(); -} diff --git a/framework-9.50.2/src/Illuminate/Contracts/Support/CanBeEscapedWhenCastToString.php b/framework-9.50.2/src/Illuminate/Contracts/Support/CanBeEscapedWhenCastToString.php deleted file mode 100644 index e1be6fe..0000000 --- a/framework-9.50.2/src/Illuminate/Contracts/Support/CanBeEscapedWhenCastToString.php +++ /dev/null @@ -1,14 +0,0 @@ -getPathAndDomain($path, $domain, $secure, $sameSite); - - $time = ($minutes == 0) ? 0 : $this->availableAt($minutes * 60); - - return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly, $raw, $sameSite); - } - - /** - * Create a cookie that lasts "forever" (400 days). - * - * @param string $name - * @param string $value - * @param string|null $path - * @param string|null $domain - * @param bool|null $secure - * @param bool $httpOnly - * @param bool $raw - * @param string|null $sameSite - * @return \Symfony\Component\HttpFoundation\Cookie - */ - public function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) - { - return $this->make($name, $value, 576000, $path, $domain, $secure, $httpOnly, $raw, $sameSite); - } - - /** - * Expire the given cookie. - * - * @param string $name - * @param string|null $path - * @param string|null $domain - * @return \Symfony\Component\HttpFoundation\Cookie - */ - public function forget($name, $path = null, $domain = null) - { - return $this->make($name, null, -2628000, $path, $domain); - } - - /** - * Determine if a cookie has been queued. - * - * @param string $key - * @param string|null $path - * @return bool - */ - public function hasQueued($key, $path = null) - { - return ! is_null($this->queued($key, null, $path)); - } - - /** - * Get a queued cookie instance. - * - * @param string $key - * @param mixed $default - * @param string|null $path - * @return \Symfony\Component\HttpFoundation\Cookie|null - */ - public function queued($key, $default = null, $path = null) - { - $queued = Arr::get($this->queued, $key, $default); - - if ($path === null) { - return Arr::last($queued, null, $default); - } - - return Arr::get($queued, $path, $default); - } - - /** - * Queue a cookie to send with the next response. - * - * @param mixed ...$parameters - * @return void - */ - public function queue(...$parameters) - { - if (isset($parameters[0]) && $parameters[0] instanceof Cookie) { - $cookie = $parameters[0]; - } else { - $cookie = $this->make(...array_values($parameters)); - } - - if (! isset($this->queued[$cookie->getName()])) { - $this->queued[$cookie->getName()] = []; - } - - $this->queued[$cookie->getName()][$cookie->getPath()] = $cookie; - } - - /** - * Queue a cookie to expire with the next response. - * - * @param string $name - * @param string|null $path - * @param string|null $domain - * @return void - */ - public function expire($name, $path = null, $domain = null) - { - $this->queue($this->forget($name, $path, $domain)); - } - - /** - * Remove a cookie from the queue. - * - * @param string $name - * @param string|null $path - * @return void - */ - public function unqueue($name, $path = null) - { - if ($path === null) { - unset($this->queued[$name]); - - return; - } - - unset($this->queued[$name][$path]); - - if (empty($this->queued[$name])) { - unset($this->queued[$name]); - } - } - - /** - * Get the path and domain, or the default values. - * - * @param string $path - * @param string|null $domain - * @param bool|null $secure - * @param string|null $sameSite - * @return array - */ - protected function getPathAndDomain($path, $domain, $secure = null, $sameSite = null) - { - return [$path ?: $this->path, $domain ?: $this->domain, is_bool($secure) ? $secure : $this->secure, $sameSite ?: $this->sameSite]; - } - - /** - * Set the default path and domain for the jar. - * - * @param string $path - * @param string|null $domain - * @param bool|null $secure - * @param string|null $sameSite - * @return $this - */ - public function setDefaultPathAndDomain($path, $domain, $secure = false, $sameSite = null) - { - [$this->path, $this->domain, $this->secure, $this->sameSite] = [$path, $domain, $secure, $sameSite]; - - return $this; - } - - /** - * Get the cookies which have been queued for the next request. - * - * @return \Symfony\Component\HttpFoundation\Cookie[] - */ - public function getQueuedCookies() - { - return Arr::flatten($this->queued); - } - - /** - * Flush the cookies which have been queued for the next request. - * - * @return $this - */ - public function flushQueuedCookies() - { - $this->queued = []; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cookie/CookieServiceProvider.php b/framework-9.50.2/src/Illuminate/Cookie/CookieServiceProvider.php deleted file mode 100755 index 7c82dc1..0000000 --- a/framework-9.50.2/src/Illuminate/Cookie/CookieServiceProvider.php +++ /dev/null @@ -1,24 +0,0 @@ -app->singleton('cookie', function ($app) { - $config = $app->make('config')->get('session'); - - return (new CookieJar)->setDefaultPathAndDomain( - $config['path'], $config['domain'], $config['secure'], $config['same_site'] ?? null - ); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Cookie/CookieValuePrefix.php b/framework-9.50.2/src/Illuminate/Cookie/CookieValuePrefix.php deleted file mode 100644 index 3f4eb22..0000000 --- a/framework-9.50.2/src/Illuminate/Cookie/CookieValuePrefix.php +++ /dev/null @@ -1,44 +0,0 @@ -cookies = $cookies; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - $response = $next($request); - - foreach ($this->cookies->getQueuedCookies() as $cookie) { - $response->headers->setCookie($cookie); - } - - return $response; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cookie/Middleware/EncryptCookies.php b/framework-9.50.2/src/Illuminate/Cookie/Middleware/EncryptCookies.php deleted file mode 100644 index d3fc9e9..0000000 --- a/framework-9.50.2/src/Illuminate/Cookie/Middleware/EncryptCookies.php +++ /dev/null @@ -1,226 +0,0 @@ - - */ - protected $except = []; - - /** - * Indicates if cookies should be serialized. - * - * @var bool - */ - protected static $serialize = false; - - /** - * Create a new CookieGuard instance. - * - * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter - * @return void - */ - public function __construct(EncrypterContract $encrypter) - { - $this->encrypter = $encrypter; - } - - /** - * Disable encryption for the given cookie name(s). - * - * @param string|array $name - * @return void - */ - public function disableFor($name) - { - $this->except = array_merge($this->except, (array) $name); - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return \Symfony\Component\HttpFoundation\Response - */ - public function handle($request, Closure $next) - { - return $this->encrypt($next($this->decrypt($request))); - } - - /** - * Decrypt the cookies on the request. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return \Symfony\Component\HttpFoundation\Request - */ - protected function decrypt(Request $request) - { - foreach ($request->cookies as $key => $cookie) { - if ($this->isDisabled($key)) { - continue; - } - - try { - $value = $this->decryptCookie($key, $cookie); - - $request->cookies->set($key, $this->validateValue($key, $value)); - } catch (DecryptException $e) { - $request->cookies->set($key, null); - } - } - - return $request; - } - - /** - * Validate and remove the cookie value prefix from the value. - * - * @param string $key - * @param string $value - * @return string|array|null - */ - protected function validateValue(string $key, $value) - { - return is_array($value) - ? $this->validateArray($key, $value) - : CookieValuePrefix::validate($key, $value, $this->encrypter->getKey()); - } - - /** - * Validate and remove the cookie value prefix from all values of an array. - * - * @param string $key - * @param array $value - * @return array - */ - protected function validateArray(string $key, array $value) - { - $validated = []; - - foreach ($value as $index => $subValue) { - $validated[$index] = $this->validateValue("{$key}[{$index}]", $subValue); - } - - return $validated; - } - - /** - * Decrypt the given cookie and return the value. - * - * @param string $name - * @param string|array $cookie - * @return string|array - */ - protected function decryptCookie($name, $cookie) - { - return is_array($cookie) - ? $this->decryptArray($cookie) - : $this->encrypter->decrypt($cookie, static::serialized($name)); - } - - /** - * Decrypt an array based cookie. - * - * @param array $cookie - * @return array - */ - protected function decryptArray(array $cookie) - { - $decrypted = []; - - foreach ($cookie as $key => $value) { - if (is_string($value)) { - $decrypted[$key] = $this->encrypter->decrypt($value, static::serialized($key)); - } - - if (is_array($value)) { - $decrypted[$key] = $this->decryptArray($value); - } - } - - return $decrypted; - } - - /** - * Encrypt the cookies on an outgoing response. - * - * @param \Symfony\Component\HttpFoundation\Response $response - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function encrypt(Response $response) - { - foreach ($response->headers->getCookies() as $cookie) { - if ($this->isDisabled($cookie->getName())) { - continue; - } - - $response->headers->setCookie($this->duplicate( - $cookie, - $this->encrypter->encrypt( - CookieValuePrefix::create($cookie->getName(), $this->encrypter->getKey()).$cookie->getValue(), - static::serialized($cookie->getName()) - ) - )); - } - - return $response; - } - - /** - * Duplicate a cookie with a new value. - * - * @param \Symfony\Component\HttpFoundation\Cookie $cookie - * @param mixed $value - * @return \Symfony\Component\HttpFoundation\Cookie - */ - protected function duplicate(Cookie $cookie, $value) - { - return new Cookie( - $cookie->getName(), $value, $cookie->getExpiresTime(), - $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), - $cookie->isHttpOnly(), $cookie->isRaw(), $cookie->getSameSite() - ); - } - - /** - * Determine whether encryption has been disabled for the given cookie. - * - * @param string $name - * @return bool - */ - public function isDisabled($name) - { - return in_array($name, $this->except); - } - - /** - * Determine if the cookie contents should be serialized. - * - * @param string $name - * @return bool - */ - public static function serialized($name) - { - return static::$serialize; - } -} diff --git a/framework-9.50.2/src/Illuminate/Cookie/composer.json b/framework-9.50.2/src/Illuminate/Cookie/composer.json deleted file mode 100755 index a7a444c..0000000 --- a/framework-9.50.2/src/Illuminate/Cookie/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "illuminate/cookie", - "description": "The Illuminate Cookie package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0", - "symfony/http-foundation": "^6.0", - "symfony/http-kernel": "^6.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Cookie\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Database/Capsule/Manager.php b/framework-9.50.2/src/Illuminate/Database/Capsule/Manager.php deleted file mode 100755 index b877e7c..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Capsule/Manager.php +++ /dev/null @@ -1,202 +0,0 @@ -setupContainer($container ?: new Container); - - // Once we have the container setup, we will setup the default configuration - // options in the container "config" binding. This will make the database - // manager work correctly out of the box without extreme configuration. - $this->setupDefaultConfiguration(); - - $this->setupManager(); - } - - /** - * Setup the default database configuration options. - * - * @return void - */ - protected function setupDefaultConfiguration() - { - $this->container['config']['database.fetch'] = PDO::FETCH_OBJ; - - $this->container['config']['database.default'] = 'default'; - } - - /** - * Build the database manager instance. - * - * @return void - */ - protected function setupManager() - { - $factory = new ConnectionFactory($this->container); - - $this->manager = new DatabaseManager($this->container, $factory); - } - - /** - * Get a connection instance from the global manager. - * - * @param string|null $connection - * @return \Illuminate\Database\Connection - */ - public static function connection($connection = null) - { - return static::$instance->getConnection($connection); - } - - /** - * Get a fluent query builder instance. - * - * @param \Closure|\Illuminate\Database\Query\Builder|string $table - * @param string|null $as - * @param string|null $connection - * @return \Illuminate\Database\Query\Builder - */ - public static function table($table, $as = null, $connection = null) - { - return static::$instance->connection($connection)->table($table, $as); - } - - /** - * Get a schema builder instance. - * - * @param string|null $connection - * @return \Illuminate\Database\Schema\Builder - */ - public static function schema($connection = null) - { - return static::$instance->connection($connection)->getSchemaBuilder(); - } - - /** - * Get a registered connection instance. - * - * @param string|null $name - * @return \Illuminate\Database\Connection - */ - public function getConnection($name = null) - { - return $this->manager->connection($name); - } - - /** - * Register a connection with the manager. - * - * @param array $config - * @param string $name - * @return void - */ - public function addConnection(array $config, $name = 'default') - { - $connections = $this->container['config']['database.connections']; - - $connections[$name] = $config; - - $this->container['config']['database.connections'] = $connections; - } - - /** - * Bootstrap Eloquent so it is ready for usage. - * - * @return void - */ - public function bootEloquent() - { - Eloquent::setConnectionResolver($this->manager); - - // If we have an event dispatcher instance, we will go ahead and register it - // with the Eloquent ORM, allowing for model callbacks while creating and - // updating "model" instances; however, it is not necessary to operate. - if ($dispatcher = $this->getEventDispatcher()) { - Eloquent::setEventDispatcher($dispatcher); - } - } - - /** - * Set the fetch mode for the database connections. - * - * @param int $fetchMode - * @return $this - */ - public function setFetchMode($fetchMode) - { - $this->container['config']['database.fetch'] = $fetchMode; - - return $this; - } - - /** - * Get the database manager instance. - * - * @return \Illuminate\Database\DatabaseManager - */ - public function getDatabaseManager() - { - return $this->manager; - } - - /** - * Get the current event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher|null - */ - public function getEventDispatcher() - { - if ($this->container->bound('events')) { - return $this->container['events']; - } - } - - /** - * Set the event dispatcher instance to be used by connections. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @return void - */ - public function setEventDispatcher(Dispatcher $dispatcher) - { - $this->container->instance('events', $dispatcher); - } - - /** - * Dynamically pass methods to the default connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public static function __callStatic($method, $parameters) - { - return static::connection()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/ClassMorphViolationException.php b/framework-9.50.2/src/Illuminate/Database/ClassMorphViolationException.php deleted file mode 100644 index 6594d2d..0000000 --- a/framework-9.50.2/src/Illuminate/Database/ClassMorphViolationException.php +++ /dev/null @@ -1,29 +0,0 @@ -model = $class; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Concerns/BuildsQueries.php b/framework-9.50.2/src/Illuminate/Database/Concerns/BuildsQueries.php deleted file mode 100644 index 16dc024..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Concerns/BuildsQueries.php +++ /dev/null @@ -1,506 +0,0 @@ -enforceOrderBy(); - - $page = 1; - - do { - // We'll execute the query for the given page and get the results. If there are - // no results we can just break and return from here. When there are results - // we will call the callback with the current chunk of these results here. - $results = $this->forPage($page, $count)->get(); - - $countResults = $results->count(); - - if ($countResults == 0) { - break; - } - - // On each chunk result set, we will pass them to the callback and then let the - // developer take care of everything within the callback, which allows us to - // keep the memory low for spinning through large result sets for working. - if ($callback($results, $page) === false) { - return false; - } - - unset($results); - - $page++; - } while ($countResults == $count); - - return true; - } - - /** - * Run a map over each item while chunking. - * - * @param callable $callback - * @param int $count - * @return \Illuminate\Support\Collection - */ - public function chunkMap(callable $callback, $count = 1000) - { - $collection = Collection::make(); - - $this->chunk($count, function ($items) use ($collection, $callback) { - $items->each(function ($item) use ($collection, $callback) { - $collection->push($callback($item)); - }); - }); - - return $collection; - } - - /** - * Execute a callback over each item while chunking. - * - * @param callable $callback - * @param int $count - * @return bool - * - * @throws \RuntimeException - */ - public function each(callable $callback, $count = 1000) - { - return $this->chunk($count, function ($results) use ($callback) { - foreach ($results as $key => $value) { - if ($callback($value, $key) === false) { - return false; - } - } - }); - } - - /** - * Chunk the results of a query by comparing IDs. - * - * @param int $count - * @param callable $callback - * @param string|null $column - * @param string|null $alias - * @return bool - */ - public function chunkById($count, callable $callback, $column = null, $alias = null) - { - $column ??= $this->defaultKeyName(); - - $alias ??= $column; - - $lastId = null; - - $page = 1; - - do { - $clone = clone $this; - - // We'll execute the query for the given page and get the results. If there are - // no results we can just break and return from here. When there are results - // we will call the callback with the current chunk of these results here. - $results = $clone->forPageAfterId($count, $lastId, $column)->get(); - - $countResults = $results->count(); - - if ($countResults == 0) { - break; - } - - // On each chunk result set, we will pass them to the callback and then let the - // developer take care of everything within the callback, which allows us to - // keep the memory low for spinning through large result sets for working. - if ($callback($results, $page) === false) { - return false; - } - - $lastId = data_get($results->last(), $alias); - - if ($lastId === null) { - throw new RuntimeException("The chunkById operation was aborted because the [{$alias}] column is not present in the query result."); - } - - unset($results); - - $page++; - } while ($countResults == $count); - - return true; - } - - /** - * Execute a callback over each item while chunking by ID. - * - * @param callable $callback - * @param int $count - * @param string|null $column - * @param string|null $alias - * @return bool - */ - public function eachById(callable $callback, $count = 1000, $column = null, $alias = null) - { - return $this->chunkById($count, function ($results, $page) use ($callback, $count) { - foreach ($results as $key => $value) { - if ($callback($value, (($page - 1) * $count) + $key) === false) { - return false; - } - } - }, $column, $alias); - } - - /** - * Query lazily, by chunks of the given size. - * - * @param int $chunkSize - * @return \Illuminate\Support\LazyCollection - * - * @throws \InvalidArgumentException - */ - public function lazy($chunkSize = 1000) - { - if ($chunkSize < 1) { - throw new InvalidArgumentException('The chunk size should be at least 1'); - } - - $this->enforceOrderBy(); - - return LazyCollection::make(function () use ($chunkSize) { - $page = 1; - - while (true) { - $results = $this->forPage($page++, $chunkSize)->get(); - - foreach ($results as $result) { - yield $result; - } - - if ($results->count() < $chunkSize) { - return; - } - } - }); - } - - /** - * Query lazily, by chunking the results of a query by comparing IDs. - * - * @param int $chunkSize - * @param string|null $column - * @param string|null $alias - * @return \Illuminate\Support\LazyCollection - * - * @throws \InvalidArgumentException - */ - public function lazyById($chunkSize = 1000, $column = null, $alias = null) - { - return $this->orderedLazyById($chunkSize, $column, $alias); - } - - /** - * Query lazily, by chunking the results of a query by comparing IDs in descending order. - * - * @param int $chunkSize - * @param string|null $column - * @param string|null $alias - * @return \Illuminate\Support\LazyCollection - * - * @throws \InvalidArgumentException - */ - public function lazyByIdDesc($chunkSize = 1000, $column = null, $alias = null) - { - return $this->orderedLazyById($chunkSize, $column, $alias, true); - } - - /** - * Query lazily, by chunking the results of a query by comparing IDs in a given order. - * - * @param int $chunkSize - * @param string|null $column - * @param string|null $alias - * @param bool $descending - * @return \Illuminate\Support\LazyCollection - * - * @throws \InvalidArgumentException - */ - protected function orderedLazyById($chunkSize = 1000, $column = null, $alias = null, $descending = false) - { - if ($chunkSize < 1) { - throw new InvalidArgumentException('The chunk size should be at least 1'); - } - - $column ??= $this->defaultKeyName(); - - $alias ??= $column; - - return LazyCollection::make(function () use ($chunkSize, $column, $alias, $descending) { - $lastId = null; - - while (true) { - $clone = clone $this; - - if ($descending) { - $results = $clone->forPageBeforeId($chunkSize, $lastId, $column)->get(); - } else { - $results = $clone->forPageAfterId($chunkSize, $lastId, $column)->get(); - } - - foreach ($results as $result) { - yield $result; - } - - if ($results->count() < $chunkSize) { - return; - } - - $lastId = $results->last()->{$alias}; - } - }); - } - - /** - * Execute the query and get the first result. - * - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model|object|static|null - */ - public function first($columns = ['*']) - { - return $this->take(1)->get($columns)->first(); - } - - /** - * Execute the query and get the first result if it's the sole matching record. - * - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model|object|static|null - * - * @throws \Illuminate\Database\RecordsNotFoundException - * @throws \Illuminate\Database\MultipleRecordsFoundException - */ - public function sole($columns = ['*']) - { - $result = $this->take(2)->get($columns); - - $count = $result->count(); - - if ($count === 0) { - throw new RecordsNotFoundException; - } - - if ($count > 1) { - throw new MultipleRecordsFoundException($count); - } - - return $result->first(); - } - - /** - * Paginate the given query using a cursor paginator. - * - * @param int $perPage - * @param array|string $columns - * @param string $cursorName - * @param \Illuminate\Pagination\Cursor|string|null $cursor - * @return \Illuminate\Contracts\Pagination\CursorPaginator - */ - protected function paginateUsingCursor($perPage, $columns = ['*'], $cursorName = 'cursor', $cursor = null) - { - if (! $cursor instanceof Cursor) { - $cursor = is_string($cursor) - ? Cursor::fromEncoded($cursor) - : CursorPaginator::resolveCurrentCursor($cursorName, $cursor); - } - - $orders = $this->ensureOrderForCursorPagination(! is_null($cursor) && $cursor->pointsToPreviousItems()); - - if (! is_null($cursor)) { - $addCursorConditions = function (self $builder, $previousColumn, $i) use (&$addCursorConditions, $cursor, $orders) { - $unionBuilders = isset($builder->unions) ? collect($builder->unions)->pluck('query') : collect(); - - if (! is_null($previousColumn)) { - $originalColumn = $this->getOriginalColumnNameForCursorPagination($this, $previousColumn); - - $builder->where( - Str::contains($originalColumn, ['(', ')']) ? new Expression($originalColumn) : $originalColumn, - '=', - $cursor->parameter($previousColumn) - ); - - $unionBuilders->each(function ($unionBuilder) use ($previousColumn, $cursor) { - $unionBuilder->where( - $this->getOriginalColumnNameForCursorPagination($this, $previousColumn), - '=', - $cursor->parameter($previousColumn) - ); - - $this->addBinding($unionBuilder->getRawBindings()['where'], 'union'); - }); - } - - $builder->where(function (self $builder) use ($addCursorConditions, $cursor, $orders, $i, $unionBuilders) { - ['column' => $column, 'direction' => $direction] = $orders[$i]; - - $originalColumn = $this->getOriginalColumnNameForCursorPagination($this, $column); - - $builder->where( - Str::contains($originalColumn, ['(', ')']) ? new Expression($originalColumn) : $originalColumn, - $direction === 'asc' ? '>' : '<', - $cursor->parameter($column) - ); - - if ($i < $orders->count() - 1) { - $builder->orWhere(function (self $builder) use ($addCursorConditions, $column, $i) { - $addCursorConditions($builder, $column, $i + 1); - }); - } - - $unionBuilders->each(function ($unionBuilder) use ($column, $direction, $cursor, $i, $orders, $addCursorConditions) { - $unionBuilder->where(function ($unionBuilder) use ($column, $direction, $cursor, $i, $orders, $addCursorConditions) { - $unionBuilder->where( - $this->getOriginalColumnNameForCursorPagination($this, $column), - $direction === 'asc' ? '>' : '<', - $cursor->parameter($column) - ); - - if ($i < $orders->count() - 1) { - $unionBuilder->orWhere(function (self $builder) use ($addCursorConditions, $column, $i) { - $addCursorConditions($builder, $column, $i + 1); - }); - } - - $this->addBinding($unionBuilder->getRawBindings()['where'], 'union'); - }); - }); - }); - }; - - $addCursorConditions($this, null, 0); - } - - $this->limit($perPage + 1); - - return $this->cursorPaginator($this->get($columns), $perPage, $cursor, [ - 'path' => Paginator::resolveCurrentPath(), - 'cursorName' => $cursorName, - 'parameters' => $orders->pluck('column')->toArray(), - ]); - } - - /** - * Get the original column name of the given column, without any aliasing. - * - * @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $builder - * @param string $parameter - * @return string - */ - protected function getOriginalColumnNameForCursorPagination($builder, string $parameter) - { - $columns = $builder instanceof Builder ? $builder->getQuery()->columns : $builder->columns; - - if (! is_null($columns)) { - foreach ($columns as $column) { - if (($position = strripos($column, ' as ')) !== false) { - $original = substr($column, 0, $position); - - $alias = substr($column, $position + 4); - - if ($parameter === $alias || $builder->getGrammar()->wrap($parameter) === $alias) { - return $original; - } - } - } - } - - return $parameter; - } - - /** - * Create a new length-aware paginator instance. - * - * @param \Illuminate\Support\Collection $items - * @param int $total - * @param int $perPage - * @param int $currentPage - * @param array $options - * @return \Illuminate\Pagination\LengthAwarePaginator - */ - protected function paginator($items, $total, $perPage, $currentPage, $options) - { - return Container::getInstance()->makeWith(LengthAwarePaginator::class, compact( - 'items', 'total', 'perPage', 'currentPage', 'options' - )); - } - - /** - * Create a new simple paginator instance. - * - * @param \Illuminate\Support\Collection $items - * @param int $perPage - * @param int $currentPage - * @param array $options - * @return \Illuminate\Pagination\Paginator - */ - protected function simplePaginator($items, $perPage, $currentPage, $options) - { - return Container::getInstance()->makeWith(Paginator::class, compact( - 'items', 'perPage', 'currentPage', 'options' - )); - } - - /** - * Create a new cursor paginator instance. - * - * @param \Illuminate\Support\Collection $items - * @param int $perPage - * @param \Illuminate\Pagination\Cursor $cursor - * @param array $options - * @return \Illuminate\Pagination\CursorPaginator - */ - protected function cursorPaginator($items, $perPage, $cursor, $options) - { - return Container::getInstance()->makeWith(CursorPaginator::class, compact( - 'items', 'perPage', 'cursor', 'options' - )); - } - - /** - * Pass the query to a given callback. - * - * @param callable $callback - * @return $this - */ - public function tap($callback) - { - $callback($this); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Concerns/CompilesJsonPaths.php b/framework-9.50.2/src/Illuminate/Database/Concerns/CompilesJsonPaths.php deleted file mode 100644 index ade5461..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Concerns/CompilesJsonPaths.php +++ /dev/null @@ -1,64 +0,0 @@ -', $column, 2); - - $field = $this->wrap($parts[0]); - - $path = count($parts) > 1 ? ', '.$this->wrapJsonPath($parts[1], '->') : ''; - - return [$field, $path]; - } - - /** - * Wrap the given JSON path. - * - * @param string $value - * @param string $delimiter - * @return string - */ - protected function wrapJsonPath($value, $delimiter = '->') - { - $value = preg_replace("/([\\\\]+)?\\'/", "''", $value); - - $jsonPath = collect(explode($delimiter, $value)) - ->map(fn ($segment) => $this->wrapJsonPathSegment($segment)) - ->join('.'); - - return "'$".(str_starts_with($jsonPath, '[') ? '' : '.').$jsonPath."'"; - } - - /** - * Wrap the given JSON path segment. - * - * @param string $segment - * @return string - */ - protected function wrapJsonPathSegment($segment) - { - if (preg_match('/(\[[^\]]+\])+$/', $segment, $parts)) { - $key = Str::beforeLast($segment, $parts[0]); - - if (! empty($key)) { - return '"'.$key.'"'.$parts[0]; - } - - return $parts[0]; - } - - return '"'.$segment.'"'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Concerns/ExplainsQueries.php b/framework-9.50.2/src/Illuminate/Database/Concerns/ExplainsQueries.php deleted file mode 100644 index 7168de1..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Concerns/ExplainsQueries.php +++ /dev/null @@ -1,24 +0,0 @@ -toSql(); - - $bindings = $this->getBindings(); - - $explanation = $this->getConnection()->select('EXPLAIN '.$sql, $bindings); - - return new Collection($explanation); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Concerns/ManagesTransactions.php b/framework-9.50.2/src/Illuminate/Database/Concerns/ManagesTransactions.php deleted file mode 100644 index 2f316a3..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Concerns/ManagesTransactions.php +++ /dev/null @@ -1,348 +0,0 @@ -beginTransaction(); - - // We'll simply execute the given callback within a try / catch block and if we - // catch any exception we can rollback this transaction so that none of this - // gets actually persisted to a database or stored in a permanent fashion. - try { - $callbackResult = $callback($this); - } - - // If we catch an exception we'll rollback this transaction and try again if we - // are not out of attempts. If we are out of attempts we will just throw the - // exception back out, and let the developer handle an uncaught exception. - catch (Throwable $e) { - $this->handleTransactionException( - $e, $currentAttempt, $attempts - ); - - continue; - } - - try { - if ($this->transactions == 1) { - $this->fireConnectionEvent('committing'); - $this->getPdo()->commit(); - } - - $this->transactions = max(0, $this->transactions - 1); - - if ($this->afterCommitCallbacksShouldBeExecuted()) { - $this->transactionsManager?->commit($this->getName()); - } - } catch (Throwable $e) { - $this->handleCommitTransactionException( - $e, $currentAttempt, $attempts - ); - - continue; - } - - $this->fireConnectionEvent('committed'); - - return $callbackResult; - } - } - - /** - * Handle an exception encountered when running a transacted statement. - * - * @param \Throwable $e - * @param int $currentAttempt - * @param int $maxAttempts - * @return void - * - * @throws \Throwable - */ - protected function handleTransactionException(Throwable $e, $currentAttempt, $maxAttempts) - { - // On a deadlock, MySQL rolls back the entire transaction so we can't just - // retry the query. We have to throw this exception all the way out and - // let the developer handle it in another way. We will decrement too. - if ($this->causedByConcurrencyError($e) && - $this->transactions > 1) { - $this->transactions--; - - $this->transactionsManager?->rollback( - $this->getName(), $this->transactions - ); - - throw new DeadlockException($e->getMessage(), is_int($e->getCode()) ? $e->getCode() : 0, $e); - } - - // If there was an exception we will rollback this transaction and then we - // can check if we have exceeded the maximum attempt count for this and - // if we haven't we will return and try this query again in our loop. - $this->rollBack(); - - if ($this->causedByConcurrencyError($e) && - $currentAttempt < $maxAttempts) { - return; - } - - throw $e; - } - - /** - * Start a new database transaction. - * - * @return void - * - * @throws \Throwable - */ - public function beginTransaction() - { - $this->createTransaction(); - - $this->transactions++; - - $this->transactionsManager?->begin( - $this->getName(), $this->transactions - ); - - $this->fireConnectionEvent('beganTransaction'); - } - - /** - * Create a transaction within the database. - * - * @return void - * - * @throws \Throwable - */ - protected function createTransaction() - { - if ($this->transactions == 0) { - $this->reconnectIfMissingConnection(); - - try { - $this->getPdo()->beginTransaction(); - } catch (Throwable $e) { - $this->handleBeginTransactionException($e); - } - } elseif ($this->transactions >= 1 && $this->queryGrammar->supportsSavepoints()) { - $this->createSavepoint(); - } - } - - /** - * Create a save point within the database. - * - * @return void - * - * @throws \Throwable - */ - protected function createSavepoint() - { - $this->getPdo()->exec( - $this->queryGrammar->compileSavepoint('trans'.($this->transactions + 1)) - ); - } - - /** - * Handle an exception from a transaction beginning. - * - * @param \Throwable $e - * @return void - * - * @throws \Throwable - */ - protected function handleBeginTransactionException(Throwable $e) - { - if ($this->causedByLostConnection($e)) { - $this->reconnect(); - - $this->getPdo()->beginTransaction(); - } else { - throw $e; - } - } - - /** - * Commit the active database transaction. - * - * @return void - * - * @throws \Throwable - */ - public function commit() - { - if ($this->transactionLevel() == 1) { - $this->fireConnectionEvent('committing'); - $this->getPdo()->commit(); - } - - $this->transactions = max(0, $this->transactions - 1); - - if ($this->afterCommitCallbacksShouldBeExecuted()) { - $this->transactionsManager?->commit($this->getName()); - } - - $this->fireConnectionEvent('committed'); - } - - /** - * Determine if after commit callbacks should be executed. - * - * @return bool - */ - protected function afterCommitCallbacksShouldBeExecuted() - { - return $this->transactions == 0 || - ($this->transactionsManager && - $this->transactionsManager->callbackApplicableTransactions()->count() === 1); - } - - /** - * Handle an exception encountered when committing a transaction. - * - * @param \Throwable $e - * @param int $currentAttempt - * @param int $maxAttempts - * @return void - * - * @throws \Throwable - */ - protected function handleCommitTransactionException(Throwable $e, $currentAttempt, $maxAttempts) - { - $this->transactions = max(0, $this->transactions - 1); - - if ($this->causedByConcurrencyError($e) && $currentAttempt < $maxAttempts) { - return; - } - - if ($this->causedByLostConnection($e)) { - $this->transactions = 0; - } - - throw $e; - } - - /** - * Rollback the active database transaction. - * - * @param int|null $toLevel - * @return void - * - * @throws \Throwable - */ - public function rollBack($toLevel = null) - { - // We allow developers to rollback to a certain transaction level. We will verify - // that this given transaction level is valid before attempting to rollback to - // that level. If it's not we will just return out and not attempt anything. - $toLevel = is_null($toLevel) - ? $this->transactions - 1 - : $toLevel; - - if ($toLevel < 0 || $toLevel >= $this->transactions) { - return; - } - - // Next, we will actually perform this rollback within this database and fire the - // rollback event. We will also set the current transaction level to the given - // level that was passed into this method so it will be right from here out. - try { - $this->performRollBack($toLevel); - } catch (Throwable $e) { - $this->handleRollBackException($e); - } - - $this->transactions = $toLevel; - - $this->transactionsManager?->rollback( - $this->getName(), $this->transactions - ); - - $this->fireConnectionEvent('rollingBack'); - } - - /** - * Perform a rollback within the database. - * - * @param int $toLevel - * @return void - * - * @throws \Throwable - */ - protected function performRollBack($toLevel) - { - if ($toLevel == 0) { - $this->getPdo()->rollBack(); - } elseif ($this->queryGrammar->supportsSavepoints()) { - $this->getPdo()->exec( - $this->queryGrammar->compileSavepointRollBack('trans'.($toLevel + 1)) - ); - } - } - - /** - * Handle an exception from a rollback. - * - * @param \Throwable $e - * @return void - * - * @throws \Throwable - */ - protected function handleRollBackException(Throwable $e) - { - if ($this->causedByLostConnection($e)) { - $this->transactions = 0; - - $this->transactionsManager?->rollback( - $this->getName(), $this->transactions - ); - } - - throw $e; - } - - /** - * Get the number of active transactions. - * - * @return int - */ - public function transactionLevel() - { - return $this->transactions; - } - - /** - * Execute the callback after a transaction commits. - * - * @param callable $callback - * @return void - * - * @throws \RuntimeException - */ - public function afterCommit($callback) - { - if ($this->transactionsManager) { - return $this->transactionsManager->addCallback($callback); - } - - throw new RuntimeException('Transactions Manager has not been set.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Concerns/ParsesSearchPath.php b/framework-9.50.2/src/Illuminate/Database/Concerns/ParsesSearchPath.php deleted file mode 100644 index e822c72..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Concerns/ParsesSearchPath.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ - protected $doctrineTypeMappings = []; - - /** - * The connection resolvers. - * - * @var \Closure[] - */ - protected static $resolvers = []; - - /** - * Create a new database connection instance. - * - * @param \PDO|\Closure $pdo - * @param string $database - * @param string $tablePrefix - * @param array $config - * @return void - */ - public function __construct($pdo, $database = '', $tablePrefix = '', array $config = []) - { - $this->pdo = $pdo; - - // First we will setup the default properties. We keep track of the DB - // name we are connected to since it is needed when some reflective - // type commands are run such as checking whether a table exists. - $this->database = $database; - - $this->tablePrefix = $tablePrefix; - - $this->config = $config; - - // We need to initialize a query grammar and the query post processors - // which are both very important parts of the database abstractions - // so we initialize these to their default values while starting. - $this->useDefaultQueryGrammar(); - - $this->useDefaultPostProcessor(); - } - - /** - * Set the query grammar to the default implementation. - * - * @return void - */ - public function useDefaultQueryGrammar() - { - $this->queryGrammar = $this->getDefaultQueryGrammar(); - } - - /** - * Get the default query grammar instance. - * - * @return \Illuminate\Database\Query\Grammars\Grammar - */ - protected function getDefaultQueryGrammar() - { - return new QueryGrammar; - } - - /** - * Set the schema grammar to the default implementation. - * - * @return void - */ - public function useDefaultSchemaGrammar() - { - $this->schemaGrammar = $this->getDefaultSchemaGrammar(); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\Grammar - */ - protected function getDefaultSchemaGrammar() - { - // - } - - /** - * Set the query post processor to the default implementation. - * - * @return void - */ - public function useDefaultPostProcessor() - { - $this->postProcessor = $this->getDefaultPostProcessor(); - } - - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - protected function getDefaultPostProcessor() - { - return new Processor; - } - - /** - * Get a schema builder instance for the connection. - * - * @return \Illuminate\Database\Schema\Builder - */ - public function getSchemaBuilder() - { - if (is_null($this->schemaGrammar)) { - $this->useDefaultSchemaGrammar(); - } - - return new SchemaBuilder($this); - } - - /** - * Begin a fluent query against a database table. - * - * @param \Closure|\Illuminate\Database\Query\Builder|string $table - * @param string|null $as - * @return \Illuminate\Database\Query\Builder - */ - public function table($table, $as = null) - { - return $this->query()->from($table, $as); - } - - /** - * Get a new query builder instance. - * - * @return \Illuminate\Database\Query\Builder - */ - public function query() - { - return new QueryBuilder( - $this, $this->getQueryGrammar(), $this->getPostProcessor() - ); - } - - /** - * Run a select statement and return a single result. - * - * @param string $query - * @param array $bindings - * @param bool $useReadPdo - * @return mixed - */ - public function selectOne($query, $bindings = [], $useReadPdo = true) - { - $records = $this->select($query, $bindings, $useReadPdo); - - return array_shift($records); - } - - /** - * Run a select statement and return the first column of the first row. - * - * @param string $query - * @param array $bindings - * @param bool $useReadPdo - * @return mixed - * - * @throws \Illuminate\Database\MultipleColumnsSelectedException - */ - public function scalar($query, $bindings = [], $useReadPdo = true) - { - $record = $this->selectOne($query, $bindings, $useReadPdo); - - if (is_null($record)) { - return null; - } - - $record = (array) $record; - - if (count($record) > 1) { - throw new MultipleColumnsSelectedException; - } - - return reset($record); - } - - /** - * Run a select statement against the database. - * - * @param string $query - * @param array $bindings - * @return array - */ - public function selectFromWriteConnection($query, $bindings = []) - { - return $this->select($query, $bindings, false); - } - - /** - * Run a select statement against the database. - * - * @param string $query - * @param array $bindings - * @param bool $useReadPdo - * @return array - */ - public function select($query, $bindings = [], $useReadPdo = true) - { - return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { - if ($this->pretending()) { - return []; - } - - // For select statements, we'll simply execute the query and return an array - // of the database result set. Each element in the array will be a single - // row from the database table, and will either be an array or objects. - $statement = $this->prepared( - $this->getPdoForSelect($useReadPdo)->prepare($query) - ); - - $this->bindValues($statement, $this->prepareBindings($bindings)); - - $statement->execute(); - - return $statement->fetchAll(); - }); - } - - /** - * Run a select statement against the database and returns a generator. - * - * @param string $query - * @param array $bindings - * @param bool $useReadPdo - * @return \Generator - */ - public function cursor($query, $bindings = [], $useReadPdo = true) - { - $statement = $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { - if ($this->pretending()) { - return []; - } - - // First we will create a statement for the query. Then, we will set the fetch - // mode and prepare the bindings for the query. Once that's done we will be - // ready to execute the query against the database and return the cursor. - $statement = $this->prepared($this->getPdoForSelect($useReadPdo) - ->prepare($query)); - - $this->bindValues( - $statement, $this->prepareBindings($bindings) - ); - - // Next, we'll execute the query against the database and return the statement - // so we can return the cursor. The cursor will use a PHP generator to give - // back one row at a time without using a bunch of memory to render them. - $statement->execute(); - - return $statement; - }); - - while ($record = $statement->fetch()) { - yield $record; - } - } - - /** - * Configure the PDO prepared statement. - * - * @param \PDOStatement $statement - * @return \PDOStatement - */ - protected function prepared(PDOStatement $statement) - { - $statement->setFetchMode($this->fetchMode); - - $this->event(new StatementPrepared($this, $statement)); - - return $statement; - } - - /** - * Get the PDO connection to use for a select query. - * - * @param bool $useReadPdo - * @return \PDO - */ - protected function getPdoForSelect($useReadPdo = true) - { - return $useReadPdo ? $this->getReadPdo() : $this->getPdo(); - } - - /** - * Run an insert statement against the database. - * - * @param string $query - * @param array $bindings - * @return bool - */ - public function insert($query, $bindings = []) - { - return $this->statement($query, $bindings); - } - - /** - * Run an update statement against the database. - * - * @param string $query - * @param array $bindings - * @return int - */ - public function update($query, $bindings = []) - { - return $this->affectingStatement($query, $bindings); - } - - /** - * Run a delete statement against the database. - * - * @param string $query - * @param array $bindings - * @return int - */ - public function delete($query, $bindings = []) - { - return $this->affectingStatement($query, $bindings); - } - - /** - * Execute an SQL statement and return the boolean result. - * - * @param string $query - * @param array $bindings - * @return bool - */ - public function statement($query, $bindings = []) - { - return $this->run($query, $bindings, function ($query, $bindings) { - if ($this->pretending()) { - return true; - } - - $statement = $this->getPdo()->prepare($query); - - $this->bindValues($statement, $this->prepareBindings($bindings)); - - $this->recordsHaveBeenModified(); - - return $statement->execute(); - }); - } - - /** - * Run an SQL statement and get the number of rows affected. - * - * @param string $query - * @param array $bindings - * @return int - */ - public function affectingStatement($query, $bindings = []) - { - return $this->run($query, $bindings, function ($query, $bindings) { - if ($this->pretending()) { - return 0; - } - - // For update or delete statements, we want to get the number of rows affected - // by the statement and return that back to the developer. We'll first need - // to execute the statement and then we'll use PDO to fetch the affected. - $statement = $this->getPdo()->prepare($query); - - $this->bindValues($statement, $this->prepareBindings($bindings)); - - $statement->execute(); - - $this->recordsHaveBeenModified( - ($count = $statement->rowCount()) > 0 - ); - - return $count; - }); - } - - /** - * Run a raw, unprepared query against the PDO connection. - * - * @param string $query - * @return bool - */ - public function unprepared($query) - { - return $this->run($query, [], function ($query) { - if ($this->pretending()) { - return true; - } - - $this->recordsHaveBeenModified( - $change = $this->getPdo()->exec($query) !== false - ); - - return $change; - }); - } - - /** - * Execute the given callback in "dry run" mode. - * - * @param \Closure $callback - * @return array - */ - public function pretend(Closure $callback) - { - return $this->withFreshQueryLog(function () use ($callback) { - $this->pretending = true; - - // Basically to make the database connection "pretend", we will just return - // the default values for all the query methods, then we will return an - // array of queries that were "executed" within the Closure callback. - $callback($this); - - $this->pretending = false; - - return $this->queryLog; - }); - } - - /** - * Execute the given callback in "dry run" mode. - * - * @param \Closure $callback - * @return array - */ - protected function withFreshQueryLog($callback) - { - $loggingQueries = $this->loggingQueries; - - // First we will back up the value of the logging queries property and then - // we'll be ready to run callbacks. This query log will also get cleared - // so we will have a new log of all the queries that are executed now. - $this->enableQueryLog(); - - $this->queryLog = []; - - // Now we'll execute this callback and capture the result. Once it has been - // executed we will restore the value of query logging and give back the - // value of the callback so the original callers can have the results. - $result = $callback(); - - $this->loggingQueries = $loggingQueries; - - return $result; - } - - /** - * Bind values to their parameters in the given statement. - * - * @param \PDOStatement $statement - * @param array $bindings - * @return void - */ - public function bindValues($statement, $bindings) - { - foreach ($bindings as $key => $value) { - $statement->bindValue( - is_string($key) ? $key : $key + 1, - $value, - match (true) { - is_int($value) => PDO::PARAM_INT, - is_resource($value) => PDO::PARAM_LOB, - default => PDO::PARAM_STR - }, - ); - } - } - - /** - * Prepare the query bindings for execution. - * - * @param array $bindings - * @return array - */ - public function prepareBindings(array $bindings) - { - $grammar = $this->getQueryGrammar(); - - foreach ($bindings as $key => $value) { - // We need to transform all instances of DateTimeInterface into the actual - // date string. Each query grammar maintains its own date string format - // so we'll just ask the grammar for the format to get from the date. - if ($value instanceof DateTimeInterface) { - $bindings[$key] = $value->format($grammar->getDateFormat()); - } elseif (is_bool($value)) { - $bindings[$key] = (int) $value; - } - } - - return $bindings; - } - - /** - * Run a SQL statement and log its execution context. - * - * @param string $query - * @param array $bindings - * @param \Closure $callback - * @return mixed - * - * @throws \Illuminate\Database\QueryException - */ - protected function run($query, $bindings, Closure $callback) - { - foreach ($this->beforeExecutingCallbacks as $beforeExecutingCallback) { - $beforeExecutingCallback($query, $bindings, $this); - } - - $this->reconnectIfMissingConnection(); - - $start = microtime(true); - - // Here we will run this query. If an exception occurs we'll determine if it was - // caused by a connection that has been lost. If that is the cause, we'll try - // to re-establish connection and re-run the query with a fresh connection. - try { - $result = $this->runQueryCallback($query, $bindings, $callback); - } catch (QueryException $e) { - $result = $this->handleQueryException( - $e, $query, $bindings, $callback - ); - } - - // Once we have run the query we will calculate the time that it took to run and - // then log the query, bindings, and execution time so we will report them on - // the event that the developer needs them. We'll log time in milliseconds. - $this->logQuery( - $query, $bindings, $this->getElapsedTime($start) - ); - - return $result; - } - - /** - * Run a SQL statement. - * - * @param string $query - * @param array $bindings - * @param \Closure $callback - * @return mixed - * - * @throws \Illuminate\Database\QueryException - */ - protected function runQueryCallback($query, $bindings, Closure $callback) - { - // To execute the statement, we'll simply call the callback, which will actually - // run the SQL against the PDO connection. Then we can calculate the time it - // took to execute and log the query SQL, bindings and time in our memory. - try { - return $callback($query, $bindings); - } - - // If an exception occurs when attempting to run a query, we'll format the error - // message to include the bindings with SQL, which will make this exception a - // lot more helpful to the developer instead of just the database's errors. - catch (Exception $e) { - throw new QueryException( - $query, $this->prepareBindings($bindings), $e - ); - } - } - - /** - * Log a query in the connection's query log. - * - * @param string $query - * @param array $bindings - * @param float|null $time - * @return void - */ - public function logQuery($query, $bindings, $time = null) - { - $this->totalQueryDuration += $time ?? 0.0; - - $this->event(new QueryExecuted($query, $bindings, $time, $this)); - - if ($this->loggingQueries) { - $this->queryLog[] = compact('query', 'bindings', 'time'); - } - } - - /** - * Get the elapsed time since a given starting point. - * - * @param int $start - * @return float - */ - protected function getElapsedTime($start) - { - return round((microtime(true) - $start) * 1000, 2); - } - - /** - * Register a callback to be invoked when the connection queries for longer than a given amount of time. - * - * @param \DateTimeInterface|\Carbon\CarbonInterval|float|int $threshold - * @param callable $handler - * @return void - */ - public function whenQueryingForLongerThan($threshold, $handler) - { - $threshold = $threshold instanceof DateTimeInterface - ? $this->secondsUntil($threshold) * 1000 - : $threshold; - - $threshold = $threshold instanceof CarbonInterval - ? $threshold->totalMilliseconds - : $threshold; - - $this->queryDurationHandlers[] = [ - 'has_run' => false, - 'handler' => $handler, - ]; - - $key = count($this->queryDurationHandlers) - 1; - - $this->listen(function ($event) use ($threshold, $handler, $key) { - if (! $this->queryDurationHandlers[$key]['has_run'] && $this->totalQueryDuration() > $threshold) { - $handler($this, $event); - - $this->queryDurationHandlers[$key]['has_run'] = true; - } - }); - } - - /** - * Allow all the query duration handlers to run again, even if they have already run. - * - * @return void - */ - public function allowQueryDurationHandlersToRunAgain() - { - foreach ($this->queryDurationHandlers as $key => $queryDurationHandler) { - $this->queryDurationHandlers[$key]['has_run'] = false; - } - } - - /** - * Get the duration of all run queries in milliseconds. - * - * @return float - */ - public function totalQueryDuration() - { - return $this->totalQueryDuration; - } - - /** - * Reset the duration of all run queries. - * - * @return void - */ - public function resetTotalQueryDuration() - { - $this->totalQueryDuration = 0.0; - } - - /** - * Handle a query exception. - * - * @param \Illuminate\Database\QueryException $e - * @param string $query - * @param array $bindings - * @param \Closure $callback - * @return mixed - * - * @throws \Illuminate\Database\QueryException - */ - protected function handleQueryException(QueryException $e, $query, $bindings, Closure $callback) - { - if ($this->transactions >= 1) { - throw $e; - } - - return $this->tryAgainIfCausedByLostConnection( - $e, $query, $bindings, $callback - ); - } - - /** - * Handle a query exception that occurred during query execution. - * - * @param \Illuminate\Database\QueryException $e - * @param string $query - * @param array $bindings - * @param \Closure $callback - * @return mixed - * - * @throws \Illuminate\Database\QueryException - */ - protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) - { - if ($this->causedByLostConnection($e->getPrevious())) { - $this->reconnect(); - - return $this->runQueryCallback($query, $bindings, $callback); - } - - throw $e; - } - - /** - * Reconnect to the database. - * - * @return mixed|false - * - * @throws \Illuminate\Database\LostConnectionException - */ - public function reconnect() - { - if (is_callable($this->reconnector)) { - $this->doctrineConnection = null; - - return call_user_func($this->reconnector, $this); - } - - throw new LostConnectionException('Lost connection and no reconnector available.'); - } - - /** - * Reconnect to the database if a PDO connection is missing. - * - * @return void - */ - protected function reconnectIfMissingConnection() - { - if (is_null($this->pdo)) { - $this->reconnect(); - } - } - - /** - * Disconnect from the underlying PDO connection. - * - * @return void - */ - public function disconnect() - { - $this->setPdo(null)->setReadPdo(null); - - $this->doctrineConnection = null; - } - - /** - * Register a hook to be run just before a database query is executed. - * - * @param \Closure $callback - * @return $this - */ - public function beforeExecuting(Closure $callback) - { - $this->beforeExecutingCallbacks[] = $callback; - - return $this; - } - - /** - * Register a database query listener with the connection. - * - * @param \Closure $callback - * @return void - */ - public function listen(Closure $callback) - { - $this->events?->listen(Events\QueryExecuted::class, $callback); - } - - /** - * Fire an event for this connection. - * - * @param string $event - * @return array|null - */ - protected function fireConnectionEvent($event) - { - return $this->events?->dispatch(match ($event) { - 'beganTransaction' => new TransactionBeginning($this), - 'committed' => new TransactionCommitted($this), - 'committing' => new TransactionCommitting($this), - 'rollingBack' => new TransactionRolledBack($this), - default => null, - }); - } - - /** - * Fire the given event if possible. - * - * @param mixed $event - * @return void - */ - protected function event($event) - { - $this->events?->dispatch($event); - } - - /** - * Get a new raw query expression. - * - * @param mixed $value - * @return \Illuminate\Database\Query\Expression - */ - public function raw($value) - { - return new Expression($value); - } - - /** - * Determine if the database connection has modified any database records. - * - * @return bool - */ - public function hasModifiedRecords() - { - return $this->recordsModified; - } - - /** - * Indicate if any records have been modified. - * - * @param bool $value - * @return void - */ - public function recordsHaveBeenModified($value = true) - { - if (! $this->recordsModified) { - $this->recordsModified = $value; - } - } - - /** - * Set the record modification state. - * - * @param bool $value - * @return $this - */ - public function setRecordModificationState(bool $value) - { - $this->recordsModified = $value; - - return $this; - } - - /** - * Reset the record modification state. - * - * @return void - */ - public function forgetRecordModificationState() - { - $this->recordsModified = false; - } - - /** - * Indicate that the connection should use the write PDO connection for reads. - * - * @param bool $value - * @return $this - */ - public function useWriteConnectionWhenReading($value = true) - { - $this->readOnWriteConnection = $value; - - return $this; - } - - /** - * Is Doctrine available? - * - * @return bool - */ - public function isDoctrineAvailable() - { - return class_exists('Doctrine\DBAL\Connection'); - } - - /** - * Indicates whether native alter operations will be used when dropping or renaming columns, even if Doctrine DBAL is installed. - * - * @return bool - */ - public function usingNativeSchemaOperations() - { - return ! $this->isDoctrineAvailable() || SchemaBuilder::$alwaysUsesNativeSchemaOperationsIfPossible; - } - - /** - * Get a Doctrine Schema Column instance. - * - * @param string $table - * @param string $column - * @return \Doctrine\DBAL\Schema\Column - */ - public function getDoctrineColumn($table, $column) - { - $schema = $this->getDoctrineSchemaManager(); - - return $schema->listTableDetails($table)->getColumn($column); - } - - /** - * Get the Doctrine DBAL schema manager for the connection. - * - * @return \Doctrine\DBAL\Schema\AbstractSchemaManager - */ - public function getDoctrineSchemaManager() - { - $connection = $this->getDoctrineConnection(); - - // Doctrine v2 expects one parameter while v3 expects two. 2nd will be ignored on v2... - return $this->getDoctrineDriver()->getSchemaManager( - $connection, - $connection->getDatabasePlatform() - ); - } - - /** - * Get the Doctrine DBAL database connection instance. - * - * @return \Doctrine\DBAL\Connection - */ - public function getDoctrineConnection() - { - if (is_null($this->doctrineConnection)) { - $driver = $this->getDoctrineDriver(); - - $this->doctrineConnection = new DoctrineConnection(array_filter([ - 'pdo' => $this->getPdo(), - 'dbname' => $this->getDatabaseName(), - 'driver' => $driver->getName(), - 'serverVersion' => $this->getConfig('server_version'), - ]), $driver); - - foreach ($this->doctrineTypeMappings as $name => $type) { - $this->doctrineConnection - ->getDatabasePlatform() - ->registerDoctrineTypeMapping($type, $name); - } - } - - return $this->doctrineConnection; - } - - /** - * Register a custom Doctrine mapping type. - * - * @param Type|class-string $class - * @param string $name - * @param string $type - * @return void - * - * @throws \Doctrine\DBAL\DBALException - * @throws \RuntimeException - */ - public function registerDoctrineType(Type|string $class, string $name, string $type): void - { - if (! $this->isDoctrineAvailable()) { - throw new RuntimeException( - 'Registering a custom Doctrine type requires Doctrine DBAL (doctrine/dbal).' - ); - } - - if (! Type::hasType($name)) { - Type::getTypeRegistry() - ->register($name, is_string($class) ? new $class() : $class); - } - - $this->doctrineTypeMappings[$name] = $type; - } - - /** - * Get the current PDO connection. - * - * @return \PDO - */ - public function getPdo() - { - if ($this->pdo instanceof Closure) { - return $this->pdo = call_user_func($this->pdo); - } - - return $this->pdo; - } - - /** - * Get the current PDO connection parameter without executing any reconnect logic. - * - * @return \PDO|\Closure|null - */ - public function getRawPdo() - { - return $this->pdo; - } - - /** - * Get the current PDO connection used for reading. - * - * @return \PDO - */ - public function getReadPdo() - { - if ($this->transactions > 0) { - return $this->getPdo(); - } - - if ($this->readOnWriteConnection || - ($this->recordsModified && $this->getConfig('sticky'))) { - return $this->getPdo(); - } - - if ($this->readPdo instanceof Closure) { - return $this->readPdo = call_user_func($this->readPdo); - } - - return $this->readPdo ?: $this->getPdo(); - } - - /** - * Get the current read PDO connection parameter without executing any reconnect logic. - * - * @return \PDO|\Closure|null - */ - public function getRawReadPdo() - { - return $this->readPdo; - } - - /** - * Set the PDO connection. - * - * @param \PDO|\Closure|null $pdo - * @return $this - */ - public function setPdo($pdo) - { - $this->transactions = 0; - - $this->pdo = $pdo; - - return $this; - } - - /** - * Set the PDO connection used for reading. - * - * @param \PDO|\Closure|null $pdo - * @return $this - */ - public function setReadPdo($pdo) - { - $this->readPdo = $pdo; - - return $this; - } - - /** - * Set the reconnect instance on the connection. - * - * @param callable $reconnector - * @return $this - */ - public function setReconnector(callable $reconnector) - { - $this->reconnector = $reconnector; - - return $this; - } - - /** - * Get the database connection name. - * - * @return string|null - */ - public function getName() - { - return $this->getConfig('name'); - } - - /** - * Get the database connection full name. - * - * @return string|null - */ - public function getNameWithReadWriteType() - { - return $this->getName().($this->readWriteType ? '::'.$this->readWriteType : ''); - } - - /** - * Get an option from the configuration options. - * - * @param string|null $option - * @return mixed - */ - public function getConfig($option = null) - { - return Arr::get($this->config, $option); - } - - /** - * Get the PDO driver name. - * - * @return string - */ - public function getDriverName() - { - return $this->getConfig('driver'); - } - - /** - * Get the query grammar used by the connection. - * - * @return \Illuminate\Database\Query\Grammars\Grammar - */ - public function getQueryGrammar() - { - return $this->queryGrammar; - } - - /** - * Set the query grammar used by the connection. - * - * @param \Illuminate\Database\Query\Grammars\Grammar $grammar - * @return $this - */ - public function setQueryGrammar(Query\Grammars\Grammar $grammar) - { - $this->queryGrammar = $grammar; - - return $this; - } - - /** - * Get the schema grammar used by the connection. - * - * @return \Illuminate\Database\Schema\Grammars\Grammar - */ - public function getSchemaGrammar() - { - return $this->schemaGrammar; - } - - /** - * Set the schema grammar used by the connection. - * - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @return $this - */ - public function setSchemaGrammar(Schema\Grammars\Grammar $grammar) - { - $this->schemaGrammar = $grammar; - - return $this; - } - - /** - * Get the query post processor used by the connection. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - public function getPostProcessor() - { - return $this->postProcessor; - } - - /** - * Set the query post processor used by the connection. - * - * @param \Illuminate\Database\Query\Processors\Processor $processor - * @return $this - */ - public function setPostProcessor(Processor $processor) - { - $this->postProcessor = $processor; - - return $this; - } - - /** - * Get the event dispatcher used by the connection. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getEventDispatcher() - { - return $this->events; - } - - /** - * Set the event dispatcher instance on the connection. - * - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return $this - */ - public function setEventDispatcher(Dispatcher $events) - { - $this->events = $events; - - return $this; - } - - /** - * Unset the event dispatcher for this connection. - * - * @return void - */ - public function unsetEventDispatcher() - { - $this->events = null; - } - - /** - * Set the transaction manager instance on the connection. - * - * @param \Illuminate\Database\DatabaseTransactionsManager $manager - * @return $this - */ - public function setTransactionManager($manager) - { - $this->transactionsManager = $manager; - - return $this; - } - - /** - * Unset the transaction manager for this connection. - * - * @return void - */ - public function unsetTransactionManager() - { - $this->transactionsManager = null; - } - - /** - * Determine if the connection is in a "dry run". - * - * @return bool - */ - public function pretending() - { - return $this->pretending === true; - } - - /** - * Get the connection query log. - * - * @return array - */ - public function getQueryLog() - { - return $this->queryLog; - } - - /** - * Clear the query log. - * - * @return void - */ - public function flushQueryLog() - { - $this->queryLog = []; - } - - /** - * Enable the query log on the connection. - * - * @return void - */ - public function enableQueryLog() - { - $this->loggingQueries = true; - } - - /** - * Disable the query log on the connection. - * - * @return void - */ - public function disableQueryLog() - { - $this->loggingQueries = false; - } - - /** - * Determine whether we're logging queries. - * - * @return bool - */ - public function logging() - { - return $this->loggingQueries; - } - - /** - * Get the name of the connected database. - * - * @return string - */ - public function getDatabaseName() - { - return $this->database; - } - - /** - * Set the name of the connected database. - * - * @param string $database - * @return $this - */ - public function setDatabaseName($database) - { - $this->database = $database; - - return $this; - } - - /** - * Set the read / write type of the connection. - * - * @param string|null $readWriteType - * @return $this - */ - public function setReadWriteType($readWriteType) - { - $this->readWriteType = $readWriteType; - - return $this; - } - - /** - * Get the table prefix for the connection. - * - * @return string - */ - public function getTablePrefix() - { - return $this->tablePrefix; - } - - /** - * Set the table prefix in use by the connection. - * - * @param string $prefix - * @return $this - */ - public function setTablePrefix($prefix) - { - $this->tablePrefix = $prefix; - - $this->getQueryGrammar()->setTablePrefix($prefix); - - return $this; - } - - /** - * Set the table prefix and return the grammar. - * - * @param \Illuminate\Database\Grammar $grammar - * @return \Illuminate\Database\Grammar - */ - public function withTablePrefix(Grammar $grammar) - { - $grammar->setTablePrefix($this->tablePrefix); - - return $grammar; - } - - /** - * Register a connection resolver. - * - * @param string $driver - * @param \Closure $callback - * @return void - */ - public static function resolverFor($driver, Closure $callback) - { - static::$resolvers[$driver] = $callback; - } - - /** - * Get the connection resolver for the given driver. - * - * @param string $driver - * @return mixed - */ - public static function getResolver($driver) - { - return static::$resolvers[$driver] ?? null; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/ConnectionInterface.php b/framework-9.50.2/src/Illuminate/Database/ConnectionInterface.php deleted file mode 100755 index 00b2395..0000000 --- a/framework-9.50.2/src/Illuminate/Database/ConnectionInterface.php +++ /dev/null @@ -1,170 +0,0 @@ - $connections - * @return void - */ - public function __construct(array $connections = []) - { - foreach ($connections as $name => $connection) { - $this->addConnection($name, $connection); - } - } - - /** - * Get a database connection instance. - * - * @param string|null $name - * @return \Illuminate\Database\ConnectionInterface - */ - public function connection($name = null) - { - if (is_null($name)) { - $name = $this->getDefaultConnection(); - } - - return $this->connections[$name]; - } - - /** - * Add a connection to the resolver. - * - * @param string $name - * @param \Illuminate\Database\ConnectionInterface $connection - * @return void - */ - public function addConnection($name, ConnectionInterface $connection) - { - $this->connections[$name] = $connection; - } - - /** - * Check if a connection has been registered. - * - * @param string $name - * @return bool - */ - public function hasConnection($name) - { - return isset($this->connections[$name]); - } - - /** - * Get the default connection name. - * - * @return string - */ - public function getDefaultConnection() - { - return $this->default; - } - - /** - * Set the default connection name. - * - * @param string $name - * @return void - */ - public function setDefaultConnection($name) - { - $this->default = $name; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/ConnectionResolverInterface.php b/framework-9.50.2/src/Illuminate/Database/ConnectionResolverInterface.php deleted file mode 100755 index b31e5a7..0000000 --- a/framework-9.50.2/src/Illuminate/Database/ConnectionResolverInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -container = $container; - } - - /** - * Establish a PDO connection based on the configuration. - * - * @param array $config - * @param string|null $name - * @return \Illuminate\Database\Connection - */ - public function make(array $config, $name = null) - { - $config = $this->parseConfig($config, $name); - - if (isset($config['read'])) { - return $this->createReadWriteConnection($config); - } - - return $this->createSingleConnection($config); - } - - /** - * Parse and prepare the database configuration. - * - * @param array $config - * @param string $name - * @return array - */ - protected function parseConfig(array $config, $name) - { - return Arr::add(Arr::add($config, 'prefix', ''), 'name', $name); - } - - /** - * Create a single database connection instance. - * - * @param array $config - * @return \Illuminate\Database\Connection - */ - protected function createSingleConnection(array $config) - { - $pdo = $this->createPdoResolver($config); - - return $this->createConnection( - $config['driver'], $pdo, $config['database'], $config['prefix'], $config - ); - } - - /** - * Create a read / write database connection instance. - * - * @param array $config - * @return \Illuminate\Database\Connection - */ - protected function createReadWriteConnection(array $config) - { - $connection = $this->createSingleConnection($this->getWriteConfig($config)); - - return $connection->setReadPdo($this->createReadPdo($config)); - } - - /** - * Create a new PDO instance for reading. - * - * @param array $config - * @return \Closure - */ - protected function createReadPdo(array $config) - { - return $this->createPdoResolver($this->getReadConfig($config)); - } - - /** - * Get the read configuration for a read / write connection. - * - * @param array $config - * @return array - */ - protected function getReadConfig(array $config) - { - return $this->mergeReadWriteConfig( - $config, $this->getReadWriteConfig($config, 'read') - ); - } - - /** - * Get the write configuration for a read / write connection. - * - * @param array $config - * @return array - */ - protected function getWriteConfig(array $config) - { - return $this->mergeReadWriteConfig( - $config, $this->getReadWriteConfig($config, 'write') - ); - } - - /** - * Get a read / write level configuration. - * - * @param array $config - * @param string $type - * @return array - */ - protected function getReadWriteConfig(array $config, $type) - { - return isset($config[$type][0]) - ? Arr::random($config[$type]) - : $config[$type]; - } - - /** - * Merge a configuration for a read / write connection. - * - * @param array $config - * @param array $merge - * @return array - */ - protected function mergeReadWriteConfig(array $config, array $merge) - { - return Arr::except(array_merge($config, $merge), ['read', 'write']); - } - - /** - * Create a new Closure that resolves to a PDO instance. - * - * @param array $config - * @return \Closure - */ - protected function createPdoResolver(array $config) - { - return array_key_exists('host', $config) - ? $this->createPdoResolverWithHosts($config) - : $this->createPdoResolverWithoutHosts($config); - } - - /** - * Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts. - * - * @param array $config - * @return \Closure - * - * @throws \PDOException - */ - protected function createPdoResolverWithHosts(array $config) - { - return function () use ($config) { - foreach (Arr::shuffle($this->parseHosts($config)) as $host) { - $config['host'] = $host; - - try { - return $this->createConnector($config)->connect($config); - } catch (PDOException $e) { - continue; - } - } - - throw $e; - }; - } - - /** - * Parse the hosts configuration item into an array. - * - * @param array $config - * @return array - * - * @throws \InvalidArgumentException - */ - protected function parseHosts(array $config) - { - $hosts = Arr::wrap($config['host']); - - if (empty($hosts)) { - throw new InvalidArgumentException('Database hosts array is empty.'); - } - - return $hosts; - } - - /** - * Create a new Closure that resolves to a PDO instance where there is no configured host. - * - * @param array $config - * @return \Closure - */ - protected function createPdoResolverWithoutHosts(array $config) - { - return fn () => $this->createConnector($config)->connect($config); - } - - /** - * Create a connector instance based on the configuration. - * - * @param array $config - * @return \Illuminate\Database\Connectors\ConnectorInterface - * - * @throws \InvalidArgumentException - */ - public function createConnector(array $config) - { - if (! isset($config['driver'])) { - throw new InvalidArgumentException('A driver must be specified.'); - } - - if ($this->container->bound($key = "db.connector.{$config['driver']}")) { - return $this->container->make($key); - } - - return match ($config['driver']) { - 'mysql' => new MySqlConnector, - 'pgsql' => new PostgresConnector, - 'sqlite' => new SQLiteConnector, - 'sqlsrv' => new SqlServerConnector, - default => throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]."), - }; - } - - /** - * Create a new connection instance. - * - * @param string $driver - * @param \PDO|\Closure $connection - * @param string $database - * @param string $prefix - * @param array $config - * @return \Illuminate\Database\Connection - * - * @throws \InvalidArgumentException - */ - protected function createConnection($driver, $connection, $database, $prefix = '', array $config = []) - { - if ($resolver = Connection::getResolver($driver)) { - return $resolver($connection, $database, $prefix, $config); - } - - return match ($driver) { - 'mysql' => new MySqlConnection($connection, $database, $prefix, $config), - 'pgsql' => new PostgresConnection($connection, $database, $prefix, $config), - 'sqlite' => new SQLiteConnection($connection, $database, $prefix, $config), - 'sqlsrv' => new SqlServerConnection($connection, $database, $prefix, $config), - default => throw new InvalidArgumentException("Unsupported driver [{$driver}]."), - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Connectors/Connector.php b/framework-9.50.2/src/Illuminate/Database/Connectors/Connector.php deleted file mode 100755 index 0fecfb5..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Connectors/Connector.php +++ /dev/null @@ -1,139 +0,0 @@ - PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - PDO::ATTR_EMULATE_PREPARES => false, - ]; - - /** - * Create a new PDO connection. - * - * @param string $dsn - * @param array $config - * @param array $options - * @return \PDO - * - * @throws \Exception - */ - public function createConnection($dsn, array $config, array $options) - { - [$username, $password] = [ - $config['username'] ?? null, $config['password'] ?? null, - ]; - - try { - return $this->createPdoConnection( - $dsn, $username, $password, $options - ); - } catch (Exception $e) { - return $this->tryAgainIfCausedByLostConnection( - $e, $dsn, $username, $password, $options - ); - } - } - - /** - * Create a new PDO connection instance. - * - * @param string $dsn - * @param string $username - * @param string $password - * @param array $options - * @return \PDO - */ - protected function createPdoConnection($dsn, $username, $password, $options) - { - if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) { - return new PDOConnection($dsn, $username, $password, $options); - } - - return new PDO($dsn, $username, $password, $options); - } - - /** - * Determine if the connection is persistent. - * - * @param array $options - * @return bool - */ - protected function isPersistentConnection($options) - { - return isset($options[PDO::ATTR_PERSISTENT]) && - $options[PDO::ATTR_PERSISTENT]; - } - - /** - * Handle an exception that occurred during connect execution. - * - * @param \Throwable $e - * @param string $dsn - * @param string $username - * @param string $password - * @param array $options - * @return \PDO - * - * @throws \Exception - */ - protected function tryAgainIfCausedByLostConnection(Throwable $e, $dsn, $username, $password, $options) - { - if ($this->causedByLostConnection($e)) { - return $this->createPdoConnection($dsn, $username, $password, $options); - } - - throw $e; - } - - /** - * Get the PDO options based on the configuration. - * - * @param array $config - * @return array - */ - public function getOptions(array $config) - { - $options = $config['options'] ?? []; - - return array_diff_key($this->options, $options) + $options; - } - - /** - * Get the default PDO connection options. - * - * @return array - */ - public function getDefaultOptions() - { - return $this->options; - } - - /** - * Set the default PDO connection options. - * - * @param array $options - * @return void - */ - public function setDefaultOptions(array $options) - { - $this->options = $options; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Connectors/ConnectorInterface.php b/framework-9.50.2/src/Illuminate/Database/Connectors/ConnectorInterface.php deleted file mode 100755 index 08597ac..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Connectors/ConnectorInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -getDsn($config); - - $options = $this->getOptions($config); - - // We need to grab the PDO options that should be used while making the brand - // new connection instance. The PDO options control various aspects of the - // connection's behavior, and some might be specified by the developers. - $connection = $this->createConnection($dsn, $config, $options); - - if (! empty($config['database'])) { - $connection->exec("use `{$config['database']}`;"); - } - - $this->configureIsolationLevel($connection, $config); - - $this->configureEncoding($connection, $config); - - // Next, we will check to see if a timezone has been specified in this config - // and if it has we will issue a statement to modify the timezone with the - // database. Setting this DB timezone is an optional configuration item. - $this->configureTimezone($connection, $config); - - $this->setModes($connection, $config); - - return $connection; - } - - /** - * Set the connection transaction isolation level. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureIsolationLevel($connection, array $config) - { - if (! isset($config['isolation_level'])) { - return; - } - - $connection->prepare( - "SET SESSION TRANSACTION ISOLATION LEVEL {$config['isolation_level']}" - )->execute(); - } - - /** - * Set the connection character set and collation. - * - * @param \PDO $connection - * @param array $config - * @return void|\PDO - */ - protected function configureEncoding($connection, array $config) - { - if (! isset($config['charset'])) { - return $connection; - } - - $connection->prepare( - "set names '{$config['charset']}'".$this->getCollation($config) - )->execute(); - } - - /** - * Get the collation for the configuration. - * - * @param array $config - * @return string - */ - protected function getCollation(array $config) - { - return isset($config['collation']) ? " collate '{$config['collation']}'" : ''; - } - - /** - * Set the timezone on the connection. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureTimezone($connection, array $config) - { - if (isset($config['timezone'])) { - $connection->prepare('set time_zone="'.$config['timezone'].'"')->execute(); - } - } - - /** - * Create a DSN string from a configuration. - * - * Chooses socket or host/port based on the 'unix_socket' config value. - * - * @param array $config - * @return string - */ - protected function getDsn(array $config) - { - return $this->hasSocket($config) - ? $this->getSocketDsn($config) - : $this->getHostDsn($config); - } - - /** - * Determine if the given configuration array has a UNIX socket value. - * - * @param array $config - * @return bool - */ - protected function hasSocket(array $config) - { - return isset($config['unix_socket']) && ! empty($config['unix_socket']); - } - - /** - * Get the DSN string for a socket configuration. - * - * @param array $config - * @return string - */ - protected function getSocketDsn(array $config) - { - return "mysql:unix_socket={$config['unix_socket']};dbname={$config['database']}"; - } - - /** - * Get the DSN string for a host / port configuration. - * - * @param array $config - * @return string - */ - protected function getHostDsn(array $config) - { - extract($config, EXTR_SKIP); - - return isset($port) - ? "mysql:host={$host};port={$port};dbname={$database}" - : "mysql:host={$host};dbname={$database}"; - } - - /** - * Set the modes for the connection. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function setModes(PDO $connection, array $config) - { - if (isset($config['modes'])) { - $this->setCustomModes($connection, $config); - } elseif (isset($config['strict'])) { - if ($config['strict']) { - $connection->prepare($this->strictMode($connection, $config))->execute(); - } else { - $connection->prepare("set session sql_mode='NO_ENGINE_SUBSTITUTION'")->execute(); - } - } - } - - /** - * Set the custom modes on the connection. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function setCustomModes(PDO $connection, array $config) - { - $modes = implode(',', $config['modes']); - - $connection->prepare("set session sql_mode='{$modes}'")->execute(); - } - - /** - * Get the query to enable strict mode. - * - * @param \PDO $connection - * @param array $config - * @return string - */ - protected function strictMode(PDO $connection, $config) - { - $version = $config['version'] ?? $connection->getAttribute(PDO::ATTR_SERVER_VERSION); - - if (version_compare($version, '8.0.11') >= 0) { - return "set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'"; - } - - return "set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'"; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Connectors/PostgresConnector.php b/framework-9.50.2/src/Illuminate/Database/Connectors/PostgresConnector.php deleted file mode 100755 index c54163f..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Connectors/PostgresConnector.php +++ /dev/null @@ -1,216 +0,0 @@ - PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - ]; - - /** - * Establish a database connection. - * - * @param array $config - * @return \PDO - */ - public function connect(array $config) - { - // First we'll create the basic DSN and connection instance connecting to the - // using the configuration option specified by the developer. We will also - // set the default character set on the connections to UTF-8 by default. - $connection = $this->createConnection( - $this->getDsn($config), $config, $this->getOptions($config) - ); - - $this->configureIsolationLevel($connection, $config); - - $this->configureEncoding($connection, $config); - - // Next, we will check to see if a timezone has been specified in this config - // and if it has we will issue a statement to modify the timezone with the - // database. Setting this DB timezone is an optional configuration item. - $this->configureTimezone($connection, $config); - - $this->configureSearchPath($connection, $config); - - // Postgres allows an application_name to be set by the user and this name is - // used to when monitoring the application with pg_stat_activity. So we'll - // determine if the option has been specified and run a statement if so. - $this->configureApplicationName($connection, $config); - - $this->configureSynchronousCommit($connection, $config); - - return $connection; - } - - /** - * Set the connection transaction isolation level. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureIsolationLevel($connection, array $config) - { - if (isset($config['isolation_level'])) { - $connection->prepare("set session characteristics as transaction isolation level {$config['isolation_level']}")->execute(); - } - } - - /** - * Set the connection character set and collation. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureEncoding($connection, $config) - { - if (! isset($config['charset'])) { - return; - } - - $connection->prepare("set names '{$config['charset']}'")->execute(); - } - - /** - * Set the timezone on the connection. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureTimezone($connection, array $config) - { - if (isset($config['timezone'])) { - $timezone = $config['timezone']; - - $connection->prepare("set time zone '{$timezone}'")->execute(); - } - } - - /** - * Set the "search_path" on the database connection. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureSearchPath($connection, $config) - { - if (isset($config['search_path']) || isset($config['schema'])) { - $searchPath = $this->quoteSearchPath( - $this->parseSearchPath($config['search_path'] ?? $config['schema']) - ); - - $connection->prepare("set search_path to {$searchPath}")->execute(); - } - } - - /** - * Format the search path for the DSN. - * - * @param array $searchPath - * @return string - */ - protected function quoteSearchPath($searchPath) - { - return count($searchPath) === 1 ? '"'.$searchPath[0].'"' : '"'.implode('", "', $searchPath).'"'; - } - - /** - * Set the application name on the connection. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureApplicationName($connection, $config) - { - if (isset($config['application_name'])) { - $applicationName = $config['application_name']; - - $connection->prepare("set application_name to '$applicationName'")->execute(); - } - } - - /** - * Create a DSN string from a configuration. - * - * @param array $config - * @return string - */ - protected function getDsn(array $config) - { - // First we will create the basic DSN setup as well as the port if it is in - // in the configuration options. This will give us the basic DSN we will - // need to establish the PDO connections and return them back for use. - extract($config, EXTR_SKIP); - - $host = isset($host) ? "host={$host};" : ''; - - // Sometimes - users may need to connect to a database that has a different - // name than the database used for "information_schema" queries. This is - // typically the case if using "pgbouncer" type software when pooling. - $database = $connect_via_database ?? $database; - - $dsn = "pgsql:{$host}dbname='{$database}'"; - - // If a port was specified, we will add it to this Postgres DSN connections - // format. Once we have done that we are ready to return this connection - // string back out for usage, as this has been fully constructed here. - if (isset($config['port'])) { - $dsn .= ";port={$port}"; - } - - return $this->addSslOptions($dsn, $config); - } - - /** - * Add the SSL options to the DSN. - * - * @param string $dsn - * @param array $config - * @return string - */ - protected function addSslOptions($dsn, array $config) - { - foreach (['sslmode', 'sslcert', 'sslkey', 'sslrootcert'] as $option) { - if (isset($config[$option])) { - $dsn .= ";{$option}={$config[$option]}"; - } - } - - return $dsn; - } - - /** - * Configure the synchronous_commit setting. - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureSynchronousCommit($connection, array $config) - { - if (! isset($config['synchronous_commit'])) { - return; - } - - $connection->prepare("set synchronous_commit to '{$config['synchronous_commit']}'")->execute(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Connectors/SQLiteConnector.php b/framework-9.50.2/src/Illuminate/Database/Connectors/SQLiteConnector.php deleted file mode 100755 index ddedfbf..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Connectors/SQLiteConnector.php +++ /dev/null @@ -1,39 +0,0 @@ -getOptions($config); - - // SQLite supports "in-memory" databases that only last as long as the owning - // connection does. These are useful for tests or for short lifetime store - // querying. In-memory databases may only have a single open connection. - if ($config['database'] === ':memory:') { - return $this->createConnection('sqlite::memory:', $config, $options); - } - - $path = realpath($config['database']); - - // Here we'll verify that the SQLite database exists before going any further - // as the developer probably wants to know if the database exists and this - // SQLite driver will not throw any exception if it does not by default. - if ($path === false) { - throw new SQLiteDatabaseDoesNotExistException($config['database']); - } - - return $this->createConnection("sqlite:{$path}", $config, $options); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Connectors/SqlServerConnector.php b/framework-9.50.2/src/Illuminate/Database/Connectors/SqlServerConnector.php deleted file mode 100755 index b6ed47d..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Connectors/SqlServerConnector.php +++ /dev/null @@ -1,233 +0,0 @@ - PDO::CASE_NATURAL, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, - PDO::ATTR_STRINGIFY_FETCHES => false, - ]; - - /** - * Establish a database connection. - * - * @param array $config - * @return \PDO - */ - public function connect(array $config) - { - $options = $this->getOptions($config); - - $connection = $this->createConnection($this->getDsn($config), $config, $options); - - $this->configureIsolationLevel($connection, $config); - - return $connection; - } - - /** - * Set the connection transaction isolation level. - * - * https://learn.microsoft.com/en-us/sql/t-sql/statements/set-transaction-isolation-level-transact-sql - * - * @param \PDO $connection - * @param array $config - * @return void - */ - protected function configureIsolationLevel($connection, array $config) - { - if (! isset($config['isolation_level'])) { - return; - } - - $connection->prepare( - "SET TRANSACTION ISOLATION LEVEL {$config['isolation_level']}" - )->execute(); - } - - /** - * Create a DSN string from a configuration. - * - * @param array $config - * @return string - */ - protected function getDsn(array $config) - { - // First we will create the basic DSN setup as well as the port if it is in - // in the configuration options. This will give us the basic DSN we will - // need to establish the PDO connections and return them back for use. - if ($this->prefersOdbc($config)) { - return $this->getOdbcDsn($config); - } - - if (in_array('sqlsrv', $this->getAvailableDrivers())) { - return $this->getSqlSrvDsn($config); - } else { - return $this->getDblibDsn($config); - } - } - - /** - * Determine if the database configuration prefers ODBC. - * - * @param array $config - * @return bool - */ - protected function prefersOdbc(array $config) - { - return in_array('odbc', $this->getAvailableDrivers()) && - ($config['odbc'] ?? null) === true; - } - - /** - * Get the DSN string for a DbLib connection. - * - * @param array $config - * @return string - */ - protected function getDblibDsn(array $config) - { - return $this->buildConnectString('dblib', array_merge([ - 'host' => $this->buildHostString($config, ':'), - 'dbname' => $config['database'], - ], Arr::only($config, ['appname', 'charset', 'version']))); - } - - /** - * Get the DSN string for an ODBC connection. - * - * @param array $config - * @return string - */ - protected function getOdbcDsn(array $config) - { - return isset($config['odbc_datasource_name']) - ? 'odbc:'.$config['odbc_datasource_name'] : ''; - } - - /** - * Get the DSN string for a SqlSrv connection. - * - * @param array $config - * @return string - */ - protected function getSqlSrvDsn(array $config) - { - $arguments = [ - 'Server' => $this->buildHostString($config, ','), - ]; - - if (isset($config['database'])) { - $arguments['Database'] = $config['database']; - } - - if (isset($config['readonly'])) { - $arguments['ApplicationIntent'] = 'ReadOnly'; - } - - if (isset($config['pooling']) && $config['pooling'] === false) { - $arguments['ConnectionPooling'] = '0'; - } - - if (isset($config['appname'])) { - $arguments['APP'] = $config['appname']; - } - - if (isset($config['encrypt'])) { - $arguments['Encrypt'] = $config['encrypt']; - } - - if (isset($config['trust_server_certificate'])) { - $arguments['TrustServerCertificate'] = $config['trust_server_certificate']; - } - - if (isset($config['multiple_active_result_sets']) && $config['multiple_active_result_sets'] === false) { - $arguments['MultipleActiveResultSets'] = 'false'; - } - - if (isset($config['transaction_isolation'])) { - $arguments['TransactionIsolation'] = $config['transaction_isolation']; - } - - if (isset($config['multi_subnet_failover'])) { - $arguments['MultiSubnetFailover'] = $config['multi_subnet_failover']; - } - - if (isset($config['column_encryption'])) { - $arguments['ColumnEncryption'] = $config['column_encryption']; - } - - if (isset($config['key_store_authentication'])) { - $arguments['KeyStoreAuthentication'] = $config['key_store_authentication']; - } - - if (isset($config['key_store_principal_id'])) { - $arguments['KeyStorePrincipalId'] = $config['key_store_principal_id']; - } - - if (isset($config['key_store_secret'])) { - $arguments['KeyStoreSecret'] = $config['key_store_secret']; - } - - if (isset($config['login_timeout'])) { - $arguments['LoginTimeout'] = $config['login_timeout']; - } - - if (isset($config['authentication'])) { - $arguments['Authentication'] = $config['authentication']; - } - - return $this->buildConnectString('sqlsrv', $arguments); - } - - /** - * Build a connection string from the given arguments. - * - * @param string $driver - * @param array $arguments - * @return string - */ - protected function buildConnectString($driver, array $arguments) - { - return $driver.':'.implode(';', array_map(function ($key) use ($arguments) { - return sprintf('%s=%s', $key, $arguments[$key]); - }, array_keys($arguments))); - } - - /** - * Build a host string from the given configuration. - * - * @param array $config - * @param string $separator - * @return string - */ - protected function buildHostString(array $config, $separator) - { - if (empty($config['port'])) { - return $config['host']; - } - - return $config['host'].$separator.$config['port']; - } - - /** - * Get the available PDO drivers. - * - * @return array - */ - protected function getAvailableDrivers() - { - return PDO::getAvailableDrivers(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/DatabaseInspectionCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/DatabaseInspectionCommand.php deleted file mode 100644 index e3391a0..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/DatabaseInspectionCommand.php +++ /dev/null @@ -1,246 +0,0 @@ - 'string', - 'citext' => 'string', - 'enum' => 'string', - 'geometry' => 'string', - 'geomcollection' => 'string', - 'linestring' => 'string', - 'ltree' => 'string', - 'multilinestring' => 'string', - 'multipoint' => 'string', - 'multipolygon' => 'string', - 'point' => 'string', - 'polygon' => 'string', - 'sysname' => 'string', - ]; - - /** - * The Composer instance. - * - * @var \Illuminate\Support\Composer - */ - protected $composer; - - /** - * Create a new command instance. - * - * @param \Illuminate\Support\Composer|null $composer - * @return void - */ - public function __construct(Composer $composer = null) - { - parent::__construct(); - - $this->composer = $composer ?? $this->laravel->make(Composer::class); - } - - /** - * Register the custom Doctrine type mappings for inspection commands. - * - * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform - * @return void - */ - protected function registerTypeMappings(AbstractPlatform $platform) - { - foreach ($this->typeMappings as $type => $value) { - $platform->registerDoctrineTypeMapping($type, $value); - } - } - - /** - * Get a human-readable platform name for the given platform. - * - * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform - * @param string $database - * @return string - */ - protected function getPlatformName(AbstractPlatform $platform, $database) - { - return match (class_basename($platform)) { - 'MySQLPlatform' => 'MySQL <= 5', - 'MySQL57Platform' => 'MySQL 5.7', - 'MySQL80Platform' => 'MySQL 8', - 'PostgreSQL100Platform', 'PostgreSQLPlatform' => 'Postgres', - 'SqlitePlatform' => 'SQLite', - 'SQLServerPlatform' => 'SQL Server', - 'SQLServer2012Platform' => 'SQL Server 2012', - default => $database, - }; - } - - /** - * Get the size of a table in bytes. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param string $table - * @return int|null - */ - protected function getTableSize(ConnectionInterface $connection, string $table) - { - return match (true) { - $connection instanceof MySqlConnection => $this->getMySQLTableSize($connection, $table), - $connection instanceof PostgresConnection => $this->getPostgresTableSize($connection, $table), - $connection instanceof SQLiteConnection => $this->getSqliteTableSize($connection, $table), - default => null, - }; - } - - /** - * Get the size of a MySQL table in bytes. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param string $table - * @return mixed - */ - protected function getMySQLTableSize(ConnectionInterface $connection, string $table) - { - $result = $connection->selectOne('SELECT (data_length + index_length) AS size FROM information_schema.TABLES WHERE table_schema = ? AND table_name = ?', [ - $connection->getDatabaseName(), - $table, - ]); - - return Arr::wrap((array) $result)['size']; - } - - /** - * Get the size of a Postgres table in bytes. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param string $table - * @return mixed - */ - protected function getPostgresTableSize(ConnectionInterface $connection, string $table) - { - $result = $connection->selectOne('SELECT pg_total_relation_size(?) AS size;', [ - $table, - ]); - - return Arr::wrap((array) $result)['size']; - } - - /** - * Get the size of a SQLite table in bytes. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param string $table - * @return mixed - */ - protected function getSqliteTableSize(ConnectionInterface $connection, string $table) - { - try { - $result = $connection->selectOne('SELECT SUM(pgsize) AS size FROM dbstat WHERE name=?', [ - $table, - ]); - - return Arr::wrap((array) $result)['size']; - } catch (QueryException $e) { - return null; - } - } - - /** - * Get the number of open connections for a database. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @return int|null - */ - protected function getConnectionCount(ConnectionInterface $connection) - { - $result = match (true) { - $connection instanceof MySqlConnection => $connection->selectOne('show status where variable_name = "threads_connected"'), - $connection instanceof PostgresConnection => $connection->selectOne('select count(*) AS "Value" from pg_stat_activity'), - $connection instanceof SqlServerConnection => $connection->selectOne('SELECT COUNT(*) Value FROM sys.dm_exec_sessions WHERE status = ?', ['running']), - default => null, - }; - - if (! $result) { - return null; - } - - return Arr::wrap((array) $result)['Value']; - } - - /** - * Get the connection configuration details for the given connection. - * - * @param string $database - * @return array - */ - protected function getConfigFromDatabase($database) - { - $database ??= config('database.default'); - - return Arr::except(config('database.connections.'.$database), ['password']); - } - - /** - * Ensure the dependencies for the database commands are available. - * - * @return bool - */ - protected function ensureDependenciesExist() - { - return tap(interface_exists('Doctrine\DBAL\Driver'), function ($dependenciesExist) { - if (! $dependenciesExist && $this->components->confirm('Inspecting database information requires the Doctrine DBAL (doctrine/dbal) package. Would you like to install it?')) { - $this->installDependencies(); - } - }); - } - - /** - * Install the command's dependencies. - * - * @return void - * - * @throws \Symfony\Component\Process\Exception\ProcessSignaledException - */ - protected function installDependencies() - { - $command = collect($this->composer->findComposer()) - ->push('require doctrine/dbal') - ->implode(' '); - - $process = Process::fromShellCommandline($command, null, null, null, null); - - if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) { - try { - $process->setTty(true); - } catch (RuntimeException $e) { - $this->components->warn($e->getMessage()); - } - } - - try { - $process->run(fn ($type, $line) => $this->output->write($line)); - } catch (ProcessSignaledException $e) { - if (extension_loaded('pcntl') && $e->getSignal() !== SIGINT) { - throw $e; - } - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/DbCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/DbCommand.php deleted file mode 100644 index caecafe..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/DbCommand.php +++ /dev/null @@ -1,227 +0,0 @@ -getConnection(); - - if (! isset($connection['host']) && $connection['driver'] !== 'sqlite') { - $this->components->error('No host specified for this database connection.'); - $this->line(' Use the [--read] and [--write] options to specify a read or write connection.'); - $this->newLine(); - - return Command::FAILURE; - } - - (new Process( - array_merge([$this->getCommand($connection)], $this->commandArguments($connection)), - null, - $this->commandEnvironment($connection) - ))->setTimeout(null)->setTty(true)->mustRun(function ($type, $buffer) { - $this->output->write($buffer); - }); - - return 0; - } - - /** - * Get the database connection configuration. - * - * @return array - * - * @throws \UnexpectedValueException - */ - public function getConnection() - { - $connection = $this->laravel['config']['database.connections.'. - (($db = $this->argument('connection')) ?? $this->laravel['config']['database.default']) - ]; - - if (empty($connection)) { - throw new UnexpectedValueException("Invalid database connection [{$db}]."); - } - - if (! empty($connection['url'])) { - $connection = (new ConfigurationUrlParser)->parseConfiguration($connection); - } - - if ($this->option('read')) { - if (is_array($connection['read']['host'])) { - $connection['read']['host'] = $connection['read']['host'][0]; - } - - $connection = array_merge($connection, $connection['read']); - } elseif ($this->option('write')) { - if (is_array($connection['write']['host'])) { - $connection['write']['host'] = $connection['write']['host'][0]; - } - - $connection = array_merge($connection, $connection['write']); - } - - return $connection; - } - - /** - * Get the arguments for the database client command. - * - * @param array $connection - * @return array - */ - public function commandArguments(array $connection) - { - $driver = ucfirst($connection['driver']); - - return $this->{"get{$driver}Arguments"}($connection); - } - - /** - * Get the environment variables for the database client command. - * - * @param array $connection - * @return array|null - */ - public function commandEnvironment(array $connection) - { - $driver = ucfirst($connection['driver']); - - if (method_exists($this, "get{$driver}Environment")) { - return $this->{"get{$driver}Environment"}($connection); - } - - return null; - } - - /** - * Get the database client command to run. - * - * @param array $connection - * @return string - */ - public function getCommand(array $connection) - { - return [ - 'mysql' => 'mysql', - 'pgsql' => 'psql', - 'sqlite' => 'sqlite3', - 'sqlsrv' => 'sqlcmd', - ][$connection['driver']]; - } - - /** - * Get the arguments for the MySQL CLI. - * - * @param array $connection - * @return array - */ - protected function getMysqlArguments(array $connection) - { - return array_merge([ - '--host='.$connection['host'], - '--port='.$connection['port'], - '--user='.$connection['username'], - ], $this->getOptionalArguments([ - 'password' => '--password='.$connection['password'], - 'unix_socket' => '--socket='.($connection['unix_socket'] ?? ''), - 'charset' => '--default-character-set='.($connection['charset'] ?? ''), - ], $connection), [$connection['database']]); - } - - /** - * Get the arguments for the Postgres CLI. - * - * @param array $connection - * @return array - */ - protected function getPgsqlArguments(array $connection) - { - return [$connection['database']]; - } - - /** - * Get the arguments for the SQLite CLI. - * - * @param array $connection - * @return array - */ - protected function getSqliteArguments(array $connection) - { - return [$connection['database']]; - } - - /** - * Get the arguments for the SQL Server CLI. - * - * @param array $connection - * @return array - */ - protected function getSqlsrvArguments(array $connection) - { - return array_merge(...$this->getOptionalArguments([ - 'database' => ['-d', $connection['database']], - 'username' => ['-U', $connection['username']], - 'password' => ['-P', $connection['password']], - 'host' => ['-S', 'tcp:'.$connection['host'] - .($connection['port'] ? ','.$connection['port'] : ''), ], - ], $connection)); - } - - /** - * Get the environment variables for the Postgres CLI. - * - * @param array $connection - * @return array|null - */ - protected function getPgsqlEnvironment(array $connection) - { - return array_merge(...$this->getOptionalArguments([ - 'username' => ['PGUSER' => $connection['username']], - 'host' => ['PGHOST' => $connection['host']], - 'port' => ['PGPORT' => $connection['port']], - 'password' => ['PGPASSWORD' => $connection['password']], - ], $connection)); - } - - /** - * Get the optional arguments based on the connection configuration. - * - * @param array $args - * @param array $connection - * @return array - */ - protected function getOptionalArguments(array $args, array $connection) - { - return array_values(array_filter($args, function ($key) use ($connection) { - return ! empty($connection[$key]); - }, ARRAY_FILTER_USE_KEY)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/DumpCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/DumpCommand.php deleted file mode 100644 index 3f21aaf..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/DumpCommand.php +++ /dev/null @@ -1,101 +0,0 @@ -connection($database = $this->input->getOption('database')); - - $this->schemaState($connection)->dump( - $connection, $path = $this->path($connection) - ); - - $dispatcher->dispatch(new SchemaDumped($connection, $path)); - - $info = 'Database schema dumped'; - - if ($this->option('prune')) { - (new Filesystem)->deleteDirectory( - database_path('migrations'), $preserve = false - ); - - $info .= ' and pruned'; - } - - $this->components->info($info.' successfully.'); - } - - /** - * Create a schema state instance for the given connection. - * - * @param \Illuminate\Database\Connection $connection - * @return mixed - */ - protected function schemaState(Connection $connection) - { - return $connection->getSchemaState() - ->withMigrationTable($connection->getTablePrefix().Config::get('database.migrations', 'migrations')) - ->handleOutputUsing(function ($type, $buffer) { - $this->output->write($buffer); - }); - } - - /** - * Get the path that the dump should be written to. - * - * @param \Illuminate\Database\Connection $connection - */ - protected function path(Connection $connection) - { - return tap($this->option('path') ?: database_path('schema/'.$connection->getName().'-schema.sql'), function ($path) { - (new Filesystem)->ensureDirectoryExists(dirname($path)); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php deleted file mode 100644 index 48c4375..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php +++ /dev/null @@ -1,154 +0,0 @@ -resolveStubPath('/stubs/factory.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Build the class with the given name. - * - * @param string $name - * @return string - */ - protected function buildClass($name) - { - $factory = class_basename(Str::ucfirst(str_replace('Factory', '', $name))); - - $namespaceModel = $this->option('model') - ? $this->qualifyModel($this->option('model')) - : $this->qualifyModel($this->guessModelName($name)); - - $model = class_basename($namespaceModel); - - $namespace = $this->getNamespace( - Str::replaceFirst($this->rootNamespace(), 'Database\\Factories\\', $this->qualifyClass($this->getNameInput())) - ); - - $replace = [ - '{{ factoryNamespace }}' => $namespace, - 'NamespacedDummyModel' => $namespaceModel, - '{{ namespacedModel }}' => $namespaceModel, - '{{namespacedModel}}' => $namespaceModel, - 'DummyModel' => $model, - '{{ model }}' => $model, - '{{model}}' => $model, - '{{ factory }}' => $factory, - '{{factory}}' => $factory, - ]; - - return str_replace( - array_keys($replace), array_values($replace), parent::buildClass($name) - ); - } - - /** - * Get the destination class path. - * - * @param string $name - * @return string - */ - protected function getPath($name) - { - $name = (string) Str::of($name)->replaceFirst($this->rootNamespace(), '')->finish('Factory'); - - return $this->laravel->databasePath().'/factories/'.str_replace('\\', '/', $name).'.php'; - } - - /** - * Guess the model name from the Factory name or return a default model name. - * - * @param string $name - * @return string - */ - protected function guessModelName($name) - { - if (str_ends_with($name, 'Factory')) { - $name = substr($name, 0, -7); - } - - $modelName = $this->qualifyModel(Str::after($name, $this->rootNamespace())); - - if (class_exists($modelName)) { - return $modelName; - } - - if (is_dir(app_path('Models/'))) { - return $this->rootNamespace().'Models\Model'; - } - - return $this->rootNamespace().'Model'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['model', 'm', InputOption::VALUE_OPTIONAL, 'The name of the model'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Factories/stubs/factory.stub b/framework-9.50.2/src/Illuminate/Database/Console/Factories/stubs/factory.stub deleted file mode 100644 index 0759b5d..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Factories/stubs/factory.stub +++ /dev/null @@ -1,23 +0,0 @@ - - */ -class {{ factory }}Factory extends Factory -{ - /** - * Define the model's default state. - * - * @return array - */ - public function definition() - { - return [ - // - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/BaseCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/BaseCommand.php deleted file mode 100755 index 6c4f255..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/BaseCommand.php +++ /dev/null @@ -1,51 +0,0 @@ -input->hasOption('path') && $this->option('path')) { - return collect($this->option('path'))->map(function ($path) { - return ! $this->usingRealPath() - ? $this->laravel->basePath().'/'.$path - : $path; - })->all(); - } - - return array_merge( - $this->migrator->paths(), [$this->getMigrationPath()] - ); - } - - /** - * Determine if the given path(s) are pre-resolved "real" paths. - * - * @return bool - */ - protected function usingRealPath() - { - return $this->input->hasOption('realpath') && $this->option('realpath'); - } - - /** - * Get the path to the migration directory. - * - * @return string - */ - protected function getMigrationPath() - { - return $this->laravel->databasePath().DIRECTORY_SEPARATOR.'migrations'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/FreshCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/FreshCommand.php deleted file mode 100644 index e319e74..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/FreshCommand.php +++ /dev/null @@ -1,120 +0,0 @@ -confirmToProceed()) { - return 1; - } - - $database = $this->input->getOption('database'); - - $this->newLine(); - - $this->components->task('Dropping all tables', fn () => $this->callSilent('db:wipe', array_filter([ - '--database' => $database, - '--drop-views' => $this->option('drop-views'), - '--drop-types' => $this->option('drop-types'), - '--force' => true, - ])) == 0); - - $this->newLine(); - - $this->call('migrate', array_filter([ - '--database' => $database, - '--path' => $this->input->getOption('path'), - '--realpath' => $this->input->getOption('realpath'), - '--schema-path' => $this->input->getOption('schema-path'), - '--force' => true, - '--step' => $this->option('step'), - ])); - - if ($this->laravel->bound(Dispatcher::class)) { - $this->laravel[Dispatcher::class]->dispatch( - new DatabaseRefreshed - ); - } - - if ($this->needsSeeding()) { - $this->runSeeder($database); - } - - return 0; - } - - /** - * Determine if the developer has requested database seeding. - * - * @return bool - */ - protected function needsSeeding() - { - return $this->option('seed') || $this->option('seeder'); - } - - /** - * Run the database seeder command. - * - * @param string $database - * @return void - */ - protected function runSeeder($database) - { - $this->call('db:seed', array_filter([ - '--database' => $database, - '--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder', - '--force' => true, - ])); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], - ['drop-views', null, InputOption::VALUE_NONE, 'Drop all tables and views'], - ['drop-types', null, InputOption::VALUE_NONE, 'Drop all tables and types (Postgres only)'], - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], - ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], - ['schema-path', null, InputOption::VALUE_OPTIONAL, 'The path to a schema dump file'], - ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'], - ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'], - ['step', null, InputOption::VALUE_NONE, 'Force the migrations to be run so they can be rolled back individually'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/InstallCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/InstallCommand.php deleted file mode 100755 index 901a83b..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/InstallCommand.php +++ /dev/null @@ -1,70 +0,0 @@ -repository = $repository; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->repository->setSource($this->input->getOption('database')); - - $this->repository->createRepository(); - - $this->components->info('Migration table created successfully.'); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/MigrateCommand.php deleted file mode 100755 index fc43bf5..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/MigrateCommand.php +++ /dev/null @@ -1,281 +0,0 @@ -migrator = $migrator; - $this->dispatcher = $dispatcher; - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - if (! $this->confirmToProceed()) { - return 1; - } - - $this->migrator->usingConnection($this->option('database'), function () { - $this->prepareDatabase(); - - // Next, we will check to see if a path option has been defined. If it has - // we will use the path relative to the root of this installation folder - // so that migrations may be run for any path within the applications. - $migrations = $this->migrator->setOutput($this->output) - ->run($this->getMigrationPaths(), [ - 'pretend' => $this->option('pretend'), - 'step' => $this->option('step'), - ]); - - // Finally, if the "seed" option has been given, we will re-run the database - // seed task to re-populate the database, which is convenient when adding - // a migration and a seed at the same time, as it is only this command. - if ($this->option('seed') && ! $this->option('pretend')) { - $this->call('db:seed', [ - '--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder', - '--force' => true, - ]); - } - }); - - return 0; - } - - /** - * Prepare the migration database for running. - * - * @return void - */ - protected function prepareDatabase() - { - if (! $this->repositoryExists()) { - $this->components->info('Preparing database.'); - - $this->components->task('Creating migration table', function () { - return $this->callSilent('migrate:install', array_filter([ - '--database' => $this->option('database'), - ])) == 0; - }); - - $this->newLine(); - } - - if (! $this->migrator->hasRunAnyMigrations() && ! $this->option('pretend')) { - $this->loadSchemaState(); - } - } - - /** - * Determine if the migrator repository exists. - * - * @return bool - */ - protected function repositoryExists() - { - return retry(2, fn () => $this->migrator->repositoryExists(), 0, function ($e) { - try { - if ($e->getPrevious() instanceof SQLiteDatabaseDoesNotExistException) { - return $this->createMissingSqliteDatbase($e->getPrevious()->path); - } - - $connection = $this->migrator->resolveConnection($this->option('database')); - - if ( - $e->getPrevious() instanceof PDOException && - $e->getPrevious()->getCode() === 1049 && - $connection->getDriverName() === 'mysql') { - return $this->createMissingMysqlDatabase($connection); - } - - return false; - } catch (Throwable) { - return false; - } - }); - } - - /** - * Create a missing SQLite database. - * - * @param string $path - * @return bool - */ - protected function createMissingSqliteDatbase($path) - { - if ($this->option('force')) { - return touch($path); - } - - if ($this->option('no-interaction')) { - return false; - } - - $this->components->warn('The SQLite database does not exist: '.$path); - - if (! $this->components->confirm('Would you like to create it?')) { - return false; - } - - return touch($path); - } - - /** - * Create a missing MySQL database. - * - * @return bool - */ - protected function createMissingMysqlDatabase($connection) - { - if ($this->laravel['config']->get("database.connections.{$connection->getName()}.database") !== $connection->getDatabaseName()) { - return false; - } - - if (! $this->option('force') && $this->option('no-interaction')) { - return false; - } - - if (! $this->option('force') && ! $this->option('no-interaction')) { - $this->components->warn("The database '{$connection->getDatabaseName()}' does not exist on the '{$connection->getName()}' connection."); - - if (! $this->components->confirm('Would you like to create it?')) { - return false; - } - } - - try { - $this->laravel['config']->set("database.connections.{$connection->getName()}.database", null); - - $this->laravel['db']->purge(); - - $freshConnection = $this->migrator->resolveConnection($this->option('database')); - - return tap($freshConnection->unprepared("CREATE DATABASE IF NOT EXISTS `{$connection->getDatabaseName()}`"), function () { - $this->laravel['db']->purge(); - }); - } finally { - $this->laravel['config']->set("database.connections.{$connection->getName()}.database", $connection->getDatabaseName()); - } - } - - /** - * Load the schema state to seed the initial database schema structure. - * - * @return void - */ - protected function loadSchemaState() - { - $connection = $this->migrator->resolveConnection($this->option('database')); - - // First, we will make sure that the connection supports schema loading and that - // the schema file exists before we proceed any further. If not, we will just - // continue with the standard migration operation as normal without errors. - if ($connection instanceof SqlServerConnection || - ! is_file($path = $this->schemaPath($connection))) { - return; - } - - $this->components->info('Loading stored database schemas.'); - - $this->components->task($path, function () use ($connection, $path) { - // Since the schema file will create the "migrations" table and reload it to its - // proper state, we need to delete it here so we don't get an error that this - // table already exists when the stored database schema file gets executed. - $this->migrator->deleteRepository(); - - $connection->getSchemaState()->handleOutputUsing(function ($type, $buffer) { - $this->output->write($buffer); - })->load($path); - }); - - $this->newLine(); - - // Finally, we will fire an event that this schema has been loaded so developers - // can perform any post schema load tasks that are necessary in listeners for - // this event, which may seed the database tables with some necessary data. - $this->dispatcher->dispatch( - new SchemaLoaded($connection, $path) - ); - } - - /** - * Get the path to the stored schema for the given connection. - * - * @param \Illuminate\Database\Connection $connection - * @return string - */ - protected function schemaPath($connection) - { - if ($this->option('schema-path')) { - return $this->option('schema-path'); - } - - if (file_exists($path = database_path('schema/'.$connection->getName().'-schema.dump'))) { - return $path; - } - - return database_path('schema/'.$connection->getName().'-schema.sql'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php deleted file mode 100644 index 75c0634..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php +++ /dev/null @@ -1,144 +0,0 @@ -creator = $creator; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - // It's possible for the developer to specify the tables to modify in this - // schema operation. The developer may also specify if this table needs - // to be freshly created so we can create the appropriate migrations. - $name = Str::snake(trim($this->input->getArgument('name'))); - - $table = $this->input->getOption('table'); - - $create = $this->input->getOption('create') ?: false; - - // If no table was given as an option but a create option is given then we - // will use the "create" option as the table name. This allows the devs - // to pass a table name into this option as a short-cut for creating. - if (! $table && is_string($create)) { - $table = $create; - - $create = true; - } - - // Next, we will attempt to guess the table name if this the migration has - // "create" in the name. This will allow us to provide a convenient way - // of creating migrations that create new tables for the application. - if (! $table) { - [$table, $create] = TableGuesser::guess($name); - } - - // Now we are ready to write the migration out to disk. Once we've written - // the migration out, we will dump-autoload for the entire framework to - // make sure that the migrations are registered by the class loaders. - $this->writeMigration($name, $table, $create); - - $this->composer->dumpAutoloads(); - } - - /** - * Write the migration file to disk. - * - * @param string $name - * @param string $table - * @param bool $create - * @return string - */ - protected function writeMigration($name, $table, $create) - { - $file = $this->creator->create( - $name, $this->getMigrationPath(), $table, $create - ); - - $this->components->info(sprintf('Migration [%s] created successfully.', $file)); - } - - /** - * Get migration path (either specified by '--path' option or default location). - * - * @return string - */ - protected function getMigrationPath() - { - if (! is_null($targetPath = $this->input->getOption('path'))) { - return ! $this->usingRealPath() - ? $this->laravel->basePath().'/'.$targetPath - : $targetPath; - } - - return parent::getMigrationPath(); - } - - /** - * Prompt for missing input arguments using the returned questions. - * - * @return array - */ - protected function promptForMissingArgumentsUsing() - { - return [ - 'name' => 'What should the migration be named?', - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/RefreshCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/RefreshCommand.php deleted file mode 100755 index 2073cd9..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/RefreshCommand.php +++ /dev/null @@ -1,159 +0,0 @@ -confirmToProceed()) { - return 1; - } - - // Next we'll gather some of the options so that we can have the right options - // to pass to the commands. This includes options such as which database to - // use and the path to use for the migration. Then we'll run the command. - $database = $this->input->getOption('database'); - - $path = $this->input->getOption('path'); - - // If the "step" option is specified it means we only want to rollback a small - // number of migrations before migrating again. For example, the user might - // only rollback and remigrate the latest four migrations instead of all. - $step = $this->input->getOption('step') ?: 0; - - if ($step > 0) { - $this->runRollback($database, $path, $step); - } else { - $this->runReset($database, $path); - } - - // The refresh command is essentially just a brief aggregate of a few other of - // the migration commands and just provides a convenient wrapper to execute - // them in succession. We'll also see if we need to re-seed the database. - $this->call('migrate', array_filter([ - '--database' => $database, - '--path' => $path, - '--realpath' => $this->input->getOption('realpath'), - '--force' => true, - ])); - - if ($this->laravel->bound(Dispatcher::class)) { - $this->laravel[Dispatcher::class]->dispatch( - new DatabaseRefreshed - ); - } - - if ($this->needsSeeding()) { - $this->runSeeder($database); - } - - return 0; - } - - /** - * Run the rollback command. - * - * @param string $database - * @param string $path - * @param int $step - * @return void - */ - protected function runRollback($database, $path, $step) - { - $this->call('migrate:rollback', array_filter([ - '--database' => $database, - '--path' => $path, - '--realpath' => $this->input->getOption('realpath'), - '--step' => $step, - '--force' => true, - ])); - } - - /** - * Run the reset command. - * - * @param string $database - * @param string $path - * @return void - */ - protected function runReset($database, $path) - { - $this->call('migrate:reset', array_filter([ - '--database' => $database, - '--path' => $path, - '--realpath' => $this->input->getOption('realpath'), - '--force' => true, - ])); - } - - /** - * Determine if the developer has requested database seeding. - * - * @return bool - */ - protected function needsSeeding() - { - return $this->option('seed') || $this->option('seeder'); - } - - /** - * Run the database seeder command. - * - * @param string $database - * @return void - */ - protected function runSeeder($database) - { - $this->call('db:seed', array_filter([ - '--database' => $database, - '--class' => $this->option('seeder') ?: 'Database\\Seeders\\DatabaseSeeder', - '--force' => true, - ])); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], - ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], - ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'], - ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'], - ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted & re-run'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/ResetCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/ResetCommand.php deleted file mode 100755 index c5952fa..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/ResetCommand.php +++ /dev/null @@ -1,91 +0,0 @@ -migrator = $migrator; - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - if (! $this->confirmToProceed()) { - return 1; - } - - return $this->migrator->usingConnection($this->option('database'), function () { - // First, we'll make sure that the migration table actually exists before we - // start trying to rollback and re-run all of the migrations. If it's not - // present we'll just bail out with an info message for the developers. - if (! $this->migrator->repositoryExists()) { - return $this->components->warn('Migration table not found.'); - } - - $this->migrator->setOutput($this->output)->reset( - $this->getMigrationPaths(), $this->option('pretend') - ); - }); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], - - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - - ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], - - ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], - - ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/RollbackCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/RollbackCommand.php deleted file mode 100755 index c851360..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/RollbackCommand.php +++ /dev/null @@ -1,91 +0,0 @@ -migrator = $migrator; - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - if (! $this->confirmToProceed()) { - return 1; - } - - $this->migrator->usingConnection($this->option('database'), function () { - $this->migrator->setOutput($this->output)->rollback( - $this->getMigrationPaths(), [ - 'pretend' => $this->option('pretend'), - 'step' => (int) $this->option('step'), - ] - ); - }); - - return 0; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], - - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - - ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], - - ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], - - ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'], - - ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/StatusCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/StatusCommand.php deleted file mode 100644 index 60ad9dc..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/StatusCommand.php +++ /dev/null @@ -1,129 +0,0 @@ -migrator = $migrator; - } - - /** - * Execute the console command. - * - * @return int|null - */ - public function handle() - { - return $this->migrator->usingConnection($this->option('database'), function () { - if (! $this->migrator->repositoryExists()) { - $this->components->error('Migration table not found.'); - - return 1; - } - - $ran = $this->migrator->getRepository()->getRan(); - - $batches = $this->migrator->getRepository()->getMigrationBatches(); - - if (count($migrations = $this->getStatusFor($ran, $batches)) > 0) { - $this->newLine(); - - $this->components->twoColumnDetail('Migration name', 'Batch / Status'); - - $migrations->each( - fn ($migration) => $this->components->twoColumnDetail($migration[0], $migration[1]) - ); - - $this->newLine(); - } else { - $this->components->info('No migrations found'); - } - }); - } - - /** - * Get the status for the given run migrations. - * - * @param array $ran - * @param array $batches - * @return \Illuminate\Support\Collection - */ - protected function getStatusFor(array $ran, array $batches) - { - return Collection::make($this->getAllMigrationFiles()) - ->map(function ($migration) use ($ran, $batches) { - $migrationName = $this->migrator->getMigrationName($migration); - - $status = in_array($migrationName, $ran) - ? 'Ran' - : 'Pending'; - - if (in_array($migrationName, $ran)) { - $status = '['.$batches[$migrationName].'] '.$status; - } - - return [$migrationName, $status]; - }); - } - - /** - * Get an array of all of the migration files. - * - * @return array - */ - protected function getAllMigrationFiles() - { - return $this->migrator->getMigrationFiles($this->getMigrationPaths()); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], - - ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to use'], - - ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/TableGuesser.php b/framework-9.50.2/src/Illuminate/Database/Console/Migrations/TableGuesser.php deleted file mode 100644 index 82dfbdd..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Migrations/TableGuesser.php +++ /dev/null @@ -1,37 +0,0 @@ -connection = $connection; - $this->events = $events; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $databases = $this->parseDatabases($this->option('databases')); - - $this->displayConnections($databases); - - if ($this->option('max')) { - $this->dispatchEvents($databases); - } - } - - /** - * Parse the database into an array of the connections. - * - * @param string $databases - * @return \Illuminate\Support\Collection - */ - protected function parseDatabases($databases) - { - return collect(explode(',', $databases))->map(function ($database) { - if (! $database) { - $database = $this->laravel['config']['database.default']; - } - - $maxConnections = $this->option('max'); - - return [ - 'database' => $database, - 'connections' => $connections = $this->getConnectionCount($this->connection->connection($database)), - 'status' => $maxConnections && $connections >= $maxConnections ? 'ALERT' : 'OK', - ]; - }); - } - - /** - * Display the databases and their connection counts in the console. - * - * @param \Illuminate\Support\Collection $databases - * @return void - */ - protected function displayConnections($databases) - { - $this->newLine(); - - $this->components->twoColumnDetail('Database name', 'Connections'); - - $databases->each(function ($database) { - $status = '['.$database['connections'].'] '.$database['status']; - - $this->components->twoColumnDetail($database['database'], $status); - }); - - $this->newLine(); - } - - /** - * Dispatch the database monitoring events. - * - * @param \Illuminate\Support\Collection $databases - * @return void - */ - protected function dispatchEvents($databases) - { - $databases->each(function ($database) { - if ($database['status'] === 'OK') { - return; - } - - $this->events->dispatch( - new DatabaseBusy( - $database['database'], - $database['connections'] - ) - ); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/PruneCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/PruneCommand.php deleted file mode 100644 index 7ea6cec..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/PruneCommand.php +++ /dev/null @@ -1,186 +0,0 @@ -models(); - - if ($models->isEmpty()) { - $this->components->info('No prunable models found.'); - - return; - } - - if ($this->option('pretend')) { - $models->each(function ($model) { - $this->pretendToPrune($model); - }); - - return; - } - - $pruning = []; - - $events->listen(ModelsPruned::class, function ($event) use (&$pruning) { - if (! in_array($event->model, $pruning)) { - $pruning[] = $event->model; - - $this->newLine(); - - $this->components->info(sprintf('Pruning [%s] records.', $event->model)); - } - - $this->components->twoColumnDetail($event->model, "{$event->count} records"); - }); - - $models->each(function ($model) { - $this->pruneModel($model); - }); - - $events->forget(ModelsPruned::class); - } - - /** - * Prune the given model. - * - * @param string $model - * @return void - */ - protected function pruneModel(string $model) - { - $instance = new $model; - - $chunkSize = property_exists($instance, 'prunableChunkSize') - ? $instance->prunableChunkSize - : $this->option('chunk'); - - $total = $this->isPrunable($model) - ? $instance->pruneAll($chunkSize) - : 0; - - if ($total == 0) { - $this->components->info("No prunable [$model] records found."); - } - } - - /** - * Determine the models that should be pruned. - * - * @return \Illuminate\Support\Collection - */ - protected function models() - { - if (! empty($models = $this->option('model'))) { - return collect($models)->filter(function ($model) { - return class_exists($model); - })->values(); - } - - $except = $this->option('except'); - - if (! empty($models) && ! empty($except)) { - throw new InvalidArgumentException('The --models and --except options cannot be combined.'); - } - - return collect((new Finder)->in($this->getDefaultPath())->files()->name('*.php')) - ->map(function ($model) { - $namespace = $this->laravel->getNamespace(); - - return $namespace.str_replace( - ['/', '.php'], - ['\\', ''], - Str::after($model->getRealPath(), realpath(app_path()).DIRECTORY_SEPARATOR) - ); - })->when(! empty($except), function ($models) use ($except) { - return $models->reject(function ($model) use ($except) { - return in_array($model, $except); - }); - })->filter(function ($model) { - return $this->isPrunable($model); - })->filter(function ($model) { - return class_exists($model); - })->values(); - } - - /** - * Get the default path where models are located. - * - * @return string|string[] - */ - protected function getDefaultPath() - { - return app_path('Models'); - } - - /** - * Determine if the given model class is prunable. - * - * @param string $model - * @return bool - */ - protected function isPrunable($model) - { - $uses = class_uses_recursive($model); - - return in_array(Prunable::class, $uses) || in_array(MassPrunable::class, $uses); - } - - /** - * Display how many models will be pruned. - * - * @param string $model - * @return void - */ - protected function pretendToPrune($model) - { - $instance = new $model; - - $count = $instance->prunable() - ->when(in_array(SoftDeletes::class, class_uses_recursive(get_class($instance))), function ($query) { - $query->withTrashed(); - })->count(); - - if ($count === 0) { - $this->components->info("No prunable [$model] records found."); - } else { - $this->components->info("{$count} [{$model}] records will be pruned."); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Seeds/SeedCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Seeds/SeedCommand.php deleted file mode 100644 index 2359586..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Seeds/SeedCommand.php +++ /dev/null @@ -1,151 +0,0 @@ -resolver = $resolver; - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - if (! $this->confirmToProceed()) { - return 1; - } - - $this->components->info('Seeding database.'); - - $previousConnection = $this->resolver->getDefaultConnection(); - - $this->resolver->setDefaultConnection($this->getDatabase()); - - Model::unguarded(function () { - $this->getSeeder()->__invoke(); - }); - - if ($previousConnection) { - $this->resolver->setDefaultConnection($previousConnection); - } - - return 0; - } - - /** - * Get a seeder instance from the container. - * - * @return \Illuminate\Database\Seeder - */ - protected function getSeeder() - { - $class = $this->input->getArgument('class') ?? $this->input->getOption('class'); - - if (! str_contains($class, '\\')) { - $class = 'Database\\Seeders\\'.$class; - } - - if ($class === 'Database\\Seeders\\DatabaseSeeder' && - ! class_exists($class)) { - $class = 'DatabaseSeeder'; - } - - return $this->laravel->make($class) - ->setContainer($this->laravel) - ->setCommand($this); - } - - /** - * Get the name of the database connection to use. - * - * @return string - */ - protected function getDatabase() - { - $database = $this->input->getOption('database'); - - return $database ?: $this->laravel['config']['database.default']; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['class', InputArgument::OPTIONAL, 'The class name of the root seeder', null], - ]; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['class', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder', 'Database\\Seeders\\DatabaseSeeder'], - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to seed'], - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php deleted file mode 100644 index 8ba01cb..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php +++ /dev/null @@ -1,103 +0,0 @@ -resolveStubPath('/stubs/seeder.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return is_file($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the destination class path. - * - * @param string $name - * @return string - */ - protected function getPath($name) - { - $name = str_replace('\\', '/', Str::replaceFirst($this->rootNamespace(), '', $name)); - - if (is_dir($this->laravel->databasePath().'/seeds')) { - return $this->laravel->databasePath().'/seeds/'.$name.'.php'; - } - - return $this->laravel->databasePath().'/seeders/'.$name.'.php'; - } - - /** - * Get the root namespace for the class. - * - * @return string - */ - protected function rootNamespace() - { - return 'Database\Seeders\\'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Seeds/WithoutModelEvents.php b/framework-9.50.2/src/Illuminate/Database/Console/Seeds/WithoutModelEvents.php deleted file mode 100644 index acd9ec3..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Seeds/WithoutModelEvents.php +++ /dev/null @@ -1,19 +0,0 @@ - Model::withoutEvents($callback); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub b/framework-9.50.2/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub deleted file mode 100644 index 19ae5f5..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub +++ /dev/null @@ -1,19 +0,0 @@ - Note: This can be slow on large databases }; - {--views : Show the database views Note: This can be slow on large databases }'; - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Display information about the given database'; - - /** - * Execute the console command. - * - * @param \Illuminate\Database\ConnectionResolverInterface $connections - * @return int - */ - public function handle(ConnectionResolverInterface $connections) - { - if (! $this->ensureDependenciesExist()) { - return 1; - } - - $connection = $connections->connection($database = $this->input->getOption('database')); - - $schema = $connection->getDoctrineSchemaManager(); - - $this->registerTypeMappings($schema->getDatabasePlatform()); - - $data = [ - 'platform' => [ - 'config' => $this->getConfigFromDatabase($database), - 'name' => $this->getPlatformName($schema->getDatabasePlatform(), $database), - 'open_connections' => $this->getConnectionCount($connection), - ], - 'tables' => $this->tables($connection, $schema), - ]; - - if ($this->option('views')) { - $data['views'] = $this->collectViews($connection, $schema); - } - - $this->display($data); - - return 0; - } - - /** - * Get information regarding the tables within the database. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema - * @return \Illuminate\Support\Collection - */ - protected function tables(ConnectionInterface $connection, AbstractSchemaManager $schema) - { - return collect($schema->listTables())->map(fn (Table $table, $index) => [ - 'table' => $table->getName(), - 'size' => $this->getTableSize($connection, $table->getName()), - 'rows' => $this->option('counts') ? $connection->table($table->getName())->count() : null, - 'engine' => rescue(fn () => $table->getOption('engine'), null, false), - 'comment' => $table->getComment(), - ]); - } - - /** - * Get information regarding the views within the database. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema - * @return \Illuminate\Support\Collection - */ - protected function collectViews(ConnectionInterface $connection, AbstractSchemaManager $schema) - { - return collect($schema->listViews()) - ->reject(fn (View $view) => str($view->getName()) - ->startsWith(['pg_catalog', 'information_schema', 'spt_'])) - ->map(fn (View $view) => [ - 'view' => $view->getName(), - 'rows' => $connection->table($view->getName())->count(), - ]); - } - - /** - * Render the database information. - * - * @param array $data - * @return void - */ - protected function display(array $data) - { - $this->option('json') ? $this->displayJson($data) : $this->displayForCli($data); - } - - /** - * Render the database information as JSON. - * - * @param array $data - * @return void - */ - protected function displayJson(array $data) - { - $this->output->writeln(json_encode($data)); - } - - /** - * Render the database information formatted for the CLI. - * - * @param array $data - * @return void - */ - protected function displayForCli(array $data) - { - $platform = $data['platform']; - $tables = $data['tables']; - $views = $data['views'] ?? null; - - $this->newLine(); - - $this->components->twoColumnDetail(''.$platform['name'].''); - $this->components->twoColumnDetail('Database', Arr::get($platform['config'], 'database')); - $this->components->twoColumnDetail('Host', Arr::get($platform['config'], 'host')); - $this->components->twoColumnDetail('Port', Arr::get($platform['config'], 'port')); - $this->components->twoColumnDetail('Username', Arr::get($platform['config'], 'username')); - $this->components->twoColumnDetail('URL', Arr::get($platform['config'], 'url')); - $this->components->twoColumnDetail('Open Connections', $platform['open_connections']); - $this->components->twoColumnDetail('Tables', $tables->count()); - - if ($tableSizeSum = $tables->sum('size')) { - $this->components->twoColumnDetail('Total Size', number_format($tableSizeSum / 1024 / 1024, 2).'MiB'); - } - - $this->newLine(); - - if ($tables->isNotEmpty()) { - $this->components->twoColumnDetail('Table', 'Size (MiB)'.($this->option('counts') ? ' / Rows' : '')); - - $tables->each(function ($table) { - if ($tableSize = $table['size']) { - $tableSize = number_format($tableSize / 1024 / 1024, 2); - } - - $this->components->twoColumnDetail( - $table['table'].($this->output->isVerbose() ? ' '.$table['engine'].'' : null), - ($tableSize ? $tableSize : '—').($this->option('counts') ? ' / '.number_format($table['rows']).'' : '') - ); - - if ($this->output->isVerbose()) { - if ($table['comment']) { - $this->components->bulletList([ - $table['comment'], - ]); - } - } - }); - - $this->newLine(); - } - - if ($views && $views->isNotEmpty()) { - $this->components->twoColumnDetail('View', 'Rows'); - - $views->each(fn ($view) => $this->components->twoColumnDetail($view['view'], number_format($view['rows']))); - - $this->newLine(); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/TableCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/TableCommand.php deleted file mode 100644 index 3b08bde..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/TableCommand.php +++ /dev/null @@ -1,246 +0,0 @@ -ensureDependenciesExist()) { - return 1; - } - - $connection = $connections->connection($this->input->getOption('database')); - - $schema = $connection->getDoctrineSchemaManager(); - - $this->registerTypeMappings($schema->getDatabasePlatform()); - - $table = $this->argument('table') ?: $this->components->choice( - 'Which table would you like to inspect?', - collect($schema->listTables())->flatMap(fn (Table $table) => [$table->getName()])->toArray() - ); - - if (! $schema->tablesExist([$table])) { - return $this->components->warn("Table [{$table}] doesn't exist."); - } - - $table = $schema->listTableDetails($table); - - $columns = $this->columns($table); - $indexes = $this->indexes($table); - $foreignKeys = $this->foreignKeys($table); - - $data = [ - 'table' => [ - 'name' => $table->getName(), - 'columns' => $columns->count(), - 'size' => $this->getTableSize($connection, $table->getName()), - ], - 'columns' => $columns, - 'indexes' => $indexes, - 'foreign_keys' => $foreignKeys, - ]; - - $this->display($data); - - return 0; - } - - /** - * Get the information regarding the table's columns. - * - * @param \Doctrine\DBAL\Schema\Table $table - * @return \Illuminate\Support\Collection - */ - protected function columns(Table $table) - { - return collect($table->getColumns())->map(fn (Column $column) => [ - 'column' => $column->getName(), - 'attributes' => $this->getAttributesForColumn($column), - 'default' => $column->getDefault(), - 'type' => $column->getType()->getName(), - ]); - } - - /** - * Get the attributes for a table column. - * - * @param \Doctrine\DBAL\Schema\Column $column - * @return \Illuminate\Support\Collection - */ - protected function getAttributesForColumn(Column $column) - { - return collect([ - $column->getAutoincrement() ? 'autoincrement' : null, - 'type' => $column->getType()->getName(), - $column->getUnsigned() ? 'unsigned' : null, - ! $column->getNotNull() ? 'nullable' : null, - ])->filter(); - } - - /** - * Get the information regarding the table's indexes. - * - * @param \Doctrine\DBAL\Schema\Table $table - * @return \Illuminate\Support\Collection - */ - protected function indexes(Table $table) - { - return collect($table->getIndexes())->map(fn (Index $index) => [ - 'name' => $index->getName(), - 'columns' => collect($index->getColumns()), - 'attributes' => $this->getAttributesForIndex($index), - ]); - } - - /** - * Get the attributes for a table index. - * - * @param \Doctrine\DBAL\Schema\Index $index - * @return \Illuminate\Support\Collection - */ - protected function getAttributesForIndex(Index $index) - { - return collect([ - 'compound' => count($index->getColumns()) > 1, - 'unique' => $index->isUnique(), - 'primary' => $index->isPrimary(), - ])->filter()->keys()->map(fn ($attribute) => Str::lower($attribute)); - } - - /** - * Get the information regarding the table's foreign keys. - * - * @param \Doctrine\DBAL\Schema\Table $table - * @return \Illuminate\Support\Collection - */ - protected function foreignKeys(Table $table) - { - return collect($table->getForeignKeys())->map(fn (ForeignKeyConstraint $foreignKey) => [ - 'name' => $foreignKey->getName(), - 'local_table' => $table->getName(), - 'local_columns' => collect($foreignKey->getLocalColumns()), - 'foreign_table' => $foreignKey->getForeignTableName(), - 'foreign_columns' => collect($foreignKey->getForeignColumns()), - 'on_update' => Str::lower(rescue(fn () => $foreignKey->getOption('onUpdate'), 'N/A')), - 'on_delete' => Str::lower(rescue(fn () => $foreignKey->getOption('onDelete'), 'N/A')), - ]); - } - - /** - * Render the table information. - * - * @param array $data - * @return void - */ - protected function display(array $data) - { - $this->option('json') ? $this->displayJson($data) : $this->displayForCli($data); - } - - /** - * Render the table information as JSON. - * - * @param array $data - * @return void - */ - protected function displayJson(array $data) - { - $this->output->writeln(json_encode($data)); - } - - /** - * Render the table information formatted for the CLI. - * - * @param array $data - * @return void - */ - protected function displayForCli(array $data) - { - [$table, $columns, $indexes, $foreignKeys] = [ - $data['table'], $data['columns'], $data['indexes'], $data['foreign_keys'], - ]; - - $this->newLine(); - - $this->components->twoColumnDetail(''.$table['name'].''); - $this->components->twoColumnDetail('Columns', $table['columns']); - - if ($size = $table['size']) { - $this->components->twoColumnDetail('Size', number_format($size / 1024 / 1024, 2).'MiB'); - } - - $this->newLine(); - - if ($columns->isNotEmpty()) { - $this->components->twoColumnDetail('Column', 'Type'); - - $columns->each(function ($column) { - $this->components->twoColumnDetail( - $column['column'].' '.$column['attributes']->implode(', ').'', - ($column['default'] ? ''.$column['default'].' ' : '').''.$column['type'].'' - ); - }); - - $this->newLine(); - } - - if ($indexes->isNotEmpty()) { - $this->components->twoColumnDetail('Index'); - - $indexes->each(function ($index) { - $this->components->twoColumnDetail( - $index['name'].' '.$index['columns']->implode(', ').'', - $index['attributes']->implode(', ') - ); - }); - - $this->newLine(); - } - - if ($foreignKeys->isNotEmpty()) { - $this->components->twoColumnDetail('Foreign Key', 'On Update / On Delete'); - - $foreignKeys->each(function ($foreignKey) { - $this->components->twoColumnDetail( - $foreignKey['name'].' '.$foreignKey['local_columns']->implode(', ').' references '.$foreignKey['foreign_columns']->implode(', ').' on '.$foreignKey['foreign_table'].'', - $foreignKey['on_update'].' / '.$foreignKey['on_delete'], - ); - }); - - $this->newLine(); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Console/WipeCommand.php b/framework-9.50.2/src/Illuminate/Database/Console/WipeCommand.php deleted file mode 100644 index cb26922..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Console/WipeCommand.php +++ /dev/null @@ -1,125 +0,0 @@ -confirmToProceed()) { - return 1; - } - - $database = $this->input->getOption('database'); - - if ($this->option('drop-views')) { - $this->dropAllViews($database); - - $this->components->info('Dropped all views successfully.'); - } - - $this->dropAllTables($database); - - $this->components->info('Dropped all tables successfully.'); - - if ($this->option('drop-types')) { - $this->dropAllTypes($database); - - $this->components->info('Dropped all types successfully.'); - } - - return 0; - } - - /** - * Drop all of the database tables. - * - * @param string $database - * @return void - */ - protected function dropAllTables($database) - { - $this->laravel['db']->connection($database) - ->getSchemaBuilder() - ->dropAllTables(); - } - - /** - * Drop all of the database views. - * - * @param string $database - * @return void - */ - protected function dropAllViews($database) - { - $this->laravel['db']->connection($database) - ->getSchemaBuilder() - ->dropAllViews(); - } - - /** - * Drop all of the database types. - * - * @param string $database - * @return void - */ - protected function dropAllTypes($database) - { - $this->laravel['db']->connection($database) - ->getSchemaBuilder() - ->dropAllTypes(); - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], - ['drop-views', null, InputOption::VALUE_NONE, 'Drop all tables and views'], - ['drop-types', null, InputOption::VALUE_NONE, 'Drop all tables and types (Postgres only)'], - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/DBAL/TimestampType.php b/framework-9.50.2/src/Illuminate/Database/DBAL/TimestampType.php deleted file mode 100644 index 4fa9851..0000000 --- a/framework-9.50.2/src/Illuminate/Database/DBAL/TimestampType.php +++ /dev/null @@ -1,95 +0,0 @@ -getName()) { - 'mysql', - 'mysql2' => $this->getMySqlPlatformSQLDeclaration($fieldDeclaration), - 'postgresql', - 'pgsql', - 'postgres' => $this->getPostgresPlatformSQLDeclaration($fieldDeclaration), - 'mssql' => $this->getSqlServerPlatformSQLDeclaration($fieldDeclaration), - 'sqlite', - 'sqlite3' => $this->getSQLitePlatformSQLDeclaration($fieldDeclaration), - default => throw new DBALException('Invalid platform: '.$name), - }; - } - - /** - * Get the SQL declaration for MySQL. - * - * @param array $fieldDeclaration - * @return string - */ - protected function getMySqlPlatformSQLDeclaration(array $fieldDeclaration) - { - $columnType = 'TIMESTAMP'; - - if ($fieldDeclaration['precision']) { - $columnType = 'TIMESTAMP('.$fieldDeclaration['precision'].')'; - } - - $notNull = $fieldDeclaration['notnull'] ?? false; - - if (! $notNull) { - return $columnType.' NULL'; - } - - return $columnType; - } - - /** - * Get the SQL declaration for PostgreSQL. - * - * @param array $fieldDeclaration - * @return string - */ - protected function getPostgresPlatformSQLDeclaration(array $fieldDeclaration) - { - return 'TIMESTAMP('.(int) $fieldDeclaration['precision'].')'; - } - - /** - * Get the SQL declaration for SQL Server. - * - * @param array $fieldDeclaration - * @return string - */ - protected function getSqlServerPlatformSQLDeclaration(array $fieldDeclaration) - { - return $fieldDeclaration['precision'] ?? false - ? 'DATETIME2('.$fieldDeclaration['precision'].')' - : 'DATETIME'; - } - - /** - * Get the SQL declaration for SQLite. - * - * @param array $fieldDeclaration - * @return string - */ - protected function getSQLitePlatformSQLDeclaration(array $fieldDeclaration) - { - return 'DATETIME'; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'timestamp'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/DatabaseManager.php b/framework-9.50.2/src/Illuminate/Database/DatabaseManager.php deleted file mode 100755 index fc81353..0000000 --- a/framework-9.50.2/src/Illuminate/Database/DatabaseManager.php +++ /dev/null @@ -1,471 +0,0 @@ - - */ - protected $connections = []; - - /** - * The custom connection resolvers. - * - * @var array - */ - protected $extensions = []; - - /** - * The callback to be executed to reconnect to a database. - * - * @var callable - */ - protected $reconnector; - - /** - * The custom Doctrine column types. - * - * @var array - */ - protected $doctrineTypes = []; - - /** - * Create a new database manager instance. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Database\Connectors\ConnectionFactory $factory - * @return void - */ - public function __construct($app, ConnectionFactory $factory) - { - $this->app = $app; - $this->factory = $factory; - - $this->reconnector = function ($connection) { - $this->reconnect($connection->getNameWithReadWriteType()); - }; - } - - /** - * Get a database connection instance. - * - * @param string|null $name - * @return \Illuminate\Database\Connection - */ - public function connection($name = null) - { - [$database, $type] = $this->parseConnectionName($name); - - $name = $name ?: $database; - - // If we haven't created this connection, we'll create it based on the config - // provided in the application. Once we've created the connections we will - // set the "fetch mode" for PDO which determines the query return types. - if (! isset($this->connections[$name])) { - $this->connections[$name] = $this->configure( - $this->makeConnection($database), $type - ); - - if ($this->app->bound('events')) { - $this->app['events']->dispatch( - new ConnectionEstablished($this->connections[$name]) - ); - } - } - - return $this->connections[$name]; - } - - /** - * Parse the connection into an array of the name and read / write type. - * - * @param string $name - * @return array - */ - protected function parseConnectionName($name) - { - $name = $name ?: $this->getDefaultConnection(); - - return Str::endsWith($name, ['::read', '::write']) - ? explode('::', $name, 2) : [$name, null]; - } - - /** - * Make the database connection instance. - * - * @param string $name - * @return \Illuminate\Database\Connection - */ - protected function makeConnection($name) - { - $config = $this->configuration($name); - - // First we will check by the connection name to see if an extension has been - // registered specifically for that connection. If it has we will call the - // Closure and pass it the config allowing it to resolve the connection. - if (isset($this->extensions[$name])) { - return call_user_func($this->extensions[$name], $config, $name); - } - - // Next we will check to see if an extension has been registered for a driver - // and will call the Closure if so, which allows us to have a more generic - // resolver for the drivers themselves which applies to all connections. - if (isset($this->extensions[$driver = $config['driver']])) { - return call_user_func($this->extensions[$driver], $config, $name); - } - - return $this->factory->make($config, $name); - } - - /** - * Get the configuration for a connection. - * - * @param string $name - * @return array - * - * @throws \InvalidArgumentException - */ - protected function configuration($name) - { - $name = $name ?: $this->getDefaultConnection(); - - // To get the database connection configuration, we will just pull each of the - // connection configurations and get the configurations for the given name. - // If the configuration doesn't exist, we'll throw an exception and bail. - $connections = $this->app['config']['database.connections']; - - if (is_null($config = Arr::get($connections, $name))) { - throw new InvalidArgumentException("Database connection [{$name}] not configured."); - } - - return (new ConfigurationUrlParser) - ->parseConfiguration($config); - } - - /** - * Prepare the database connection instance. - * - * @param \Illuminate\Database\Connection $connection - * @param string $type - * @return \Illuminate\Database\Connection - */ - protected function configure(Connection $connection, $type) - { - $connection = $this->setPdoForType($connection, $type)->setReadWriteType($type); - - // First we'll set the fetch mode and a few other dependencies of the database - // connection. This method basically just configures and prepares it to get - // used by the application. Once we're finished we'll return it back out. - if ($this->app->bound('events')) { - $connection->setEventDispatcher($this->app['events']); - } - - if ($this->app->bound('db.transactions')) { - $connection->setTransactionManager($this->app['db.transactions']); - } - - // Here we'll set a reconnector callback. This reconnector can be any callable - // so we will set a Closure to reconnect from this manager with the name of - // the connection, which will allow us to reconnect from the connections. - $connection->setReconnector($this->reconnector); - - $this->registerConfiguredDoctrineTypes($connection); - - return $connection; - } - - /** - * Prepare the read / write mode for database connection instance. - * - * @param \Illuminate\Database\Connection $connection - * @param string|null $type - * @return \Illuminate\Database\Connection - */ - protected function setPdoForType(Connection $connection, $type = null) - { - if ($type === 'read') { - $connection->setPdo($connection->getReadPdo()); - } elseif ($type === 'write') { - $connection->setReadPdo($connection->getPdo()); - } - - return $connection; - } - - /** - * Register custom Doctrine types with the connection. - * - * @param \Illuminate\Database\Connection $connection - * @return void - */ - protected function registerConfiguredDoctrineTypes(Connection $connection): void - { - foreach ($this->app['config']->get('database.dbal.types', []) as $name => $class) { - $this->registerDoctrineType($class, $name, $name); - } - - foreach ($this->doctrineTypes as $name => [$type, $class]) { - $connection->registerDoctrineType($class, $name, $type); - } - } - - /** - * Register a custom Doctrine type. - * - * @param string $class - * @param string $name - * @param string $type - * @return void - * - * @throws \Doctrine\DBAL\DBALException - * @throws \RuntimeException - */ - public function registerDoctrineType(string $class, string $name, string $type): void - { - if (! class_exists('Doctrine\DBAL\Connection')) { - throw new RuntimeException( - 'Registering a custom Doctrine type requires Doctrine DBAL (doctrine/dbal).' - ); - } - - if (! Type::hasType($name)) { - Type::addType($name, $class); - } - - $this->doctrineTypes[$name] = [$type, $class]; - } - - /** - * Disconnect from the given database and remove from local cache. - * - * @param string|null $name - * @return void - */ - public function purge($name = null) - { - $name = $name ?: $this->getDefaultConnection(); - - $this->disconnect($name); - - unset($this->connections[$name]); - } - - /** - * Disconnect from the given database. - * - * @param string|null $name - * @return void - */ - public function disconnect($name = null) - { - if (isset($this->connections[$name = $name ?: $this->getDefaultConnection()])) { - $this->connections[$name]->disconnect(); - } - } - - /** - * Reconnect to the given database. - * - * @param string|null $name - * @return \Illuminate\Database\Connection - */ - public function reconnect($name = null) - { - $this->disconnect($name = $name ?: $this->getDefaultConnection()); - - if (! isset($this->connections[$name])) { - return $this->connection($name); - } - - return $this->refreshPdoConnections($name); - } - - /** - * Set the default database connection for the callback execution. - * - * @param string $name - * @param callable $callback - * @return mixed - */ - public function usingConnection($name, callable $callback) - { - $previousName = $this->getDefaultConnection(); - - $this->setDefaultConnection($name); - - return tap($callback(), function () use ($previousName) { - $this->setDefaultConnection($previousName); - }); - } - - /** - * Refresh the PDO connections on a given connection. - * - * @param string $name - * @return \Illuminate\Database\Connection - */ - protected function refreshPdoConnections($name) - { - [$database, $type] = $this->parseConnectionName($name); - - $fresh = $this->configure( - $this->makeConnection($database), $type - ); - - return $this->connections[$name] - ->setPdo($fresh->getRawPdo()) - ->setReadPdo($fresh->getRawReadPdo()); - } - - /** - * Get the default connection name. - * - * @return string - */ - public function getDefaultConnection() - { - return $this->app['config']['database.default']; - } - - /** - * Set the default connection name. - * - * @param string $name - * @return void - */ - public function setDefaultConnection($name) - { - $this->app['config']['database.default'] = $name; - } - - /** - * Get all of the support drivers. - * - * @return string[] - */ - public function supportedDrivers() - { - return ['mysql', 'pgsql', 'sqlite', 'sqlsrv']; - } - - /** - * Get all of the drivers that are actually available. - * - * @return string[] - */ - public function availableDrivers() - { - return array_intersect( - $this->supportedDrivers(), - str_replace('dblib', 'sqlsrv', PDO::getAvailableDrivers()) - ); - } - - /** - * Register an extension connection resolver. - * - * @param string $name - * @param callable $resolver - * @return void - */ - public function extend($name, callable $resolver) - { - $this->extensions[$name] = $resolver; - } - - /** - * Remove an extension connection resolver. - * - * @param string $name - * @return void - */ - public function forgetExtension($name) - { - unset($this->extensions[$name]); - } - - /** - * Return all of the created connections. - * - * @return array - */ - public function getConnections() - { - return $this->connections; - } - - /** - * Set the database reconnector callback. - * - * @param callable $reconnector - * @return void - */ - public function setReconnector(callable $reconnector) - { - $this->reconnector = $reconnector; - } - - /** - * Set the application instance used by the manager. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return $this - */ - public function setApplication($app) - { - $this->app = $app; - - return $this; - } - - /** - * Dynamically pass methods to the default connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - return $this->connection()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/DatabaseServiceProvider.php b/framework-9.50.2/src/Illuminate/Database/DatabaseServiceProvider.php deleted file mode 100755 index 9a2f47d..0000000 --- a/framework-9.50.2/src/Illuminate/Database/DatabaseServiceProvider.php +++ /dev/null @@ -1,113 +0,0 @@ -app['db']); - - Model::setEventDispatcher($this->app['events']); - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - Model::clearBootedModels(); - - $this->registerConnectionServices(); - $this->registerEloquentFactory(); - $this->registerQueueableEntityResolver(); - } - - /** - * Register the primary database bindings. - * - * @return void - */ - protected function registerConnectionServices() - { - // The connection factory is used to create the actual connection instances on - // the database. We will inject the factory into the manager so that it may - // make the connections while they are actually needed and not of before. - $this->app->singleton('db.factory', function ($app) { - return new ConnectionFactory($app); - }); - - // The database manager is used to resolve various connections, since multiple - // connections might be managed. It also implements the connection resolver - // interface which may be used by other components requiring connections. - $this->app->singleton('db', function ($app) { - return new DatabaseManager($app, $app['db.factory']); - }); - - $this->app->bind('db.connection', function ($app) { - return $app['db']->connection(); - }); - - $this->app->bind('db.schema', function ($app) { - return $app['db']->connection()->getSchemaBuilder(); - }); - - $this->app->singleton('db.transactions', function ($app) { - return new DatabaseTransactionsManager; - }); - } - - /** - * Register the Eloquent factory instance in the container. - * - * @return void - */ - protected function registerEloquentFactory() - { - $this->app->singleton(FakerGenerator::class, function ($app, $parameters) { - $locale = $parameters['locale'] ?? $app['config']->get('app.faker_locale', 'en_US'); - - if (! isset(static::$fakers[$locale])) { - static::$fakers[$locale] = FakerFactory::create($locale); - } - - static::$fakers[$locale]->unique(true); - - return static::$fakers[$locale]; - }); - } - - /** - * Register the queueable entity resolver implementation. - * - * @return void - */ - protected function registerQueueableEntityResolver() - { - $this->app->singleton(EntityResolver::class, function () { - return new QueueEntityResolver; - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/DatabaseTransactionRecord.php b/framework-9.50.2/src/Illuminate/Database/DatabaseTransactionRecord.php deleted file mode 100755 index 4736ee9..0000000 --- a/framework-9.50.2/src/Illuminate/Database/DatabaseTransactionRecord.php +++ /dev/null @@ -1,73 +0,0 @@ -connection = $connection; - $this->level = $level; - } - - /** - * Register a callback to be executed after committing. - * - * @param callable $callback - * @return void - */ - public function addCallback($callback) - { - $this->callbacks[] = $callback; - } - - /** - * Execute all of the callbacks. - * - * @return void - */ - public function executeCallbacks() - { - foreach ($this->callbacks as $callback) { - $callback(); - } - } - - /** - * Get all of the callbacks. - * - * @return array - */ - public function getCallbacks() - { - return $this->callbacks; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/DatabaseTransactionsManager.php b/framework-9.50.2/src/Illuminate/Database/DatabaseTransactionsManager.php deleted file mode 100755 index 8d14518..0000000 --- a/framework-9.50.2/src/Illuminate/Database/DatabaseTransactionsManager.php +++ /dev/null @@ -1,133 +0,0 @@ -transactions = collect(); - } - - /** - * Start a new database transaction. - * - * @param string $connection - * @param int $level - * @return void - */ - public function begin($connection, $level) - { - $this->transactions->push( - new DatabaseTransactionRecord($connection, $level) - ); - } - - /** - * Rollback the active database transaction. - * - * @param string $connection - * @param int $level - * @return void - */ - public function rollback($connection, $level) - { - $this->transactions = $this->transactions->reject( - fn ($transaction) => $transaction->connection == $connection && $transaction->level > $level - )->values(); - - if ($this->transactions->isEmpty()) { - $this->callbacksShouldIgnore = null; - } - } - - /** - * Commit the active database transaction. - * - * @param string $connection - * @return void - */ - public function commit($connection) - { - [$forThisConnection, $forOtherConnections] = $this->transactions->partition( - fn ($transaction) => $transaction->connection == $connection - ); - - $this->transactions = $forOtherConnections->values(); - - $forThisConnection->map->executeCallbacks(); - - if ($this->transactions->isEmpty()) { - $this->callbacksShouldIgnore = null; - } - } - - /** - * Register a transaction callback. - * - * @param callable $callback - * @return void - */ - public function addCallback($callback) - { - if ($current = $this->callbackApplicableTransactions()->last()) { - return $current->addCallback($callback); - } - - $callback(); - } - - /** - * Specify that callbacks should ignore the given transaction when determining if they should be executed. - * - * @param \Illuminate\Database\DatabaseTransactionRecord $transaction - * @return $this - */ - public function callbacksShouldIgnore(DatabaseTransactionRecord $transaction) - { - $this->callbacksShouldIgnore = $transaction; - - return $this; - } - - /** - * Get the transactions that are applicable to callbacks. - * - * @return \Illuminate\Support\Collection - */ - public function callbackApplicableTransactions() - { - return $this->transactions->reject(function ($transaction) { - return $transaction === $this->callbacksShouldIgnore; - })->values(); - } - - /** - * Get all the transactions. - * - * @return \Illuminate\Support\Collection - */ - public function getTransactions() - { - return $this->transactions; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/DeadlockException.php b/framework-9.50.2/src/Illuminate/Database/DeadlockException.php deleted file mode 100644 index 375a39b..0000000 --- a/framework-9.50.2/src/Illuminate/Database/DeadlockException.php +++ /dev/null @@ -1,10 +0,0 @@ -getCode() === 40001 || $e->getCode() === '40001')) { - return true; - } - - $message = $e->getMessage(); - - return Str::contains($message, [ - 'Deadlock found when trying to get lock', - 'deadlock detected', - 'The database file is locked', - 'database is locked', - 'database table is locked', - 'A table in the database is locked', - 'has been chosen as the deadlock victim', - 'Lock wait timeout exceeded; try restarting transaction', - 'WSREP detected deadlock/conflict and aborted the transaction. Try restarting the transaction', - ]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/DetectsLostConnections.php b/framework-9.50.2/src/Illuminate/Database/DetectsLostConnections.php deleted file mode 100644 index f0c216f..0000000 --- a/framework-9.50.2/src/Illuminate/Database/DetectsLostConnections.php +++ /dev/null @@ -1,66 +0,0 @@ -getMessage(); - - return Str::contains($message, [ - 'server has gone away', - 'no connection to the server', - 'Lost connection', - 'is dead or not enabled', - 'Error while sending', - 'decryption failed or bad record mac', - 'server closed the connection unexpectedly', - 'SSL connection has been closed unexpectedly', - 'Error writing data to the connection', - 'Resource deadlock avoided', - 'Transaction() on null', - 'child connection forced to terminate due to client_idle_limit', - 'query_wait_timeout', - 'reset by peer', - 'Physical connection is not usable', - 'TCP Provider: Error code 0x68', - 'ORA-03114', - 'Packets out of order. Expected', - 'Adaptive Server connection failed', - 'Communication link failure', - 'connection is no longer usable', - 'Login timeout expired', - 'SQLSTATE[HY000] [2002] Connection refused', - 'running with the --read-only option so it cannot execute this statement', - 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', - 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again', - 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known', - 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for', - 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected', - 'SQLSTATE[HY000] [2002] Connection timed out', - 'SSL: Connection timed out', - 'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.', - 'Temporary failure in name resolution', - 'SSL: Broken pipe', - 'SQLSTATE[08S01]: Communication link failure', - 'SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host', - 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: No route to host', - 'The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.', - 'SQLSTATE[08006] [7] could not translate host name', - 'TCP Provider: Error code 0x274C', - 'SQLSTATE[HY000] [2002] No such file or directory', - 'SSL: Operation timed out', - 'Reason: Server is in script upgrade mode. Only administrator can connect at this time.', - ]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/BroadcastableModelEventOccurred.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/BroadcastableModelEventOccurred.php deleted file mode 100644 index 249b183..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/BroadcastableModelEventOccurred.php +++ /dev/null @@ -1,144 +0,0 @@ -model = $model; - $this->event = $event; - } - - /** - * The channels the event should broadcast on. - * - * @return array - */ - public function broadcastOn() - { - $channels = empty($this->channels) - ? ($this->model->broadcastOn($this->event) ?: []) - : $this->channels; - - return collect($channels)->map(function ($channel) { - return $channel instanceof Model ? new PrivateChannel($channel) : $channel; - })->all(); - } - - /** - * The name the event should broadcast as. - * - * @return string - */ - public function broadcastAs() - { - $default = class_basename($this->model).ucfirst($this->event); - - return method_exists($this->model, 'broadcastAs') - ? ($this->model->broadcastAs($this->event) ?: $default) - : $default; - } - - /** - * Get the data that should be sent with the broadcasted event. - * - * @return array|null - */ - public function broadcastWith() - { - return method_exists($this->model, 'broadcastWith') - ? $this->model->broadcastWith($this->event) - : null; - } - - /** - * Manually specify the channels the event should broadcast on. - * - * @param array $channels - * @return $this - */ - public function onChannels(array $channels) - { - $this->channels = $channels; - - return $this; - } - - /** - * Determine if the event should be broadcast synchronously. - * - * @return bool - */ - public function shouldBroadcastNow() - { - return $this->event === 'deleted' && - ! method_exists($this->model, 'bootSoftDeletes'); - } - - /** - * Get the event name. - * - * @return string - */ - public function event() - { - return $this->event; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/BroadcastsEvents.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/BroadcastsEvents.php deleted file mode 100644 index 79dc02d..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/BroadcastsEvents.php +++ /dev/null @@ -1,197 +0,0 @@ -broadcastCreated(); - }); - - static::updated(function ($model) { - $model->broadcastUpdated(); - }); - - if (method_exists(static::class, 'bootSoftDeletes')) { - static::softDeleted(function ($model) { - $model->broadcastTrashed(); - }); - - static::restored(function ($model) { - $model->broadcastRestored(); - }); - } - - static::deleted(function ($model) { - $model->broadcastDeleted(); - }); - } - - /** - * Broadcast that the model was created. - * - * @param \Illuminate\Broadcasting\Channel|\Illuminate\Contracts\Broadcasting\HasBroadcastChannel|array|null $channels - * @return \Illuminate\Broadcasting\PendingBroadcast - */ - public function broadcastCreated($channels = null) - { - return $this->broadcastIfBroadcastChannelsExistForEvent( - $this->newBroadcastableModelEvent('created'), 'created', $channels - ); - } - - /** - * Broadcast that the model was updated. - * - * @param \Illuminate\Broadcasting\Channel|\Illuminate\Contracts\Broadcasting\HasBroadcastChannel|array|null $channels - * @return \Illuminate\Broadcasting\PendingBroadcast - */ - public function broadcastUpdated($channels = null) - { - return $this->broadcastIfBroadcastChannelsExistForEvent( - $this->newBroadcastableModelEvent('updated'), 'updated', $channels - ); - } - - /** - * Broadcast that the model was trashed. - * - * @param \Illuminate\Broadcasting\Channel|\Illuminate\Contracts\Broadcasting\HasBroadcastChannel|array|null $channels - * @return \Illuminate\Broadcasting\PendingBroadcast - */ - public function broadcastTrashed($channels = null) - { - return $this->broadcastIfBroadcastChannelsExistForEvent( - $this->newBroadcastableModelEvent('trashed'), 'trashed', $channels - ); - } - - /** - * Broadcast that the model was restored. - * - * @param \Illuminate\Broadcasting\Channel|\Illuminate\Contracts\Broadcasting\HasBroadcastChannel|array|null $channels - * @return \Illuminate\Broadcasting\PendingBroadcast - */ - public function broadcastRestored($channels = null) - { - return $this->broadcastIfBroadcastChannelsExistForEvent( - $this->newBroadcastableModelEvent('restored'), 'restored', $channels - ); - } - - /** - * Broadcast that the model was deleted. - * - * @param \Illuminate\Broadcasting\Channel|\Illuminate\Contracts\Broadcasting\HasBroadcastChannel|array|null $channels - * @return \Illuminate\Broadcasting\PendingBroadcast - */ - public function broadcastDeleted($channels = null) - { - return $this->broadcastIfBroadcastChannelsExistForEvent( - $this->newBroadcastableModelEvent('deleted'), 'deleted', $channels - ); - } - - /** - * Broadcast the given event instance if channels are configured for the model event. - * - * @param mixed $instance - * @param string $event - * @param mixed $channels - * @return \Illuminate\Broadcasting\PendingBroadcast|null - */ - protected function broadcastIfBroadcastChannelsExistForEvent($instance, $event, $channels = null) - { - if (! static::$isBroadcasting) { - return; - } - - if (! empty($this->broadcastOn($event)) || ! empty($channels)) { - return broadcast($instance->onChannels(Arr::wrap($channels))); - } - } - - /** - * Create a new broadcastable model event event. - * - * @param string $event - * @return mixed - */ - public function newBroadcastableModelEvent($event) - { - return tap($this->newBroadcastableEvent($event), function ($event) { - $event->connection = property_exists($this, 'broadcastConnection') - ? $this->broadcastConnection - : $this->broadcastConnection(); - - $event->queue = property_exists($this, 'broadcastQueue') - ? $this->broadcastQueue - : $this->broadcastQueue(); - - $event->afterCommit = property_exists($this, 'broadcastAfterCommit') - ? $this->broadcastAfterCommit - : $this->broadcastAfterCommit(); - }); - } - - /** - * Create a new broadcastable model event for the model. - * - * @param string $event - * @return \Illuminate\Database\Eloquent\BroadcastableModelEventOccurred - */ - protected function newBroadcastableEvent($event) - { - return new BroadcastableModelEventOccurred($this, $event); - } - - /** - * Get the channels that model events should broadcast on. - * - * @param string $event - * @return \Illuminate\Broadcasting\Channel|array - */ - public function broadcastOn($event) - { - return [$this]; - } - - /** - * Get the queue connection that should be used to broadcast model events. - * - * @return string|null - */ - public function broadcastConnection() - { - // - } - - /** - * Get the queue that should be used to broadcast model events. - * - * @return string|null - */ - public function broadcastQueue() - { - // - } - - /** - * Determine if the model event broadcast queued job should be dispatched after all transactions are committed. - * - * @return bool - */ - public function broadcastAfterCommit() - { - return false; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Builder.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Builder.php deleted file mode 100755 index 4387bc8..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Builder.php +++ /dev/null @@ -1,1952 +0,0 @@ -query = $query; - } - - /** - * Create and return an un-saved model instance. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function make(array $attributes = []) - { - return $this->newModelInstance($attributes); - } - - /** - * Register a new global scope. - * - * @param string $identifier - * @param \Illuminate\Database\Eloquent\Scope|\Closure $scope - * @return $this - */ - public function withGlobalScope($identifier, $scope) - { - $this->scopes[$identifier] = $scope; - - if (method_exists($scope, 'extend')) { - $scope->extend($this); - } - - return $this; - } - - /** - * Remove a registered global scope. - * - * @param \Illuminate\Database\Eloquent\Scope|string $scope - * @return $this - */ - public function withoutGlobalScope($scope) - { - if (! is_string($scope)) { - $scope = get_class($scope); - } - - unset($this->scopes[$scope]); - - $this->removedScopes[] = $scope; - - return $this; - } - - /** - * Remove all or passed registered global scopes. - * - * @param array|null $scopes - * @return $this - */ - public function withoutGlobalScopes(array $scopes = null) - { - if (! is_array($scopes)) { - $scopes = array_keys($this->scopes); - } - - foreach ($scopes as $scope) { - $this->withoutGlobalScope($scope); - } - - return $this; - } - - /** - * Get an array of global scopes that were removed from the query. - * - * @return array - */ - public function removedScopes() - { - return $this->removedScopes; - } - - /** - * Add a where clause on the primary key to the query. - * - * @param mixed $id - * @return $this - */ - public function whereKey($id) - { - if ($id instanceof Model) { - $id = $id->getKey(); - } - - if (is_array($id) || $id instanceof Arrayable) { - if (in_array($this->model->getKeyType(), ['int', 'integer'])) { - $this->query->whereIntegerInRaw($this->model->getQualifiedKeyName(), $id); - } else { - $this->query->whereIn($this->model->getQualifiedKeyName(), $id); - } - - return $this; - } - - if ($id !== null && $this->model->getKeyType() === 'string') { - $id = (string) $id; - } - - return $this->where($this->model->getQualifiedKeyName(), '=', $id); - } - - /** - * Add a where clause on the primary key to the query. - * - * @param mixed $id - * @return $this - */ - public function whereKeyNot($id) - { - if ($id instanceof Model) { - $id = $id->getKey(); - } - - if (is_array($id) || $id instanceof Arrayable) { - if (in_array($this->model->getKeyType(), ['int', 'integer'])) { - $this->query->whereIntegerNotInRaw($this->model->getQualifiedKeyName(), $id); - } else { - $this->query->whereNotIn($this->model->getQualifiedKeyName(), $id); - } - - return $this; - } - - if ($id !== null && $this->model->getKeyType() === 'string') { - $id = (string) $id; - } - - return $this->where($this->model->getQualifiedKeyName(), '!=', $id); - } - - /** - * Add a basic where clause to the query. - * - * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return $this - */ - public function where($column, $operator = null, $value = null, $boolean = 'and') - { - if ($column instanceof Closure && is_null($operator)) { - $column($query = $this->model->newQueryWithoutRelationships()); - - $this->query->addNestedWhereQuery($query->getQuery(), $boolean); - } else { - $this->query->where(...func_get_args()); - } - - return $this; - } - - /** - * Add a basic where clause to the query, and return the first result. - * - * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return \Illuminate\Database\Eloquent\Model|static|null - */ - public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') - { - return $this->where(...func_get_args())->first(); - } - - /** - * Add an "or where" clause to the query. - * - * @param \Closure|array|string|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @return $this - */ - public function orWhere($column, $operator = null, $value = null) - { - [$value, $operator] = $this->query->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->where($column, $operator, $value, 'or'); - } - - /** - * Add a basic "where not" clause to the query. - * - * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return $this - */ - public function whereNot($column, $operator = null, $value = null, $boolean = 'and') - { - return $this->where($column, $operator, $value, $boolean.' not'); - } - - /** - * Add an "or where not" clause to the query. - * - * @param \Closure|array|string|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @return $this - */ - public function orWhereNot($column, $operator = null, $value = null) - { - return $this->whereNot($column, $operator, $value, 'or'); - } - - /** - * Add an "order by" clause for a timestamp to the query. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @return $this - */ - public function latest($column = null) - { - if (is_null($column)) { - $column = $this->model->getCreatedAtColumn() ?? 'created_at'; - } - - $this->query->latest($column); - - return $this; - } - - /** - * Add an "order by" clause for a timestamp to the query. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @return $this - */ - public function oldest($column = null) - { - if (is_null($column)) { - $column = $this->model->getCreatedAtColumn() ?? 'created_at'; - } - - $this->query->oldest($column); - - return $this; - } - - /** - * Create a collection of models from plain arrays. - * - * @param array $items - * @return \Illuminate\Database\Eloquent\Collection - */ - public function hydrate(array $items) - { - $instance = $this->newModelInstance(); - - return $instance->newCollection(array_map(function ($item) use ($items, $instance) { - $model = $instance->newFromBuilder($item); - - if (count($items) > 1) { - $model->preventsLazyLoading = Model::preventsLazyLoading(); - } - - return $model; - }, $items)); - } - - /** - * Create a collection of models from a raw query. - * - * @param string $query - * @param array $bindings - * @return \Illuminate\Database\Eloquent\Collection - */ - public function fromQuery($query, $bindings = []) - { - return $this->hydrate( - $this->query->getConnection()->select($query, $bindings) - ); - } - - /** - * Find a model by its primary key. - * - * @param mixed $id - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null - */ - public function find($id, $columns = ['*']) - { - if (is_array($id) || $id instanceof Arrayable) { - return $this->findMany($id, $columns); - } - - return $this->whereKey($id)->first($columns); - } - - /** - * Find multiple models by their primary keys. - * - * @param \Illuminate\Contracts\Support\Arrayable|array $ids - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function findMany($ids, $columns = ['*']) - { - $ids = $ids instanceof Arrayable ? $ids->toArray() : $ids; - - if (empty($ids)) { - return $this->model->newCollection(); - } - - return $this->whereKey($ids)->get($columns); - } - - /** - * Find a model by its primary key or throw an exception. - * - * @param mixed $id - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static|static[] - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - public function findOrFail($id, $columns = ['*']) - { - $result = $this->find($id, $columns); - - $id = $id instanceof Arrayable ? $id->toArray() : $id; - - if (is_array($id)) { - if (count($result) !== count(array_unique($id))) { - throw (new ModelNotFoundException)->setModel( - get_class($this->model), array_diff($id, $result->modelKeys()) - ); - } - - return $result; - } - - if (is_null($result)) { - throw (new ModelNotFoundException)->setModel( - get_class($this->model), $id - ); - } - - return $result; - } - - /** - * Find a model by its primary key or return fresh model instance. - * - * @param mixed $id - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function findOrNew($id, $columns = ['*']) - { - if (! is_null($model = $this->find($id, $columns))) { - return $model; - } - - return $this->newModelInstance(); - } - - /** - * Find a model by its primary key or call a callback. - * - * @param mixed $id - * @param \Closure|array|string $columns - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|mixed - */ - public function findOr($id, $columns = ['*'], Closure $callback = null) - { - if ($columns instanceof Closure) { - $callback = $columns; - - $columns = ['*']; - } - - if (! is_null($model = $this->find($id, $columns))) { - return $model; - } - - return $callback(); - } - - /** - * Get the first record matching the attributes or instantiate it. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function firstOrNew(array $attributes = [], array $values = []) - { - if (! is_null($instance = $this->where($attributes)->first())) { - return $instance; - } - - return $this->newModelInstance(array_merge($attributes, $values)); - } - - /** - * Get the first record matching the attributes or create it. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function firstOrCreate(array $attributes = [], array $values = []) - { - if (! is_null($instance = $this->where($attributes)->first())) { - return $instance; - } - - return tap($this->newModelInstance(array_merge($attributes, $values)), function ($instance) { - $instance->save(); - }); - } - - /** - * Create or update a record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function updateOrCreate(array $attributes, array $values = []) - { - return tap($this->firstOrNew($attributes), function ($instance) use ($values) { - $instance->fill($values)->save(); - }); - } - - /** - * Execute the query and get the first result or throw an exception. - * - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model|static - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - public function firstOrFail($columns = ['*']) - { - if (! is_null($model = $this->first($columns))) { - return $model; - } - - throw (new ModelNotFoundException)->setModel(get_class($this->model)); - } - - /** - * Execute the query and get the first result or call a callback. - * - * @param \Closure|array|string $columns - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Model|static|mixed - */ - public function firstOr($columns = ['*'], Closure $callback = null) - { - if ($columns instanceof Closure) { - $callback = $columns; - - $columns = ['*']; - } - - if (! is_null($model = $this->first($columns))) { - return $model; - } - - return $callback(); - } - - /** - * Execute the query and get the first result if it's the sole matching record. - * - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - * @throws \Illuminate\Database\MultipleRecordsFoundException - */ - public function sole($columns = ['*']) - { - try { - return $this->baseSole($columns); - } catch (RecordsNotFoundException $exception) { - throw (new ModelNotFoundException)->setModel(get_class($this->model)); - } - } - - /** - * Get a single column's value from the first result of a query. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @return mixed - */ - public function value($column) - { - if ($result = $this->first([$column])) { - return $result->{Str::afterLast($column, '.')}; - } - } - - /** - * Get a single column's value from the first result of a query if it's the sole matching record. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @return mixed - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - * @throws \Illuminate\Database\MultipleRecordsFoundException - */ - public function soleValue($column) - { - return $this->sole([$column])->{Str::afterLast($column, '.')}; - } - - /** - * Get a single column's value from the first result of the query or throw an exception. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @return mixed - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - public function valueOrFail($column) - { - return $this->firstOrFail([$column])->{Str::afterLast($column, '.')}; - } - - /** - * Execute the query as a "select" statement. - * - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Collection|static[] - */ - public function get($columns = ['*']) - { - $builder = $this->applyScopes(); - - // If we actually found models we will also eager load any relationships that - // have been specified as needing to be eager loaded, which will solve the - // n+1 query issue for the developers to avoid running a lot of queries. - if (count($models = $builder->getModels($columns)) > 0) { - $models = $builder->eagerLoadRelations($models); - } - - return $builder->getModel()->newCollection($models); - } - - /** - * Get the hydrated models without eager loading. - * - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model[]|static[] - */ - public function getModels($columns = ['*']) - { - return $this->model->hydrate( - $this->query->get($columns)->all() - )->all(); - } - - /** - * Eager load the relationships for the models. - * - * @param array $models - * @return array - */ - public function eagerLoadRelations(array $models) - { - foreach ($this->eagerLoad as $name => $constraints) { - // For nested eager loads we'll skip loading them here and they will be set as an - // eager load on the query to retrieve the relation so that they will be eager - // loaded on that query, because that is where they get hydrated as models. - if (! str_contains($name, '.')) { - $models = $this->eagerLoadRelation($models, $name, $constraints); - } - } - - return $models; - } - - /** - * Eagerly load the relationship on a set of models. - * - * @param array $models - * @param string $name - * @param \Closure $constraints - * @return array - */ - protected function eagerLoadRelation(array $models, $name, Closure $constraints) - { - // First we will "back up" the existing where conditions on the query so we can - // add our eager constraints. Then we will merge the wheres that were on the - // query back to it in order that any where conditions might be specified. - $relation = $this->getRelation($name); - - $relation->addEagerConstraints($models); - - $constraints($relation); - - // Once we have the results, we just match those back up to their parent models - // using the relationship instance. Then we just return the finished arrays - // of models which have been eagerly hydrated and are readied for return. - return $relation->match( - $relation->initRelation($models, $name), - $relation->getEager(), $name - ); - } - - /** - * Get the relation instance for the given relation name. - * - * @param string $name - * @return \Illuminate\Database\Eloquent\Relations\Relation - */ - public function getRelation($name) - { - // We want to run a relationship query without any constrains so that we will - // not have to remove these where clauses manually which gets really hacky - // and error prone. We don't want constraints because we add eager ones. - $relation = Relation::noConstraints(function () use ($name) { - try { - return $this->getModel()->newInstance()->$name(); - } catch (BadMethodCallException $e) { - throw RelationNotFoundException::make($this->getModel(), $name); - } - }); - - $nested = $this->relationsNestedUnder($name); - - // If there are nested relationships set on the query, we will put those onto - // the query instances so that they can be handled after this relationship - // is loaded. In this way they will all trickle down as they are loaded. - if (count($nested) > 0) { - $relation->getQuery()->with($nested); - } - - return $relation; - } - - /** - * Get the deeply nested relations for a given top-level relation. - * - * @param string $relation - * @return array - */ - protected function relationsNestedUnder($relation) - { - $nested = []; - - // We are basically looking for any relationships that are nested deeper than - // the given top-level relationship. We will just check for any relations - // that start with the given top relations and adds them to our arrays. - foreach ($this->eagerLoad as $name => $constraints) { - if ($this->isNestedUnder($relation, $name)) { - $nested[substr($name, strlen($relation.'.'))] = $constraints; - } - } - - return $nested; - } - - /** - * Determine if the relationship is nested. - * - * @param string $relation - * @param string $name - * @return bool - */ - protected function isNestedUnder($relation, $name) - { - return str_contains($name, '.') && str_starts_with($name, $relation.'.'); - } - - /** - * Get a lazy collection for the given query. - * - * @return \Illuminate\Support\LazyCollection - */ - public function cursor() - { - return $this->applyScopes()->query->cursor()->map(function ($record) { - return $this->newModelInstance()->newFromBuilder($record); - }); - } - - /** - * Add a generic "order by" clause if the query doesn't already have one. - * - * @return void - */ - protected function enforceOrderBy() - { - if (empty($this->query->orders) && empty($this->query->unionOrders)) { - $this->orderBy($this->model->getQualifiedKeyName(), 'asc'); - } - } - - /** - * Get a collection with the values of a given column. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @param string|null $key - * @return \Illuminate\Support\Collection - */ - public function pluck($column, $key = null) - { - $results = $this->toBase()->pluck($column, $key); - - // If the model has a mutator for the requested column, we will spin through - // the results and mutate the values so that the mutated version of these - // columns are returned as you would expect from these Eloquent models. - if (! $this->model->hasGetMutator($column) && - ! $this->model->hasCast($column) && - ! in_array($column, $this->model->getDates())) { - return $results; - } - - return $results->map(function ($value) use ($column) { - return $this->model->newFromBuilder([$column => $value])->{$column}; - }); - } - - /** - * Paginate the given query. - * - * @param int|null|\Closure $perPage - * @param array|string $columns - * @param string $pageName - * @param int|null $page - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - * - * @throws \InvalidArgumentException - */ - public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) - { - $page = $page ?: Paginator::resolveCurrentPage($pageName); - - $total = $this->toBase()->getCountForPagination(); - - $perPage = ($perPage instanceof Closure - ? $perPage($total) - : $perPage - ) ?: $this->model->getPerPage(); - - $results = $total - ? $this->forPage($page, $perPage)->get($columns) - : $this->model->newCollection(); - - return $this->paginator($results, $total, $perPage, $page, [ - 'path' => Paginator::resolveCurrentPath(), - 'pageName' => $pageName, - ]); - } - - /** - * Paginate the given query into a simple paginator. - * - * @param int|null $perPage - * @param array|string $columns - * @param string $pageName - * @param int|null $page - * @return \Illuminate\Contracts\Pagination\Paginator - */ - public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) - { - $page = $page ?: Paginator::resolveCurrentPage($pageName); - - $perPage = $perPage ?: $this->model->getPerPage(); - - // Next we will set the limit and offset for this query so that when we get the - // results we get the proper section of results. Then, we'll create the full - // paginator instances for these results with the given page and per page. - $this->skip(($page - 1) * $perPage)->take($perPage + 1); - - return $this->simplePaginator($this->get($columns), $perPage, $page, [ - 'path' => Paginator::resolveCurrentPath(), - 'pageName' => $pageName, - ]); - } - - /** - * Paginate the given query into a cursor paginator. - * - * @param int|null $perPage - * @param array|string $columns - * @param string $cursorName - * @param \Illuminate\Pagination\Cursor|string|null $cursor - * @return \Illuminate\Contracts\Pagination\CursorPaginator - */ - public function cursorPaginate($perPage = null, $columns = ['*'], $cursorName = 'cursor', $cursor = null) - { - $perPage = $perPage ?: $this->model->getPerPage(); - - return $this->paginateUsingCursor($perPage, $columns, $cursorName, $cursor); - } - - /** - * Ensure the proper order by required for cursor pagination. - * - * @param bool $shouldReverse - * @return \Illuminate\Support\Collection - */ - protected function ensureOrderForCursorPagination($shouldReverse = false) - { - if (empty($this->query->orders) && empty($this->query->unionOrders)) { - $this->enforceOrderBy(); - } - - if ($shouldReverse) { - $this->query->orders = collect($this->query->orders)->map(function ($order) { - $order['direction'] = $order['direction'] === 'asc' ? 'desc' : 'asc'; - - return $order; - })->toArray(); - } - - if ($this->query->unionOrders) { - return collect($this->query->unionOrders); - } - - return collect($this->query->orders); - } - - /** - * Save a new model and return the instance. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model|$this - */ - public function create(array $attributes = []) - { - return tap($this->newModelInstance($attributes), function ($instance) { - $instance->save(); - }); - } - - /** - * Save a new model and return the instance. Allow mass-assignment. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model|$this - */ - public function forceCreate(array $attributes) - { - return $this->model->unguarded(function () use ($attributes) { - return $this->newModelInstance()->create($attributes); - }); - } - - /** - * Update records in the database. - * - * @param array $values - * @return int - */ - public function update(array $values) - { - return $this->toBase()->update($this->addUpdatedAtColumn($values)); - } - - /** - * Insert new records or update the existing ones. - * - * @param array $values - * @param array|string $uniqueBy - * @param array|null $update - * @return int - */ - public function upsert(array $values, $uniqueBy, $update = null) - { - if (empty($values)) { - return 0; - } - - if (! is_array(reset($values))) { - $values = [$values]; - } - - if (is_null($update)) { - $update = array_keys(reset($values)); - } - - return $this->toBase()->upsert( - $this->addTimestampsToUpsertValues($values), - $uniqueBy, - $this->addUpdatedAtToUpsertColumns($update) - ); - } - - /** - * Update the column's update timestamp. - * - * @param string|null $column - * @return int|false - */ - public function touch($column = null) - { - $time = $this->model->freshTimestamp(); - - if ($column) { - return $this->toBase()->update([$column => $time]); - } - - $column = $this->model->getUpdatedAtColumn(); - - if (! $this->model->usesTimestamps() || is_null($column)) { - return false; - } - - return $this->toBase()->update([$column => $time]); - } - - /** - * Increment a column's value by a given amount. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @param float|int $amount - * @param array $extra - * @return int - */ - public function increment($column, $amount = 1, array $extra = []) - { - return $this->toBase()->increment( - $column, $amount, $this->addUpdatedAtColumn($extra) - ); - } - - /** - * Decrement a column's value by a given amount. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @param float|int $amount - * @param array $extra - * @return int - */ - public function decrement($column, $amount = 1, array $extra = []) - { - return $this->toBase()->decrement( - $column, $amount, $this->addUpdatedAtColumn($extra) - ); - } - - /** - * Add the "updated at" column to an array of values. - * - * @param array $values - * @return array - */ - protected function addUpdatedAtColumn(array $values) - { - if (! $this->model->usesTimestamps() || - is_null($this->model->getUpdatedAtColumn())) { - return $values; - } - - $column = $this->model->getUpdatedAtColumn(); - - $values = array_merge( - [$column => $this->model->freshTimestampString()], - $values - ); - - $segments = preg_split('/\s+as\s+/i', $this->query->from); - - $qualifiedColumn = end($segments).'.'.$column; - - $values[$qualifiedColumn] = Arr::get($values, $qualifiedColumn, $values[$column]); - - unset($values[$column]); - - return $values; - } - - /** - * Add timestamps to the inserted values. - * - * @param array $values - * @return array - */ - protected function addTimestampsToUpsertValues(array $values) - { - if (! $this->model->usesTimestamps()) { - return $values; - } - - $timestamp = $this->model->freshTimestampString(); - - $columns = array_filter([ - $this->model->getCreatedAtColumn(), - $this->model->getUpdatedAtColumn(), - ]); - - foreach ($columns as $column) { - foreach ($values as &$row) { - $row = array_merge([$column => $timestamp], $row); - } - } - - return $values; - } - - /** - * Add the "updated at" column to the updated columns. - * - * @param array $update - * @return array - */ - protected function addUpdatedAtToUpsertColumns(array $update) - { - if (! $this->model->usesTimestamps()) { - return $update; - } - - $column = $this->model->getUpdatedAtColumn(); - - if (! is_null($column) && - ! array_key_exists($column, $update) && - ! in_array($column, $update)) { - $update[] = $column; - } - - return $update; - } - - /** - * Delete records from the database. - * - * @return mixed - */ - public function delete() - { - if (isset($this->onDelete)) { - return call_user_func($this->onDelete, $this); - } - - return $this->toBase()->delete(); - } - - /** - * Run the default delete function on the builder. - * - * Since we do not apply scopes here, the row will actually be deleted. - * - * @return mixed - */ - public function forceDelete() - { - return $this->query->delete(); - } - - /** - * Register a replacement for the default delete function. - * - * @param \Closure $callback - * @return void - */ - public function onDelete(Closure $callback) - { - $this->onDelete = $callback; - } - - /** - * Determine if the given model has a scope. - * - * @param string $scope - * @return bool - */ - public function hasNamedScope($scope) - { - return $this->model && $this->model->hasNamedScope($scope); - } - - /** - * Call the given local model scopes. - * - * @param array|string $scopes - * @return static|mixed - */ - public function scopes($scopes) - { - $builder = $this; - - foreach (Arr::wrap($scopes) as $scope => $parameters) { - // If the scope key is an integer, then the scope was passed as the value and - // the parameter list is empty, so we will format the scope name and these - // parameters here. Then, we'll be ready to call the scope on the model. - if (is_int($scope)) { - [$scope, $parameters] = [$parameters, []]; - } - - // Next we'll pass the scope callback to the callScope method which will take - // care of grouping the "wheres" properly so the logical order doesn't get - // messed up when adding scopes. Then we'll return back out the builder. - $builder = $builder->callNamedScope( - $scope, Arr::wrap($parameters) - ); - } - - return $builder; - } - - /** - * Apply the scopes to the Eloquent builder instance and return it. - * - * @return static - */ - public function applyScopes() - { - if (! $this->scopes) { - return $this; - } - - $builder = clone $this; - - foreach ($this->scopes as $identifier => $scope) { - if (! isset($builder->scopes[$identifier])) { - continue; - } - - $builder->callScope(function (self $builder) use ($scope) { - // If the scope is a Closure we will just go ahead and call the scope with the - // builder instance. The "callScope" method will properly group the clauses - // that are added to this query so "where" clauses maintain proper logic. - if ($scope instanceof Closure) { - $scope($builder); - } - - // If the scope is a scope object, we will call the apply method on this scope - // passing in the builder and the model instance. After we run all of these - // scopes we will return back the builder instance to the outside caller. - if ($scope instanceof Scope) { - $scope->apply($builder, $this->getModel()); - } - }); - } - - return $builder; - } - - /** - * Apply the given scope on the current builder instance. - * - * @param callable $scope - * @param array $parameters - * @return mixed - */ - protected function callScope(callable $scope, array $parameters = []) - { - array_unshift($parameters, $this); - - $query = $this->getQuery(); - - // We will keep track of how many wheres are on the query before running the - // scope so that we can properly group the added scope constraints in the - // query as their own isolated nested where statement and avoid issues. - $originalWhereCount = is_null($query->wheres) - ? 0 : count($query->wheres); - - $result = $scope(...$parameters) ?? $this; - - if (count((array) $query->wheres) > $originalWhereCount) { - $this->addNewWheresWithinGroup($query, $originalWhereCount); - } - - return $result; - } - - /** - * Apply the given named scope on the current builder instance. - * - * @param string $scope - * @param array $parameters - * @return mixed - */ - protected function callNamedScope($scope, array $parameters = []) - { - return $this->callScope(function (...$parameters) use ($scope) { - return $this->model->callNamedScope($scope, $parameters); - }, $parameters); - } - - /** - * Nest where conditions by slicing them at the given where count. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $originalWhereCount - * @return void - */ - protected function addNewWheresWithinGroup(QueryBuilder $query, $originalWhereCount) - { - // Here, we totally remove all of the where clauses since we are going to - // rebuild them as nested queries by slicing the groups of wheres into - // their own sections. This is to prevent any confusing logic order. - $allWheres = $query->wheres; - - $query->wheres = []; - - $this->groupWhereSliceForScope( - $query, array_slice($allWheres, 0, $originalWhereCount) - ); - - $this->groupWhereSliceForScope( - $query, array_slice($allWheres, $originalWhereCount) - ); - } - - /** - * Slice where conditions at the given offset and add them to the query as a nested condition. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $whereSlice - * @return void - */ - protected function groupWhereSliceForScope(QueryBuilder $query, $whereSlice) - { - $whereBooleans = collect($whereSlice)->pluck('boolean'); - - // Here we'll check if the given subset of where clauses contains any "or" - // booleans and in this case create a nested where expression. That way - // we don't add any unnecessary nesting thus keeping the query clean. - if ($whereBooleans->contains('or')) { - $query->wheres[] = $this->createNestedWhere( - $whereSlice, $whereBooleans->first() - ); - } else { - $query->wheres = array_merge($query->wheres, $whereSlice); - } - } - - /** - * Create a where array with nested where conditions. - * - * @param array $whereSlice - * @param string $boolean - * @return array - */ - protected function createNestedWhere($whereSlice, $boolean = 'and') - { - $whereGroup = $this->getQuery()->forNestedWhere(); - - $whereGroup->wheres = $whereSlice; - - return ['type' => 'Nested', 'query' => $whereGroup, 'boolean' => $boolean]; - } - - /** - * Set the relationships that should be eager loaded. - * - * @param string|array $relations - * @param string|\Closure|null $callback - * @return $this - */ - public function with($relations, $callback = null) - { - if ($callback instanceof Closure) { - $eagerLoad = $this->parseWithRelations([$relations => $callback]); - } else { - $eagerLoad = $this->parseWithRelations(is_string($relations) ? func_get_args() : $relations); - } - - $this->eagerLoad = array_merge($this->eagerLoad, $eagerLoad); - - return $this; - } - - /** - * Prevent the specified relations from being eager loaded. - * - * @param mixed $relations - * @return $this - */ - public function without($relations) - { - $this->eagerLoad = array_diff_key($this->eagerLoad, array_flip( - is_string($relations) ? func_get_args() : $relations - )); - - return $this; - } - - /** - * Set the relationships that should be eager loaded while removing any previously added eager loading specifications. - * - * @param mixed $relations - * @return $this - */ - public function withOnly($relations) - { - $this->eagerLoad = []; - - return $this->with($relations); - } - - /** - * Create a new instance of the model being queried. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function newModelInstance($attributes = []) - { - return $this->model->newInstance($attributes)->setConnection( - $this->query->getConnection()->getName() - ); - } - - /** - * Parse a list of relations into individuals. - * - * @param array $relations - * @return array - */ - protected function parseWithRelations(array $relations) - { - if ($relations === []) { - return []; - } - - $results = []; - - foreach ($this->prepareNestedWithRelationships($relations) as $name => $constraints) { - // We need to separate out any nested includes, which allows the developers - // to load deep relationships using "dots" without stating each level of - // the relationship with its own key in the array of eager-load names. - $results = $this->addNestedWiths($name, $results); - - $results[$name] = $constraints; - } - - return $results; - } - - /** - * Prepare nested with relationships. - * - * @param array $relations - * @param string $prefix - * @return array - */ - protected function prepareNestedWithRelationships($relations, $prefix = '') - { - $preparedRelationships = []; - - if ($prefix !== '') { - $prefix .= '.'; - } - - // If any of the relationships are formatted with the [$attribute => array()] - // syntax, we shall loop over the nested relations and prepend each key of - // this array while flattening into the traditional dot notation format. - foreach ($relations as $key => $value) { - if (! is_string($key) || ! is_array($value)) { - continue; - } - - [$attribute, $attributeSelectConstraint] = $this->parseNameAndAttributeSelectionConstraint($key); - - $preparedRelationships = array_merge( - $preparedRelationships, - ["{$prefix}{$attribute}" => $attributeSelectConstraint], - $this->prepareNestedWithRelationships($value, "{$prefix}{$attribute}"), - ); - - unset($relations[$key]); - } - - // We now know that the remaining relationships are in a dot notation format - // and may be a string or Closure. We'll loop over them and ensure all of - // the present Closures are merged + strings are made into constraints. - foreach ($relations as $key => $value) { - if (is_numeric($key) && is_string($value)) { - [$key, $value] = $this->parseNameAndAttributeSelectionConstraint($value); - } - - $preparedRelationships[$prefix.$key] = $this->combineConstraints([ - $value, - $preparedRelationships[$prefix.$key] ?? static function () { - // - }, - ]); - } - - return $preparedRelationships; - } - - /** - * Combine an array of constraints into a single constraint. - * - * @param array $constraints - * @return \Closure - */ - protected function combineConstraints(array $constraints) - { - return function ($builder) use ($constraints) { - foreach ($constraints as $constraint) { - $builder = $constraint($builder) ?? $builder; - } - - return $builder; - }; - } - - /** - * Parse the attribute select constraints from the name. - * - * @param string $name - * @return array - */ - protected function parseNameAndAttributeSelectionConstraint($name) - { - return str_contains($name, ':') - ? $this->createSelectWithConstraint($name) - : [$name, static function () { - // - }]; - } - - /** - * Create a constraint to select the given columns for the relation. - * - * @param string $name - * @return array - */ - protected function createSelectWithConstraint($name) - { - return [explode(':', $name)[0], static function ($query) use ($name) { - $query->select(array_map(static function ($column) use ($query) { - if (str_contains($column, '.')) { - return $column; - } - - return $query instanceof BelongsToMany - ? $query->getRelated()->getTable().'.'.$column - : $column; - }, explode(',', explode(':', $name)[1]))); - }]; - } - - /** - * Parse the nested relationships in a relation. - * - * @param string $name - * @param array $results - * @return array - */ - protected function addNestedWiths($name, $results) - { - $progress = []; - - // If the relation has already been set on the result array, we will not set it - // again, since that would override any constraints that were already placed - // on the relationships. We will only set the ones that are not specified. - foreach (explode('.', $name) as $segment) { - $progress[] = $segment; - - if (! isset($results[$last = implode('.', $progress)])) { - $results[$last] = static function () { - // - }; - } - } - - return $results; - } - - /** - * Apply query-time casts to the model instance. - * - * @param array $casts - * @return $this - */ - public function withCasts($casts) - { - $this->model->mergeCasts($casts); - - return $this; - } - - /** - * Get the underlying query builder instance. - * - * @return \Illuminate\Database\Query\Builder - */ - public function getQuery() - { - return $this->query; - } - - /** - * Set the underlying query builder instance. - * - * @param \Illuminate\Database\Query\Builder $query - * @return $this - */ - public function setQuery($query) - { - $this->query = $query; - - return $this; - } - - /** - * Get a base query builder instance. - * - * @return \Illuminate\Database\Query\Builder - */ - public function toBase() - { - return $this->applyScopes()->getQuery(); - } - - /** - * Get the relationships being eagerly loaded. - * - * @return array - */ - public function getEagerLoads() - { - return $this->eagerLoad; - } - - /** - * Set the relationships being eagerly loaded. - * - * @param array $eagerLoad - * @return $this - */ - public function setEagerLoads(array $eagerLoad) - { - $this->eagerLoad = $eagerLoad; - - return $this; - } - - /** - * Indicate that the given relationships should not be eagerly loaded. - * - * @param array $relations - * @return $this - */ - public function withoutEagerLoad(array $relations) - { - $relations = array_diff(array_keys($this->model->getRelations()), $relations); - - return $this->with($relations); - } - - /** - * Flush the relationships being eagerly loaded. - * - * @return $this - */ - public function withoutEagerLoads() - { - return $this->setEagerLoads([]); - } - - /** - * Get the default key name of the table. - * - * @return string - */ - protected function defaultKeyName() - { - return $this->getModel()->getKeyName(); - } - - /** - * Get the model instance being queried. - * - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function getModel() - { - return $this->model; - } - - /** - * Set a model instance for the model being queried. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return $this - */ - public function setModel(Model $model) - { - $this->model = $model; - - $this->query->from($model->getTable()); - - return $this; - } - - /** - * Qualify the given column name by the model's table. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @return string - */ - public function qualifyColumn($column) - { - return $this->model->qualifyColumn($column); - } - - /** - * Qualify the given columns with the model's table. - * - * @param array|\Illuminate\Database\Query\Expression $columns - * @return array - */ - public function qualifyColumns($columns) - { - return $this->model->qualifyColumns($columns); - } - - /** - * Get the given macro by name. - * - * @param string $name - * @return \Closure - */ - public function getMacro($name) - { - return Arr::get($this->localMacros, $name); - } - - /** - * Checks if a macro is registered. - * - * @param string $name - * @return bool - */ - public function hasMacro($name) - { - return isset($this->localMacros[$name]); - } - - /** - * Get the given global macro by name. - * - * @param string $name - * @return \Closure - */ - public static function getGlobalMacro($name) - { - return Arr::get(static::$macros, $name); - } - - /** - * Checks if a global macro is registered. - * - * @param string $name - * @return bool - */ - public static function hasGlobalMacro($name) - { - return isset(static::$macros[$name]); - } - - /** - * Dynamically access builder proxies. - * - * @param string $key - * @return mixed - * - * @throws \Exception - */ - public function __get($key) - { - if (in_array($key, ['orWhere', 'whereNot', 'orWhereNot'])) { - return new HigherOrderBuilderProxy($this, $key); - } - - if (in_array($key, $this->propertyPassthru)) { - return $this->toBase()->{$key}; - } - - throw new Exception("Property [{$key}] does not exist on the Eloquent builder instance."); - } - - /** - * Dynamically handle calls into the query instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if ($method === 'macro') { - $this->localMacros[$parameters[0]] = $parameters[1]; - - return; - } - - if ($this->hasMacro($method)) { - array_unshift($parameters, $this); - - return $this->localMacros[$method](...$parameters); - } - - if (static::hasGlobalMacro($method)) { - $callable = static::$macros[$method]; - - if ($callable instanceof Closure) { - $callable = $callable->bindTo($this, static::class); - } - - return $callable(...$parameters); - } - - if ($this->hasNamedScope($method)) { - return $this->callNamedScope($method, $parameters); - } - - if (in_array($method, $this->passthru)) { - return $this->toBase()->{$method}(...$parameters); - } - - $this->forwardCallTo($this->query, $method, $parameters); - - return $this; - } - - /** - * Dynamically handle calls into the query instance. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public static function __callStatic($method, $parameters) - { - if ($method === 'macro') { - static::$macros[$parameters[0]] = $parameters[1]; - - return; - } - - if ($method === 'mixin') { - return static::registerMixin($parameters[0], $parameters[1] ?? true); - } - - if (! static::hasGlobalMacro($method)) { - static::throwBadMethodCallException($method); - } - - $callable = static::$macros[$method]; - - if ($callable instanceof Closure) { - $callable = $callable->bindTo(null, static::class); - } - - return $callable(...$parameters); - } - - /** - * Register the given mixin with the builder. - * - * @param string $mixin - * @param bool $replace - * @return void - */ - protected static function registerMixin($mixin, $replace) - { - $methods = (new ReflectionClass($mixin))->getMethods( - ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED - ); - - foreach ($methods as $method) { - if ($replace || ! static::hasGlobalMacro($method->name)) { - $method->setAccessible(true); - - static::macro($method->name, $method->invoke($mixin)); - } - } - } - - /** - * Clone the Eloquent query builder. - * - * @return static - */ - public function clone() - { - return clone $this; - } - - /** - * Force a clone of the underlying query builder when cloning. - * - * @return void - */ - public function __clone() - { - $this->query = clone $this->query; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/ArrayObject.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/ArrayObject.php deleted file mode 100644 index 896445e..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/ArrayObject.php +++ /dev/null @@ -1,45 +0,0 @@ - - */ -class ArrayObject extends BaseArrayObject implements Arrayable, JsonSerializable -{ - /** - * Get a collection containing the underlying array. - * - * @return \Illuminate\Support\Collection - */ - public function collect() - { - return collect($this->getArrayCopy()); - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return $this->getArrayCopy(); - } - - /** - * Get the array that should be JSON serialized. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->getArrayCopy(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsArrayObject.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsArrayObject.php deleted file mode 100644 index 23543ba..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsArrayObject.php +++ /dev/null @@ -1,42 +0,0 @@ -, iterable> - */ - public static function castUsing(array $arguments) - { - return new class implements CastsAttributes - { - public function get($model, $key, $value, $attributes) - { - if (! isset($attributes[$key])) { - return; - } - - $data = json_decode($attributes[$key], true); - - return is_array($data) ? new ArrayObject($data) : null; - } - - public function set($model, $key, $value, $attributes) - { - return [$key => json_encode($value)]; - } - - public function serialize($model, string $key, $value, array $attributes) - { - return $value->getArrayCopy(); - } - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsCollection.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsCollection.php deleted file mode 100644 index 1a0dd83..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsCollection.php +++ /dev/null @@ -1,38 +0,0 @@ -, iterable> - */ - public static function castUsing(array $arguments) - { - return new class implements CastsAttributes - { - public function get($model, $key, $value, $attributes) - { - if (! isset($attributes[$key])) { - return; - } - - $data = json_decode($attributes[$key], true); - - return is_array($data) ? new Collection($data) : null; - } - - public function set($model, $key, $value, $attributes) - { - return [$key => json_encode($value)]; - } - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEncryptedArrayObject.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEncryptedArrayObject.php deleted file mode 100644 index ce2b663..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEncryptedArrayObject.php +++ /dev/null @@ -1,45 +0,0 @@ -, iterable> - */ - public static function castUsing(array $arguments) - { - return new class implements CastsAttributes - { - public function get($model, $key, $value, $attributes) - { - if (isset($attributes[$key])) { - return new ArrayObject(json_decode(Crypt::decryptString($attributes[$key]), true)); - } - - return null; - } - - public function set($model, $key, $value, $attributes) - { - if (! is_null($value)) { - return [$key => Crypt::encryptString(json_encode($value))]; - } - - return null; - } - - public function serialize($model, string $key, $value, array $attributes) - { - return ! is_null($value) ? $value->getArrayCopy() : null; - } - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEncryptedCollection.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEncryptedCollection.php deleted file mode 100644 index 64cdf00..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEncryptedCollection.php +++ /dev/null @@ -1,41 +0,0 @@ -, iterable> - */ - public static function castUsing(array $arguments) - { - return new class implements CastsAttributes - { - public function get($model, $key, $value, $attributes) - { - if (isset($attributes[$key])) { - return new Collection(json_decode(Crypt::decryptString($attributes[$key]), true)); - } - - return null; - } - - public function set($model, $key, $value, $attributes) - { - if (! is_null($value)) { - return [$key => Crypt::encryptString(json_encode($value))]; - } - - return null; - } - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEnumArrayObject.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEnumArrayObject.php deleted file mode 100644 index 5b47785..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEnumArrayObject.php +++ /dev/null @@ -1,84 +0,0 @@ -} $arguments - * @return CastsAttributes, iterable> - */ - public static function castUsing(array $arguments) - { - return new class($arguments) implements CastsAttributes - { - protected $arguments; - - public function __construct(array $arguments) - { - $this->arguments = $arguments; - } - - public function get($model, $key, $value, $attributes) - { - if (! isset($attributes[$key]) || is_null($attributes[$key])) { - return; - } - - $data = json_decode($attributes[$key], true); - - if (! is_array($data)) { - return; - } - - $enumClass = $this->arguments[0]; - - return new ArrayObject((new Collection($data))->map(function ($value) use ($enumClass) { - return is_subclass_of($enumClass, BackedEnum::class) - ? $enumClass::from($value) - : constant($enumClass.'::'.$value); - })->toArray()); - } - - public function set($model, $key, $value, $attributes) - { - if ($value === null) { - return [$key => null]; - } - - $storable = []; - - foreach ($value as $enum) { - $storable[] = $this->getStorableEnumValue($enum); - } - - return [$key => json_encode($storable)]; - } - - public function serialize($model, string $key, $value, array $attributes) - { - return (new Collection($value->getArrayCopy()))->map(function ($enum) { - return $this->getStorableEnumValue($enum); - })->toArray(); - } - - protected function getStorableEnumValue($enum) - { - if (is_string($enum) || is_int($enum)) { - return $enum; - } - - return $enum instanceof BackedEnum ? $enum->value : $enum->name; - } - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEnumCollection.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEnumCollection.php deleted file mode 100644 index ca1feb5..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsEnumCollection.php +++ /dev/null @@ -1,80 +0,0 @@ -} $arguments - * @return CastsAttributes, iterable> - */ - public static function castUsing(array $arguments) - { - return new class($arguments) implements CastsAttributes - { - protected $arguments; - - public function __construct(array $arguments) - { - $this->arguments = $arguments; - } - - public function get($model, $key, $value, $attributes) - { - if (! isset($attributes[$key]) || is_null($attributes[$key])) { - return; - } - - $data = json_decode($attributes[$key], true); - - if (! is_array($data)) { - return; - } - - $enumClass = $this->arguments[0]; - - return (new Collection($data))->map(function ($value) use ($enumClass) { - return is_subclass_of($enumClass, BackedEnum::class) - ? $enumClass::from($value) - : constant($enumClass.'::'.$value); - }); - } - - public function set($model, $key, $value, $attributes) - { - $value = $value !== null - ? (new Collection($value))->map(function ($enum) { - return $this->getStorableEnumValue($enum); - })->toJson() - : null; - - return [$key => $value]; - } - - public function serialize($model, string $key, $value, array $attributes) - { - return (new Collection($value))->map(function ($enum) { - return $this->getStorableEnumValue($enum); - })->toArray(); - } - - protected function getStorableEnumValue($enum) - { - if (is_string($enum) || is_int($enum)) { - return $enum; - } - - return $enum instanceof BackedEnum ? $enum->value : $enum->name; - } - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsStringable.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsStringable.php deleted file mode 100644 index c2927d2..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/AsStringable.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ - public static function castUsing(array $arguments) - { - return new class implements CastsAttributes - { - public function get($model, $key, $value, $attributes) - { - return isset($value) ? Str::of($value) : null; - } - - public function set($model, $key, $value, $attributes) - { - return isset($value) ? (string) $value : null; - } - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/Attribute.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/Attribute.php deleted file mode 100644 index 3f9fd19..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Casts/Attribute.php +++ /dev/null @@ -1,105 +0,0 @@ -get = $get; - $this->set = $set; - } - - /** - * Create a new attribute accessor / mutator. - * - * @param callable|null $get - * @param callable|null $set - * @return static - */ - public static function make(callable $get = null, callable $set = null): static - { - return new static($get, $set); - } - - /** - * Create a new attribute accessor. - * - * @param callable $get - * @return static - */ - public static function get(callable $get) - { - return new static($get); - } - - /** - * Create a new attribute mutator. - * - * @param callable $set - * @return static - */ - public static function set(callable $set) - { - return new static(null, $set); - } - - /** - * Disable object caching for the attribute. - * - * @return static - */ - public function withoutObjectCaching() - { - $this->withObjectCaching = false; - - return $this; - } - - /** - * Enable caching for the attribute. - * - * @return static - */ - public function shouldCache() - { - $this->withCaching = true; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Collection.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Collection.php deleted file mode 100755 index 79785c6..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Collection.php +++ /dev/null @@ -1,782 +0,0 @@ - - */ -class Collection extends BaseCollection implements QueueableCollection -{ - /** - * Find a model in the collection by key. - * - * @template TFindDefault - * - * @param mixed $key - * @param TFindDefault $default - * @return static|TModel|TFindDefault - */ - public function find($key, $default = null) - { - if ($key instanceof Model) { - $key = $key->getKey(); - } - - if ($key instanceof Arrayable) { - $key = $key->toArray(); - } - - if (is_array($key)) { - if ($this->isEmpty()) { - return new static; - } - - return $this->whereIn($this->first()->getKeyName(), $key); - } - - return Arr::first($this->items, fn ($model) => $model->getKey() == $key, $default); - } - - /** - * Load a set of relationships onto the collection. - * - * @param array|string $relations - * @return $this - */ - public function load($relations) - { - if ($this->isNotEmpty()) { - if (is_string($relations)) { - $relations = func_get_args(); - } - - $query = $this->first()->newQueryWithoutRelationships()->with($relations); - - $this->items = $query->eagerLoadRelations($this->items); - } - - return $this; - } - - /** - * Load a set of aggregations over relationship's column onto the collection. - * - * @param array|string $relations - * @param string $column - * @param string|null $function - * @return $this - */ - public function loadAggregate($relations, $column, $function = null) - { - if ($this->isEmpty()) { - return $this; - } - - $models = $this->first()->newModelQuery() - ->whereKey($this->modelKeys()) - ->select($this->first()->getKeyName()) - ->withAggregate($relations, $column, $function) - ->get() - ->keyBy($this->first()->getKeyName()); - - $attributes = Arr::except( - array_keys($models->first()->getAttributes()), - $models->first()->getKeyName() - ); - - $this->each(function ($model) use ($models, $attributes) { - $extraAttributes = Arr::only($models->get($model->getKey())->getAttributes(), $attributes); - - $model->forceFill($extraAttributes) - ->syncOriginalAttributes($attributes) - ->mergeCasts($models->get($model->getKey())->getCasts()); - }); - - return $this; - } - - /** - * Load a set of relationship counts onto the collection. - * - * @param array|string $relations - * @return $this - */ - public function loadCount($relations) - { - return $this->loadAggregate($relations, '*', 'count'); - } - - /** - * Load a set of relationship's max column values onto the collection. - * - * @param array|string $relations - * @param string $column - * @return $this - */ - public function loadMax($relations, $column) - { - return $this->loadAggregate($relations, $column, 'max'); - } - - /** - * Load a set of relationship's min column values onto the collection. - * - * @param array|string $relations - * @param string $column - * @return $this - */ - public function loadMin($relations, $column) - { - return $this->loadAggregate($relations, $column, 'min'); - } - - /** - * Load a set of relationship's column summations onto the collection. - * - * @param array|string $relations - * @param string $column - * @return $this - */ - public function loadSum($relations, $column) - { - return $this->loadAggregate($relations, $column, 'sum'); - } - - /** - * Load a set of relationship's average column values onto the collection. - * - * @param array|string $relations - * @param string $column - * @return $this - */ - public function loadAvg($relations, $column) - { - return $this->loadAggregate($relations, $column, 'avg'); - } - - /** - * Load a set of related existences onto the collection. - * - * @param array|string $relations - * @return $this - */ - public function loadExists($relations) - { - return $this->loadAggregate($relations, '*', 'exists'); - } - - /** - * Load a set of relationships onto the collection if they are not already eager loaded. - * - * @param array|string $relations - * @return $this - */ - public function loadMissing($relations) - { - if (is_string($relations)) { - $relations = func_get_args(); - } - - foreach ($relations as $key => $value) { - if (is_numeric($key)) { - $key = $value; - } - - $segments = explode('.', explode(':', $key)[0]); - - if (str_contains($key, ':')) { - $segments[count($segments) - 1] .= ':'.explode(':', $key)[1]; - } - - $path = []; - - foreach ($segments as $segment) { - $path[] = [$segment => $segment]; - } - - if (is_callable($value)) { - $path[count($segments) - 1][end($segments)] = $value; - } - - $this->loadMissingRelation($this, $path); - } - - return $this; - } - - /** - * Load a relationship path if it is not already eager loaded. - * - * @param \Illuminate\Database\Eloquent\Collection $models - * @param array $path - * @return void - */ - protected function loadMissingRelation(self $models, array $path) - { - $relation = array_shift($path); - - $name = explode(':', key($relation))[0]; - - if (is_string(reset($relation))) { - $relation = reset($relation); - } - - $models->filter(fn ($model) => ! is_null($model) && ! $model->relationLoaded($name))->load($relation); - - if (empty($path)) { - return; - } - - $models = $models->pluck($name)->whereNotNull(); - - if ($models->first() instanceof BaseCollection) { - $models = $models->collapse(); - } - - $this->loadMissingRelation(new static($models), $path); - } - - /** - * Load a set of relationships onto the mixed relationship collection. - * - * @param string $relation - * @param array $relations - * @return $this - */ - public function loadMorph($relation, $relations) - { - $this->pluck($relation) - ->filter() - ->groupBy(fn ($model) => get_class($model)) - ->each(fn ($models, $className) => static::make($models)->load($relations[$className] ?? [])); - - return $this; - } - - /** - * Load a set of relationship counts onto the mixed relationship collection. - * - * @param string $relation - * @param array $relations - * @return $this - */ - public function loadMorphCount($relation, $relations) - { - $this->pluck($relation) - ->filter() - ->groupBy(fn ($model) => get_class($model)) - ->each(fn ($models, $className) => static::make($models)->loadCount($relations[$className] ?? [])); - - return $this; - } - - /** - * Determine if a key exists in the collection. - * - * @param (callable(TModel, TKey): bool)|TModel|string|int $key - * @param mixed $operator - * @param mixed $value - * @return bool - */ - public function contains($key, $operator = null, $value = null) - { - if (func_num_args() > 1 || $this->useAsCallable($key)) { - return parent::contains(...func_get_args()); - } - - if ($key instanceof Model) { - return parent::contains(fn ($model) => $model->is($key)); - } - - return parent::contains(fn ($model) => $model->getKey() == $key); - } - - /** - * Get the array of primary keys. - * - * @return array - */ - public function modelKeys() - { - return array_map(fn ($model) => $model->getKey(), $this->items); - } - - /** - * Merge the collection with the given items. - * - * @param iterable $items - * @return static - */ - public function merge($items) - { - $dictionary = $this->getDictionary(); - - foreach ($items as $item) { - $dictionary[$item->getKey()] = $item; - } - - return new static(array_values($dictionary)); - } - - /** - * Run a map over each of the items. - * - * @template TMapValue - * - * @param callable(TModel, TKey): TMapValue $callback - * @return \Illuminate\Support\Collection|static - */ - public function map(callable $callback) - { - $result = parent::map($callback); - - return $result->contains(fn ($item) => ! $item instanceof Model) ? $result->toBase() : $result; - } - - /** - * Run an associative map over each of the items. - * - * The callback should return an associative array with a single key / value pair. - * - * @template TMapWithKeysKey of array-key - * @template TMapWithKeysValue - * - * @param callable(TModel, TKey): array $callback - * @return \Illuminate\Support\Collection|static - */ - public function mapWithKeys(callable $callback) - { - $result = parent::mapWithKeys($callback); - - return $result->contains(fn ($item) => ! $item instanceof Model) ? $result->toBase() : $result; - } - - /** - * Reload a fresh model instance from the database for all the entities. - * - * @param array|string $with - * @return static - */ - public function fresh($with = []) - { - if ($this->isEmpty()) { - return new static; - } - - $model = $this->first(); - - $freshModels = $model->newQueryWithoutScopes() - ->with(is_string($with) ? func_get_args() : $with) - ->whereIn($model->getKeyName(), $this->modelKeys()) - ->get() - ->getDictionary(); - - return $this->filter(fn ($model) => $model->exists && isset($freshModels[$model->getKey()])) - ->map(fn ($model) => $freshModels[$model->getKey()]); - } - - /** - * Diff the collection with the given items. - * - * @param iterable $items - * @return static - */ - public function diff($items) - { - $diff = new static; - - $dictionary = $this->getDictionary($items); - - foreach ($this->items as $item) { - if (! isset($dictionary[$item->getKey()])) { - $diff->add($item); - } - } - - return $diff; - } - - /** - * Intersect the collection with the given items. - * - * @param iterable $items - * @return static - */ - public function intersect($items) - { - $intersect = new static; - - if (empty($items)) { - return $intersect; - } - - $dictionary = $this->getDictionary($items); - - foreach ($this->items as $item) { - if (isset($dictionary[$item->getKey()])) { - $intersect->add($item); - } - } - - return $intersect; - } - - /** - * Return only unique items from the collection. - * - * @param (callable(TModel, TKey): mixed)|string|null $key - * @param bool $strict - * @return static - */ - public function unique($key = null, $strict = false) - { - if (! is_null($key)) { - return parent::unique($key, $strict); - } - - return new static(array_values($this->getDictionary())); - } - - /** - * Returns only the models from the collection with the specified keys. - * - * @param array|null $keys - * @return static - */ - public function only($keys) - { - if (is_null($keys)) { - return new static($this->items); - } - - $dictionary = Arr::only($this->getDictionary(), $keys); - - return new static(array_values($dictionary)); - } - - /** - * Returns all models in the collection except the models with specified keys. - * - * @param array|null $keys - * @return static - */ - public function except($keys) - { - $dictionary = Arr::except($this->getDictionary(), $keys); - - return new static(array_values($dictionary)); - } - - /** - * Make the given, typically visible, attributes hidden across the entire collection. - * - * @param array|string $attributes - * @return $this - */ - public function makeHidden($attributes) - { - return $this->each->makeHidden($attributes); - } - - /** - * Make the given, typically hidden, attributes visible across the entire collection. - * - * @param array|string $attributes - * @return $this - */ - public function makeVisible($attributes) - { - return $this->each->makeVisible($attributes); - } - - /** - * Set the visible attributes across the entire collection. - * - * @param array $visible - * @return $this - */ - public function setVisible($visible) - { - return $this->each->setVisible($visible); - } - - /** - * Set the hidden attributes across the entire collection. - * - * @param array $hidden - * @return $this - */ - public function setHidden($hidden) - { - return $this->each->setHidden($hidden); - } - - /** - * Append an attribute across the entire collection. - * - * @param array|string $attributes - * @return $this - */ - public function append($attributes) - { - return $this->each->append($attributes); - } - - /** - * Get a dictionary keyed by primary keys. - * - * @param iterable|null $items - * @return array - */ - public function getDictionary($items = null) - { - $items = is_null($items) ? $this->items : $items; - - $dictionary = []; - - foreach ($items as $value) { - $dictionary[$value->getKey()] = $value; - } - - return $dictionary; - } - - /** - * The following methods are intercepted to always return base collections. - */ - - /** - * Count the number of items in the collection by a field or using a callback. - * - * @param (callable(TModel, TKey): array-key)|string|null $countBy - * @return \Illuminate\Support\Collection - */ - public function countBy($countBy = null) - { - return $this->toBase()->countBy($countBy); - } - - /** - * Collapse the collection of items into a single array. - * - * @return \Illuminate\Support\Collection - */ - public function collapse() - { - return $this->toBase()->collapse(); - } - - /** - * Get a flattened array of the items in the collection. - * - * @param int $depth - * @return \Illuminate\Support\Collection - */ - public function flatten($depth = INF) - { - return $this->toBase()->flatten($depth); - } - - /** - * Flip the items in the collection. - * - * @return \Illuminate\Support\Collection - */ - public function flip() - { - return $this->toBase()->flip(); - } - - /** - * Get the keys of the collection items. - * - * @return \Illuminate\Support\Collection - */ - public function keys() - { - return $this->toBase()->keys(); - } - - /** - * Pad collection to the specified length with a value. - * - * @template TPadValue - * - * @param int $size - * @param TPadValue $value - * @return \Illuminate\Support\Collection - */ - public function pad($size, $value) - { - return $this->toBase()->pad($size, $value); - } - - /** - * Get an array with the values of a given key. - * - * @param string|array $value - * @param string|null $key - * @return \Illuminate\Support\Collection - */ - public function pluck($value, $key = null) - { - return $this->toBase()->pluck($value, $key); - } - - /** - * Zip the collection together with one or more arrays. - * - * @template TZipValue - * - * @param \Illuminate\Contracts\Support\Arrayable|iterable ...$items - * @return \Illuminate\Support\Collection> - */ - public function zip($items) - { - return $this->toBase()->zip(...func_get_args()); - } - - /** - * Get the comparison function to detect duplicates. - * - * @param bool $strict - * @return callable(TModel, TModel): bool - */ - protected function duplicateComparator($strict) - { - return fn ($a, $b) => $a->is($b); - } - - /** - * Get the type of the entities being queued. - * - * @return string|null - * - * @throws \LogicException - */ - public function getQueueableClass() - { - if ($this->isEmpty()) { - return; - } - - $class = $this->getQueueableModelClass($this->first()); - - $this->each(function ($model) use ($class) { - if ($this->getQueueableModelClass($model) !== $class) { - throw new LogicException('Queueing collections with multiple model types is not supported.'); - } - }); - - return $class; - } - - /** - * Get the queueable class name for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return string - */ - protected function getQueueableModelClass($model) - { - return method_exists($model, 'getQueueableClassName') - ? $model->getQueueableClassName() - : get_class($model); - } - - /** - * Get the identifiers for all of the entities. - * - * @return array - */ - public function getQueueableIds() - { - if ($this->isEmpty()) { - return []; - } - - return $this->first() instanceof QueueableEntity - ? $this->map->getQueueableId()->all() - : $this->modelKeys(); - } - - /** - * Get the relationships of the entities being queued. - * - * @return array - */ - public function getQueueableRelations() - { - if ($this->isEmpty()) { - return []; - } - - $relations = $this->map->getQueueableRelations()->all(); - - if (count($relations) === 0 || $relations === [[]]) { - return []; - } elseif (count($relations) === 1) { - return reset($relations); - } else { - return array_intersect(...array_values($relations)); - } - } - - /** - * Get the connection of the entities being queued. - * - * @return string|null - * - * @throws \LogicException - */ - public function getQueueableConnection() - { - if ($this->isEmpty()) { - return; - } - - $connection = $this->first()->getConnectionName(); - - $this->each(function ($model) use ($connection) { - if ($model->getConnectionName() !== $connection) { - throw new LogicException('Queueing collections with multiple model connections is not supported.'); - } - }); - - return $connection; - } - - /** - * Get the Eloquent query builder from the collection. - * - * @return \Illuminate\Database\Eloquent\Builder - * - * @throws \LogicException - */ - public function toQuery() - { - $model = $this->first(); - - if (! $model) { - throw new LogicException('Unable to create query for empty collection.'); - } - - $class = get_class($model); - - if ($this->filter(fn ($model) => ! $model instanceof $class)->isNotEmpty()) { - throw new LogicException('Unable to create query for collection with mixed types.'); - } - - return $model->newModelQuery()->whereKey($this->modelKeys()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php deleted file mode 100644 index bfb6775..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php +++ /dev/null @@ -1,255 +0,0 @@ - - */ - protected $fillable = []; - - /** - * The attributes that aren't mass assignable. - * - * @var array|bool - */ - protected $guarded = ['*']; - - /** - * Indicates if all mass assignment is enabled. - * - * @var bool - */ - protected static $unguarded = false; - - /** - * The actual columns that exist on the database and can be guarded. - * - * @var array - */ - protected static $guardableColumns = []; - - /** - * Get the fillable attributes for the model. - * - * @return array - */ - public function getFillable() - { - return $this->fillable; - } - - /** - * Set the fillable attributes for the model. - * - * @param array $fillable - * @return $this - */ - public function fillable(array $fillable) - { - $this->fillable = $fillable; - - return $this; - } - - /** - * Merge new fillable attributes with existing fillable attributes on the model. - * - * @param array $fillable - * @return $this - */ - public function mergeFillable(array $fillable) - { - $this->fillable = array_merge($this->fillable, $fillable); - - return $this; - } - - /** - * Get the guarded attributes for the model. - * - * @return array - */ - public function getGuarded() - { - return $this->guarded === false - ? [] - : $this->guarded; - } - - /** - * Set the guarded attributes for the model. - * - * @param array $guarded - * @return $this - */ - public function guard(array $guarded) - { - $this->guarded = $guarded; - - return $this; - } - - /** - * Merge new guarded attributes with existing guarded attributes on the model. - * - * @param array $guarded - * @return $this - */ - public function mergeGuarded(array $guarded) - { - $this->guarded = array_merge($this->guarded, $guarded); - - return $this; - } - - /** - * Disable all mass assignable restrictions. - * - * @param bool $state - * @return void - */ - public static function unguard($state = true) - { - static::$unguarded = $state; - } - - /** - * Enable the mass assignment restrictions. - * - * @return void - */ - public static function reguard() - { - static::$unguarded = false; - } - - /** - * Determine if the current state is "unguarded". - * - * @return bool - */ - public static function isUnguarded() - { - return static::$unguarded; - } - - /** - * Run the given callable while being unguarded. - * - * @param callable $callback - * @return mixed - */ - public static function unguarded(callable $callback) - { - if (static::$unguarded) { - return $callback(); - } - - static::unguard(); - - try { - return $callback(); - } finally { - static::reguard(); - } - } - - /** - * Determine if the given attribute may be mass assigned. - * - * @param string $key - * @return bool - */ - public function isFillable($key) - { - if (static::$unguarded) { - return true; - } - - // If the key is in the "fillable" array, we can of course assume that it's - // a fillable attribute. Otherwise, we will check the guarded array when - // we need to determine if the attribute is black-listed on the model. - if (in_array($key, $this->getFillable())) { - return true; - } - - // If the attribute is explicitly listed in the "guarded" array then we can - // return false immediately. This means this attribute is definitely not - // fillable and there is no point in going any further in this method. - if ($this->isGuarded($key)) { - return false; - } - - return empty($this->getFillable()) && - ! str_contains($key, '.') && - ! str_starts_with($key, '_'); - } - - /** - * Determine if the given key is guarded. - * - * @param string $key - * @return bool - */ - public function isGuarded($key) - { - if (empty($this->getGuarded())) { - return false; - } - - return $this->getGuarded() == ['*'] || - ! empty(preg_grep('/^'.preg_quote($key, '/').'$/i', $this->getGuarded())) || - ! $this->isGuardableColumn($key); - } - - /** - * Determine if the given column is a valid, guardable column. - * - * @param string $key - * @return bool - */ - protected function isGuardableColumn($key) - { - if (! isset(static::$guardableColumns[get_class($this)])) { - $columns = $this->getConnection() - ->getSchemaBuilder() - ->getColumnListing($this->getTable()); - - if (empty($columns)) { - return true; - } - static::$guardableColumns[get_class($this)] = $columns; - } - - return in_array($key, static::$guardableColumns[get_class($this)]); - } - - /** - * Determine if the model is totally guarded. - * - * @return bool - */ - public function totallyGuarded() - { - return count($this->getFillable()) === 0 && $this->getGuarded() == ['*']; - } - - /** - * Get the fillable attributes of a given array. - * - * @param array $attributes - * @return array - */ - protected function fillableFromArray(array $attributes) - { - if (count($this->getFillable()) > 0 && ! static::$unguarded) { - return array_intersect_key($attributes, array_flip($this->getFillable())); - } - - return $attributes; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php deleted file mode 100644 index 2b1b7ca..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ /dev/null @@ -1,2232 +0,0 @@ -addDateAttributesToArray( - $attributes = $this->getArrayableAttributes() - ); - - $attributes = $this->addMutatedAttributesToArray( - $attributes, $mutatedAttributes = $this->getMutatedAttributes() - ); - - // Next we will handle any casts that have been setup for this model and cast - // the values to their appropriate type. If the attribute has a mutator we - // will not perform the cast on those attributes to avoid any confusion. - $attributes = $this->addCastAttributesToArray( - $attributes, $mutatedAttributes - ); - - // Here we will grab all of the appended, calculated attributes to this model - // as these attributes are not really in the attributes array, but are run - // when we need to array or JSON the model for convenience to the coder. - foreach ($this->getArrayableAppends() as $key) { - $attributes[$key] = $this->mutateAttributeForArray($key, null); - } - - return $attributes; - } - - /** - * Add the date attributes to the attributes array. - * - * @param array $attributes - * @return array - */ - protected function addDateAttributesToArray(array $attributes) - { - foreach ($this->getDates() as $key) { - if (! isset($attributes[$key])) { - continue; - } - - $attributes[$key] = $this->serializeDate( - $this->asDateTime($attributes[$key]) - ); - } - - return $attributes; - } - - /** - * Add the mutated attributes to the attributes array. - * - * @param array $attributes - * @param array $mutatedAttributes - * @return array - */ - protected function addMutatedAttributesToArray(array $attributes, array $mutatedAttributes) - { - foreach ($mutatedAttributes as $key) { - // We want to spin through all the mutated attributes for this model and call - // the mutator for the attribute. We cache off every mutated attributes so - // we don't have to constantly check on attributes that actually change. - if (! array_key_exists($key, $attributes)) { - continue; - } - - // Next, we will call the mutator for this attribute so that we can get these - // mutated attribute's actual values. After we finish mutating each of the - // attributes we will return this final array of the mutated attributes. - $attributes[$key] = $this->mutateAttributeForArray( - $key, $attributes[$key] - ); - } - - return $attributes; - } - - /** - * Add the casted attributes to the attributes array. - * - * @param array $attributes - * @param array $mutatedAttributes - * @return array - */ - protected function addCastAttributesToArray(array $attributes, array $mutatedAttributes) - { - foreach ($this->getCasts() as $key => $value) { - if (! array_key_exists($key, $attributes) || - in_array($key, $mutatedAttributes)) { - continue; - } - - // Here we will cast the attribute. Then, if the cast is a date or datetime cast - // then we will serialize the date for the array. This will convert the dates - // to strings based on the date format specified for these Eloquent models. - $attributes[$key] = $this->castAttribute( - $key, $attributes[$key] - ); - - // If the attribute cast was a date or a datetime, we will serialize the date as - // a string. This allows the developers to customize how dates are serialized - // into an array without affecting how they are persisted into the storage. - if (isset($attributes[$key]) && in_array($value, ['date', 'datetime', 'immutable_date', 'immutable_datetime'])) { - $attributes[$key] = $this->serializeDate($attributes[$key]); - } - - if (isset($attributes[$key]) && ($this->isCustomDateTimeCast($value) || - $this->isImmutableCustomDateTimeCast($value))) { - $attributes[$key] = $attributes[$key]->format(explode(':', $value, 2)[1]); - } - - if ($attributes[$key] instanceof DateTimeInterface && - $this->isClassCastable($key)) { - $attributes[$key] = $this->serializeDate($attributes[$key]); - } - - if (isset($attributes[$key]) && $this->isClassSerializable($key)) { - $attributes[$key] = $this->serializeClassCastableAttribute($key, $attributes[$key]); - } - - if ($this->isEnumCastable($key) && (! ($attributes[$key] ?? null) instanceof Arrayable)) { - $attributes[$key] = isset($attributes[$key]) ? $this->getStorableEnumValue($attributes[$key]) : null; - } - - if ($attributes[$key] instanceof Arrayable) { - $attributes[$key] = $attributes[$key]->toArray(); - } - } - - return $attributes; - } - - /** - * Get an attribute array of all arrayable attributes. - * - * @return array - */ - protected function getArrayableAttributes() - { - return $this->getArrayableItems($this->getAttributes()); - } - - /** - * Get all of the appendable values that are arrayable. - * - * @return array - */ - protected function getArrayableAppends() - { - if (! count($this->appends)) { - return []; - } - - return $this->getArrayableItems( - array_combine($this->appends, $this->appends) - ); - } - - /** - * Get the model's relationships in array form. - * - * @return array - */ - public function relationsToArray() - { - $attributes = []; - - foreach ($this->getArrayableRelations() as $key => $value) { - // If the values implement the Arrayable interface we can just call this - // toArray method on the instances which will convert both models and - // collections to their proper array form and we'll set the values. - if ($value instanceof Arrayable) { - $relation = $value->toArray(); - } - - // If the value is null, we'll still go ahead and set it in this list of - // attributes, since null is used to represent empty relationships if - // it has a has one or belongs to type relationships on the models. - elseif (is_null($value)) { - $relation = $value; - } - - // If the relationships snake-casing is enabled, we will snake case this - // key so that the relation attribute is snake cased in this returned - // array to the developers, making this consistent with attributes. - if (static::$snakeAttributes) { - $key = Str::snake($key); - } - - // If the relation value has been set, we will set it on this attributes - // list for returning. If it was not arrayable or null, we'll not set - // the value on the array because it is some type of invalid value. - if (isset($relation) || is_null($value)) { - $attributes[$key] = $relation; - } - - unset($relation); - } - - return $attributes; - } - - /** - * Get an attribute array of all arrayable relations. - * - * @return array - */ - protected function getArrayableRelations() - { - return $this->getArrayableItems($this->relations); - } - - /** - * Get an attribute array of all arrayable values. - * - * @param array $values - * @return array - */ - protected function getArrayableItems(array $values) - { - if (count($this->getVisible()) > 0) { - $values = array_intersect_key($values, array_flip($this->getVisible())); - } - - if (count($this->getHidden()) > 0) { - $values = array_diff_key($values, array_flip($this->getHidden())); - } - - return $values; - } - - /** - * Get an attribute from the model. - * - * @param string $key - * @return mixed - */ - public function getAttribute($key) - { - if (! $key) { - return; - } - - // If the attribute exists in the attribute array or has a "get" mutator we will - // get the attribute's value. Otherwise, we will proceed as if the developers - // are asking for a relationship's value. This covers both types of values. - if (array_key_exists($key, $this->attributes) || - array_key_exists($key, $this->casts) || - $this->hasGetMutator($key) || - $this->hasAttributeMutator($key) || - $this->isClassCastable($key)) { - return $this->getAttributeValue($key); - } - - // Here we will determine if the model base class itself contains this given key - // since we don't want to treat any of those methods as relationships because - // they are all intended as helper methods and none of these are relations. - if (method_exists(self::class, $key)) { - return $this->throwMissingAttributeExceptionIfApplicable($key); - } - - return $this->isRelation($key) || $this->relationLoaded($key) - ? $this->getRelationValue($key) - : $this->throwMissingAttributeExceptionIfApplicable($key); - } - - /** - * Either throw a missing attribute exception or return null depending on Eloquent's configuration. - * - * @param string $key - * @return null - * - * @throws \Illuminate\Database\Eloquent\MissingAttributeException - */ - protected function throwMissingAttributeExceptionIfApplicable($key) - { - if ($this->exists && - ! $this->wasRecentlyCreated && - static::preventsAccessingMissingAttributes()) { - if (isset(static::$missingAttributeViolationCallback)) { - return call_user_func(static::$missingAttributeViolationCallback, $this, $key); - } - - throw new MissingAttributeException($this, $key); - } - - return null; - } - - /** - * Get a plain attribute (not a relationship). - * - * @param string $key - * @return mixed - */ - public function getAttributeValue($key) - { - return $this->transformModelValue($key, $this->getAttributeFromArray($key)); - } - - /** - * Get an attribute from the $attributes array. - * - * @param string $key - * @return mixed - */ - protected function getAttributeFromArray($key) - { - return $this->getAttributes()[$key] ?? null; - } - - /** - * Get a relationship. - * - * @param string $key - * @return mixed - */ - public function getRelationValue($key) - { - // If the key already exists in the relationships array, it just means the - // relationship has already been loaded, so we'll just return it out of - // here because there is no need to query within the relations twice. - if ($this->relationLoaded($key)) { - return $this->relations[$key]; - } - - if (! $this->isRelation($key)) { - return; - } - - if ($this->preventsLazyLoading) { - $this->handleLazyLoadingViolation($key); - } - - // If the "attribute" exists as a method on the model, we will just assume - // it is a relationship and will load and return results from the query - // and hydrate the relationship's value on the "relationships" array. - return $this->getRelationshipFromMethod($key); - } - - /** - * Determine if the given key is a relationship method on the model. - * - * @param string $key - * @return bool - */ - public function isRelation($key) - { - if ($this->hasAttributeMutator($key)) { - return false; - } - - return method_exists($this, $key) || - $this->relationResolver(static::class, $key); - } - - /** - * Handle a lazy loading violation. - * - * @param string $key - * @return mixed - */ - protected function handleLazyLoadingViolation($key) - { - if (isset(static::$lazyLoadingViolationCallback)) { - return call_user_func(static::$lazyLoadingViolationCallback, $this, $key); - } - - if (! $this->exists || $this->wasRecentlyCreated) { - return; - } - - throw new LazyLoadingViolationException($this, $key); - } - - /** - * Get a relationship value from a method. - * - * @param string $method - * @return mixed - * - * @throws \LogicException - */ - protected function getRelationshipFromMethod($method) - { - $relation = $this->$method(); - - if (! $relation instanceof Relation) { - if (is_null($relation)) { - throw new LogicException(sprintf( - '%s::%s must return a relationship instance, but "null" was returned. Was the "return" keyword used?', static::class, $method - )); - } - - throw new LogicException(sprintf( - '%s::%s must return a relationship instance.', static::class, $method - )); - } - - return tap($relation->getResults(), function ($results) use ($method) { - $this->setRelation($method, $results); - }); - } - - /** - * Determine if a get mutator exists for an attribute. - * - * @param string $key - * @return bool - */ - public function hasGetMutator($key) - { - return method_exists($this, 'get'.Str::studly($key).'Attribute'); - } - - /** - * Determine if a "Attribute" return type marked mutator exists for an attribute. - * - * @param string $key - * @return bool - */ - public function hasAttributeMutator($key) - { - if (isset(static::$attributeMutatorCache[get_class($this)][$key])) { - return static::$attributeMutatorCache[get_class($this)][$key]; - } - - if (! method_exists($this, $method = Str::camel($key))) { - return static::$attributeMutatorCache[get_class($this)][$key] = false; - } - - $returnType = (new ReflectionMethod($this, $method))->getReturnType(); - - return static::$attributeMutatorCache[get_class($this)][$key] = - $returnType instanceof ReflectionNamedType && - $returnType->getName() === Attribute::class; - } - - /** - * Determine if a "Attribute" return type marked get mutator exists for an attribute. - * - * @param string $key - * @return bool - */ - public function hasAttributeGetMutator($key) - { - if (isset(static::$getAttributeMutatorCache[get_class($this)][$key])) { - return static::$getAttributeMutatorCache[get_class($this)][$key]; - } - - if (! $this->hasAttributeMutator($key)) { - return static::$getAttributeMutatorCache[get_class($this)][$key] = false; - } - - return static::$getAttributeMutatorCache[get_class($this)][$key] = is_callable($this->{Str::camel($key)}()->get); - } - - /** - * Get the value of an attribute using its mutator. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function mutateAttribute($key, $value) - { - return $this->{'get'.Str::studly($key).'Attribute'}($value); - } - - /** - * Get the value of an "Attribute" return type marked attribute using its mutator. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function mutateAttributeMarkedAttribute($key, $value) - { - if (array_key_exists($key, $this->attributeCastCache)) { - return $this->attributeCastCache[$key]; - } - - $attribute = $this->{Str::camel($key)}(); - - $value = call_user_func($attribute->get ?: function ($value) { - return $value; - }, $value, $this->attributes); - - if ($attribute->withCaching || (is_object($value) && $attribute->withObjectCaching)) { - $this->attributeCastCache[$key] = $value; - } else { - unset($this->attributeCastCache[$key]); - } - - return $value; - } - - /** - * Get the value of an attribute using its mutator for array conversion. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function mutateAttributeForArray($key, $value) - { - if ($this->isClassCastable($key)) { - $value = $this->getClassCastableAttributeValue($key, $value); - } elseif (isset(static::$getAttributeMutatorCache[get_class($this)][$key]) && - static::$getAttributeMutatorCache[get_class($this)][$key] === true) { - $value = $this->mutateAttributeMarkedAttribute($key, $value); - - $value = $value instanceof DateTimeInterface - ? $this->serializeDate($value) - : $value; - } else { - $value = $this->mutateAttribute($key, $value); - } - - return $value instanceof Arrayable ? $value->toArray() : $value; - } - - /** - * Merge new casts with existing casts on the model. - * - * @param array $casts - * @return $this - */ - public function mergeCasts($casts) - { - $this->casts = array_merge($this->casts, $casts); - - return $this; - } - - /** - * Cast an attribute to a native PHP type. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function castAttribute($key, $value) - { - $castType = $this->getCastType($key); - - if (is_null($value) && in_array($castType, static::$primitiveCastTypes)) { - return $value; - } - - // If the key is one of the encrypted castable types, we'll first decrypt - // the value and update the cast type so we may leverage the following - // logic for casting this value to any additionally specified types. - if ($this->isEncryptedCastable($key)) { - $value = $this->fromEncryptedString($value); - - $castType = Str::after($castType, 'encrypted:'); - } - - switch ($castType) { - case 'int': - case 'integer': - return (int) $value; - case 'real': - case 'float': - case 'double': - return $this->fromFloat($value); - case 'decimal': - return $this->asDecimal($value, explode(':', $this->getCasts()[$key], 2)[1]); - case 'string': - return (string) $value; - case 'bool': - case 'boolean': - return (bool) $value; - case 'object': - return $this->fromJson($value, true); - case 'array': - case 'json': - return $this->fromJson($value); - case 'collection': - return new BaseCollection($this->fromJson($value)); - case 'date': - return $this->asDate($value); - case 'datetime': - case 'custom_datetime': - return $this->asDateTime($value); - case 'immutable_date': - return $this->asDate($value)->toImmutable(); - case 'immutable_custom_datetime': - case 'immutable_datetime': - return $this->asDateTime($value)->toImmutable(); - case 'timestamp': - return $this->asTimestamp($value); - } - - if ($this->isEnumCastable($key)) { - return $this->getEnumCastableAttributeValue($key, $value); - } - - if ($this->isClassCastable($key)) { - return $this->getClassCastableAttributeValue($key, $value); - } - - return $value; - } - - /** - * Cast the given attribute using a custom cast class. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function getClassCastableAttributeValue($key, $value) - { - if (isset($this->classCastCache[$key])) { - return $this->classCastCache[$key]; - } else { - $caster = $this->resolveCasterClass($key); - - $value = $caster instanceof CastsInboundAttributes - ? $value - : $caster->get($this, $key, $value, $this->attributes); - - if ($caster instanceof CastsInboundAttributes || ! is_object($value)) { - unset($this->classCastCache[$key]); - } else { - $this->classCastCache[$key] = $value; - } - - return $value; - } - } - - /** - * Cast the given attribute to an enum. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function getEnumCastableAttributeValue($key, $value) - { - if (is_null($value)) { - return; - } - - $castType = $this->getCasts()[$key]; - - if ($value instanceof $castType) { - return $value; - } - - return $this->getEnumCaseFromValue($castType, $value); - } - - /** - * Get the type of cast for a model attribute. - * - * @param string $key - * @return string - */ - protected function getCastType($key) - { - $castType = $this->getCasts()[$key]; - - if (isset(static::$castTypeCache[$castType])) { - return static::$castTypeCache[$castType]; - } - - if ($this->isCustomDateTimeCast($castType)) { - $convertedCastType = 'custom_datetime'; - } elseif ($this->isImmutableCustomDateTimeCast($castType)) { - $convertedCastType = 'immutable_custom_datetime'; - } elseif ($this->isDecimalCast($castType)) { - $convertedCastType = 'decimal'; - } else { - $convertedCastType = trim(strtolower($castType)); - } - - return static::$castTypeCache[$castType] = $convertedCastType; - } - - /** - * Increment or decrement the given attribute using the custom cast class. - * - * @param string $method - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function deviateClassCastableAttribute($method, $key, $value) - { - return $this->resolveCasterClass($key)->{$method}( - $this, $key, $value, $this->attributes - ); - } - - /** - * Serialize the given attribute using the custom cast class. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function serializeClassCastableAttribute($key, $value) - { - return $this->resolveCasterClass($key)->serialize( - $this, $key, $value, $this->attributes - ); - } - - /** - * Determine if the cast type is a custom date time cast. - * - * @param string $cast - * @return bool - */ - protected function isCustomDateTimeCast($cast) - { - return str_starts_with($cast, 'date:') || - str_starts_with($cast, 'datetime:'); - } - - /** - * Determine if the cast type is an immutable custom date time cast. - * - * @param string $cast - * @return bool - */ - protected function isImmutableCustomDateTimeCast($cast) - { - return str_starts_with($cast, 'immutable_date:') || - str_starts_with($cast, 'immutable_datetime:'); - } - - /** - * Determine if the cast type is a decimal cast. - * - * @param string $cast - * @return bool - */ - protected function isDecimalCast($cast) - { - return str_starts_with($cast, 'decimal:'); - } - - /** - * Set a given attribute on the model. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - public function setAttribute($key, $value) - { - // First we will check for the presence of a mutator for the set operation - // which simply lets the developers tweak the attribute as it is set on - // this model, such as "json_encoding" a listing of data for storage. - if ($this->hasSetMutator($key)) { - return $this->setMutatedAttributeValue($key, $value); - } elseif ($this->hasAttributeSetMutator($key)) { - return $this->setAttributeMarkedMutatedAttributeValue($key, $value); - } - - // If an attribute is listed as a "date", we'll convert it from a DateTime - // instance into a form proper for storage on the database tables using - // the connection grammar's date format. We will auto set the values. - elseif (! is_null($value) && $this->isDateAttribute($key)) { - $value = $this->fromDateTime($value); - } - - if ($this->isEnumCastable($key)) { - $this->setEnumCastableAttribute($key, $value); - - return $this; - } - - if ($this->isClassCastable($key)) { - $this->setClassCastableAttribute($key, $value); - - return $this; - } - - if (! is_null($value) && $this->isJsonCastable($key)) { - $value = $this->castAttributeAsJson($key, $value); - } - - // If this attribute contains a JSON ->, we'll set the proper value in the - // attribute's underlying array. This takes care of properly nesting an - // attribute in the array's value in the case of deeply nested items. - if (str_contains($key, '->')) { - return $this->fillJsonAttribute($key, $value); - } - - if (! is_null($value) && $this->isEncryptedCastable($key)) { - $value = $this->castAttributeAsEncryptedString($key, $value); - } - - $this->attributes[$key] = $value; - - return $this; - } - - /** - * Determine if a set mutator exists for an attribute. - * - * @param string $key - * @return bool - */ - public function hasSetMutator($key) - { - return method_exists($this, 'set'.Str::studly($key).'Attribute'); - } - - /** - * Determine if an "Attribute" return type marked set mutator exists for an attribute. - * - * @param string $key - * @return bool - */ - public function hasAttributeSetMutator($key) - { - $class = get_class($this); - - if (isset(static::$setAttributeMutatorCache[$class][$key])) { - return static::$setAttributeMutatorCache[$class][$key]; - } - - if (! method_exists($this, $method = Str::camel($key))) { - return static::$setAttributeMutatorCache[$class][$key] = false; - } - - $returnType = (new ReflectionMethod($this, $method))->getReturnType(); - - return static::$setAttributeMutatorCache[$class][$key] = - $returnType instanceof ReflectionNamedType && - $returnType->getName() === Attribute::class && - is_callable($this->{$method}()->set); - } - - /** - * Set the value of an attribute using its mutator. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function setMutatedAttributeValue($key, $value) - { - return $this->{'set'.Str::studly($key).'Attribute'}($value); - } - - /** - * Set the value of a "Attribute" return type marked attribute using its mutator. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function setAttributeMarkedMutatedAttributeValue($key, $value) - { - $attribute = $this->{Str::camel($key)}(); - - $callback = $attribute->set ?: function ($value) use ($key) { - $this->attributes[$key] = $value; - }; - - $this->attributes = array_merge( - $this->attributes, - $this->normalizeCastClassResponse( - $key, $callback($value, $this->attributes) - ) - ); - - if ($attribute->withCaching || (is_object($value) && $attribute->withObjectCaching)) { - $this->attributeCastCache[$key] = $value; - } else { - unset($this->attributeCastCache[$key]); - } - - return $this; - } - - /** - * Determine if the given attribute is a date or date castable. - * - * @param string $key - * @return bool - */ - protected function isDateAttribute($key) - { - return in_array($key, $this->getDates(), true) || - $this->isDateCastable($key); - } - - /** - * Set a given JSON attribute on the model. - * - * @param string $key - * @param mixed $value - * @return $this - */ - public function fillJsonAttribute($key, $value) - { - [$key, $path] = explode('->', $key, 2); - - $value = $this->asJson($this->getArrayAttributeWithValue( - $path, $key, $value - )); - - $this->attributes[$key] = $this->isEncryptedCastable($key) - ? $this->castAttributeAsEncryptedString($key, $value) - : $value; - - if ($this->isClassCastable($key)) { - unset($this->classCastCache[$key]); - } - - return $this; - } - - /** - * Set the value of a class castable attribute. - * - * @param string $key - * @param mixed $value - * @return void - */ - protected function setClassCastableAttribute($key, $value) - { - $caster = $this->resolveCasterClass($key); - - $this->attributes = array_replace( - $this->attributes, - $this->normalizeCastClassResponse($key, $caster->set( - $this, $key, $value, $this->attributes - )) - ); - - if ($caster instanceof CastsInboundAttributes || ! is_object($value)) { - unset($this->classCastCache[$key]); - } else { - $this->classCastCache[$key] = $value; - } - } - - /** - * Set the value of an enum castable attribute. - * - * @param string $key - * @param \UnitEnum|string|int $value - * @return void - */ - protected function setEnumCastableAttribute($key, $value) - { - $enumClass = $this->getCasts()[$key]; - - if (! isset($value)) { - $this->attributes[$key] = null; - } elseif (is_object($value)) { - $this->attributes[$key] = $this->getStorableEnumValue($value); - } else { - $this->attributes[$key] = $this->getStorableEnumValue( - $this->getEnumCaseFromValue($enumClass, $value) - ); - } - } - - /** - * Get an enum case instance from a given class and value. - * - * @param string $enumClass - * @param string|int $value - * @return \UnitEnum|\BackedEnum - */ - protected function getEnumCaseFromValue($enumClass, $value) - { - return is_subclass_of($enumClass, BackedEnum::class) - ? $enumClass::from($value) - : constant($enumClass.'::'.$value); - } - - /** - * Get the storable value from the given enum. - * - * @param \UnitEnum|\BackedEnum $value - * @return string|int - */ - protected function getStorableEnumValue($value) - { - return $value instanceof BackedEnum - ? $value->value - : $value->name; - } - - /** - * Get an array attribute with the given key and value set. - * - * @param string $path - * @param string $key - * @param mixed $value - * @return $this - */ - protected function getArrayAttributeWithValue($path, $key, $value) - { - return tap($this->getArrayAttributeByKey($key), function (&$array) use ($path, $value) { - Arr::set($array, str_replace('->', '.', $path), $value); - }); - } - - /** - * Get an array attribute or return an empty array if it is not set. - * - * @param string $key - * @return array - */ - protected function getArrayAttributeByKey($key) - { - if (! isset($this->attributes[$key])) { - return []; - } - - return $this->fromJson( - $this->isEncryptedCastable($key) - ? $this->fromEncryptedString($this->attributes[$key]) - : $this->attributes[$key] - ); - } - - /** - * Cast the given attribute to JSON. - * - * @param string $key - * @param mixed $value - * @return string - */ - protected function castAttributeAsJson($key, $value) - { - $value = $this->asJson($value); - - if ($value === false) { - throw JsonEncodingException::forAttribute( - $this, $key, json_last_error_msg() - ); - } - - return $value; - } - - /** - * Encode the given value as JSON. - * - * @param mixed $value - * @return string - */ - protected function asJson($value) - { - return json_encode($value); - } - - /** - * Decode the given JSON back into an array or object. - * - * @param string $value - * @param bool $asObject - * @return mixed - */ - public function fromJson($value, $asObject = false) - { - return json_decode($value ?? '', ! $asObject); - } - - /** - * Decrypt the given encrypted string. - * - * @param string $value - * @return mixed - */ - public function fromEncryptedString($value) - { - return (static::$encrypter ?? Crypt::getFacadeRoot())->decrypt($value, false); - } - - /** - * Cast the given attribute to an encrypted string. - * - * @param string $key - * @param mixed $value - * @return string - */ - protected function castAttributeAsEncryptedString($key, $value) - { - return (static::$encrypter ?? Crypt::getFacadeRoot())->encrypt($value, false); - } - - /** - * Set the encrypter instance that will be used to encrypt attributes. - * - * @param \Illuminate\Contracts\Encryption\Encrypter|null $encrypter - * @return void - */ - public static function encryptUsing($encrypter) - { - static::$encrypter = $encrypter; - } - - /** - * Decode the given float. - * - * @param mixed $value - * @return mixed - */ - public function fromFloat($value) - { - return match ((string) $value) { - 'Infinity' => INF, - '-Infinity' => -INF, - 'NaN' => NAN, - default => (float) $value, - }; - } - - /** - * Return a decimal as string. - * - * @param float|string $value - * @param int $decimals - * @return string - */ - protected function asDecimal($value, $decimals) - { - try { - return (string) BigDecimal::of($value)->toScale($decimals, RoundingMode::HALF_UP); - } catch (BrickMathException $e) { - throw new MathException('Unable to cast value to a decimal.', previous: $e); - } - } - - /** - * Return a timestamp as DateTime object with time set to 00:00:00. - * - * @param mixed $value - * @return \Illuminate\Support\Carbon - */ - protected function asDate($value) - { - return $this->asDateTime($value)->startOfDay(); - } - - /** - * Return a timestamp as DateTime object. - * - * @param mixed $value - * @return \Illuminate\Support\Carbon - */ - protected function asDateTime($value) - { - // If this value is already a Carbon instance, we shall just return it as is. - // This prevents us having to re-instantiate a Carbon instance when we know - // it already is one, which wouldn't be fulfilled by the DateTime check. - if ($value instanceof CarbonInterface) { - return Date::instance($value); - } - - // If the value is already a DateTime instance, we will just skip the rest of - // these checks since they will be a waste of time, and hinder performance - // when checking the field. We will just return the DateTime right away. - if ($value instanceof DateTimeInterface) { - return Date::parse( - $value->format('Y-m-d H:i:s.u'), $value->getTimezone() - ); - } - - // If this value is an integer, we will assume it is a UNIX timestamp's value - // and format a Carbon object from this timestamp. This allows flexibility - // when defining your date fields as they might be UNIX timestamps here. - if (is_numeric($value)) { - return Date::createFromTimestamp($value); - } - - // If the value is in simply year, month, day format, we will instantiate the - // Carbon instances from that format. Again, this provides for simple date - // fields on the database, while still supporting Carbonized conversion. - if ($this->isStandardDateFormat($value)) { - return Date::instance(Carbon::createFromFormat('Y-m-d', $value)->startOfDay()); - } - - $format = $this->getDateFormat(); - - // Finally, we will just assume this date is in the format used by default on - // the database connection and use that format to create the Carbon object - // that is returned back out to the developers after we convert it here. - try { - $date = Date::createFromFormat($format, $value); - } catch (InvalidArgumentException $e) { - $date = false; - } - - return $date ?: Date::parse($value); - } - - /** - * Determine if the given value is a standard date format. - * - * @param string $value - * @return bool - */ - protected function isStandardDateFormat($value) - { - return preg_match('/^(\d{4})-(\d{1,2})-(\d{1,2})$/', $value); - } - - /** - * Convert a DateTime to a storable string. - * - * @param mixed $value - * @return string|null - */ - public function fromDateTime($value) - { - return empty($value) ? $value : $this->asDateTime($value)->format( - $this->getDateFormat() - ); - } - - /** - * Return a timestamp as unix timestamp. - * - * @param mixed $value - * @return int - */ - protected function asTimestamp($value) - { - return $this->asDateTime($value)->getTimestamp(); - } - - /** - * Prepare a date for array / JSON serialization. - * - * @param \DateTimeInterface $date - * @return string - */ - protected function serializeDate(DateTimeInterface $date) - { - return $date instanceof DateTimeImmutable ? - CarbonImmutable::instance($date)->toJSON() : - Carbon::instance($date)->toJSON(); - } - - /** - * Get the attributes that should be converted to dates. - * - * @return array - */ - public function getDates() - { - if (! $this->usesTimestamps()) { - return $this->dates; - } - - $defaults = [ - $this->getCreatedAtColumn(), - $this->getUpdatedAtColumn(), - ]; - - return array_unique(array_merge($this->dates, $defaults)); - } - - /** - * Get the format for database stored dates. - * - * @return string - */ - public function getDateFormat() - { - return $this->dateFormat ?: $this->getConnection()->getQueryGrammar()->getDateFormat(); - } - - /** - * Set the date format used by the model. - * - * @param string $format - * @return $this - */ - public function setDateFormat($format) - { - $this->dateFormat = $format; - - return $this; - } - - /** - * Determine whether an attribute should be cast to a native type. - * - * @param string $key - * @param array|string|null $types - * @return bool - */ - public function hasCast($key, $types = null) - { - if (array_key_exists($key, $this->getCasts())) { - return $types ? in_array($this->getCastType($key), (array) $types, true) : true; - } - - return false; - } - - /** - * Get the casts array. - * - * @return array - */ - public function getCasts() - { - if ($this->getIncrementing()) { - return array_merge([$this->getKeyName() => $this->getKeyType()], $this->casts); - } - - return $this->casts; - } - - /** - * Determine whether a value is Date / DateTime castable for inbound manipulation. - * - * @param string $key - * @return bool - */ - protected function isDateCastable($key) - { - return $this->hasCast($key, ['date', 'datetime', 'immutable_date', 'immutable_datetime']); - } - - /** - * Determine whether a value is Date / DateTime custom-castable for inbound manipulation. - * - * @param string $key - * @return bool - */ - protected function isDateCastableWithCustomFormat($key) - { - return $this->hasCast($key, ['custom_datetime', 'immutable_custom_datetime']); - } - - /** - * Determine whether a value is JSON castable for inbound manipulation. - * - * @param string $key - * @return bool - */ - protected function isJsonCastable($key) - { - return $this->hasCast($key, ['array', 'json', 'object', 'collection', 'encrypted:array', 'encrypted:collection', 'encrypted:json', 'encrypted:object']); - } - - /** - * Determine whether a value is an encrypted castable for inbound manipulation. - * - * @param string $key - * @return bool - */ - protected function isEncryptedCastable($key) - { - return $this->hasCast($key, ['encrypted', 'encrypted:array', 'encrypted:collection', 'encrypted:json', 'encrypted:object']); - } - - /** - * Determine if the given key is cast using a custom class. - * - * @param string $key - * @return bool - * - * @throws \Illuminate\Database\Eloquent\InvalidCastException - */ - protected function isClassCastable($key) - { - $casts = $this->getCasts(); - - if (! array_key_exists($key, $casts)) { - return false; - } - - $castType = $this->parseCasterClass($casts[$key]); - - if (in_array($castType, static::$primitiveCastTypes)) { - return false; - } - - if (class_exists($castType)) { - return true; - } - - throw new InvalidCastException($this->getModel(), $key, $castType); - } - - /** - * Determine if the given key is cast using an enum. - * - * @param string $key - * @return bool - */ - protected function isEnumCastable($key) - { - $casts = $this->getCasts(); - - if (! array_key_exists($key, $casts)) { - return false; - } - - $castType = $casts[$key]; - - if (in_array($castType, static::$primitiveCastTypes)) { - return false; - } - - if (function_exists('enum_exists') && enum_exists($castType)) { - return true; - } - } - - /** - * Determine if the key is deviable using a custom class. - * - * @param string $key - * @return bool - * - * @throws \Illuminate\Database\Eloquent\InvalidCastException - */ - protected function isClassDeviable($key) - { - if (! $this->isClassCastable($key)) { - return false; - } - - $castType = $this->resolveCasterClass($key); - - return method_exists($castType::class, 'increment') && method_exists($castType::class, 'decrement'); - } - - /** - * Determine if the key is serializable using a custom class. - * - * @param string $key - * @return bool - * - * @throws \Illuminate\Database\Eloquent\InvalidCastException - */ - protected function isClassSerializable($key) - { - return ! $this->isEnumCastable($key) && - $this->isClassCastable($key) && - method_exists($this->resolveCasterClass($key), 'serialize'); - } - - /** - * Resolve the custom caster class for a given key. - * - * @param string $key - * @return mixed - */ - protected function resolveCasterClass($key) - { - $castType = $this->getCasts()[$key]; - - $arguments = []; - - if (is_string($castType) && str_contains($castType, ':')) { - $segments = explode(':', $castType, 2); - - $castType = $segments[0]; - $arguments = explode(',', $segments[1]); - } - - if (is_subclass_of($castType, Castable::class)) { - $castType = $castType::castUsing($arguments); - } - - if (is_object($castType)) { - return $castType; - } - - return new $castType(...$arguments); - } - - /** - * Parse the given caster class, removing any arguments. - * - * @param string $class - * @return string - */ - protected function parseCasterClass($class) - { - return ! str_contains($class, ':') - ? $class - : explode(':', $class, 2)[0]; - } - - /** - * Merge the cast class and attribute cast attributes back into the model. - * - * @return void - */ - protected function mergeAttributesFromCachedCasts() - { - $this->mergeAttributesFromClassCasts(); - $this->mergeAttributesFromAttributeCasts(); - } - - /** - * Merge the cast class attributes back into the model. - * - * @return void - */ - protected function mergeAttributesFromClassCasts() - { - foreach ($this->classCastCache as $key => $value) { - $caster = $this->resolveCasterClass($key); - - $this->attributes = array_merge( - $this->attributes, - $caster instanceof CastsInboundAttributes - ? [$key => $value] - : $this->normalizeCastClassResponse($key, $caster->set($this, $key, $value, $this->attributes)) - ); - } - } - - /** - * Merge the cast class attributes back into the model. - * - * @return void - */ - protected function mergeAttributesFromAttributeCasts() - { - foreach ($this->attributeCastCache as $key => $value) { - $attribute = $this->{Str::camel($key)}(); - - if ($attribute->get && ! $attribute->set) { - continue; - } - - $callback = $attribute->set ?: function ($value) use ($key) { - $this->attributes[$key] = $value; - }; - - $this->attributes = array_merge( - $this->attributes, - $this->normalizeCastClassResponse( - $key, $callback($value, $this->attributes) - ) - ); - } - } - - /** - * Normalize the response from a custom class caster. - * - * @param string $key - * @param mixed $value - * @return array - */ - protected function normalizeCastClassResponse($key, $value) - { - return is_array($value) ? $value : [$key => $value]; - } - - /** - * Get all of the current attributes on the model. - * - * @return array - */ - public function getAttributes() - { - $this->mergeAttributesFromCachedCasts(); - - return $this->attributes; - } - - /** - * Get all of the current attributes on the model for an insert operation. - * - * @return array - */ - protected function getAttributesForInsert() - { - return $this->getAttributes(); - } - - /** - * Set the array of model attributes. No checking is done. - * - * @param array $attributes - * @param bool $sync - * @return $this - */ - public function setRawAttributes(array $attributes, $sync = false) - { - $this->attributes = $attributes; - - if ($sync) { - $this->syncOriginal(); - } - - $this->classCastCache = []; - $this->attributeCastCache = []; - - return $this; - } - - /** - * Get the model's original attribute values. - * - * @param string|null $key - * @param mixed $default - * @return mixed|array - */ - public function getOriginal($key = null, $default = null) - { - return (new static)->setRawAttributes( - $this->original, $sync = true - )->getOriginalWithoutRewindingModel($key, $default); - } - - /** - * Get the model's original attribute values. - * - * @param string|null $key - * @param mixed $default - * @return mixed|array - */ - protected function getOriginalWithoutRewindingModel($key = null, $default = null) - { - if ($key) { - return $this->transformModelValue( - $key, Arr::get($this->original, $key, $default) - ); - } - - return collect($this->original)->mapWithKeys(function ($value, $key) { - return [$key => $this->transformModelValue($key, $value)]; - })->all(); - } - - /** - * Get the model's raw original attribute values. - * - * @param string|null $key - * @param mixed $default - * @return mixed|array - */ - public function getRawOriginal($key = null, $default = null) - { - return Arr::get($this->original, $key, $default); - } - - /** - * Get a subset of the model's attributes. - * - * @param array|mixed $attributes - * @return array - */ - public function only($attributes) - { - $results = []; - - foreach (is_array($attributes) ? $attributes : func_get_args() as $attribute) { - $results[$attribute] = $this->getAttribute($attribute); - } - - return $results; - } - - /** - * Sync the original attributes with the current. - * - * @return $this - */ - public function syncOriginal() - { - $this->original = $this->getAttributes(); - - return $this; - } - - /** - * Sync a single original attribute with its current value. - * - * @param string $attribute - * @return $this - */ - public function syncOriginalAttribute($attribute) - { - return $this->syncOriginalAttributes($attribute); - } - - /** - * Sync multiple original attribute with their current values. - * - * @param array|string $attributes - * @return $this - */ - public function syncOriginalAttributes($attributes) - { - $attributes = is_array($attributes) ? $attributes : func_get_args(); - - $modelAttributes = $this->getAttributes(); - - foreach ($attributes as $attribute) { - $this->original[$attribute] = $modelAttributes[$attribute]; - } - - return $this; - } - - /** - * Sync the changed attributes. - * - * @return $this - */ - public function syncChanges() - { - $this->changes = $this->getDirty(); - - return $this; - } - - /** - * Determine if the model or any of the given attribute(s) have been modified. - * - * @param array|string|null $attributes - * @return bool - */ - public function isDirty($attributes = null) - { - return $this->hasChanges( - $this->getDirty(), is_array($attributes) ? $attributes : func_get_args() - ); - } - - /** - * Determine if the model or all the given attribute(s) have remained the same. - * - * @param array|string|null $attributes - * @return bool - */ - public function isClean($attributes = null) - { - return ! $this->isDirty(...func_get_args()); - } - - /** - * Discard attribute changes and reset the attributes to their original state. - * - * @return $this - */ - public function discardChanges() - { - [$this->attributes, $this->changes] = [$this->original, []]; - - return $this; - } - - /** - * Determine if the model or any of the given attribute(s) were changed when the model was last saved. - * - * @param array|string|null $attributes - * @return bool - */ - public function wasChanged($attributes = null) - { - return $this->hasChanges( - $this->getChanges(), is_array($attributes) ? $attributes : func_get_args() - ); - } - - /** - * Determine if any of the given attributes were changed when the model was last saved. - * - * @param array $changes - * @param array|string|null $attributes - * @return bool - */ - protected function hasChanges($changes, $attributes = null) - { - // If no specific attributes were provided, we will just see if the dirty array - // already contains any attributes. If it does we will just return that this - // count is greater than zero. Else, we need to check specific attributes. - if (empty($attributes)) { - return count($changes) > 0; - } - - // Here we will spin through every attribute and see if this is in the array of - // dirty attributes. If it is, we will return true and if we make it through - // all of the attributes for the entire array we will return false at end. - foreach (Arr::wrap($attributes) as $attribute) { - if (array_key_exists($attribute, $changes)) { - return true; - } - } - - return false; - } - - /** - * Get the attributes that have been changed since the last sync. - * - * @return array - */ - public function getDirty() - { - $dirty = []; - - foreach ($this->getAttributes() as $key => $value) { - if (! $this->originalIsEquivalent($key)) { - $dirty[$key] = $value; - } - } - - return $dirty; - } - - /** - * Get the attributes that were changed when the model was last saved. - * - * @return array - */ - public function getChanges() - { - return $this->changes; - } - - /** - * Determine if the new and old values for a given key are equivalent. - * - * @param string $key - * @return bool - */ - public function originalIsEquivalent($key) - { - if (! array_key_exists($key, $this->original)) { - return false; - } - - $attribute = Arr::get($this->attributes, $key); - $original = Arr::get($this->original, $key); - - if ($attribute === $original) { - return true; - } elseif (is_null($attribute)) { - return false; - } elseif ($this->isDateAttribute($key) || $this->isDateCastableWithCustomFormat($key)) { - return $this->fromDateTime($attribute) === - $this->fromDateTime($original); - } elseif ($this->hasCast($key, ['object', 'collection'])) { - return $this->fromJson($attribute) === - $this->fromJson($original); - } elseif ($this->hasCast($key, ['real', 'float', 'double'])) { - if ($original === null) { - return false; - } - - return abs($this->castAttribute($key, $attribute) - $this->castAttribute($key, $original)) < PHP_FLOAT_EPSILON * 4; - } elseif ($this->hasCast($key, static::$primitiveCastTypes)) { - return $this->castAttribute($key, $attribute) === - $this->castAttribute($key, $original); - } elseif ($this->isClassCastable($key) && in_array($this->getCasts()[$key], [AsArrayObject::class, AsCollection::class])) { - return $this->fromJson($attribute) === $this->fromJson($original); - } elseif ($this->isClassCastable($key) && $original !== null && in_array($this->getCasts()[$key], [AsEncryptedArrayObject::class, AsEncryptedCollection::class])) { - return $this->fromEncryptedString($attribute) === $this->fromEncryptedString($original); - } - - return is_numeric($attribute) && is_numeric($original) - && strcmp((string) $attribute, (string) $original) === 0; - } - - /** - * Transform a raw model value using mutators, casts, etc. - * - * @param string $key - * @param mixed $value - * @return mixed - */ - protected function transformModelValue($key, $value) - { - // If the attribute has a get mutator, we will call that then return what - // it returns as the value, which is useful for transforming values on - // retrieval from the model to a form that is more useful for usage. - if ($this->hasGetMutator($key)) { - return $this->mutateAttribute($key, $value); - } elseif ($this->hasAttributeGetMutator($key)) { - return $this->mutateAttributeMarkedAttribute($key, $value); - } - - // If the attribute exists within the cast array, we will convert it to - // an appropriate native PHP type dependent upon the associated value - // given with the key in the pair. Dayle made this comment line up. - if ($this->hasCast($key)) { - return $this->castAttribute($key, $value); - } - - // If the attribute is listed as a date, we will convert it to a DateTime - // instance on retrieval, which makes it quite convenient to work with - // date fields without having to create a mutator for each property. - if ($value !== null - && \in_array($key, $this->getDates(), false)) { - return $this->asDateTime($value); - } - - return $value; - } - - /** - * Append attributes to query when building a query. - * - * @param array|string $attributes - * @return $this - */ - public function append($attributes) - { - $this->appends = array_unique( - array_merge($this->appends, is_string($attributes) ? func_get_args() : $attributes) - ); - - return $this; - } - - /** - * Get the accessors that are being appended to model arrays. - * - * @return array - */ - public function getAppends() - { - return $this->appends; - } - - /** - * Set the accessors to append to model arrays. - * - * @param array $appends - * @return $this - */ - public function setAppends(array $appends) - { - $this->appends = $appends; - - return $this; - } - - /** - * Return whether the accessor attribute has been appended. - * - * @param string $attribute - * @return bool - */ - public function hasAppended($attribute) - { - return in_array($attribute, $this->appends); - } - - /** - * Get the mutated attributes for a given instance. - * - * @return array - */ - public function getMutatedAttributes() - { - if (! isset(static::$mutatorCache[static::class])) { - static::cacheMutatedAttributes($this); - } - - return static::$mutatorCache[static::class]; - } - - /** - * Extract and cache all the mutated attributes of a class. - * - * @param object|string $classOrInstance - * @return void - */ - public static function cacheMutatedAttributes($classOrInstance) - { - $reflection = new ReflectionClass($classOrInstance); - - $class = $reflection->getName(); - - static::$getAttributeMutatorCache[$class] = - collect($attributeMutatorMethods = static::getAttributeMarkedMutatorMethods($classOrInstance)) - ->mapWithKeys(function ($match) { - return [lcfirst(static::$snakeAttributes ? Str::snake($match) : $match) => true]; - })->all(); - - static::$mutatorCache[$class] = collect(static::getMutatorMethods($class)) - ->merge($attributeMutatorMethods) - ->map(function ($match) { - return lcfirst(static::$snakeAttributes ? Str::snake($match) : $match); - })->all(); - } - - /** - * Get all of the attribute mutator methods. - * - * @param mixed $class - * @return array - */ - protected static function getMutatorMethods($class) - { - preg_match_all('/(?<=^|;)get([^;]+?)Attribute(;|$)/', implode(';', get_class_methods($class)), $matches); - - return $matches[1]; - } - - /** - * Get all of the "Attribute" return typed attribute mutator methods. - * - * @param mixed $class - * @return array - */ - protected static function getAttributeMarkedMutatorMethods($class) - { - $instance = is_object($class) ? $class : new $class; - - return collect((new ReflectionClass($instance))->getMethods())->filter(function ($method) use ($instance) { - $returnType = $method->getReturnType(); - - if ($returnType instanceof ReflectionNamedType && - $returnType->getName() === Attribute::class) { - $method->setAccessible(true); - - if (is_callable($method->invoke($instance)->get)) { - return true; - } - } - - return false; - })->map->name->values()->all(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php deleted file mode 100644 index 37bc063..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php +++ /dev/null @@ -1,415 +0,0 @@ -registerObserver($class); - } - } - - /** - * Register a single observer with the model. - * - * @param object|string $class - * @return void - * - * @throws \RuntimeException - */ - protected function registerObserver($class) - { - $className = $this->resolveObserverClassName($class); - - // When registering a model observer, we will spin through the possible events - // and determine if this observer has that method. If it does, we will hook - // it into the model's event system, making it convenient to watch these. - foreach ($this->getObservableEvents() as $event) { - if (method_exists($class, $event)) { - static::registerModelEvent($event, $className.'@'.$event); - } - } - } - - /** - * Resolve the observer's class name from an object or string. - * - * @param object|string $class - * @return string - * - * @throws \InvalidArgumentException - */ - private function resolveObserverClassName($class) - { - if (is_object($class)) { - return get_class($class); - } - - if (class_exists($class)) { - return $class; - } - - throw new InvalidArgumentException('Unable to find observer: '.$class); - } - - /** - * Get the observable event names. - * - * @return array - */ - public function getObservableEvents() - { - return array_merge( - [ - 'retrieved', 'creating', 'created', 'updating', 'updated', - 'saving', 'saved', 'restoring', 'restored', 'replicating', - 'deleting', 'deleted', 'forceDeleting', 'forceDeleted', - ], - $this->observables - ); - } - - /** - * Set the observable event names. - * - * @param array $observables - * @return $this - */ - public function setObservableEvents(array $observables) - { - $this->observables = $observables; - - return $this; - } - - /** - * Add an observable event name. - * - * @param array|mixed $observables - * @return void - */ - public function addObservableEvents($observables) - { - $this->observables = array_unique(array_merge( - $this->observables, is_array($observables) ? $observables : func_get_args() - )); - } - - /** - * Remove an observable event name. - * - * @param array|mixed $observables - * @return void - */ - public function removeObservableEvents($observables) - { - $this->observables = array_diff( - $this->observables, is_array($observables) ? $observables : func_get_args() - ); - } - - /** - * Register a model event with the dispatcher. - * - * @param string $event - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - protected static function registerModelEvent($event, $callback) - { - if (isset(static::$dispatcher)) { - $name = static::class; - - static::$dispatcher->listen("eloquent.{$event}: {$name}", $callback); - } - } - - /** - * Fire the given event for the model. - * - * @param string $event - * @param bool $halt - * @return mixed - */ - protected function fireModelEvent($event, $halt = true) - { - if (! isset(static::$dispatcher)) { - return true; - } - - // First, we will get the proper method to call on the event dispatcher, and then we - // will attempt to fire a custom, object based event for the given event. If that - // returns a result we can return that result, or we'll call the string events. - $method = $halt ? 'until' : 'dispatch'; - - $result = $this->filterModelEventResults( - $this->fireCustomModelEvent($event, $method) - ); - - if ($result === false) { - return false; - } - - return ! empty($result) ? $result : static::$dispatcher->{$method}( - "eloquent.{$event}: ".static::class, $this - ); - } - - /** - * Fire a custom model event for the given event. - * - * @param string $event - * @param string $method - * @return mixed|null - */ - protected function fireCustomModelEvent($event, $method) - { - if (! isset($this->dispatchesEvents[$event])) { - return; - } - - $result = static::$dispatcher->$method(new $this->dispatchesEvents[$event]($this)); - - if (! is_null($result)) { - return $result; - } - } - - /** - * Filter the model event results. - * - * @param mixed $result - * @return mixed - */ - protected function filterModelEventResults($result) - { - if (is_array($result)) { - $result = array_filter($result, function ($response) { - return ! is_null($response); - }); - } - - return $result; - } - - /** - * Register a retrieved model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function retrieved($callback) - { - static::registerModelEvent('retrieved', $callback); - } - - /** - * Register a saving model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function saving($callback) - { - static::registerModelEvent('saving', $callback); - } - - /** - * Register a saved model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function saved($callback) - { - static::registerModelEvent('saved', $callback); - } - - /** - * Register an updating model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function updating($callback) - { - static::registerModelEvent('updating', $callback); - } - - /** - * Register an updated model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function updated($callback) - { - static::registerModelEvent('updated', $callback); - } - - /** - * Register a creating model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function creating($callback) - { - static::registerModelEvent('creating', $callback); - } - - /** - * Register a created model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function created($callback) - { - static::registerModelEvent('created', $callback); - } - - /** - * Register a replicating model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function replicating($callback) - { - static::registerModelEvent('replicating', $callback); - } - - /** - * Register a deleting model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function deleting($callback) - { - static::registerModelEvent('deleting', $callback); - } - - /** - * Register a deleted model event with the dispatcher. - * - * @param \Illuminate\Events\QueuedClosure|\Closure|string|array $callback - * @return void - */ - public static function deleted($callback) - { - static::registerModelEvent('deleted', $callback); - } - - /** - * Remove all the event listeners for the model. - * - * @return void - */ - public static function flushEventListeners() - { - if (! isset(static::$dispatcher)) { - return; - } - - $instance = new static; - - foreach ($instance->getObservableEvents() as $event) { - static::$dispatcher->forget("eloquent.{$event}: ".static::class); - } - - foreach (array_values($instance->dispatchesEvents) as $event) { - static::$dispatcher->forget($event); - } - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public static function getEventDispatcher() - { - return static::$dispatcher; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher - * @return void - */ - public static function setEventDispatcher(Dispatcher $dispatcher) - { - static::$dispatcher = $dispatcher; - } - - /** - * Unset the event dispatcher for models. - * - * @return void - */ - public static function unsetEventDispatcher() - { - static::$dispatcher = null; - } - - /** - * Execute a callback without firing any model events for any model type. - * - * @param callable $callback - * @return mixed - */ - public static function withoutEvents(callable $callback) - { - $dispatcher = static::getEventDispatcher(); - - if ($dispatcher) { - static::setEventDispatcher(new NullDispatcher($dispatcher)); - } - - try { - return $callback(); - } finally { - if ($dispatcher) { - static::setEventDispatcher($dispatcher); - } - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php deleted file mode 100644 index 72afb17..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php +++ /dev/null @@ -1,71 +0,0 @@ -relationResolver($parent, $key); - } - - return null; - } - - /** - * Define a dynamic relation resolver. - * - * @param string $name - * @param \Closure $callback - * @return void - */ - public static function resolveRelationUsing($name, Closure $callback) - { - static::$relationResolvers = array_replace_recursive( - static::$relationResolvers, - [static::class => [$name => $callback]] - ); - } - - /** - * Define a one-to-one relationship. - * - * @param string $related - * @param string|null $foreignKey - * @param string|null $localKey - * @return \Illuminate\Database\Eloquent\Relations\HasOne - */ - public function hasOne($related, $foreignKey = null, $localKey = null) - { - $instance = $this->newRelatedInstance($related); - - $foreignKey = $foreignKey ?: $this->getForeignKey(); - - $localKey = $localKey ?: $this->getKeyName(); - - return $this->newHasOne($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey); - } - - /** - * Instantiate a new HasOne relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string $foreignKey - * @param string $localKey - * @return \Illuminate\Database\Eloquent\Relations\HasOne - */ - protected function newHasOne(Builder $query, Model $parent, $foreignKey, $localKey) - { - return new HasOne($query, $parent, $foreignKey, $localKey); - } - - /** - * Define a has-one-through relationship. - * - * @param string $related - * @param string $through - * @param string|null $firstKey - * @param string|null $secondKey - * @param string|null $localKey - * @param string|null $secondLocalKey - * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough - */ - public function hasOneThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null) - { - $through = $this->newRelatedThroughInstance($through); - - $firstKey = $firstKey ?: $this->getForeignKey(); - - $secondKey = $secondKey ?: $through->getForeignKey(); - - return $this->newHasOneThrough( - $this->newRelatedInstance($related)->newQuery(), $this, $through, - $firstKey, $secondKey, $localKey ?: $this->getKeyName(), - $secondLocalKey ?: $through->getKeyName() - ); - } - - /** - * Instantiate a new HasOneThrough relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $farParent - * @param \Illuminate\Database\Eloquent\Model $throughParent - * @param string $firstKey - * @param string $secondKey - * @param string $localKey - * @param string $secondLocalKey - * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough - */ - protected function newHasOneThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) - { - return new HasOneThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); - } - - /** - * Define a polymorphic one-to-one relationship. - * - * @param string $related - * @param string $name - * @param string|null $type - * @param string|null $id - * @param string|null $localKey - * @return \Illuminate\Database\Eloquent\Relations\MorphOne - */ - public function morphOne($related, $name, $type = null, $id = null, $localKey = null) - { - $instance = $this->newRelatedInstance($related); - - [$type, $id] = $this->getMorphs($name, $type, $id); - - $table = $instance->getTable(); - - $localKey = $localKey ?: $this->getKeyName(); - - return $this->newMorphOne($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); - } - - /** - * Instantiate a new MorphOne relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string $type - * @param string $id - * @param string $localKey - * @return \Illuminate\Database\Eloquent\Relations\MorphOne - */ - protected function newMorphOne(Builder $query, Model $parent, $type, $id, $localKey) - { - return new MorphOne($query, $parent, $type, $id, $localKey); - } - - /** - * Define an inverse one-to-one or many relationship. - * - * @param string $related - * @param string|null $foreignKey - * @param string|null $ownerKey - * @param string|null $relation - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null) - { - // If no relation name was given, we will use this debug backtrace to extract - // the calling method's name and use that as the relationship name as most - // of the time this will be what we desire to use for the relationships. - if (is_null($relation)) { - $relation = $this->guessBelongsToRelation(); - } - - $instance = $this->newRelatedInstance($related); - - // If no foreign key was supplied, we can use a backtrace to guess the proper - // foreign key name by using the name of the relationship function, which - // when combined with an "_id" should conventionally match the columns. - if (is_null($foreignKey)) { - $foreignKey = Str::snake($relation).'_'.$instance->getKeyName(); - } - - // Once we have the foreign key names we'll just create a new Eloquent query - // for the related models and return the relationship instance which will - // actually be responsible for retrieving and hydrating every relation. - $ownerKey = $ownerKey ?: $instance->getKeyName(); - - return $this->newBelongsTo( - $instance->newQuery(), $this, $foreignKey, $ownerKey, $relation - ); - } - - /** - * Instantiate a new BelongsTo relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $child - * @param string $foreignKey - * @param string $ownerKey - * @param string $relation - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - protected function newBelongsTo(Builder $query, Model $child, $foreignKey, $ownerKey, $relation) - { - return new BelongsTo($query, $child, $foreignKey, $ownerKey, $relation); - } - - /** - * Define a polymorphic, inverse one-to-one or many relationship. - * - * @param string|null $name - * @param string|null $type - * @param string|null $id - * @param string|null $ownerKey - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - public function morphTo($name = null, $type = null, $id = null, $ownerKey = null) - { - // If no name is provided, we will use the backtrace to get the function name - // since that is most likely the name of the polymorphic interface. We can - // use that to get both the class and foreign key that will be utilized. - $name = $name ?: $this->guessBelongsToRelation(); - - [$type, $id] = $this->getMorphs( - Str::snake($name), $type, $id - ); - - // If the type value is null it is probably safe to assume we're eager loading - // the relationship. In this case we'll just pass in a dummy query where we - // need to remove any eager loads that may already be defined on a model. - return is_null($class = $this->getAttributeFromArray($type)) || $class === '' - ? $this->morphEagerTo($name, $type, $id, $ownerKey) - : $this->morphInstanceTo($class, $name, $type, $id, $ownerKey); - } - - /** - * Define a polymorphic, inverse one-to-one or many relationship. - * - * @param string $name - * @param string $type - * @param string $id - * @param string $ownerKey - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - protected function morphEagerTo($name, $type, $id, $ownerKey) - { - return $this->newMorphTo( - $this->newQuery()->setEagerLoads([]), $this, $id, $ownerKey, $type, $name - ); - } - - /** - * Define a polymorphic, inverse one-to-one or many relationship. - * - * @param string $target - * @param string $name - * @param string $type - * @param string $id - * @param string $ownerKey - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - protected function morphInstanceTo($target, $name, $type, $id, $ownerKey) - { - $instance = $this->newRelatedInstance( - static::getActualClassNameForMorph($target) - ); - - return $this->newMorphTo( - $instance->newQuery(), $this, $id, $ownerKey ?? $instance->getKeyName(), $type, $name - ); - } - - /** - * Instantiate a new MorphTo relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string $foreignKey - * @param string $ownerKey - * @param string $type - * @param string $relation - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - protected function newMorphTo(Builder $query, Model $parent, $foreignKey, $ownerKey, $type, $relation) - { - return new MorphTo($query, $parent, $foreignKey, $ownerKey, $type, $relation); - } - - /** - * Retrieve the actual class name for a given morph class. - * - * @param string $class - * @return string - */ - public static function getActualClassNameForMorph($class) - { - return Arr::get(Relation::morphMap() ?: [], $class, $class); - } - - /** - * Guess the "belongs to" relationship name. - * - * @return string - */ - protected function guessBelongsToRelation() - { - [$one, $two, $caller] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); - - return $caller['function']; - } - - /** - * Define a one-to-many relationship. - * - * @param string $related - * @param string|null $foreignKey - * @param string|null $localKey - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function hasMany($related, $foreignKey = null, $localKey = null) - { - $instance = $this->newRelatedInstance($related); - - $foreignKey = $foreignKey ?: $this->getForeignKey(); - - $localKey = $localKey ?: $this->getKeyName(); - - return $this->newHasMany( - $instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey - ); - } - - /** - * Instantiate a new HasMany relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string $foreignKey - * @param string $localKey - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - protected function newHasMany(Builder $query, Model $parent, $foreignKey, $localKey) - { - return new HasMany($query, $parent, $foreignKey, $localKey); - } - - /** - * Define a has-many-through relationship. - * - * @param string $related - * @param string $through - * @param string|null $firstKey - * @param string|null $secondKey - * @param string|null $localKey - * @param string|null $secondLocalKey - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough - */ - public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null) - { - $through = $this->newRelatedThroughInstance($through); - - $firstKey = $firstKey ?: $this->getForeignKey(); - - $secondKey = $secondKey ?: $through->getForeignKey(); - - return $this->newHasManyThrough( - $this->newRelatedInstance($related)->newQuery(), - $this, - $through, - $firstKey, - $secondKey, - $localKey ?: $this->getKeyName(), - $secondLocalKey ?: $through->getKeyName() - ); - } - - /** - * Instantiate a new HasManyThrough relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $farParent - * @param \Illuminate\Database\Eloquent\Model $throughParent - * @param string $firstKey - * @param string $secondKey - * @param string $localKey - * @param string $secondLocalKey - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough - */ - protected function newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) - { - return new HasManyThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); - } - - /** - * Define a polymorphic one-to-many relationship. - * - * @param string $related - * @param string $name - * @param string|null $type - * @param string|null $id - * @param string|null $localKey - * @return \Illuminate\Database\Eloquent\Relations\MorphMany - */ - public function morphMany($related, $name, $type = null, $id = null, $localKey = null) - { - $instance = $this->newRelatedInstance($related); - - // Here we will gather up the morph type and ID for the relationship so that we - // can properly query the intermediate table of a relation. Finally, we will - // get the table and create the relationship instances for the developers. - [$type, $id] = $this->getMorphs($name, $type, $id); - - $table = $instance->getTable(); - - $localKey = $localKey ?: $this->getKeyName(); - - return $this->newMorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); - } - - /** - * Instantiate a new MorphMany relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string $type - * @param string $id - * @param string $localKey - * @return \Illuminate\Database\Eloquent\Relations\MorphMany - */ - protected function newMorphMany(Builder $query, Model $parent, $type, $id, $localKey) - { - return new MorphMany($query, $parent, $type, $id, $localKey); - } - - /** - * Define a many-to-many relationship. - * - * @param string $related - * @param string|null $table - * @param string|null $foreignPivotKey - * @param string|null $relatedPivotKey - * @param string|null $parentKey - * @param string|null $relatedKey - * @param string|null $relation - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - public function belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null, - $parentKey = null, $relatedKey = null, $relation = null) - { - // If no relationship name was passed, we will pull backtraces to get the - // name of the calling function. We will use that function name as the - // title of this relation since that is a great convention to apply. - if (is_null($relation)) { - $relation = $this->guessBelongsToManyRelation(); - } - - // First, we'll need to determine the foreign key and "other key" for the - // relationship. Once we have determined the keys we'll make the query - // instances as well as the relationship instances we need for this. - $instance = $this->newRelatedInstance($related); - - $foreignPivotKey = $foreignPivotKey ?: $this->getForeignKey(); - - $relatedPivotKey = $relatedPivotKey ?: $instance->getForeignKey(); - - // If no table name was provided, we can guess it by concatenating the two - // models using underscores in alphabetical order. The two model names - // are transformed to snake case from their default CamelCase also. - if (is_null($table)) { - $table = $this->joiningTable($related, $instance); - } - - return $this->newBelongsToMany( - $instance->newQuery(), $this, $table, $foreignPivotKey, - $relatedPivotKey, $parentKey ?: $this->getKeyName(), - $relatedKey ?: $instance->getKeyName(), $relation - ); - } - - /** - * Instantiate a new BelongsToMany relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string $table - * @param string $foreignPivotKey - * @param string $relatedPivotKey - * @param string $parentKey - * @param string $relatedKey - * @param string|null $relationName - * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany - */ - protected function newBelongsToMany(Builder $query, Model $parent, $table, $foreignPivotKey, $relatedPivotKey, - $parentKey, $relatedKey, $relationName = null) - { - return new BelongsToMany($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName); - } - - /** - * Define a polymorphic many-to-many relationship. - * - * @param string $related - * @param string $name - * @param string|null $table - * @param string|null $foreignPivotKey - * @param string|null $relatedPivotKey - * @param string|null $parentKey - * @param string|null $relatedKey - * @param bool $inverse - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany - */ - public function morphToMany($related, $name, $table = null, $foreignPivotKey = null, - $relatedPivotKey = null, $parentKey = null, - $relatedKey = null, $inverse = false) - { - $caller = $this->guessBelongsToManyRelation(); - - // First, we will need to determine the foreign key and "other key" for the - // relationship. Once we have determined the keys we will make the query - // instances, as well as the relationship instances we need for these. - $instance = $this->newRelatedInstance($related); - - $foreignPivotKey = $foreignPivotKey ?: $name.'_id'; - - $relatedPivotKey = $relatedPivotKey ?: $instance->getForeignKey(); - - // Now we're ready to create a new query builder for the related model and - // the relationship instances for this relation. This relation will set - // appropriate query constraints then entirely manage the hydrations. - if (! $table) { - $words = preg_split('/(_)/u', $name, -1, PREG_SPLIT_DELIM_CAPTURE); - - $lastWord = array_pop($words); - - $table = implode('', $words).Str::plural($lastWord); - } - - return $this->newMorphToMany( - $instance->newQuery(), $this, $name, $table, - $foreignPivotKey, $relatedPivotKey, $parentKey ?: $this->getKeyName(), - $relatedKey ?: $instance->getKeyName(), $caller, $inverse - ); - } - - /** - * Instantiate a new MorphToMany relationship. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Model $parent - * @param string $name - * @param string $table - * @param string $foreignPivotKey - * @param string $relatedPivotKey - * @param string $parentKey - * @param string $relatedKey - * @param string|null $relationName - * @param bool $inverse - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany - */ - protected function newMorphToMany(Builder $query, Model $parent, $name, $table, $foreignPivotKey, - $relatedPivotKey, $parentKey, $relatedKey, - $relationName = null, $inverse = false) - { - return new MorphToMany($query, $parent, $name, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, - $relationName, $inverse); - } - - /** - * Define a polymorphic, inverse many-to-many relationship. - * - * @param string $related - * @param string $name - * @param string|null $table - * @param string|null $foreignPivotKey - * @param string|null $relatedPivotKey - * @param string|null $parentKey - * @param string|null $relatedKey - * @return \Illuminate\Database\Eloquent\Relations\MorphToMany - */ - public function morphedByMany($related, $name, $table = null, $foreignPivotKey = null, - $relatedPivotKey = null, $parentKey = null, $relatedKey = null) - { - $foreignPivotKey = $foreignPivotKey ?: $this->getForeignKey(); - - // For the inverse of the polymorphic many-to-many relations, we will change - // the way we determine the foreign and other keys, as it is the opposite - // of the morph-to-many method since we're figuring out these inverses. - $relatedPivotKey = $relatedPivotKey ?: $name.'_id'; - - return $this->morphToMany( - $related, $name, $table, $foreignPivotKey, - $relatedPivotKey, $parentKey, $relatedKey, true - ); - } - - /** - * Get the relationship name of the belongsToMany relationship. - * - * @return string|null - */ - protected function guessBelongsToManyRelation() - { - $caller = Arr::first(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), function ($trace) { - return ! in_array( - $trace['function'], - array_merge(static::$manyMethods, ['guessBelongsToManyRelation']) - ); - }); - - return ! is_null($caller) ? $caller['function'] : null; - } - - /** - * Get the joining table name for a many-to-many relation. - * - * @param string $related - * @param \Illuminate\Database\Eloquent\Model|null $instance - * @return string - */ - public function joiningTable($related, $instance = null) - { - // The joining table name, by convention, is simply the snake cased models - // sorted alphabetically and concatenated with an underscore, so we can - // just sort the models and join them together to get the table name. - $segments = [ - $instance ? $instance->joiningTableSegment() - : Str::snake(class_basename($related)), - $this->joiningTableSegment(), - ]; - - // Now that we have the model names in an array we can just sort them and - // use the implode function to join them together with an underscores, - // which is typically used by convention within the database system. - sort($segments); - - return strtolower(implode('_', $segments)); - } - - /** - * Get this model's half of the intermediate table name for belongsToMany relationships. - * - * @return string - */ - public function joiningTableSegment() - { - return Str::snake(class_basename($this)); - } - - /** - * Determine if the model touches a given relation. - * - * @param string $relation - * @return bool - */ - public function touches($relation) - { - return in_array($relation, $this->getTouchedRelations()); - } - - /** - * Touch the owning relations of the model. - * - * @return void - */ - public function touchOwners() - { - foreach ($this->getTouchedRelations() as $relation) { - $this->$relation()->touch(); - - if ($this->$relation instanceof self) { - $this->$relation->fireModelEvent('saved', false); - - $this->$relation->touchOwners(); - } elseif ($this->$relation instanceof Collection) { - $this->$relation->each->touchOwners(); - } - } - } - - /** - * Get the polymorphic relationship columns. - * - * @param string $name - * @param string $type - * @param string $id - * @return array - */ - protected function getMorphs($name, $type, $id) - { - return [$type ?: $name.'_type', $id ?: $name.'_id']; - } - - /** - * Get the class name for polymorphic relations. - * - * @return string - */ - public function getMorphClass() - { - $morphMap = Relation::morphMap(); - - if (! empty($morphMap) && in_array(static::class, $morphMap)) { - return array_search(static::class, $morphMap, true); - } - - if (static::class === Pivot::class) { - return static::class; - } - - if (Relation::requiresMorphMap()) { - throw new ClassMorphViolationException($this); - } - - return static::class; - } - - /** - * Create a new model instance for a related model. - * - * @param string $class - * @return mixed - */ - protected function newRelatedInstance($class) - { - return tap(new $class, function ($instance) { - if (! $instance->getConnectionName()) { - $instance->setConnection($this->connection); - } - }); - } - - /** - * Create a new model instance for a related "through" model. - * - * @param string $class - * @return mixed - */ - protected function newRelatedThroughInstance($class) - { - return new $class; - } - - /** - * Get all the loaded relations for the instance. - * - * @return array - */ - public function getRelations() - { - return $this->relations; - } - - /** - * Get a specified relationship. - * - * @param string $relation - * @return mixed - */ - public function getRelation($relation) - { - return $this->relations[$relation]; - } - - /** - * Determine if the given relation is loaded. - * - * @param string $key - * @return bool - */ - public function relationLoaded($key) - { - return array_key_exists($key, $this->relations); - } - - /** - * Set the given relationship on the model. - * - * @param string $relation - * @param mixed $value - * @return $this - */ - public function setRelation($relation, $value) - { - $this->relations[$relation] = $value; - - return $this; - } - - /** - * Unset a loaded relationship. - * - * @param string $relation - * @return $this - */ - public function unsetRelation($relation) - { - unset($this->relations[$relation]); - - return $this; - } - - /** - * Set the entire relations array on the model. - * - * @param array $relations - * @return $this - */ - public function setRelations(array $relations) - { - $this->relations = $relations; - - return $this; - } - - /** - * Duplicate the instance and unset all the loaded relations. - * - * @return $this - */ - public function withoutRelations() - { - $model = clone $this; - - return $model->unsetRelations(); - } - - /** - * Unset all the loaded relations for the instance. - * - * @return $this - */ - public function unsetRelations() - { - $this->relations = []; - - return $this; - } - - /** - * Get the relationships that are touched on save. - * - * @return array - */ - public function getTouchedRelations() - { - return $this->touches; - } - - /** - * Set the relationships that are touched on save. - * - * @param array $touches - * @return $this - */ - public function setTouchedRelations(array $touches) - { - $this->touches = $touches; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php deleted file mode 100644 index 2b6dfab..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php +++ /dev/null @@ -1,224 +0,0 @@ -$attribute = $this->freshTimestamp(); - - return $this->save(); - } - - if (! $this->usesTimestamps()) { - return false; - } - - $this->updateTimestamps(); - - return $this->save(); - } - - /** - * Update the model's update timestamp without raising any events. - * - * @param string|null $attribute - * @return bool - */ - public function touchQuietly($attribute = null) - { - return static::withoutEvents(fn () => $this->touch($attribute)); - } - - /** - * Update the creation and update timestamps. - * - * @return $this - */ - public function updateTimestamps() - { - $time = $this->freshTimestamp(); - - $updatedAtColumn = $this->getUpdatedAtColumn(); - - if (! is_null($updatedAtColumn) && ! $this->isDirty($updatedAtColumn)) { - $this->setUpdatedAt($time); - } - - $createdAtColumn = $this->getCreatedAtColumn(); - - if (! $this->exists && ! is_null($createdAtColumn) && ! $this->isDirty($createdAtColumn)) { - $this->setCreatedAt($time); - } - - return $this; - } - - /** - * Set the value of the "created at" attribute. - * - * @param mixed $value - * @return $this - */ - public function setCreatedAt($value) - { - $this->{$this->getCreatedAtColumn()} = $value; - - return $this; - } - - /** - * Set the value of the "updated at" attribute. - * - * @param mixed $value - * @return $this - */ - public function setUpdatedAt($value) - { - $this->{$this->getUpdatedAtColumn()} = $value; - - return $this; - } - - /** - * Get a fresh timestamp for the model. - * - * @return \Illuminate\Support\Carbon - */ - public function freshTimestamp() - { - return Date::now(); - } - - /** - * Get a fresh timestamp for the model. - * - * @return string - */ - public function freshTimestampString() - { - return $this->fromDateTime($this->freshTimestamp()); - } - - /** - * Determine if the model uses timestamps. - * - * @return bool - */ - public function usesTimestamps() - { - return $this->timestamps && ! static::isIgnoringTimestamps($this::class); - } - - /** - * Get the name of the "created at" column. - * - * @return string|null - */ - public function getCreatedAtColumn() - { - return static::CREATED_AT; - } - - /** - * Get the name of the "updated at" column. - * - * @return string|null - */ - public function getUpdatedAtColumn() - { - return static::UPDATED_AT; - } - - /** - * Get the fully qualified "created at" column. - * - * @return string|null - */ - public function getQualifiedCreatedAtColumn() - { - return $this->qualifyColumn($this->getCreatedAtColumn()); - } - - /** - * Get the fully qualified "updated at" column. - * - * @return string|null - */ - public function getQualifiedUpdatedAtColumn() - { - return $this->qualifyColumn($this->getUpdatedAtColumn()); - } - - /** - * Disable timestamps for the current class during the given callback scope. - * - * @param callable $callback - * @return mixed - */ - public static function withoutTimestamps(callable $callback) - { - return static::withoutTimestampsOn([static::class], $callback); - } - - /** - * Disable timestamps for the given model classes during the given callback scope. - * - * @param array $models - * @param callable $callback - * @return mixed - */ - public static function withoutTimestampsOn($models, $callback) - { - static::$ignoreTimestampsOn = array_values(array_merge(static::$ignoreTimestampsOn, $models)); - - try { - return $callback(); - } finally { - static::$ignoreTimestampsOn = array_values(array_diff(static::$ignoreTimestampsOn, $models)); - } - } - - /** - * Determine if the given model is ignoring timestamps / touches. - * - * @param string|null $class - * @return bool - */ - public static function isIgnoringTimestamps($class = null) - { - $class ??= static::class; - - foreach (static::$ignoreTimestampsOn as $ignoredClass) { - if ($class === $ignoredClass || is_subclass_of($class, $ignoredClass)) { - return true; - } - } - - return false; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasUlids.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasUlids.php deleted file mode 100644 index b944c5d..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasUlids.php +++ /dev/null @@ -1,96 +0,0 @@ -uniqueIds() as $column) { - if (empty($model->{$column})) { - $model->{$column} = $model->newUniqueId(); - } - } - }); - } - - /** - * Generate a new ULID for the model. - * - * @return string - */ - public function newUniqueId() - { - return strtolower((string) Str::ulid()); - } - - /** - * Retrieve the model for a bound value. - * - * @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation $query - * @param mixed $value - * @param string|null $field - * @return \Illuminate\Database\Eloquent\Relations\Relation - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException - */ - public function resolveRouteBindingQuery($query, $value, $field = null) - { - if ($field && in_array($field, $this->uniqueIds()) && ! Str::isUlid($value)) { - throw (new ModelNotFoundException)->setModel(get_class($this), $value); - } - - if (! $field && in_array($this->getRouteKeyName(), $this->uniqueIds()) && ! Str::isUlid($value)) { - throw (new ModelNotFoundException)->setModel(get_class($this), $value); - } - - return parent::resolveRouteBindingQuery($query, $value, $field); - } - - /** - * Get the columns that should receive a unique identifier. - * - * @return array - */ - public function uniqueIds() - { - return [$this->getKeyName()]; - } - - /** - * Get the auto-incrementing key type. - * - * @return string - */ - public function getKeyType() - { - if (in_array($this->getKeyName(), $this->uniqueIds())) { - return 'string'; - } - - return $this->keyType; - } - - /** - * Get the value indicating whether the IDs are incrementing. - * - * @return bool - */ - public function getIncrementing() - { - if (in_array($this->getKeyName(), $this->uniqueIds())) { - return false; - } - - return $this->incrementing; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasUuids.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasUuids.php deleted file mode 100644 index 96a08b6..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HasUuids.php +++ /dev/null @@ -1,96 +0,0 @@ -uniqueIds() as $column) { - if (empty($model->{$column})) { - $model->{$column} = $model->newUniqueId(); - } - } - }); - } - - /** - * Generate a new UUID for the model. - * - * @return string - */ - public function newUniqueId() - { - return (string) Str::orderedUuid(); - } - - /** - * Get the columns that should receive a unique identifier. - * - * @return array - */ - public function uniqueIds() - { - return [$this->getKeyName()]; - } - - /** - * Retrieve the model for a bound value. - * - * @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation $query - * @param mixed $value - * @param string|null $field - * @return \Illuminate\Database\Eloquent\Relations\Relation - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException - */ - public function resolveRouteBindingQuery($query, $value, $field = null) - { - if ($field && in_array($field, $this->uniqueIds()) && ! Str::isUuid($value)) { - throw (new ModelNotFoundException)->setModel(get_class($this), $value); - } - - if (! $field && in_array($this->getRouteKeyName(), $this->uniqueIds()) && ! Str::isUuid($value)) { - throw (new ModelNotFoundException)->setModel(get_class($this), $value); - } - - return parent::resolveRouteBindingQuery($query, $value, $field); - } - - /** - * Get the auto-incrementing key type. - * - * @return string - */ - public function getKeyType() - { - if (in_array($this->getKeyName(), $this->uniqueIds())) { - return 'string'; - } - - return $this->keyType; - } - - /** - * Get the value indicating whether the IDs are incrementing. - * - * @return bool - */ - public function getIncrementing() - { - if (in_array($this->getKeyName(), $this->uniqueIds())) { - return false; - } - - return $this->incrementing; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php deleted file mode 100644 index 5a7e3ba..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php +++ /dev/null @@ -1,124 +0,0 @@ - - */ - protected $hidden = []; - - /** - * The attributes that should be visible in serialization. - * - * @var array - */ - protected $visible = []; - - /** - * Get the hidden attributes for the model. - * - * @return array - */ - public function getHidden() - { - return $this->hidden; - } - - /** - * Set the hidden attributes for the model. - * - * @param array $hidden - * @return $this - */ - public function setHidden(array $hidden) - { - $this->hidden = $hidden; - - return $this; - } - - /** - * Get the visible attributes for the model. - * - * @return array - */ - public function getVisible() - { - return $this->visible; - } - - /** - * Set the visible attributes for the model. - * - * @param array $visible - * @return $this - */ - public function setVisible(array $visible) - { - $this->visible = $visible; - - return $this; - } - - /** - * Make the given, typically hidden, attributes visible. - * - * @param array|string|null $attributes - * @return $this - */ - public function makeVisible($attributes) - { - $attributes = is_array($attributes) ? $attributes : func_get_args(); - - $this->hidden = array_diff($this->hidden, $attributes); - - if (! empty($this->visible)) { - $this->visible = array_merge($this->visible, $attributes); - } - - return $this; - } - - /** - * Make the given, typically hidden, attributes visible if the given truth test passes. - * - * @param bool|\Closure $condition - * @param array|string|null $attributes - * @return $this - */ - public function makeVisibleIf($condition, $attributes) - { - return value($condition, $this) ? $this->makeVisible($attributes) : $this; - } - - /** - * Make the given, typically visible, attributes hidden. - * - * @param array|string|null $attributes - * @return $this - */ - public function makeHidden($attributes) - { - $this->hidden = array_merge( - $this->hidden, is_array($attributes) ? $attributes : func_get_args() - ); - - return $this; - } - - /** - * Make the given, typically visible, attributes hidden if the given truth test passes. - * - * @param bool|\Closure $condition - * @param array|string|null $attributes - * @return $this - */ - public function makeHiddenIf($condition, $attributes) - { - return value($condition, $this) ? $this->makeHidden($attributes) : $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php deleted file mode 100644 index 6f64884..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php +++ /dev/null @@ -1,879 +0,0 @@ -=', $count = 1, $boolean = 'and', Closure $callback = null) - { - if (is_string($relation)) { - if (str_contains($relation, '.')) { - return $this->hasNested($relation, $operator, $count, $boolean, $callback); - } - - $relation = $this->getRelationWithoutConstraints($relation); - } - - if ($relation instanceof MorphTo) { - return $this->hasMorph($relation, ['*'], $operator, $count, $boolean, $callback); - } - - // 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()->newQueryWithoutRelationships(), $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); - - $doesntHave = $operator === '<' && $count === 1; - - if ($doesntHave) { - $operator = '>='; - $count = 1; - } - - $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), $doesntHave ? '<' : '>=', 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. - * - * Also load the relationship with same condition. - * - * @param string $relation - * @param \Closure|null $callback - * @param string $operator - * @param int $count - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function withWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) - { - return $this->whereHas(Str::before($relation, ':'), $callback, $operator, $count) - ->with($callback ? [$relation => fn ($query) => $callback($query)] : $relation); - } - - /** - * Add a relationship count / exists condition to the query with where clauses and an "or". - * - * @param string $relation - * @param \Closure|null $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|null $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhereDoesntHave($relation, Closure $callback = null) - { - return $this->doesntHave($relation, 'or', $callback); - } - - /** - * Add a polymorphic relationship count / exists condition to the query. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param string $operator - * @param int $count - * @param string $boolean - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null) - { - if (is_string($relation)) { - $relation = $this->getRelationWithoutConstraints($relation); - } - - $types = (array) $types; - - if ($types === ['*']) { - $types = $this->model->newModelQuery()->distinct()->pluck($relation->getMorphType())->filter()->all(); - } - - foreach ($types as &$type) { - $type = Relation::getMorphedModel($type) ?? $type; - } - - return $this->where(function ($query) use ($relation, $callback, $operator, $count, $types) { - foreach ($types as $type) { - $query->orWhere(function ($query) use ($relation, $callback, $operator, $count, $type) { - $belongsTo = $this->getBelongsToRelation($relation, $type); - - if ($callback) { - $callback = function ($query) use ($callback, $type) { - return $callback($query, $type); - }; - } - - $query->where($this->qualifyColumn($relation->getMorphType()), '=', (new $type)->getMorphClass()) - ->whereHas($belongsTo, $callback, $operator, $count); - }); - } - }, null, null, $boolean); - } - - /** - * Get the BelongsTo relationship for a single polymorphic type. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo $relation - * @param string $type - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - protected function getBelongsToRelation(MorphTo $relation, $type) - { - $belongsTo = Relation::noConstraints(function () use ($relation, $type) { - return $this->model->belongsTo( - $type, - $relation->getForeignKeyName(), - $relation->getOwnerKeyName() - ); - }); - - $belongsTo->getQuery()->mergeConstraintsFrom($relation->getQuery()); - - return $belongsTo; - } - - /** - * Add a polymorphic relationship count / exists condition to the query with an "or". - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param string $operator - * @param int $count - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orHasMorph($relation, $types, $operator = '>=', $count = 1) - { - return $this->hasMorph($relation, $types, $operator, $count, 'or'); - } - - /** - * Add a polymorphic relationship count / exists condition to the query. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param string $boolean - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function doesntHaveMorph($relation, $types, $boolean = 'and', Closure $callback = null) - { - return $this->hasMorph($relation, $types, '<', 1, $boolean, $callback); - } - - /** - * Add a polymorphic relationship count / exists condition to the query with an "or". - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orDoesntHaveMorph($relation, $types) - { - return $this->doesntHaveMorph($relation, $types, 'or'); - } - - /** - * Add a polymorphic relationship count / exists condition to the query with where clauses. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param \Closure|null $callback - * @param string $operator - * @param int $count - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function whereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1) - { - return $this->hasMorph($relation, $types, $operator, $count, 'and', $callback); - } - - /** - * Add a polymorphic relationship count / exists condition to the query with where clauses and an "or". - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param \Closure|null $callback - * @param string $operator - * @param int $count - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1) - { - return $this->hasMorph($relation, $types, $operator, $count, 'or', $callback); - } - - /** - * Add a polymorphic relationship count / exists condition to the query with where clauses. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function whereDoesntHaveMorph($relation, $types, Closure $callback = null) - { - return $this->doesntHaveMorph($relation, $types, 'and', $callback); - } - - /** - * Add a polymorphic relationship count / exists condition to the query with where clauses and an "or". - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhereDoesntHaveMorph($relation, $types, Closure $callback = null) - { - return $this->doesntHaveMorph($relation, $types, 'or', $callback); - } - - /** - * Add a basic where clause to a relationship query. - * - * @param string $relation - * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function whereRelation($relation, $column, $operator = null, $value = null) - { - return $this->whereHas($relation, function ($query) use ($column, $operator, $value) { - if ($column instanceof Closure) { - $column($query); - } else { - $query->where($column, $operator, $value); - } - }); - } - - /** - * Add an "or where" clause to a relationship query. - * - * @param string $relation - * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhereRelation($relation, $column, $operator = null, $value = null) - { - return $this->orWhereHas($relation, function ($query) use ($column, $operator, $value) { - if ($column instanceof Closure) { - $column($query); - } else { - $query->where($column, $operator, $value); - } - }); - } - - /** - * Add a polymorphic relationship condition to the query with a where clause. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function whereMorphRelation($relation, $types, $column, $operator = null, $value = null) - { - return $this->whereHasMorph($relation, $types, function ($query) use ($column, $operator, $value) { - $query->where($column, $operator, $value); - }); - } - - /** - * Add a polymorphic relationship condition to the query with an "or where" clause. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param string|array $types - * @param \Closure|string|array|\Illuminate\Database\Query\Expression $column - * @param mixed $operator - * @param mixed $value - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhereMorphRelation($relation, $types, $column, $operator = null, $value = null) - { - return $this->orWhereHasMorph($relation, $types, function ($query) use ($column, $operator, $value) { - $query->where($column, $operator, $value); - }); - } - - /** - * Add a morph-to relationship condition to the query. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param \Illuminate\Database\Eloquent\Model|string $model - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function whereMorphedTo($relation, $model, $boolean = 'and') - { - if (is_string($relation)) { - $relation = $this->getRelationWithoutConstraints($relation); - } - - if (is_string($model)) { - $morphMap = Relation::morphMap(); - - if (! empty($morphMap) && in_array($model, $morphMap)) { - $model = array_search($model, $morphMap, true); - } - - return $this->where($relation->getMorphType(), $model, null, $boolean); - } - - return $this->where(function ($query) use ($relation, $model) { - $query->where($relation->getMorphType(), $model->getMorphClass()) - ->where($relation->getForeignKeyName(), $model->getKey()); - }, null, null, $boolean); - } - - /** - * Add a not morph-to relationship condition to the query. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param \Illuminate\Database\Eloquent\Model|string $model - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function whereNotMorphedTo($relation, $model, $boolean = 'and') - { - if (is_string($relation)) { - $relation = $this->getRelationWithoutConstraints($relation); - } - - if (is_string($model)) { - $morphMap = Relation::morphMap(); - - if (! empty($morphMap) && in_array($model, $morphMap)) { - $model = array_search($model, $morphMap, true); - } - - return $this->whereNot($relation->getMorphType(), '<=>', $model, $boolean); - } - - return $this->whereNot(function ($query) use ($relation, $model) { - $query->where($relation->getMorphType(), '<=>', $model->getMorphClass()) - ->where($relation->getForeignKeyName(), '<=>', $model->getKey()); - }, null, null, $boolean); - } - - /** - * Add a morph-to relationship condition to the query with an "or where" clause. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param \Illuminate\Database\Eloquent\Model|string $model - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhereMorphedTo($relation, $model) - { - return $this->whereMorphedTo($relation, $model, 'or'); - } - - /** - * Add a not morph-to relationship condition to the query with an "or where" clause. - * - * @param \Illuminate\Database\Eloquent\Relations\MorphTo|string $relation - * @param \Illuminate\Database\Eloquent\Model|string $model - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function orWhereNotMorphedTo($relation, $model) - { - return $this->whereNotMorphedTo($relation, $model, 'or'); - } - - /** - * Add a "belongs to" relationship where clause to the query. - * - * @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection<\Illuminate\Database\Eloquent\Model> $related - * @param string|null $relationshipName - * @param string $boolean - * @return $this - * - * @throws \Illuminate\Database\Eloquent\RelationNotFoundException - */ - public function whereBelongsTo($related, $relationshipName = null, $boolean = 'and') - { - if (! $related instanceof Collection) { - $relatedCollection = $related->newCollection([$related]); - } else { - $relatedCollection = $related; - - $related = $relatedCollection->first(); - } - - if ($relatedCollection->isEmpty()) { - throw new InvalidArgumentException('Collection given to whereBelongsTo method may not be empty.'); - } - - if ($relationshipName === null) { - $relationshipName = Str::camel(class_basename($related)); - } - - try { - $relationship = $this->model->{$relationshipName}(); - } catch (BadMethodCallException $exception) { - throw RelationNotFoundException::make($this->model, $relationshipName); - } - - if (! $relationship instanceof BelongsTo) { - throw RelationNotFoundException::make($this->model, $relationshipName, BelongsTo::class); - } - - $this->whereIn( - $relationship->getQualifiedForeignKeyName(), - $relatedCollection->pluck($relationship->getOwnerKeyName())->toArray(), - $boolean, - ); - - return $this; - } - - /** - * Add an "BelongsTo" relationship with an "or where" clause to the query. - * - * @param \Illuminate\Database\Eloquent\Model $related - * @param string|null $relationshipName - * @return $this - * - * @throws \RuntimeException - */ - public function orWhereBelongsTo($related, $relationshipName = null) - { - return $this->whereBelongsTo($related, $relationshipName, 'or'); - } - - /** - * Add subselect queries to include an aggregate value for a relationship. - * - * @param mixed $relations - * @param string $column - * @param string $function - * @return $this - */ - public function withAggregate($relations, $column, $function = null) - { - if (empty($relations)) { - return $this; - } - - if (is_null($this->query->columns)) { - $this->query->select([$this->query->from.'.*']); - } - - $relations = is_array($relations) ? $relations : [$relations]; - - 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 aggregates on the same relationships. - $segments = explode(' ', $name); - - unset($alias); - - if (count($segments) === 3 && Str::lower($segments[1]) === 'as') { - [$name, $alias] = [$segments[0], $segments[2]]; - } - - $relation = $this->getRelationWithoutConstraints($name); - - if ($function) { - $hashedColumn = $this->getRelationHashedColumn($column, $relation); - - $wrappedColumn = $this->getQuery()->getGrammar()->wrap( - $column === '*' ? $column : $relation->getRelated()->qualifyColumn($hashedColumn) - ); - - $expression = $function === 'exists' ? $wrappedColumn : sprintf('%s(%s)', $function, $wrappedColumn); - } else { - $expression = $column; - } - - // Here, we will grab the relationship sub-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 - // sub-query. We'll format this relationship name and append this column if needed. - $query = $relation->getRelationExistenceQuery( - $relation->getRelated()->newQuery(), $this, new Expression($expression) - )->setBindings([], 'select'); - - $query->callScope($constraints); - - $query = $query->mergeConstraintsFrom($relation->getQuery())->toBase(); - - // If the query contains certain elements like orderings / more than one column selected - // then we will remove those elements from the query so that it will execute properly - // when given to the database. Otherwise, we may receive SQL errors or poor syntax. - $query->orders = null; - $query->setBindings([], 'order'); - - if (count($query->columns) > 1) { - $query->columns = [$query->columns[0]]; - $query->bindings['select'] = []; - } - - // Finally, we will make the proper column alias to the query and run this sub-select on - // the query builder. Then, we will return the builder instance back to the developer - // for further constraint chaining that needs to take place on the query as needed. - $alias ??= Str::snake( - preg_replace('/[^[:alnum:][:space:]_]/u', '', "$name $function $column") - ); - - if ($function === 'exists') { - $this->selectRaw( - sprintf('exists(%s) as %s', $query->toSql(), $this->getQuery()->grammar->wrap($alias)), - $query->getBindings() - )->withCasts([$alias => 'bool']); - } else { - $this->selectSub( - $function ? $query : $query->limit(1), - $alias - ); - } - } - - return $this; - } - - /** - * Get the relation hashed column name for the given column and relation. - * - * @param string $column - * @param \Illuminate\Database\Eloquent\Relations\Relationship $relation - * @return string - */ - protected function getRelationHashedColumn($column, $relation) - { - if (str_contains($column, '.')) { - return $column; - } - - return $this->getQuery()->from === $relation->getQuery()->getQuery()->from - ? "{$relation->getRelationCountHash(false)}.$column" - : $column; - } - - /** - * Add subselect queries to count the relations. - * - * @param mixed $relations - * @return $this - */ - public function withCount($relations) - { - return $this->withAggregate(is_array($relations) ? $relations : func_get_args(), '*', 'count'); - } - - /** - * Add subselect queries to include the max of the relation's column. - * - * @param string|array $relation - * @param string $column - * @return $this - */ - public function withMax($relation, $column) - { - return $this->withAggregate($relation, $column, 'max'); - } - - /** - * Add subselect queries to include the min of the relation's column. - * - * @param string|array $relation - * @param string $column - * @return $this - */ - public function withMin($relation, $column) - { - return $this->withAggregate($relation, $column, 'min'); - } - - /** - * Add subselect queries to include the sum of the relation's column. - * - * @param string|array $relation - * @param string $column - * @return $this - */ - public function withSum($relation, $column) - { - return $this->withAggregate($relation, $column, 'sum'); - } - - /** - * Add subselect queries to include the average of the relation's column. - * - * @param string|array $relation - * @param string $column - * @return $this - */ - public function withAvg($relation, $column) - { - return $this->withAggregate($relation, $column, 'avg'); - } - - /** - * Add subselect queries to include the existence of related models. - * - * @param string|array $relation - * @return $this - */ - public function withExists($relation) - { - return $this->withAggregate($relation, '*', 'exists'); - } - - /** - * 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'] ?? []; - - $wheres = $from->getQuery()->from !== $this->getQuery()->from - ? $this->requalifyWhereTables( - $from->getQuery()->wheres, - $from->getQuery()->from, - $this->getModel()->getTable() - ) : $from->getQuery()->wheres; - - // 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( - $wheres, $whereBindings - ); - } - - /** - * Updates the table name for any columns with a new qualified name. - * - * @param array $wheres - * @param string $from - * @param string $to - * @return array - */ - protected function requalifyWhereTables(array $wheres, string $from, string $to): array - { - return collect($wheres)->map(function ($where) use ($from, $to) { - return collect($where)->map(function ($value) use ($from, $to) { - return is_string($value) && str_starts_with($value, $from.'.') - ? $to.'.'.Str::afterLast($value, '.') - : $value; - }); - })->toArray(); - } - - /** - * 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; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/BelongsToManyRelationship.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/BelongsToManyRelationship.php deleted file mode 100644 index 8e40261..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/BelongsToManyRelationship.php +++ /dev/null @@ -1,76 +0,0 @@ -factory = $factory; - $this->pivot = $pivot; - $this->relationship = $relationship; - } - - /** - * Create the attached relationship for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return void - */ - public function createFor(Model $model) - { - Collection::wrap($this->factory instanceof Factory ? $this->factory->create([], $model) : $this->factory)->each(function ($attachable) use ($model) { - $model->{$this->relationship}()->attach( - $attachable, - is_callable($this->pivot) ? call_user_func($this->pivot, $model) : $this->pivot - ); - }); - } - - /** - * Specify the model instances to always use when creating relationships. - * - * @param \Illuminate\Support\Collection $recycle - * @return $this - */ - public function recycle($recycle) - { - if ($this->factory instanceof Factory) { - $this->factory = $this->factory->recycle($recycle); - } - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/BelongsToRelationship.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/BelongsToRelationship.php deleted file mode 100644 index b2fb1b2..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/BelongsToRelationship.php +++ /dev/null @@ -1,97 +0,0 @@ -factory = $factory; - $this->relationship = $relationship; - } - - /** - * Get the parent model attributes and resolvers for the given child model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return array - */ - public function attributesFor(Model $model) - { - $relationship = $model->{$this->relationship}(); - - return $relationship instanceof MorphTo ? [ - $relationship->getMorphType() => $this->factory instanceof Factory ? $this->factory->newModel()->getMorphClass() : $this->factory->getMorphClass(), - $relationship->getForeignKeyName() => $this->resolver($relationship->getOwnerKeyName()), - ] : [ - $relationship->getForeignKeyName() => $this->resolver($relationship->getOwnerKeyName()), - ]; - } - - /** - * Get the deferred resolver for this relationship's parent ID. - * - * @param string|null $key - * @return \Closure - */ - protected function resolver($key) - { - return function () use ($key) { - if (! $this->resolved) { - $instance = $this->factory instanceof Factory - ? ($this->factory->getRandomRecycledModel($this->factory->modelName()) ?? $this->factory->create()) - : $this->factory; - - return $this->resolved = $key ? $instance->{$key} : $instance->getKey(); - } - - return $this->resolved; - }; - } - - /** - * Specify the model instances to always use when creating relationships. - * - * @param \Illuminate\Support\Collection $recycle - * @return $this - */ - public function recycle($recycle) - { - if ($this->factory instanceof Factory) { - $this->factory = $this->factory->recycle($recycle); - } - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/CrossJoinSequence.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/CrossJoinSequence.php deleted file mode 100644 index 3270b30..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/CrossJoinSequence.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - protected $model; - - /** - * The number of models that should be generated. - * - * @var int|null - */ - protected $count; - - /** - * The state transformations that will be applied to the model. - * - * @var \Illuminate\Support\Collection - */ - protected $states; - - /** - * The parent relationships that will be applied to the model. - * - * @var \Illuminate\Support\Collection - */ - protected $has; - - /** - * The child relationships that will be applied to the model. - * - * @var \Illuminate\Support\Collection - */ - protected $for; - - /** - * The model instances to always use when creating relationships. - * - * @var \Illuminate\Support\Collection - */ - protected $recycle; - - /** - * The "after making" callbacks that will be applied to the model. - * - * @var \Illuminate\Support\Collection - */ - protected $afterMaking; - - /** - * The "after creating" callbacks that will be applied to the model. - * - * @var \Illuminate\Support\Collection - */ - protected $afterCreating; - - /** - * The name of the database connection that will be used to create the models. - * - * @var string|null - */ - protected $connection; - - /** - * The current Faker instance. - * - * @var \Faker\Generator - */ - protected $faker; - - /** - * The default namespace where factories reside. - * - * @var string - */ - protected static $namespace = 'Database\\Factories\\'; - - /** - * The default model name resolver. - * - * @var callable - */ - protected static $modelNameResolver; - - /** - * The factory name resolver. - * - * @var callable - */ - protected static $factoryNameResolver; - - /** - * Create a new factory instance. - * - * @param int|null $count - * @param \Illuminate\Support\Collection|null $states - * @param \Illuminate\Support\Collection|null $has - * @param \Illuminate\Support\Collection|null $for - * @param \Illuminate\Support\Collection|null $afterMaking - * @param \Illuminate\Support\Collection|null $afterCreating - * @param string|null $connection - * @param \Illuminate\Support\Collection|null $recycle - * @return void - */ - public function __construct($count = null, - ?Collection $states = null, - ?Collection $has = null, - ?Collection $for = null, - ?Collection $afterMaking = null, - ?Collection $afterCreating = null, - $connection = null, - ?Collection $recycle = null) - { - $this->count = $count; - $this->states = $states ?? new Collection; - $this->has = $has ?? new Collection; - $this->for = $for ?? new Collection; - $this->afterMaking = $afterMaking ?? new Collection; - $this->afterCreating = $afterCreating ?? new Collection; - $this->connection = $connection; - $this->recycle = $recycle ?? new Collection; - $this->faker = $this->withFaker(); - } - - /** - * Define the model's default state. - * - * @return array - */ - abstract public function definition(); - - /** - * Get a new factory instance for the given attributes. - * - * @param (callable(array): array)|array $attributes - * @return static - */ - public static function new($attributes = []) - { - return (new static)->state($attributes)->configure(); - } - - /** - * Get a new factory instance for the given number of models. - * - * @param int $count - * @return static - */ - public static function times(int $count) - { - return static::new()->count($count); - } - - /** - * Configure the factory. - * - * @return $this - */ - public function configure() - { - return $this; - } - - /** - * Get the raw attributes generated by the factory. - * - * @param (callable(array): array)|array $attributes - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return array - */ - public function raw($attributes = [], ?Model $parent = null) - { - if ($this->count === null) { - return $this->state($attributes)->getExpandedAttributes($parent); - } - - return array_map(function () use ($attributes, $parent) { - return $this->state($attributes)->getExpandedAttributes($parent); - }, range(1, $this->count)); - } - - /** - * Create a single model and persist it to the database. - * - * @param (callable(array): array)|array $attributes - * @return \Illuminate\Database\Eloquent\Model|TModel - */ - public function createOne($attributes = []) - { - return $this->count(null)->create($attributes); - } - - /** - * Create a single model and persist it to the database without dispatching any model events. - * - * @param (callable(array): array)|array $attributes - * @return \Illuminate\Database\Eloquent\Model|TModel - */ - public function createOneQuietly($attributes = []) - { - return $this->count(null)->createQuietly($attributes); - } - - /** - * Create a collection of models and persist them to the database. - * - * @param iterable> $records - * @return \Illuminate\Database\Eloquent\Collection - */ - public function createMany(iterable $records) - { - return new EloquentCollection( - collect($records)->map(function ($record) { - return $this->state($record)->create(); - }) - ); - } - - /** - * Create a collection of models and persist them to the database without dispatching any model events. - * - * @param iterable> $records - * @return \Illuminate\Database\Eloquent\Collection - */ - public function createManyQuietly(iterable $records) - { - return Model::withoutEvents(function () use ($records) { - return $this->createMany($records); - }); - } - - /** - * Create a collection of models and persist them to the database. - * - * @param (callable(array): array)|array $attributes - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|TModel - */ - public function create($attributes = [], ?Model $parent = null) - { - if (! empty($attributes)) { - return $this->state($attributes)->create([], $parent); - } - - $results = $this->make($attributes, $parent); - - if ($results instanceof Model) { - $this->store(collect([$results])); - - $this->callAfterCreating(collect([$results]), $parent); - } else { - $this->store($results); - - $this->callAfterCreating($results, $parent); - } - - return $results; - } - - /** - * Create a collection of models and persist them to the database without dispatching any model events. - * - * @param (callable(array): array)|array $attributes - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|TModel - */ - public function createQuietly($attributes = [], ?Model $parent = null) - { - return Model::withoutEvents(function () use ($attributes, $parent) { - return $this->create($attributes, $parent); - }); - } - - /** - * Create a callback that persists a model in the database when invoked. - * - * @param array $attributes - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return \Closure(): (\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|TModel) - */ - public function lazy(array $attributes = [], ?Model $parent = null) - { - return fn () => $this->create($attributes, $parent); - } - - /** - * Set the connection name on the results and store them. - * - * @param \Illuminate\Support\Collection $results - * @return void - */ - protected function store(Collection $results) - { - $results->each(function ($model) { - if (! isset($this->connection)) { - $model->setConnection($model->newQueryWithoutScopes()->getConnection()->getName()); - } - - $model->save(); - - foreach ($model->getRelations() as $name => $items) { - if ($items instanceof Enumerable && $items->isEmpty()) { - $model->unsetRelation($name); - } - } - - $this->createChildren($model); - }); - } - - /** - * Create the children for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return void - */ - protected function createChildren(Model $model) - { - Model::unguarded(function () use ($model) { - $this->has->each(function ($has) use ($model) { - $has->recycle($this->recycle)->createFor($model); - }); - }); - } - - /** - * Make a single instance of the model. - * - * @param (callable(array): array)|array $attributes - * @return \Illuminate\Database\Eloquent\Model|TModel - */ - public function makeOne($attributes = []) - { - return $this->count(null)->make($attributes); - } - - /** - * Create a collection of models. - * - * @param (callable(array): array)|array $attributes - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|TModel - */ - public function make($attributes = [], ?Model $parent = null) - { - if (! empty($attributes)) { - return $this->state($attributes)->make([], $parent); - } - - if ($this->count === null) { - return tap($this->makeInstance($parent), function ($instance) { - $this->callAfterMaking(collect([$instance])); - }); - } - - if ($this->count < 1) { - return $this->newModel()->newCollection(); - } - - $instances = $this->newModel()->newCollection(array_map(function () use ($parent) { - return $this->makeInstance($parent); - }, range(1, $this->count))); - - $this->callAfterMaking($instances); - - return $instances; - } - - /** - * Make an instance of the model with the given attributes. - * - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return \Illuminate\Database\Eloquent\Model - */ - protected function makeInstance(?Model $parent) - { - return Model::unguarded(function () use ($parent) { - return tap($this->newModel($this->getExpandedAttributes($parent)), function ($instance) { - if (isset($this->connection)) { - $instance->setConnection($this->connection); - } - }); - }); - } - - /** - * Get a raw attributes array for the model. - * - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return mixed - */ - protected function getExpandedAttributes(?Model $parent) - { - return $this->expandAttributes($this->getRawAttributes($parent)); - } - - /** - * Get the raw attributes for the model as an array. - * - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return array - */ - protected function getRawAttributes(?Model $parent) - { - return $this->states->pipe(function ($states) { - return $this->for->isEmpty() ? $states : new Collection(array_merge([function () { - return $this->parentResolvers(); - }], $states->all())); - })->reduce(function ($carry, $state) use ($parent) { - if ($state instanceof Closure) { - $state = $state->bindTo($this); - } - - return array_merge($carry, $state($carry, $parent)); - }, $this->definition()); - } - - /** - * Create the parent relationship resolvers (as deferred Closures). - * - * @return array - */ - protected function parentResolvers() - { - $model = $this->newModel(); - - return $this->for->map(function (BelongsToRelationship $for) use ($model) { - return $for->recycle($this->recycle)->attributesFor($model); - })->collapse()->all(); - } - - /** - * Expand all attributes to their underlying values. - * - * @param array $definition - * @return array - */ - protected function expandAttributes(array $definition) - { - return collect($definition) - ->map($evaluateRelations = function ($attribute) { - if ($attribute instanceof self) { - $attribute = $this->getRandomRecycledModel($attribute->modelName()) - ?? $attribute->recycle($this->recycle)->create()->getKey(); - } elseif ($attribute instanceof Model) { - $attribute = $attribute->getKey(); - } - - return $attribute; - }) - ->map(function ($attribute, $key) use (&$definition, $evaluateRelations) { - if (is_callable($attribute) && ! is_string($attribute) && ! is_array($attribute)) { - $attribute = $attribute($definition); - } - - $attribute = $evaluateRelations($attribute); - - $definition[$key] = $attribute; - - return $attribute; - }) - ->all(); - } - - /** - * Add a new state transformation to the model definition. - * - * @param (callable(array, \Illuminate\Database\Eloquent\Model|null): array)|array $state - * @return static - */ - public function state($state) - { - return $this->newInstance([ - 'states' => $this->states->concat([ - is_callable($state) ? $state : function () use ($state) { - return $state; - }, - ]), - ]); - } - - /** - * Set a single model attribute. - * - * @param string|int $key - * @param mixed $value - * @return static - */ - public function set($key, $value) - { - return $this->state([$key => $value]); - } - - /** - * Add a new sequenced state transformation to the model definition. - * - * @param array ...$sequence - * @return static - */ - public function sequence(...$sequence) - { - return $this->state(new Sequence(...$sequence)); - } - - /** - * Add a new sequenced state transformation to the model definition and update the pending creation count to the size of the sequence. - * - * @param array ...$sequence - * @return static - */ - public function forEachSequence(...$sequence) - { - return $this->state(new Sequence(...$sequence))->count(count($sequence)); - } - - /** - * Add a new cross joined sequenced state transformation to the model definition. - * - * @param array ...$sequence - * @return static - */ - public function crossJoinSequence(...$sequence) - { - return $this->state(new CrossJoinSequence(...$sequence)); - } - - /** - * Define a child relationship for the model. - * - * @param \Illuminate\Database\Eloquent\Factories\Factory $factory - * @param string|null $relationship - * @return static - */ - public function has(self $factory, $relationship = null) - { - return $this->newInstance([ - 'has' => $this->has->concat([new Relationship( - $factory, $relationship ?? $this->guessRelationship($factory->modelName()) - )]), - ]); - } - - /** - * Attempt to guess the relationship name for a "has" relationship. - * - * @param string $related - * @return string - */ - protected function guessRelationship(string $related) - { - $guess = Str::camel(Str::plural(class_basename($related))); - - return method_exists($this->modelName(), $guess) ? $guess : Str::singular($guess); - } - - /** - * Define an attached relationship for the model. - * - * @param \Illuminate\Database\Eloquent\Factories\Factory|\Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $factory - * @param (callable(): array)|array $pivot - * @param string|null $relationship - * @return static - */ - public function hasAttached($factory, $pivot = [], $relationship = null) - { - return $this->newInstance([ - 'has' => $this->has->concat([new BelongsToManyRelationship( - $factory, - $pivot, - $relationship ?? Str::camel(Str::plural(class_basename( - $factory instanceof Factory - ? $factory->modelName() - : Collection::wrap($factory)->first() - ))) - )]), - ]); - } - - /** - * Define a parent relationship for the model. - * - * @param \Illuminate\Database\Eloquent\Factories\Factory|\Illuminate\Database\Eloquent\Model $factory - * @param string|null $relationship - * @return static - */ - public function for($factory, $relationship = null) - { - return $this->newInstance(['for' => $this->for->concat([new BelongsToRelationship( - $factory, - $relationship ?? Str::camel(class_basename( - $factory instanceof Factory ? $factory->modelName() : $factory - )) - )])]); - } - - /** - * Provide model instances to use instead of any nested factory calls when creating relationships. - * - * @param \Illuminate\Database\Eloquent\Model|\Illuminate\Support\Collection|array $model - * @return static - */ - public function recycle($model) - { - // Group provided models by the type and merge them into existing recycle collection - return $this->newInstance([ - 'recycle' => $this->recycle - ->flatten() - ->merge( - Collection::wrap($model instanceof Model ? func_get_args() : $model) - ->flatten() - )->groupBy(fn ($model) => get_class($model)), - ]); - } - - /** - * Retrieve a random model of a given type from previously provided models to recycle. - * - * @param string $modelClassName - * @return \Illuminate\Database\Eloquent\Model|null - */ - public function getRandomRecycledModel($modelClassName) - { - return $this->recycle->get($modelClassName)?->random(); - } - - /** - * Add a new "after making" callback to the model definition. - * - * @param \Closure(\Illuminate\Database\Eloquent\Model|TModel): mixed $callback - * @return static - */ - public function afterMaking(Closure $callback) - { - return $this->newInstance(['afterMaking' => $this->afterMaking->concat([$callback])]); - } - - /** - * Add a new "after creating" callback to the model definition. - * - * @param \Closure(\Illuminate\Database\Eloquent\Model|TModel): mixed $callback - * @return static - */ - public function afterCreating(Closure $callback) - { - return $this->newInstance(['afterCreating' => $this->afterCreating->concat([$callback])]); - } - - /** - * Call the "after making" callbacks for the given model instances. - * - * @param \Illuminate\Support\Collection $instances - * @return void - */ - protected function callAfterMaking(Collection $instances) - { - $instances->each(function ($model) { - $this->afterMaking->each(function ($callback) use ($model) { - $callback($model); - }); - }); - } - - /** - * Call the "after creating" callbacks for the given model instances. - * - * @param \Illuminate\Support\Collection $instances - * @param \Illuminate\Database\Eloquent\Model|null $parent - * @return void - */ - protected function callAfterCreating(Collection $instances, ?Model $parent = null) - { - $instances->each(function ($model) use ($parent) { - $this->afterCreating->each(function ($callback) use ($model, $parent) { - $callback($model, $parent); - }); - }); - } - - /** - * Specify how many models should be generated. - * - * @param int|null $count - * @return static - */ - public function count(?int $count) - { - return $this->newInstance(['count' => $count]); - } - - /** - * Specify the database connection that should be used to generate models. - * - * @param string $connection - * @return static - */ - public function connection(string $connection) - { - return $this->newInstance(['connection' => $connection]); - } - - /** - * Create a new instance of the factory builder with the given mutated properties. - * - * @param array $arguments - * @return static - */ - protected function newInstance(array $arguments = []) - { - return new static(...array_values(array_merge([ - 'count' => $this->count, - 'states' => $this->states, - 'has' => $this->has, - 'for' => $this->for, - 'afterMaking' => $this->afterMaking, - 'afterCreating' => $this->afterCreating, - 'connection' => $this->connection, - 'recycle' => $this->recycle, - ], $arguments))); - } - - /** - * Get a new model instance. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model|TModel - */ - public function newModel(array $attributes = []) - { - $model = $this->modelName(); - - return new $model($attributes); - } - - /** - * Get the name of the model that is generated by the factory. - * - * @return class-string<\Illuminate\Database\Eloquent\Model|TModel> - */ - public function modelName() - { - $resolver = static::$modelNameResolver ?? function (self $factory) { - $namespacedFactoryBasename = Str::replaceLast( - 'Factory', '', Str::replaceFirst(static::$namespace, '', get_class($factory)) - ); - - $factoryBasename = Str::replaceLast('Factory', '', class_basename($factory)); - - $appNamespace = static::appNamespace(); - - return class_exists($appNamespace.'Models\\'.$namespacedFactoryBasename) - ? $appNamespace.'Models\\'.$namespacedFactoryBasename - : $appNamespace.$factoryBasename; - }; - - return $this->model ?? $resolver($this); - } - - /** - * Specify the callback that should be invoked to guess model names based on factory names. - * - * @param callable(self): class-string<\Illuminate\Database\Eloquent\Model|TModel> $callback - * @return void - */ - public static function guessModelNamesUsing(callable $callback) - { - static::$modelNameResolver = $callback; - } - - /** - * Specify the default namespace that contains the application's model factories. - * - * @param string $namespace - * @return void - */ - public static function useNamespace(string $namespace) - { - static::$namespace = $namespace; - } - - /** - * Get a new factory instance for the given model name. - * - * @param class-string<\Illuminate\Database\Eloquent\Model> $modelName - * @return \Illuminate\Database\Eloquent\Factories\Factory - */ - public static function factoryForModel(string $modelName) - { - $factory = static::resolveFactoryName($modelName); - - return $factory::new(); - } - - /** - * Specify the callback that should be invoked to guess factory names based on dynamic relationship names. - * - * @param callable(class-string<\Illuminate\Database\Eloquent\Model>): class-string<\Illuminate\Database\Eloquent\Factories\Factory> $callback - * @return void - */ - public static function guessFactoryNamesUsing(callable $callback) - { - static::$factoryNameResolver = $callback; - } - - /** - * Get a new Faker instance. - * - * @return \Faker\Generator - */ - protected function withFaker() - { - return Container::getInstance()->make(Generator::class); - } - - /** - * Get the factory name for the given model name. - * - * @param class-string<\Illuminate\Database\Eloquent\Model> $modelName - * @return class-string<\Illuminate\Database\Eloquent\Factories\Factory> - */ - public static function resolveFactoryName(string $modelName) - { - $resolver = static::$factoryNameResolver ?? function (string $modelName) { - $appNamespace = static::appNamespace(); - - $modelName = Str::startsWith($modelName, $appNamespace.'Models\\') - ? Str::after($modelName, $appNamespace.'Models\\') - : Str::after($modelName, $appNamespace); - - return static::$namespace.$modelName.'Factory'; - }; - - return $resolver($modelName); - } - - /** - * Get the application namespace for the application. - * - * @return string - */ - protected static function appNamespace() - { - try { - return Container::getInstance() - ->make(Application::class) - ->getNamespace(); - } catch (Throwable $e) { - return 'App\\'; - } - } - - /** - * Proxy dynamic factory methods onto their proper methods. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - if ($method === 'trashed' && in_array(SoftDeletes::class, class_uses_recursive($this->modelName()))) { - return $this->state([ - $this->newModel()->getDeletedAtColumn() => $parameters[0] ?? Carbon::now()->subDay(), - ]); - } - - if (! Str::startsWith($method, ['for', 'has'])) { - static::throwBadMethodCallException($method); - } - - $relationship = Str::camel(Str::substr($method, 3)); - - $relatedModel = get_class($this->newModel()->{$relationship}()->getRelated()); - - if (method_exists($relatedModel, 'newFactory')) { - $factory = $relatedModel::newFactory() ?? static::factoryForModel($relatedModel); - } else { - $factory = static::factoryForModel($relatedModel); - } - - if (str_starts_with($method, 'for')) { - return $this->for($factory->state($parameters[0] ?? []), $relationship); - } elseif (str_starts_with($method, 'has')) { - return $this->has( - $factory - ->count(is_numeric($parameters[0] ?? null) ? $parameters[0] : 1) - ->state((is_callable($parameters[0] ?? null) || is_array($parameters[0] ?? null)) ? $parameters[0] : ($parameters[1] ?? [])), - $relationship - ); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/HasFactory.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/HasFactory.php deleted file mode 100644 index f10281d..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/HasFactory.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ - public static function factory($count = null, $state = []) - { - $factory = static::newFactory() ?: Factory::factoryForModel(get_called_class()); - - return $factory - ->count(is_numeric($count) ? $count : null) - ->state(is_callable($count) || is_array($count) ? $count : $state); - } - - /** - * Create a new factory instance for the model. - * - * @return \Illuminate\Database\Eloquent\Factories\Factory - */ - protected static function newFactory() - { - // - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Relationship.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Relationship.php deleted file mode 100644 index 3eb62da..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Relationship.php +++ /dev/null @@ -1,75 +0,0 @@ -factory = $factory; - $this->relationship = $relationship; - } - - /** - * Create the child relationship for the given parent model. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @return void - */ - public function createFor(Model $parent) - { - $relationship = $parent->{$this->relationship}(); - - if ($relationship instanceof MorphOneOrMany) { - $this->factory->state([ - $relationship->getMorphType() => $relationship->getMorphClass(), - $relationship->getForeignKeyName() => $relationship->getParentKey(), - ])->create([], $parent); - } elseif ($relationship instanceof HasOneOrMany) { - $this->factory->state([ - $relationship->getForeignKeyName() => $relationship->getParentKey(), - ])->create([], $parent); - } elseif ($relationship instanceof BelongsToMany) { - $relationship->attach($this->factory->create([], $parent)); - } - } - - /** - * Specify the model instances to always use when creating relationships. - * - * @param \Illuminate\Support\Collection $recycle - * @return $this - */ - public function recycle($recycle) - { - $this->factory = $this->factory->recycle($recycle); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Sequence.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Sequence.php deleted file mode 100644 index 7a4688b..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Factories/Sequence.php +++ /dev/null @@ -1,63 +0,0 @@ -sequence = $sequence; - $this->count = count($sequence); - } - - /** - * Get the current count of the sequence items. - * - * @return int - */ - public function count(): int - { - return $this->count; - } - - /** - * Get the next value in the sequence. - * - * @return mixed - */ - public function __invoke() - { - return tap(value($this->sequence[$this->index % $this->count], $this), function () { - $this->index = $this->index + 1; - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/HigherOrderBuilderProxy.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/HigherOrderBuilderProxy.php deleted file mode 100644 index 16b49a1..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/HigherOrderBuilderProxy.php +++ /dev/null @@ -1,50 +0,0 @@ -method = $method; - $this->builder = $builder; - } - - /** - * Proxy a scope call onto the query builder. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->builder->{$this->method}(function ($value) use ($method, $parameters) { - return $value->{$method}(...$parameters); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/InvalidCastException.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/InvalidCastException.php deleted file mode 100644 index 9d00eb3..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/InvalidCastException.php +++ /dev/null @@ -1,48 +0,0 @@ -model = $class; - $this->column = $column; - $this->castType = $castType; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/JsonEncodingException.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/JsonEncodingException.php deleted file mode 100644 index f62abd4..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/JsonEncodingException.php +++ /dev/null @@ -1,49 +0,0 @@ -getKey().'] to JSON: '.$message); - } - - /** - * Create a new JSON encoding exception for the resource. - * - * @param \Illuminate\Http\Resources\Json\JsonResource $resource - * @param string $message - * @return static - */ - public static function forResource($resource, $message) - { - $model = $resource->resource; - - return new static('Error encoding resource ['.get_class($resource).'] with model ['.get_class($model).'] with ID ['.$model->getKey().'] to JSON: '.$message); - } - - /** - * Create a new JSON encoding exception for an attribute. - * - * @param mixed $model - * @param mixed $key - * @param string $message - * @return static - */ - public static function forAttribute($model, $key, $message) - { - $class = get_class($model); - - return new static("Unable to encode attribute [{$key}] for model [{$class}] to JSON: {$message}."); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/MassAssignmentException.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/MassAssignmentException.php deleted file mode 100755 index 7c81aae..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/MassAssignmentException.php +++ /dev/null @@ -1,10 +0,0 @@ -prunable(), function ($query) use ($chunkSize) { - $query->when(! $query->getQuery()->limit, function ($query) use ($chunkSize) { - $query->limit($chunkSize); - }); - }); - - $total = 0; - - do { - $total += $count = in_array(SoftDeletes::class, class_uses_recursive(get_class($this))) - ? $query->forceDelete() - : $query->delete(); - - if ($count > 0) { - event(new ModelsPruned(static::class, $total)); - } - } while ($count > 0); - - return $total; - } - - /** - * Get the prunable model query. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public function prunable() - { - throw new LogicException('Please implement the prunable method on your model.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/MissingAttributeException.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/MissingAttributeException.php deleted file mode 100755 index 87935c1..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/MissingAttributeException.php +++ /dev/null @@ -1,23 +0,0 @@ -bootIfNotBooted(); - - $this->initializeTraits(); - - $this->syncOriginal(); - - $this->fill($attributes); - } - - /** - * Check if the model needs to be booted and if so, do it. - * - * @return void - */ - protected function bootIfNotBooted() - { - if (! isset(static::$booted[static::class])) { - static::$booted[static::class] = true; - - $this->fireModelEvent('booting', false); - - static::booting(); - static::boot(); - static::booted(); - - $this->fireModelEvent('booted', false); - } - } - - /** - * Perform any actions required before the model boots. - * - * @return void - */ - protected static function booting() - { - // - } - - /** - * Bootstrap the model and its traits. - * - * @return void - */ - protected static function boot() - { - static::bootTraits(); - } - - /** - * Boot all of the bootable traits on the model. - * - * @return void - */ - protected static function bootTraits() - { - $class = static::class; - - $booted = []; - - static::$traitInitializers[$class] = []; - - foreach (class_uses_recursive($class) as $trait) { - $method = 'boot'.class_basename($trait); - - if (method_exists($class, $method) && ! in_array($method, $booted)) { - forward_static_call([$class, $method]); - - $booted[] = $method; - } - - if (method_exists($class, $method = 'initialize'.class_basename($trait))) { - static::$traitInitializers[$class][] = $method; - - static::$traitInitializers[$class] = array_unique( - static::$traitInitializers[$class] - ); - } - } - } - - /** - * Initialize any initializable traits on the model. - * - * @return void - */ - protected function initializeTraits() - { - foreach (static::$traitInitializers[static::class] as $method) { - $this->{$method}(); - } - } - - /** - * Perform any actions required after the model boots. - * - * @return void - */ - protected static function booted() - { - // - } - - /** - * Clear the list of booted models so they will be re-booted. - * - * @return void - */ - public static function clearBootedModels() - { - static::$booted = []; - - static::$globalScopes = []; - } - - /** - * Disables relationship model touching for the current class during given callback scope. - * - * @param callable $callback - * @return void - */ - public static function withoutTouching(callable $callback) - { - static::withoutTouchingOn([static::class], $callback); - } - - /** - * Disables relationship model touching for the given model classes during given callback scope. - * - * @param array $models - * @param callable $callback - * @return void - */ - public static function withoutTouchingOn(array $models, callable $callback) - { - static::$ignoreOnTouch = array_values(array_merge(static::$ignoreOnTouch, $models)); - - try { - $callback(); - } finally { - static::$ignoreOnTouch = array_values(array_diff(static::$ignoreOnTouch, $models)); - } - } - - /** - * Determine if the given model is ignoring touches. - * - * @param string|null $class - * @return bool - */ - public static function isIgnoringTouch($class = null) - { - $class = $class ?: static::class; - - if (! get_class_vars($class)['timestamps'] || ! $class::UPDATED_AT) { - return true; - } - - foreach (static::$ignoreOnTouch as $ignoredClass) { - if ($class === $ignoredClass || is_subclass_of($class, $ignoredClass)) { - return true; - } - } - - return false; - } - - /** - * Indicate that models should prevent lazy loading, silently discarding attributes, and accessing missing attributes. - * - * @param bool $shouldBeStrict - * @return void - */ - public static function shouldBeStrict(bool $shouldBeStrict = true) - { - static::preventLazyLoading($shouldBeStrict); - static::preventSilentlyDiscardingAttributes($shouldBeStrict); - static::preventAccessingMissingAttributes($shouldBeStrict); - } - - /** - * Prevent model relationships from being lazy loaded. - * - * @param bool $value - * @return void - */ - public static function preventLazyLoading($value = true) - { - static::$modelsShouldPreventLazyLoading = $value; - } - - /** - * Register a callback that is responsible for handling lazy loading violations. - * - * @param callable|null $callback - * @return void - */ - public static function handleLazyLoadingViolationUsing(?callable $callback) - { - static::$lazyLoadingViolationCallback = $callback; - } - - /** - * Prevent non-fillable attributes from being silently discarded. - * - * @param bool $value - * @return void - */ - public static function preventSilentlyDiscardingAttributes($value = true) - { - static::$modelsShouldPreventSilentlyDiscardingAttributes = $value; - } - - /** - * Register a callback that is responsible for handling discarded attribute violations. - * - * @param callable|null $callback - * @return void - */ - public static function handleDiscardedAttributeViolationUsing(?callable $callback) - { - static::$discardedAttributeViolationCallback = $callback; - } - - /** - * Prevent accessing missing attributes on retrieved models. - * - * @param bool $value - * @return void - */ - public static function preventAccessingMissingAttributes($value = true) - { - static::$modelsShouldPreventAccessingMissingAttributes = $value; - } - - /** - * Register a callback that is responsible for handling lazy loading violations. - * - * @param callable|null $callback - * @return void - */ - public static function handleMissingAttributeViolationUsing(?callable $callback) - { - static::$missingAttributeViolationCallback = $callback; - } - - /** - * Execute a callback without broadcasting any model events for all model types. - * - * @param callable $callback - * @return mixed - */ - public static function withoutBroadcasting(callable $callback) - { - $isBroadcasting = static::$isBroadcasting; - - static::$isBroadcasting = false; - - try { - return $callback(); - } finally { - static::$isBroadcasting = $isBroadcasting; - } - } - - /** - * Fill the model with an array of attributes. - * - * @param array $attributes - * @return $this - * - * @throws \Illuminate\Database\Eloquent\MassAssignmentException - */ - public function fill(array $attributes) - { - $totallyGuarded = $this->totallyGuarded(); - - $fillable = $this->fillableFromArray($attributes); - - foreach ($fillable as $key => $value) { - // The developers may choose to place some attributes in the "fillable" array - // which means only those attributes may be set through mass assignment to - // the model, and all others will just get ignored for security reasons. - if ($this->isFillable($key)) { - $this->setAttribute($key, $value); - } elseif ($totallyGuarded || static::preventsSilentlyDiscardingAttributes()) { - if (isset(static::$discardedAttributeViolationCallback)) { - call_user_func(static::$discardedAttributeViolationCallback, $this, [$key]); - } else { - throw new MassAssignmentException(sprintf( - 'Add [%s] to fillable property to allow mass assignment on [%s].', - $key, get_class($this) - )); - } - } - } - - if (count($attributes) !== count($fillable) && - static::preventsSilentlyDiscardingAttributes()) { - $keys = array_diff(array_keys($attributes), array_keys($fillable)); - - if (isset(static::$discardedAttributeViolationCallback)) { - call_user_func(static::$discardedAttributeViolationCallback, $this, $keys); - } else { - throw new MassAssignmentException(sprintf( - 'Add fillable property [%s] to allow mass assignment on [%s].', - implode(', ', $keys), - get_class($this) - )); - } - } - - return $this; - } - - /** - * Fill the model with an array of attributes. Force mass assignment. - * - * @param array $attributes - * @return $this - */ - public function forceFill(array $attributes) - { - return static::unguarded(fn () => $this->fill($attributes)); - } - - /** - * Qualify the given column name by the model's table. - * - * @param string $column - * @return string - */ - public function qualifyColumn($column) - { - if (str_contains($column, '.')) { - return $column; - } - - return $this->getTable().'.'.$column; - } - - /** - * Qualify the given columns with the model's table. - * - * @param array $columns - * @return array - */ - public function qualifyColumns($columns) - { - return collect($columns)->map(function ($column) { - return $this->qualifyColumn($column); - })->all(); - } - - /** - * Create a new instance of the given model. - * - * @param array $attributes - * @param bool $exists - * @return static - */ - public function newInstance($attributes = [], $exists = false) - { - // This method just provides a convenient way for us to generate fresh model - // instances of this current model. It is particularly useful during the - // hydration of new objects via the Eloquent query builder instances. - $model = new static; - - $model->exists = $exists; - - $model->setConnection( - $this->getConnectionName() - ); - - $model->setTable($this->getTable()); - - $model->mergeCasts($this->casts); - - $model->fill((array) $attributes); - - return $model; - } - - /** - * Create a new model instance that is existing. - * - * @param array $attributes - * @param string|null $connection - * @return static - */ - public function newFromBuilder($attributes = [], $connection = null) - { - $model = $this->newInstance([], true); - - $model->setRawAttributes((array) $attributes, true); - - $model->setConnection($connection ?: $this->getConnectionName()); - - $model->fireModelEvent('retrieved', false); - - return $model; - } - - /** - * Begin querying the model on a given connection. - * - * @param string|null $connection - * @return \Illuminate\Database\Eloquent\Builder - */ - public static function on($connection = null) - { - // First we will just create a fresh instance of this model, and then we can set the - // connection on the model so that it is used for the queries we execute, as well - // as being set on every relation we retrieve without a custom connection name. - $instance = new static; - - $instance->setConnection($connection); - - return $instance->newQuery(); - } - - /** - * Begin querying the model on the write connection. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public static function onWriteConnection() - { - return static::query()->useWritePdo(); - } - - /** - * Get all of the models from the database. - * - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public static function all($columns = ['*']) - { - return static::query()->get( - is_array($columns) ? $columns : func_get_args() - ); - } - - /** - * Begin querying a model with eager loading. - * - * @param array|string $relations - * @return \Illuminate\Database\Eloquent\Builder - */ - public static function with($relations) - { - return static::query()->with( - is_string($relations) ? func_get_args() : $relations - ); - } - - /** - * Eager load relations on the model. - * - * @param array|string $relations - * @return $this - */ - public function load($relations) - { - $query = $this->newQueryWithoutRelationships()->with( - is_string($relations) ? func_get_args() : $relations - ); - - $query->eagerLoadRelations([$this]); - - return $this; - } - - /** - * Eager load relationships on the polymorphic relation of a model. - * - * @param string $relation - * @param array $relations - * @return $this - */ - public function loadMorph($relation, $relations) - { - if (! $this->{$relation}) { - return $this; - } - - $className = get_class($this->{$relation}); - - $this->{$relation}->load($relations[$className] ?? []); - - return $this; - } - - /** - * Eager load relations on the model if they are not already eager loaded. - * - * @param array|string $relations - * @return $this - */ - public function loadMissing($relations) - { - $relations = is_string($relations) ? func_get_args() : $relations; - - $this->newCollection([$this])->loadMissing($relations); - - return $this; - } - - /** - * Eager load relation's column aggregations on the model. - * - * @param array|string $relations - * @param string $column - * @param string $function - * @return $this - */ - public function loadAggregate($relations, $column, $function = null) - { - $this->newCollection([$this])->loadAggregate($relations, $column, $function); - - return $this; - } - - /** - * Eager load relation counts on the model. - * - * @param array|string $relations - * @return $this - */ - public function loadCount($relations) - { - $relations = is_string($relations) ? func_get_args() : $relations; - - return $this->loadAggregate($relations, '*', 'count'); - } - - /** - * Eager load relation max column values on the model. - * - * @param array|string $relations - * @param string $column - * @return $this - */ - public function loadMax($relations, $column) - { - return $this->loadAggregate($relations, $column, 'max'); - } - - /** - * Eager load relation min column values on the model. - * - * @param array|string $relations - * @param string $column - * @return $this - */ - public function loadMin($relations, $column) - { - return $this->loadAggregate($relations, $column, 'min'); - } - - /** - * Eager load relation's column summations on the model. - * - * @param array|string $relations - * @param string $column - * @return $this - */ - public function loadSum($relations, $column) - { - return $this->loadAggregate($relations, $column, 'sum'); - } - - /** - * Eager load relation average column values on the model. - * - * @param array|string $relations - * @param string $column - * @return $this - */ - public function loadAvg($relations, $column) - { - return $this->loadAggregate($relations, $column, 'avg'); - } - - /** - * Eager load related model existence values on the model. - * - * @param array|string $relations - * @return $this - */ - public function loadExists($relations) - { - return $this->loadAggregate($relations, '*', 'exists'); - } - - /** - * Eager load relationship column aggregation on the polymorphic relation of a model. - * - * @param string $relation - * @param array $relations - * @param string $column - * @param string $function - * @return $this - */ - public function loadMorphAggregate($relation, $relations, $column, $function = null) - { - if (! $this->{$relation}) { - return $this; - } - - $className = get_class($this->{$relation}); - - $this->{$relation}->loadAggregate($relations[$className] ?? [], $column, $function); - - return $this; - } - - /** - * Eager load relationship counts on the polymorphic relation of a model. - * - * @param string $relation - * @param array $relations - * @return $this - */ - public function loadMorphCount($relation, $relations) - { - return $this->loadMorphAggregate($relation, $relations, '*', 'count'); - } - - /** - * Eager load relationship max column values on the polymorphic relation of a model. - * - * @param string $relation - * @param array $relations - * @param string $column - * @return $this - */ - public function loadMorphMax($relation, $relations, $column) - { - return $this->loadMorphAggregate($relation, $relations, $column, 'max'); - } - - /** - * Eager load relationship min column values on the polymorphic relation of a model. - * - * @param string $relation - * @param array $relations - * @param string $column - * @return $this - */ - public function loadMorphMin($relation, $relations, $column) - { - return $this->loadMorphAggregate($relation, $relations, $column, 'min'); - } - - /** - * Eager load relationship column summations on the polymorphic relation of a model. - * - * @param string $relation - * @param array $relations - * @param string $column - * @return $this - */ - public function loadMorphSum($relation, $relations, $column) - { - return $this->loadMorphAggregate($relation, $relations, $column, 'sum'); - } - - /** - * Eager load relationship average column values on the polymorphic relation of a model. - * - * @param string $relation - * @param array $relations - * @param string $column - * @return $this - */ - public function loadMorphAvg($relation, $relations, $column) - { - return $this->loadMorphAggregate($relation, $relations, $column, 'avg'); - } - - /** - * Increment a column's value by a given amount. - * - * @param string $column - * @param float|int $amount - * @param array $extra - * @return int - */ - protected function increment($column, $amount = 1, array $extra = []) - { - return $this->incrementOrDecrement($column, $amount, $extra, 'increment'); - } - - /** - * Decrement a column's value by a given amount. - * - * @param string $column - * @param float|int $amount - * @param array $extra - * @return int - */ - protected function decrement($column, $amount = 1, array $extra = []) - { - return $this->incrementOrDecrement($column, $amount, $extra, 'decrement'); - } - - /** - * Run the increment or decrement method on the model. - * - * @param string $column - * @param float|int $amount - * @param array $extra - * @param string $method - * @return int - */ - protected function incrementOrDecrement($column, $amount, $extra, $method) - { - $query = $this->newQueryWithoutRelationships(); - - if (! $this->exists) { - return $query->{$method}($column, $amount, $extra); - } - - $this->{$column} = $this->isClassDeviable($column) - ? $this->deviateClassCastableAttribute($method, $column, $amount) - : $this->{$column} + ($method === 'increment' ? $amount : $amount * -1); - - $this->forceFill($extra); - - if ($this->fireModelEvent('updating') === false) { - return false; - } - - return tap($this->setKeysForSaveQuery($query)->{$method}($column, $amount, $extra), function () use ($column) { - $this->syncChanges(); - - $this->fireModelEvent('updated', false); - - $this->syncOriginalAttribute($column); - }); - } - - /** - * Update the model in the database. - * - * @param array $attributes - * @param array $options - * @return bool - */ - public function update(array $attributes = [], array $options = []) - { - if (! $this->exists) { - return false; - } - - return $this->fill($attributes)->save($options); - } - - /** - * Update the model in the database within a transaction. - * - * @param array $attributes - * @param array $options - * @return bool - * - * @throws \Throwable - */ - public function updateOrFail(array $attributes = [], array $options = []) - { - if (! $this->exists) { - return false; - } - - return $this->fill($attributes)->saveOrFail($options); - } - - /** - * Update the model in the database without raising any events. - * - * @param array $attributes - * @param array $options - * @return bool - */ - public function updateQuietly(array $attributes = [], array $options = []) - { - if (! $this->exists) { - return false; - } - - return $this->fill($attributes)->saveQuietly($options); - } - - /** - * Increment a column's value by a given amount without raising any events. - * - * @param string $column - * @param float|int $amount - * @param array $extra - * @return int - */ - protected function incrementQuietly($column, $amount = 1, array $extra = []) - { - return static::withoutEvents(function () use ($column, $amount, $extra) { - return $this->incrementOrDecrement($column, $amount, $extra, 'increment'); - }); - } - - /** - * Decrement a column's value by a given amount without raising any events. - * - * @param string $column - * @param float|int $amount - * @param array $extra - * @return int - */ - protected function decrementQuietly($column, $amount = 1, array $extra = []) - { - return static::withoutEvents(function () use ($column, $amount, $extra) { - return $this->incrementOrDecrement($column, $amount, $extra, 'decrement'); - }); - } - - /** - * Save the model and all of its relationships. - * - * @return bool - */ - public function push() - { - if (! $this->save()) { - return false; - } - - // To sync all of the relationships to the database, we will simply spin through - // the relationships and save each model via this "push" method, which allows - // us to recurse into all of these nested relations for the model instance. - foreach ($this->relations as $models) { - $models = $models instanceof Collection - ? $models->all() : [$models]; - - foreach (array_filter($models) as $model) { - if (! $model->push()) { - return false; - } - } - } - - return true; - } - - /** - * Save the model to the database without raising any events. - * - * @param array $options - * @return bool - */ - public function saveQuietly(array $options = []) - { - return static::withoutEvents(fn () => $this->save($options)); - } - - /** - * Save the model to the database. - * - * @param array $options - * @return bool - */ - public function save(array $options = []) - { - $this->mergeAttributesFromCachedCasts(); - - $query = $this->newModelQuery(); - - // If the "saving" event returns false we'll bail out of the save and return - // false, indicating that the save failed. This provides a chance for any - // listeners to cancel save operations if validations fail or whatever. - if ($this->fireModelEvent('saving') === false) { - return false; - } - - // If the model already exists in the database we can just update our record - // that is already in this database using the current IDs in this "where" - // clause to only update this model. Otherwise, we'll just insert them. - if ($this->exists) { - $saved = $this->isDirty() ? - $this->performUpdate($query) : true; - } - - // If the model is brand new, we'll insert it into our database and set the - // ID attribute on the model to the value of the newly inserted row's ID - // which is typically an auto-increment value managed by the database. - else { - $saved = $this->performInsert($query); - - if (! $this->getConnectionName() && - $connection = $query->getConnection()) { - $this->setConnection($connection->getName()); - } - } - - // If the model is successfully saved, we need to do a few more things once - // that is done. We will call the "saved" method here to run any actions - // we need to happen after a model gets successfully saved right here. - if ($saved) { - $this->finishSave($options); - } - - return $saved; - } - - /** - * Save the model to the database within a transaction. - * - * @param array $options - * @return bool - * - * @throws \Throwable - */ - public function saveOrFail(array $options = []) - { - return $this->getConnection()->transaction(fn () => $this->save($options)); - } - - /** - * Perform any actions that are necessary after the model is saved. - * - * @param array $options - * @return void - */ - protected function finishSave(array $options) - { - $this->fireModelEvent('saved', false); - - if ($this->isDirty() && ($options['touch'] ?? true)) { - $this->touchOwners(); - } - - $this->syncOriginal(); - } - - /** - * Perform a model update operation. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return bool - */ - protected function performUpdate(Builder $query) - { - // If the updating event returns false, we will cancel the update operation so - // developers can hook Validation systems into their models and cancel this - // operation if the model does not pass validation. Otherwise, we update. - if ($this->fireModelEvent('updating') === false) { - return false; - } - - // First we need to create a fresh query instance and touch the creation and - // update timestamp on the model which are maintained by us for developer - // convenience. Then we will just continue saving the model instances. - if ($this->usesTimestamps()) { - $this->updateTimestamps(); - } - - // Once we have run the update operation, we will fire the "updated" event for - // this model instance. This will allow developers to hook into these after - // models are updated, giving them a chance to do any special processing. - $dirty = $this->getDirty(); - - if (count($dirty) > 0) { - $this->setKeysForSaveQuery($query)->update($dirty); - - $this->syncChanges(); - - $this->fireModelEvent('updated', false); - } - - return true; - } - - /** - * Set the keys for a select query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function setKeysForSelectQuery($query) - { - $query->where($this->getKeyName(), '=', $this->getKeyForSelectQuery()); - - return $query; - } - - /** - * Get the primary key value for a select query. - * - * @return mixed - */ - protected function getKeyForSelectQuery() - { - return $this->original[$this->getKeyName()] ?? $this->getKey(); - } - - /** - * Set the keys for a save update query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function setKeysForSaveQuery($query) - { - $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); - - return $query; - } - - /** - * Get the primary key value for a save query. - * - * @return mixed - */ - protected function getKeyForSaveQuery() - { - return $this->original[$this->getKeyName()] ?? $this->getKey(); - } - - /** - * Perform a model insert operation. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return bool - */ - protected function performInsert(Builder $query) - { - if ($this->fireModelEvent('creating') === false) { - return false; - } - - // First we'll need to create a fresh query instance and touch the creation and - // update timestamps on this model, which are maintained by us for developer - // convenience. After, we will just continue saving these model instances. - if ($this->usesTimestamps()) { - $this->updateTimestamps(); - } - - // If the model has an incrementing key, we can use the "insertGetId" method on - // the query builder, which will give us back the final inserted ID for this - // table from the database. Not all tables have to be incrementing though. - $attributes = $this->getAttributesForInsert(); - - if ($this->getIncrementing()) { - $this->insertAndSetId($query, $attributes); - } - - // If the table isn't incrementing we'll simply insert these attributes as they - // are. These attribute arrays must contain an "id" column previously placed - // there by the developer as the manually determined key for these models. - else { - if (empty($attributes)) { - return true; - } - - $query->insert($attributes); - } - - // We will go ahead and set the exists property to true, so that it is set when - // the created event is fired, just in case the developer tries to update it - // during the event. This will allow them to do so and run an update here. - $this->exists = true; - - $this->wasRecentlyCreated = true; - - $this->fireModelEvent('created', false); - - return true; - } - - /** - * Insert the given attributes and set the ID on the model. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param array $attributes - * @return void - */ - protected function insertAndSetId(Builder $query, $attributes) - { - $id = $query->insertGetId($attributes, $keyName = $this->getKeyName()); - - $this->setAttribute($keyName, $id); - } - - /** - * Destroy the models for the given IDs. - * - * @param \Illuminate\Support\Collection|array|int|string $ids - * @return int - */ - public static function destroy($ids) - { - if ($ids instanceof EloquentCollection) { - $ids = $ids->modelKeys(); - } - - if ($ids instanceof BaseCollection) { - $ids = $ids->all(); - } - - $ids = is_array($ids) ? $ids : func_get_args(); - - if (count($ids) === 0) { - return 0; - } - - // We will actually pull the models from the database table and call delete on - // each of them individually so that their events get fired properly with a - // correct set of attributes in case the developers wants to check these. - $key = ($instance = new static)->getKeyName(); - - $count = 0; - - foreach ($instance->whereIn($key, $ids)->get() as $model) { - if ($model->delete()) { - $count++; - } - } - - return $count; - } - - /** - * Delete the model from the database. - * - * @return bool|null - * - * @throws \LogicException - */ - public function delete() - { - $this->mergeAttributesFromCachedCasts(); - - if (is_null($this->getKeyName())) { - throw new LogicException('No primary key defined on model.'); - } - - // If the model doesn't exist, there is nothing to delete so we'll just return - // immediately and not do anything else. Otherwise, we will continue with a - // deletion process on the model, firing the proper events, and so forth. - if (! $this->exists) { - return; - } - - if ($this->fireModelEvent('deleting') === false) { - return false; - } - - // Here, we'll touch the owning models, verifying these timestamps get updated - // for the models. This will allow any caching to get broken on the parents - // by the timestamp. Then we will go ahead and delete the model instance. - $this->touchOwners(); - - $this->performDeleteOnModel(); - - // Once the model has been deleted, we will fire off the deleted event so that - // the developers may hook into post-delete operations. We will then return - // a boolean true as the delete is presumably successful on the database. - $this->fireModelEvent('deleted', false); - - return true; - } - - /** - * Delete the model from the database without raising any events. - * - * @return bool - */ - public function deleteQuietly() - { - return static::withoutEvents(fn () => $this->delete()); - } - - /** - * Delete the model from the database within a transaction. - * - * @return bool|null - * - * @throws \Throwable - */ - public function deleteOrFail() - { - if (! $this->exists) { - return false; - } - - return $this->getConnection()->transaction(fn () => $this->delete()); - } - - /** - * Force a hard delete on a soft deleted model. - * - * This method protects developers from running forceDelete when the trait is missing. - * - * @return bool|null - */ - public function forceDelete() - { - return $this->delete(); - } - - /** - * Perform the actual delete query on this model instance. - * - * @return void - */ - protected function performDeleteOnModel() - { - $this->setKeysForSaveQuery($this->newModelQuery())->delete(); - - $this->exists = false; - } - - /** - * Begin querying the model. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public static function query() - { - return (new static)->newQuery(); - } - - /** - * Get a new query builder for the model's table. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public function newQuery() - { - return $this->registerGlobalScopes($this->newQueryWithoutScopes()); - } - - /** - * Get a new query builder that doesn't have any global scopes or eager loading. - * - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function newModelQuery() - { - return $this->newEloquentBuilder( - $this->newBaseQueryBuilder() - )->setModel($this); - } - - /** - * Get a new query builder with no relationships loaded. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public function newQueryWithoutRelationships() - { - return $this->registerGlobalScopes($this->newModelQuery()); - } - - /** - * Register the global scopes for this builder instance. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return \Illuminate\Database\Eloquent\Builder - */ - public function registerGlobalScopes($builder) - { - foreach ($this->getGlobalScopes() as $identifier => $scope) { - $builder->withGlobalScope($identifier, $scope); - } - - return $builder; - } - - /** - * Get a new query builder that doesn't have any global scopes. - * - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function newQueryWithoutScopes() - { - return $this->newModelQuery() - ->with($this->with) - ->withCount($this->withCount); - } - - /** - * Get a new query instance without a given scope. - * - * @param \Illuminate\Database\Eloquent\Scope|string $scope - * @return \Illuminate\Database\Eloquent\Builder - */ - public function newQueryWithoutScope($scope) - { - return $this->newQuery()->withoutGlobalScope($scope); - } - - /** - * Get a new query to restore one or more models by their queueable IDs. - * - * @param array|int $ids - * @return \Illuminate\Database\Eloquent\Builder - */ - public function newQueryForRestoration($ids) - { - return $this->newQueryWithoutScopes()->whereKey($ids); - } - - /** - * Create a new Eloquent query builder for the model. - * - * @param \Illuminate\Database\Query\Builder $query - * @return \Illuminate\Database\Eloquent\Builder|static - */ - public function newEloquentBuilder($query) - { - return new Builder($query); - } - - /** - * Get a new query builder instance for the connection. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function newBaseQueryBuilder() - { - return $this->getConnection()->query(); - } - - /** - * Create a new Eloquent Collection instance. - * - * @param array $models - * @return \Illuminate\Database\Eloquent\Collection - */ - public function newCollection(array $models = []) - { - return new Collection($models); - } - - /** - * Create a new pivot model instance. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @param array $attributes - * @param string $table - * @param bool $exists - * @param string|null $using - * @return \Illuminate\Database\Eloquent\Relations\Pivot - */ - public function newPivot(self $parent, array $attributes, $table, $exists, $using = null) - { - return $using ? $using::fromRawAttributes($parent, $attributes, $table, $exists) - : Pivot::fromAttributes($parent, $attributes, $table, $exists); - } - - /** - * Determine if the model has a given scope. - * - * @param string $scope - * @return bool - */ - public function hasNamedScope($scope) - { - return method_exists($this, 'scope'.ucfirst($scope)); - } - - /** - * Apply the given named scope if possible. - * - * @param string $scope - * @param array $parameters - * @return mixed - */ - public function callNamedScope($scope, array $parameters = []) - { - return $this->{'scope'.ucfirst($scope)}(...$parameters); - } - - /** - * Convert the model instance to an array. - * - * @return array - */ - public function toArray() - { - return array_merge($this->attributesToArray(), $this->relationsToArray()); - } - - /** - * Convert the model instance to JSON. - * - * @param int $options - * @return string - * - * @throws \Illuminate\Database\Eloquent\JsonEncodingException - */ - public function toJson($options = 0) - { - $json = json_encode($this->jsonSerialize(), $options); - - if (json_last_error() !== JSON_ERROR_NONE) { - throw JsonEncodingException::forModel($this, json_last_error_msg()); - } - - return $json; - } - - /** - * Convert the object into something JSON serializable. - * - * @return mixed - */ - public function jsonSerialize(): mixed - { - return $this->toArray(); - } - - /** - * Reload a fresh model instance from the database. - * - * @param array|string $with - * @return static|null - */ - public function fresh($with = []) - { - if (! $this->exists) { - return; - } - - return $this->setKeysForSelectQuery($this->newQueryWithoutScopes()) - ->useWritePdo() - ->with(is_string($with) ? func_get_args() : $with) - ->first(); - } - - /** - * Reload the current model instance with fresh attributes from the database. - * - * @return $this - */ - public function refresh() - { - if (! $this->exists) { - return $this; - } - - $this->setRawAttributes( - $this->setKeysForSelectQuery($this->newQueryWithoutScopes()) - ->useWritePdo() - ->firstOrFail() - ->attributes - ); - - $this->load(collect($this->relations)->reject(function ($relation) { - return $relation instanceof Pivot - || (is_object($relation) && in_array(AsPivot::class, class_uses_recursive($relation), true)); - })->keys()->all()); - - $this->syncOriginal(); - - return $this; - } - - /** - * Clone the model into a new, non-existing instance. - * - * @param array|null $except - * @return static - */ - public function replicate(array $except = null) - { - $defaults = array_values(array_filter([ - $this->getKeyName(), - $this->getCreatedAtColumn(), - $this->getUpdatedAtColumn(), - ])); - - $attributes = Arr::except( - $this->getAttributes(), $except ? array_unique(array_merge($except, $defaults)) : $defaults - ); - - return tap(new static, function ($instance) use ($attributes) { - $instance->setRawAttributes($attributes); - - $instance->setRelations($this->relations); - - $instance->fireModelEvent('replicating', false); - }); - } - - /** - * Clone the model into a new, non-existing instance without raising any events. - * - * @param array|null $except - * @return static - */ - public function replicateQuietly(array $except = null) - { - return static::withoutEvents(fn () => $this->replicate($except)); - } - - /** - * Determine if two models have the same ID and belong to the same table. - * - * @param \Illuminate\Database\Eloquent\Model|null $model - * @return bool - */ - public function is($model) - { - return ! is_null($model) && - $this->getKey() === $model->getKey() && - $this->getTable() === $model->getTable() && - $this->getConnectionName() === $model->getConnectionName(); - } - - /** - * Determine if two models are not the same. - * - * @param \Illuminate\Database\Eloquent\Model|null $model - * @return bool - */ - public function isNot($model) - { - return ! $this->is($model); - } - - /** - * Get the database connection for the model. - * - * @return \Illuminate\Database\Connection - */ - public function getConnection() - { - return static::resolveConnection($this->getConnectionName()); - } - - /** - * Get the current connection name for the model. - * - * @return string|null - */ - public function getConnectionName() - { - return $this->connection; - } - - /** - * Set the connection associated with the model. - * - * @param string|null $name - * @return $this - */ - public function setConnection($name) - { - $this->connection = $name; - - return $this; - } - - /** - * Resolve a connection instance. - * - * @param string|null $connection - * @return \Illuminate\Database\Connection - */ - public static function resolveConnection($connection = null) - { - return static::$resolver->connection($connection); - } - - /** - * Get the connection resolver instance. - * - * @return \Illuminate\Database\ConnectionResolverInterface - */ - public static function getConnectionResolver() - { - return static::$resolver; - } - - /** - * Set the connection resolver instance. - * - * @param \Illuminate\Database\ConnectionResolverInterface $resolver - * @return void - */ - public static function setConnectionResolver(Resolver $resolver) - { - static::$resolver = $resolver; - } - - /** - * Unset the connection resolver for models. - * - * @return void - */ - public static function unsetConnectionResolver() - { - static::$resolver = null; - } - - /** - * Get the table associated with the model. - * - * @return string - */ - public function getTable() - { - return $this->table ?? Str::snake(Str::pluralStudly(class_basename($this))); - } - - /** - * Set the table associated with the model. - * - * @param string $table - * @return $this - */ - public function setTable($table) - { - $this->table = $table; - - return $this; - } - - /** - * Get the primary key for the model. - * - * @return string - */ - public function getKeyName() - { - return $this->primaryKey; - } - - /** - * Set the primary key for the model. - * - * @param string $key - * @return $this - */ - public function setKeyName($key) - { - $this->primaryKey = $key; - - return $this; - } - - /** - * Get the table qualified key name. - * - * @return string - */ - public function getQualifiedKeyName() - { - return $this->qualifyColumn($this->getKeyName()); - } - - /** - * Get the auto-incrementing key type. - * - * @return string - */ - public function getKeyType() - { - return $this->keyType; - } - - /** - * Set the data type for the primary key. - * - * @param string $type - * @return $this - */ - public function setKeyType($type) - { - $this->keyType = $type; - - return $this; - } - - /** - * Get the value indicating whether the IDs are incrementing. - * - * @return bool - */ - public function getIncrementing() - { - return $this->incrementing; - } - - /** - * Set whether IDs are incrementing. - * - * @param bool $value - * @return $this - */ - public function setIncrementing($value) - { - $this->incrementing = $value; - - return $this; - } - - /** - * Get the value of the model's primary key. - * - * @return mixed - */ - public function getKey() - { - return $this->getAttribute($this->getKeyName()); - } - - /** - * Get the queueable identity for the entity. - * - * @return mixed - */ - public function getQueueableId() - { - return $this->getKey(); - } - - /** - * Get the queueable relationships for the entity. - * - * @return array - */ - public function getQueueableRelations() - { - $relations = []; - - foreach ($this->getRelations() as $key => $relation) { - if (! method_exists($this, $key)) { - continue; - } - - $relations[] = $key; - - if ($relation instanceof QueueableCollection) { - foreach ($relation->getQueueableRelations() as $collectionValue) { - $relations[] = $key.'.'.$collectionValue; - } - } - - if ($relation instanceof QueueableEntity) { - foreach ($relation->getQueueableRelations() as $entityValue) { - $relations[] = $key.'.'.$entityValue; - } - } - } - - return array_unique($relations); - } - - /** - * Get the queueable connection for the entity. - * - * @return string|null - */ - public function getQueueableConnection() - { - return $this->getConnectionName(); - } - - /** - * Get the value of the model's route key. - * - * @return mixed - */ - public function getRouteKey() - { - return $this->getAttribute($this->getRouteKeyName()); - } - - /** - * Get the route key for the model. - * - * @return string - */ - public function getRouteKeyName() - { - return $this->getKeyName(); - } - - /** - * Retrieve the model for a bound value. - * - * @param mixed $value - * @param string|null $field - * @return \Illuminate\Database\Eloquent\Model|null - */ - public function resolveRouteBinding($value, $field = null) - { - return $this->resolveRouteBindingQuery($this, $value, $field)->first(); - } - - /** - * Retrieve the model for a bound value. - * - * @param mixed $value - * @param string|null $field - * @return \Illuminate\Database\Eloquent\Model|null - */ - public function resolveSoftDeletableRouteBinding($value, $field = null) - { - return $this->resolveRouteBindingQuery($this, $value, $field)->withTrashed()->first(); - } - - /** - * Retrieve the child model for a bound value. - * - * @param string $childType - * @param mixed $value - * @param string|null $field - * @return \Illuminate\Database\Eloquent\Model|null - */ - public function resolveChildRouteBinding($childType, $value, $field) - { - return $this->resolveChildRouteBindingQuery($childType, $value, $field)->first(); - } - - /** - * Retrieve the child model for a bound value. - * - * @param string $childType - * @param mixed $value - * @param string|null $field - * @return \Illuminate\Database\Eloquent\Model|null - */ - public function resolveSoftDeletableChildRouteBinding($childType, $value, $field) - { - return $this->resolveChildRouteBindingQuery($childType, $value, $field)->withTrashed()->first(); - } - - /** - * Retrieve the child model query for a bound value. - * - * @param string $childType - * @param mixed $value - * @param string|null $field - * @return \Illuminate\Database\Eloquent\Relations\Relation - */ - protected function resolveChildRouteBindingQuery($childType, $value, $field) - { - $relationship = $this->{$this->childRouteBindingRelationshipName($childType)}(); - - $field = $field ?: $relationship->getRelated()->getRouteKeyName(); - - if ($relationship instanceof HasManyThrough || - $relationship instanceof BelongsToMany) { - $field = $relationship->getRelated()->getTable().'.'.$field; - } - - return $relationship instanceof Model - ? $relationship->resolveRouteBindingQuery($relationship, $value, $field) - : $relationship->getRelated()->resolveRouteBindingQuery($relationship, $value, $field); - } - - /** - * Retrieve the child route model binding relationship name for the given child type. - * - * @param string $childType - * @return string - */ - protected function childRouteBindingRelationshipName($childType) - { - return Str::plural(Str::camel($childType)); - } - - /** - * Retrieve the model for a bound value. - * - * @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation $query - * @param mixed $value - * @param string|null $field - * @return \Illuminate\Database\Eloquent\Relations\Relation - */ - public function resolveRouteBindingQuery($query, $value, $field = null) - { - return $query->where($field ?? $this->getRouteKeyName(), $value); - } - - /** - * Get the default foreign key name for the model. - * - * @return string - */ - public function getForeignKey() - { - return Str::snake(class_basename($this)).'_'.$this->getKeyName(); - } - - /** - * Get the number of models to return per page. - * - * @return int - */ - public function getPerPage() - { - return $this->perPage; - } - - /** - * Set the number of models to return per page. - * - * @param int $perPage - * @return $this - */ - public function setPerPage($perPage) - { - $this->perPage = $perPage; - - return $this; - } - - /** - * Determine if lazy loading is disabled. - * - * @return bool - */ - public static function preventsLazyLoading() - { - return static::$modelsShouldPreventLazyLoading; - } - - /** - * Determine if discarding guarded attribute fills is disabled. - * - * @return bool - */ - public static function preventsSilentlyDiscardingAttributes() - { - return static::$modelsShouldPreventSilentlyDiscardingAttributes; - } - - /** - * Determine if accessing missing attributes is disabled. - * - * @return bool - */ - public static function preventsAccessingMissingAttributes() - { - return static::$modelsShouldPreventAccessingMissingAttributes; - } - - /** - * Get the broadcast channel route definition that is associated with the given entity. - * - * @return string - */ - public function broadcastChannelRoute() - { - return str_replace('\\', '.', get_class($this)).'.{'.Str::camel(class_basename($this)).'}'; - } - - /** - * Get the broadcast channel name that is associated with the given entity. - * - * @return string - */ - public function broadcastChannel() - { - return str_replace('\\', '.', get_class($this)).'.'.$this->getKey(); - } - - /** - * Dynamically retrieve attributes on the model. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->getAttribute($key); - } - - /** - * Dynamically set attributes on the model. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this->setAttribute($key, $value); - } - - /** - * Determine if the given attribute exists. - * - * @param mixed $offset - * @return bool - */ - public function offsetExists($offset): bool - { - try { - return ! is_null($this->getAttribute($offset)); - } catch (MissingAttributeException) { - return false; - } - } - - /** - * Get the value for a given offset. - * - * @param mixed $offset - * @return mixed - */ - public function offsetGet($offset): mixed - { - return $this->getAttribute($offset); - } - - /** - * Set the value for a given offset. - * - * @param mixed $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset, $value): void - { - $this->setAttribute($offset, $value); - } - - /** - * Unset the value for a given offset. - * - * @param mixed $offset - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->attributes[$offset], $this->relations[$offset]); - } - - /** - * Determine if an attribute or relation exists on the model. - * - * @param string $key - * @return bool - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset an attribute on the model. - * - * @param string $key - * @return void - */ - public function __unset($key) - { - $this->offsetUnset($key); - } - - /** - * Handle dynamic method calls into the model. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (in_array($method, ['increment', 'decrement'])) { - return $this->$method(...$parameters); - } - - if ($resolver = ($this->relationResolver(static::class, $method))) { - return $resolver($this); - } - - return $this->forwardCallTo($this->newQuery(), $method, $parameters); - } - - /** - * Handle dynamic static method calls into the model. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public static function __callStatic($method, $parameters) - { - return (new static)->$method(...$parameters); - } - - /** - * Convert the model to its string representation. - * - * @return string - */ - public function __toString() - { - return $this->escapeWhenCastingToString - ? e($this->toJson()) - : $this->toJson(); - } - - /** - * Indicate that the object's string representation should be escaped when __toString is invoked. - * - * @param bool $escape - * @return $this - */ - public function escapeWhenCastingToString($escape = true) - { - $this->escapeWhenCastingToString = $escape; - - return $this; - } - - /** - * Prepare the object for serialization. - * - * @return array - */ - public function __sleep() - { - $this->mergeAttributesFromCachedCasts(); - - $this->classCastCache = []; - $this->attributeCastCache = []; - - return array_keys(get_object_vars($this)); - } - - /** - * When a model is being unserialized, check if it needs to be booted. - * - * @return void - */ - public function __wakeup() - { - $this->bootIfNotBooted(); - - $this->initializeTraits(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/ModelNotFoundException.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/ModelNotFoundException.php deleted file mode 100755 index 79ae8a3..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/ModelNotFoundException.php +++ /dev/null @@ -1,69 +0,0 @@ - - */ - protected $model; - - /** - * The affected model IDs. - * - * @var array - */ - protected $ids; - - /** - * Set the affected Eloquent model and instance ids. - * - * @param class-string $model - * @param array|int|string $ids - * @return $this - */ - public function setModel($model, $ids = []) - { - $this->model = $model; - $this->ids = Arr::wrap($ids); - - $this->message = "No query results for model [{$model}]"; - - if (count($this->ids) > 0) { - $this->message .= ' '.implode(', ', $this->ids); - } else { - $this->message .= '.'; - } - - return $this; - } - - /** - * Get the affected Eloquent model. - * - * @return class-string - */ - public function getModel() - { - return $this->model; - } - - /** - * Get the affected Eloquent model IDs. - * - * @return array - */ - public function getIds() - { - return $this->ids; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Prunable.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Prunable.php deleted file mode 100644 index b4ce1b0..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Prunable.php +++ /dev/null @@ -1,67 +0,0 @@ -prunable() - ->when(in_array(SoftDeletes::class, class_uses_recursive(get_class($this))), function ($query) { - $query->withTrashed(); - })->chunkById($chunkSize, function ($models) use (&$total) { - $models->each->prune(); - - $total += $models->count(); - - event(new ModelsPruned(static::class, $total)); - }); - - return $total; - } - - /** - * Get the prunable model query. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - public function prunable() - { - throw new LogicException('Please implement the prunable method on your model.'); - } - - /** - * Prune the model in the database. - * - * @return bool|null - */ - public function prune() - { - $this->pruning(); - - return in_array(SoftDeletes::class, class_uses_recursive(get_class($this))) - ? $this->forceDelete() - : $this->delete(); - } - - /** - * Prepare the model for pruning. - * - * @return void - */ - protected function pruning() - { - // - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/QueueEntityResolver.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/QueueEntityResolver.php deleted file mode 100644 index 22fccf2..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/QueueEntityResolver.php +++ /dev/null @@ -1,29 +0,0 @@ -find($id); - - if ($instance) { - return $instance; - } - - throw new EntityNotFoundException($type, $id); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/RelationNotFoundException.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/RelationNotFoundException.php deleted file mode 100755 index 73257bb..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/RelationNotFoundException.php +++ /dev/null @@ -1,46 +0,0 @@ -model = $class; - $instance->relation = $relation; - - return $instance; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php deleted file mode 100755 index c17b733..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php +++ /dev/null @@ -1,383 +0,0 @@ -ownerKey = $ownerKey; - $this->relationName = $relationName; - $this->foreignKey = $foreignKey; - - // In the underlying base relationship class, this variable is referred to as - // the "parent" since most relationships are not inversed. But, since this - // one is we will create a "child" variable for much better readability. - $this->child = $child; - - parent::__construct($query, $child); - } - - /** - * Get the results of the relationship. - * - * @return mixed - */ - public function getResults() - { - if (is_null($this->child->{$this->foreignKey})) { - return $this->getDefaultFor($this->parent); - } - - return $this->query->first() ?: $this->getDefaultFor($this->parent); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - if (static::$constraints) { - // For belongs to relationships, which are essentially the inverse of has one - // or has many relationships, we need to actually query on the primary key - // of the related models matching on the foreign key that's on a parent. - $table = $this->related->getTable(); - - $this->query->where($table.'.'.$this->ownerKey, '=', $this->child->{$this->foreignKey}); - } - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - // We'll grab the primary key name of the related models since it could be set to - // a non-standard name and not "id". We will then construct the constraint for - // our eagerly loading query so it returns the proper models from execution. - $key = $this->related->getTable().'.'.$this->ownerKey; - - $whereIn = $this->whereInMethod($this->related, $this->ownerKey); - - $this->query->{$whereIn}($key, $this->getEagerModelKeys($models)); - } - - /** - * Gather the keys from an array of related models. - * - * @param array $models - * @return array - */ - protected function getEagerModelKeys(array $models) - { - $keys = []; - - // First we need to gather all of the keys from the parent models so we know what - // to query for via the eager loading query. We will add them to an array then - // execute a "where in" statement to gather up all of those related records. - foreach ($models as $model) { - if (! is_null($value = $model->{$this->foreignKey})) { - $keys[] = $value; - } - } - - sort($keys); - - return array_values(array_unique($keys)); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) { - $model->setRelation($relation, $this->getDefaultFor($model)); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - $foreign = $this->foreignKey; - - $owner = $this->ownerKey; - - // First we will get to build a dictionary of the child models by their primary - // key of the relationship, then we can easily match the children back onto - // the parents using that dictionary and the primary key of the children. - $dictionary = []; - - foreach ($results as $result) { - $attribute = $this->getDictionaryKey($result->getAttribute($owner)); - - $dictionary[$attribute] = $result; - } - - // Once we have the dictionary constructed, we can loop through all the parents - // and match back onto their children using these keys of the dictionary and - // the primary key of the children to map them onto the correct instances. - foreach ($models as $model) { - $attribute = $this->getDictionaryKey($model->{$foreign}); - - if (isset($dictionary[$attribute])) { - $model->setRelation($relation, $dictionary[$attribute]); - } - } - - return $models; - } - - /** - * Associate the model instance to the given parent. - * - * @param \Illuminate\Database\Eloquent\Model|int|string|null $model - * @return \Illuminate\Database\Eloquent\Model - */ - public function associate($model) - { - $ownerKey = $model instanceof Model ? $model->getAttribute($this->ownerKey) : $model; - - $this->child->setAttribute($this->foreignKey, $ownerKey); - - if ($model instanceof Model) { - $this->child->setRelation($this->relationName, $model); - } else { - $this->child->unsetRelation($this->relationName); - } - - return $this->child; - } - - /** - * Dissociate previously associated model from the given parent. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function dissociate() - { - $this->child->setAttribute($this->foreignKey, null); - - return $this->child->setRelation($this->relationName, null); - } - - /** - * Alias of "dissociate" method. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function disassociate() - { - return $this->dissociate(); - } - - /** - * Add the constraints for a relationship query. - * - * @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 = ['*']) - { - if ($parentQuery->getQuery()->from == $query->getQuery()->from) { - return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); - } - - return $query->select($columns)->whereColumn( - $this->getQualifiedForeignKeyName(), '=', $query->qualifyColumn($this->ownerKey) - ); - } - - /** - * Add the constraints for a relationship query on the same table. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parentQuery - * @param array|mixed $columns - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) - { - $query->select($columns)->from( - $query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash() - ); - - $query->getModel()->setTable($hash); - - return $query->whereColumn( - $hash.'.'.$this->ownerKey, '=', $this->getQualifiedForeignKeyName() - ); - } - - /** - * Determine if the related model has an auto-incrementing ID. - * - * @return bool - */ - protected function relationHasIncrementingId() - { - return $this->related->getIncrementing() && - in_array($this->related->getKeyType(), ['int', 'integer']); - } - - /** - * Make a new related instance for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @return \Illuminate\Database\Eloquent\Model - */ - protected function newRelatedInstanceFor(Model $parent) - { - return $this->related->newInstance(); - } - - /** - * Get the child of the relationship. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function getChild() - { - return $this->child; - } - - /** - * Get the foreign key of the relationship. - * - * @return string - */ - public function getForeignKeyName() - { - return $this->foreignKey; - } - - /** - * Get the fully qualified foreign key of the relationship. - * - * @return string - */ - public function getQualifiedForeignKeyName() - { - return $this->child->qualifyColumn($this->foreignKey); - } - - /** - * Get the key value of the child's foreign key. - * - * @return mixed - */ - public function getParentKey() - { - return $this->child->{$this->foreignKey}; - } - - /** - * Get the associated key of the relationship. - * - * @return string - */ - public function getOwnerKeyName() - { - return $this->ownerKey; - } - - /** - * Get the fully qualified associated key of the relationship. - * - * @return string - */ - public function getQualifiedOwnerKeyName() - { - return $this->related->qualifyColumn($this->ownerKey); - } - - /** - * Get the value of the model's associated key. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return mixed - */ - protected function getRelatedKeyFrom(Model $model) - { - return $model->{$this->ownerKey}; - } - - /** - * Get the name of the relationship. - * - * @return string - */ - public function getRelationName() - { - return $this->relationName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php deleted file mode 100755 index 6a9ec9e..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php +++ /dev/null @@ -1,1503 +0,0 @@ -parentKey = $parentKey; - $this->relatedKey = $relatedKey; - $this->relationName = $relationName; - $this->relatedPivotKey = $relatedPivotKey; - $this->foreignPivotKey = $foreignPivotKey; - $this->table = $this->resolveTableName($table); - - parent::__construct($query, $parent); - } - - /** - * Attempt to resolve the intermediate table name from the given string. - * - * @param string $table - * @return string - */ - protected function resolveTableName($table) - { - if (! str_contains($table, '\\') || ! class_exists($table)) { - return $table; - } - - $model = new $table; - - if (! $model instanceof Model) { - return $table; - } - - if (in_array(AsPivot::class, class_uses_recursive($model))) { - $this->using($table); - } - - return $model->getTable(); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - $this->performJoin(); - - if (static::$constraints) { - $this->addWhereConstraints(); - } - } - - /** - * Set the join clause for the relation query. - * - * @param \Illuminate\Database\Eloquent\Builder|null $query - * @return $this - */ - protected function performJoin($query = null) - { - $query = $query ?: $this->query; - - // We need to join to the intermediate table on the related model's primary - // key column with the intermediate table's foreign key for the related - // model instance. Then we can set the "where" for the parent models. - $query->join( - $this->table, - $this->getQualifiedRelatedKeyName(), - '=', - $this->getQualifiedRelatedPivotKeyName() - ); - - return $this; - } - - /** - * Set the where clause for the relation query. - * - * @return $this - */ - protected function addWhereConstraints() - { - $this->query->where( - $this->getQualifiedForeignPivotKeyName(), '=', $this->parent->{$this->parentKey} - ); - - return $this; - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - $whereIn = $this->whereInMethod($this->parent, $this->parentKey); - - $this->query->{$whereIn}( - $this->getQualifiedForeignPivotKeyName(), - $this->getKeys($models, $this->parentKey) - ); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) { - $model->setRelation($relation, $this->related->newCollection()); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - $dictionary = $this->buildDictionary($results); - - // Once we have an array dictionary of child objects we can easily match the - // children back to their parent using the dictionary and the keys on the - // parent models. Then we should return these hydrated models back out. - foreach ($models as $model) { - $key = $this->getDictionaryKey($model->{$this->parentKey}); - - if (isset($dictionary[$key])) { - $model->setRelation( - $relation, $this->related->newCollection($dictionary[$key]) - ); - } - } - - return $models; - } - - /** - * Build model dictionary keyed by the relation's foreign key. - * - * @param \Illuminate\Database\Eloquent\Collection $results - * @return array - */ - protected function buildDictionary(Collection $results) - { - // First we'll build a dictionary of child models keyed by the foreign key - // of the relation so that we will easily and quickly match them to the - // parents without having a possibly slow inner loop for every model. - $dictionary = []; - - foreach ($results as $result) { - $value = $this->getDictionaryKey($result->{$this->accessor}->{$this->foreignPivotKey}); - - $dictionary[$value][] = $result; - } - - return $dictionary; - } - - /** - * Get the class being used for pivot models. - * - * @return string - */ - public function getPivotClass() - { - return $this->using ?? Pivot::class; - } - - /** - * Specify the custom pivot model to use for the relationship. - * - * @param string $class - * @return $this - */ - public function using($class) - { - $this->using = $class; - - return $this; - } - - /** - * Specify the custom pivot accessor to use for the relationship. - * - * @param string $accessor - * @return $this - */ - public function as($accessor) - { - $this->accessor = $accessor; - - return $this; - } - - /** - * Set a where clause for a pivot table column. - * - * @param string $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return $this - */ - public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') - { - $this->pivotWheres[] = func_get_args(); - - return $this->where($this->qualifyPivotColumn($column), $operator, $value, $boolean); - } - - /** - * Set a "where between" clause for a pivot table column. - * - * @param string $column - * @param array $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function wherePivotBetween($column, array $values, $boolean = 'and', $not = false) - { - return $this->whereBetween($this->qualifyPivotColumn($column), $values, $boolean, $not); - } - - /** - * Set a "or where between" clause for a pivot table column. - * - * @param string $column - * @param array $values - * @return $this - */ - public function orWherePivotBetween($column, array $values) - { - return $this->wherePivotBetween($column, $values, 'or'); - } - - /** - * Set a "where pivot not between" clause for a pivot table column. - * - * @param string $column - * @param array $values - * @param string $boolean - * @return $this - */ - public function wherePivotNotBetween($column, array $values, $boolean = 'and') - { - return $this->wherePivotBetween($column, $values, $boolean, true); - } - - /** - * Set a "or where not between" clause for a pivot table column. - * - * @param string $column - * @param array $values - * @return $this - */ - public function orWherePivotNotBetween($column, array $values) - { - return $this->wherePivotBetween($column, $values, 'or', true); - } - - /** - * Set a "where in" clause for a pivot table column. - * - * @param string $column - * @param mixed $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function wherePivotIn($column, $values, $boolean = 'and', $not = false) - { - $this->pivotWhereIns[] = func_get_args(); - - return $this->whereIn($this->qualifyPivotColumn($column), $values, $boolean, $not); - } - - /** - * Set an "or where" clause for a pivot table column. - * - * @param string $column - * @param mixed $operator - * @param mixed $value - * @return $this - */ - public function orWherePivot($column, $operator = null, $value = null) - { - return $this->wherePivot($column, $operator, $value, 'or'); - } - - /** - * Set a where clause for a pivot table column. - * - * In addition, new pivot records will receive this value. - * - * @param string|array $column - * @param mixed $value - * @return $this - * - * @throws \InvalidArgumentException - */ - public function withPivotValue($column, $value = null) - { - if (is_array($column)) { - foreach ($column as $name => $value) { - $this->withPivotValue($name, $value); - } - - return $this; - } - - if (is_null($value)) { - throw new InvalidArgumentException('The provided value may not be null.'); - } - - $this->pivotValues[] = compact('column', 'value'); - - return $this->wherePivot($column, '=', $value); - } - - /** - * Set an "or where in" clause for a pivot table column. - * - * @param string $column - * @param mixed $values - * @return $this - */ - public function orWherePivotIn($column, $values) - { - return $this->wherePivotIn($column, $values, 'or'); - } - - /** - * Set a "where not in" clause for a pivot table column. - * - * @param string $column - * @param mixed $values - * @param string $boolean - * @return $this - */ - public function wherePivotNotIn($column, $values, $boolean = 'and') - { - return $this->wherePivotIn($column, $values, $boolean, true); - } - - /** - * Set an "or where not in" clause for a pivot table column. - * - * @param string $column - * @param mixed $values - * @return $this - */ - public function orWherePivotNotIn($column, $values) - { - return $this->wherePivotNotIn($column, $values, 'or'); - } - - /** - * Set a "where null" clause for a pivot table column. - * - * @param string $column - * @param string $boolean - * @param bool $not - * @return $this - */ - public function wherePivotNull($column, $boolean = 'and', $not = false) - { - $this->pivotWhereNulls[] = func_get_args(); - - return $this->whereNull($this->qualifyPivotColumn($column), $boolean, $not); - } - - /** - * Set a "where not null" clause for a pivot table column. - * - * @param string $column - * @param string $boolean - * @return $this - */ - public function wherePivotNotNull($column, $boolean = 'and') - { - return $this->wherePivotNull($column, $boolean, true); - } - - /** - * Set a "or where null" clause for a pivot table column. - * - * @param string $column - * @param bool $not - * @return $this - */ - public function orWherePivotNull($column, $not = false) - { - return $this->wherePivotNull($column, 'or', $not); - } - - /** - * Set a "or where not null" clause for a pivot table column. - * - * @param string $column - * @return $this - */ - public function orWherePivotNotNull($column) - { - return $this->orWherePivotNull($column, true); - } - - /** - * Add an "order by" clause for a pivot table column. - * - * @param string $column - * @param string $direction - * @return $this - */ - public function orderByPivot($column, $direction = 'asc') - { - return $this->orderBy($this->qualifyPivotColumn($column), $direction); - } - - /** - * Find a related model by its primary key or return a new instance of the related model. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model - */ - public function findOrNew($id, $columns = ['*']) - { - if (is_null($instance = $this->find($id, $columns))) { - $instance = $this->related->newInstance(); - } - - return $instance; - } - - /** - * Get the first related model record matching the attributes or instantiate it. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrNew(array $attributes = [], array $values = []) - { - if (is_null($instance = $this->related->where($attributes)->first())) { - $instance = $this->related->newInstance(array_merge($attributes, $values)); - } - - return $instance; - } - - /** - * Get the first related record matching the attributes or create it. - * - * @param array $attributes - * @param array $values - * @param array $joining - * @param bool $touch - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrCreate(array $attributes = [], array $values = [], array $joining = [], $touch = true) - { - if (is_null($instance = (clone $this)->where($attributes)->first())) { - if (is_null($instance = $this->related->where($attributes)->first())) { - $instance = $this->create(array_merge($attributes, $values), $joining, $touch); - } else { - $this->attach($instance, $joining, $touch); - } - } - - return $instance; - } - - /** - * Create or update a related record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @param array $joining - * @param bool $touch - * @return \Illuminate\Database\Eloquent\Model - */ - public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true) - { - if (is_null($instance = (clone $this)->where($attributes)->first())) { - if (is_null($instance = $this->related->where($attributes)->first())) { - return $this->create(array_merge($attributes, $values), $joining, $touch); - } else { - $this->attach($instance, $joining, $touch); - } - } - - $instance->fill($values); - - $instance->save(['touch' => false]); - - return $instance; - } - - /** - * Find a related model by its primary key. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null - */ - public function find($id, $columns = ['*']) - { - if (! $id instanceof Model && (is_array($id) || $id instanceof Arrayable)) { - return $this->findMany($id, $columns); - } - - return $this->where( - $this->getRelated()->getQualifiedKeyName(), '=', $this->parseId($id) - )->first($columns); - } - - /** - * Find multiple related models by their primary keys. - * - * @param \Illuminate\Contracts\Support\Arrayable|array $ids - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function findMany($ids, $columns = ['*']) - { - $ids = $ids instanceof Arrayable ? $ids->toArray() : $ids; - - if (empty($ids)) { - return $this->getRelated()->newCollection(); - } - - return $this->whereKey( - $this->parseIds($ids) - )->get($columns); - } - - /** - * Find a related model by its primary key or throw an exception. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - public function findOrFail($id, $columns = ['*']) - { - $result = $this->find($id, $columns); - - $id = $id instanceof Arrayable ? $id->toArray() : $id; - - if (is_array($id)) { - if (count($result) === count(array_unique($id))) { - return $result; - } - } elseif (! is_null($result)) { - return $result; - } - - throw (new ModelNotFoundException)->setModel(get_class($this->related), $id); - } - - /** - * Find a related model by its primary key or call a callback. - * - * @param mixed $id - * @param \Closure|array $columns - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|mixed - */ - public function findOr($id, $columns = ['*'], Closure $callback = null) - { - if ($columns instanceof Closure) { - $callback = $columns; - - $columns = ['*']; - } - - $result = $this->find($id, $columns); - - $id = $id instanceof Arrayable ? $id->toArray() : $id; - - if (is_array($id)) { - if (count($result) === count(array_unique($id))) { - return $result; - } - } elseif (! is_null($result)) { - return $result; - } - - return $callback(); - } - - /** - * Add a basic where clause to the query, and return the first result. - * - * @param \Closure|string|array $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') - { - return $this->where($column, $operator, $value, $boolean)->first(); - } - - /** - * Execute the query and get the first result. - * - * @param array $columns - * @return mixed - */ - public function first($columns = ['*']) - { - $results = $this->take(1)->get($columns); - - return count($results) > 0 ? $results->first() : null; - } - - /** - * Execute the query and get the first result or throw an exception. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|static - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - public function firstOrFail($columns = ['*']) - { - if (! is_null($model = $this->first($columns))) { - return $model; - } - - throw (new ModelNotFoundException)->setModel(get_class($this->related)); - } - - /** - * Execute the query and get the first result or call a callback. - * - * @param \Closure|array $columns - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Model|static|mixed - */ - public function firstOr($columns = ['*'], Closure $callback = null) - { - if ($columns instanceof Closure) { - $callback = $columns; - - $columns = ['*']; - } - - if (! is_null($model = $this->first($columns))) { - return $model; - } - - return $callback(); - } - - /** - * Get the results of the relationship. - * - * @return mixed - */ - public function getResults() - { - return ! is_null($this->parent->{$this->parentKey}) - ? $this->get() - : $this->related->newCollection(); - } - - /** - * Execute the query as a "select" statement. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function get($columns = ['*']) - { - // First we'll add the proper select columns onto the query so it is run with - // the proper columns. Then, we will get the results and hydrate our pivot - // models with the result of those columns as a separate model relation. - $builder = $this->query->applyScopes(); - - $columns = $builder->getQuery()->columns ? [] : $columns; - - $models = $builder->addSelect( - $this->shouldSelect($columns) - )->getModels(); - - $this->hydratePivotRelation($models); - - // If we actually found models we will also eager load any relationships that - // have been specified as needing to be eager loaded. This will solve the - // n + 1 query problem for the developer and also increase performance. - if (count($models) > 0) { - $models = $builder->eagerLoadRelations($models); - } - - return $this->related->newCollection($models); - } - - /** - * Get the select columns for the relation query. - * - * @param array $columns - * @return array - */ - protected function shouldSelect(array $columns = ['*']) - { - if ($columns == ['*']) { - $columns = [$this->related->getTable().'.*']; - } - - return array_merge($columns, $this->aliasedPivotColumns()); - } - - /** - * Get the pivot columns for the relation. - * - * "pivot_" is prefixed at each column for easy removal later. - * - * @return array - */ - protected function aliasedPivotColumns() - { - $defaults = [$this->foreignPivotKey, $this->relatedPivotKey]; - - return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { - return $this->qualifyPivotColumn($column).' as pivot_'.$column; - })->unique()->all(); - } - - /** - * Get a paginator for the "select" statement. - * - * @param int|null $perPage - * @param array $columns - * @param string $pageName - * @param int|null $page - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ - public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) - { - $this->query->addSelect($this->shouldSelect($columns)); - - return tap($this->query->paginate($perPage, $columns, $pageName, $page), function ($paginator) { - $this->hydratePivotRelation($paginator->items()); - }); - } - - /** - * Paginate the given query into a simple paginator. - * - * @param int|null $perPage - * @param array $columns - * @param string $pageName - * @param int|null $page - * @return \Illuminate\Contracts\Pagination\Paginator - */ - public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) - { - $this->query->addSelect($this->shouldSelect($columns)); - - return tap($this->query->simplePaginate($perPage, $columns, $pageName, $page), function ($paginator) { - $this->hydratePivotRelation($paginator->items()); - }); - } - - /** - * Paginate the given query into a cursor paginator. - * - * @param int|null $perPage - * @param array $columns - * @param string $cursorName - * @param string|null $cursor - * @return \Illuminate\Contracts\Pagination\CursorPaginator - */ - public function cursorPaginate($perPage = null, $columns = ['*'], $cursorName = 'cursor', $cursor = null) - { - $this->query->addSelect($this->shouldSelect($columns)); - - return tap($this->query->cursorPaginate($perPage, $columns, $cursorName, $cursor), function ($paginator) { - $this->hydratePivotRelation($paginator->items()); - }); - } - - /** - * Chunk the results of the query. - * - * @param int $count - * @param callable $callback - * @return bool - */ - public function chunk($count, callable $callback) - { - return $this->prepareQueryBuilder()->chunk($count, function ($results, $page) use ($callback) { - $this->hydratePivotRelation($results->all()); - - return $callback($results, $page); - }); - } - - /** - * Chunk the results of a query by comparing numeric IDs. - * - * @param int $count - * @param callable $callback - * @param string|null $column - * @param string|null $alias - * @return bool - */ - public function chunkById($count, callable $callback, $column = null, $alias = null) - { - $this->prepareQueryBuilder(); - - $column ??= $this->getRelated()->qualifyColumn( - $this->getRelatedKeyName() - ); - - $alias ??= $this->getRelatedKeyName(); - - return $this->query->chunkById($count, function ($results) use ($callback) { - $this->hydratePivotRelation($results->all()); - - return $callback($results); - }, $column, $alias); - } - - /** - * Execute a callback over each item while chunking. - * - * @param callable $callback - * @param int $count - * @return bool - */ - public function each(callable $callback, $count = 1000) - { - return $this->chunk($count, function ($results) use ($callback) { - foreach ($results as $key => $value) { - if ($callback($value, $key) === false) { - return false; - } - } - }); - } - - /** - * Query lazily, by chunks of the given size. - * - * @param int $chunkSize - * @return \Illuminate\Support\LazyCollection - */ - public function lazy($chunkSize = 1000) - { - return $this->prepareQueryBuilder()->lazy($chunkSize)->map(function ($model) { - $this->hydratePivotRelation([$model]); - - return $model; - }); - } - - /** - * Query lazily, by chunking the results of a query by comparing IDs. - * - * @param int $chunkSize - * @param string|null $column - * @param string|null $alias - * @return \Illuminate\Support\LazyCollection - */ - public function lazyById($chunkSize = 1000, $column = null, $alias = null) - { - $column ??= $this->getRelated()->qualifyColumn( - $this->getRelatedKeyName() - ); - - $alias ??= $this->getRelatedKeyName(); - - return $this->prepareQueryBuilder()->lazyById($chunkSize, $column, $alias)->map(function ($model) { - $this->hydratePivotRelation([$model]); - - return $model; - }); - } - - /** - * Get a lazy collection for the given query. - * - * @return \Illuminate\Support\LazyCollection - */ - public function cursor() - { - return $this->prepareQueryBuilder()->cursor()->map(function ($model) { - $this->hydratePivotRelation([$model]); - - return $model; - }); - } - - /** - * Prepare the query builder for query execution. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function prepareQueryBuilder() - { - return $this->query->addSelect($this->shouldSelect()); - } - - /** - * Hydrate the pivot table relationship on the models. - * - * @param array $models - * @return void - */ - protected function hydratePivotRelation(array $models) - { - // To hydrate the pivot relationship, we will just gather the pivot attributes - // and create a new Pivot model, which is basically a dynamic model that we - // will set the attributes, table, and connections on it so it will work. - foreach ($models as $model) { - $model->setRelation($this->accessor, $this->newExistingPivot( - $this->migratePivotAttributes($model) - )); - } - } - - /** - * Get the pivot attributes from a model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return array - */ - protected function migratePivotAttributes(Model $model) - { - $values = []; - - foreach ($model->getAttributes() as $key => $value) { - // To get the pivots attributes we will just take any of the attributes which - // begin with "pivot_" and add those to this arrays, as well as unsetting - // them from the parent's models since they exist in a different table. - if (str_starts_with($key, 'pivot_')) { - $values[substr($key, 6)] = $value; - - unset($model->$key); - } - } - - return $values; - } - - /** - * If we're touching the parent model, touch. - * - * @return void - */ - public function touchIfTouching() - { - if ($this->touchingParent()) { - $this->getParent()->touch(); - } - - if ($this->getParent()->touches($this->relationName)) { - $this->touch(); - } - } - - /** - * Determine if we should touch the parent on sync. - * - * @return bool - */ - protected function touchingParent() - { - return $this->getRelated()->touches($this->guessInverseRelation()); - } - - /** - * Attempt to guess the name of the inverse of the relation. - * - * @return string - */ - protected function guessInverseRelation() - { - return Str::camel(Str::pluralStudly(class_basename($this->getParent()))); - } - - /** - * Touch all of the related models for the relationship. - * - * E.g.: Touch all roles associated with this user. - * - * @return void - */ - public function touch() - { - $columns = [ - $this->related->getUpdatedAtColumn() => $this->related->freshTimestampString(), - ]; - - // If we actually have IDs for the relation, we will run the query to update all - // the related model's timestamps, to make sure these all reflect the changes - // to the parent models. This will help us keep any caching synced up here. - if (count($ids = $this->allRelatedIds()) > 0) { - $this->getRelated()->newQueryWithoutRelationships()->whereKey($ids)->update($columns); - } - } - - /** - * Get all of the IDs for the related models. - * - * @return \Illuminate\Support\Collection - */ - public function allRelatedIds() - { - return $this->newPivotQuery()->pluck($this->relatedPivotKey); - } - - /** - * Save a new model and attach it to the parent model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param array $pivotAttributes - * @param bool $touch - * @return \Illuminate\Database\Eloquent\Model - */ - public function save(Model $model, array $pivotAttributes = [], $touch = true) - { - $model->save(['touch' => false]); - - $this->attach($model, $pivotAttributes, $touch); - - return $model; - } - - /** - * Save a new model without raising any events and attach it to the parent model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param array $pivotAttributes - * @param bool $touch - * @return \Illuminate\Database\Eloquent\Model - */ - public function saveQuietly(Model $model, array $pivotAttributes = [], $touch = true) - { - return Model::withoutEvents(function () use ($model, $pivotAttributes, $touch) { - return $this->save($model, $pivotAttributes, $touch); - }); - } - - /** - * Save an array of new models and attach them to the parent model. - * - * @param \Illuminate\Support\Collection|array $models - * @param array $pivotAttributes - * @return array - */ - public function saveMany($models, array $pivotAttributes = []) - { - foreach ($models as $key => $model) { - $this->save($model, (array) ($pivotAttributes[$key] ?? []), false); - } - - $this->touchIfTouching(); - - return $models; - } - - /** - * Save an array of new models without raising any events and attach them to the parent model. - * - * @param \Illuminate\Support\Collection|array $models - * @param array $pivotAttributes - * @return array - */ - public function saveManyQuietly($models, array $pivotAttributes = []) - { - return Model::withoutEvents(function () use ($models, $pivotAttributes) { - return $this->saveMany($models, $pivotAttributes); - }); - } - - /** - * Create a new instance of the related model. - * - * @param array $attributes - * @param array $joining - * @param bool $touch - * @return \Illuminate\Database\Eloquent\Model - */ - public function create(array $attributes = [], array $joining = [], $touch = true) - { - $instance = $this->related->newInstance($attributes); - - // Once we save the related model, we need to attach it to the base model via - // through intermediate table so we'll use the existing "attach" method to - // accomplish this which will insert the record and any more attributes. - $instance->save(['touch' => false]); - - $this->attach($instance, $joining, $touch); - - return $instance; - } - - /** - * Create an array of new instances of the related models. - * - * @param iterable $records - * @param array $joinings - * @return array - */ - public function createMany(iterable $records, array $joinings = []) - { - $instances = []; - - foreach ($records as $key => $record) { - $instances[] = $this->create($record, (array) ($joinings[$key] ?? []), false); - } - - $this->touchIfTouching(); - - return $instances; - } - - /** - * Add the constraints for a relationship query. - * - * @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 = ['*']) - { - if ($parentQuery->getQuery()->from == $query->getQuery()->from) { - return $this->getRelationExistenceQueryForSelfJoin($query, $parentQuery, $columns); - } - - $this->performJoin($query); - - return parent::getRelationExistenceQuery($query, $parentQuery, $columns); - } - - /** - * Add the constraints for a relationship query on the same table. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parentQuery - * @param array|mixed $columns - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationExistenceQueryForSelfJoin(Builder $query, Builder $parentQuery, $columns = ['*']) - { - $query->select($columns); - - $query->from($this->related->getTable().' as '.$hash = $this->getRelationCountHash()); - - $this->related->setTable($hash); - - $this->performJoin($query); - - return parent::getRelationExistenceQuery($query, $parentQuery, $columns); - } - - /** - * Get the key for comparing against the parent key in "has" query. - * - * @return string - */ - public function getExistenceCompareKey() - { - return $this->getQualifiedForeignPivotKeyName(); - } - - /** - * Specify that the pivot table has creation and update timestamps. - * - * @param mixed $createdAt - * @param mixed $updatedAt - * @return $this - */ - public function withTimestamps($createdAt = null, $updatedAt = null) - { - $this->withTimestamps = true; - - $this->pivotCreatedAt = $createdAt; - $this->pivotUpdatedAt = $updatedAt; - - return $this->withPivot($this->createdAt(), $this->updatedAt()); - } - - /** - * Get the name of the "created at" column. - * - * @return string - */ - public function createdAt() - { - return $this->pivotCreatedAt ?: $this->parent->getCreatedAtColumn(); - } - - /** - * Get the name of the "updated at" column. - * - * @return string - */ - public function updatedAt() - { - return $this->pivotUpdatedAt ?: $this->parent->getUpdatedAtColumn(); - } - - /** - * Get the foreign key for the relation. - * - * @return string - */ - public function getForeignPivotKeyName() - { - return $this->foreignPivotKey; - } - - /** - * Get the fully qualified foreign key for the relation. - * - * @return string - */ - public function getQualifiedForeignPivotKeyName() - { - return $this->qualifyPivotColumn($this->foreignPivotKey); - } - - /** - * Get the "related key" for the relation. - * - * @return string - */ - public function getRelatedPivotKeyName() - { - return $this->relatedPivotKey; - } - - /** - * Get the fully qualified "related key" for the relation. - * - * @return string - */ - public function getQualifiedRelatedPivotKeyName() - { - return $this->qualifyPivotColumn($this->relatedPivotKey); - } - - /** - * Get the parent key for the relationship. - * - * @return string - */ - public function getParentKeyName() - { - return $this->parentKey; - } - - /** - * Get the fully qualified parent key name for the relation. - * - * @return string - */ - public function getQualifiedParentKeyName() - { - return $this->parent->qualifyColumn($this->parentKey); - } - - /** - * Get the related key for the relationship. - * - * @return string - */ - public function getRelatedKeyName() - { - return $this->relatedKey; - } - - /** - * Get the fully qualified related key name for the relation. - * - * @return string - */ - public function getQualifiedRelatedKeyName() - { - return $this->related->qualifyColumn($this->relatedKey); - } - - /** - * Get the intermediate table for the relationship. - * - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Get the relationship name for the relationship. - * - * @return string - */ - public function getRelationName() - { - return $this->relationName; - } - - /** - * Get the name of the pivot accessor for this relationship. - * - * @return string - */ - public function getPivotAccessor() - { - return $this->accessor; - } - - /** - * Get the pivot columns for this relationship. - * - * @return array - */ - public function getPivotColumns() - { - return $this->pivotColumns; - } - - /** - * Qualify the given column name by the pivot table. - * - * @param string $column - * @return string - */ - public function qualifyPivotColumn($column) - { - return str_contains($column, '.') - ? $column - : $this->table.'.'.$column; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php deleted file mode 100644 index e6f9f23..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php +++ /dev/null @@ -1,333 +0,0 @@ -timestamps = $instance->hasTimestampAttributes($attributes); - - // The pivot model is a "dynamic" model since we will set the tables dynamically - // for the instance. This allows it work for any intermediate tables for the - // many to many relationship that are defined by this developer's classes. - $instance->setConnection($parent->getConnectionName()) - ->setTable($table) - ->forceFill($attributes) - ->syncOriginal(); - - // We store off the parent instance so we will access the timestamp column names - // for the model, since the pivot model timestamps aren't easily configurable - // from the developer's point of view. We can use the parents to get these. - $instance->pivotParent = $parent; - - $instance->exists = $exists; - - return $instance; - } - - /** - * Create a new pivot model from raw values returned from a query. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @param array $attributes - * @param string $table - * @param bool $exists - * @return static - */ - public static function fromRawAttributes(Model $parent, $attributes, $table, $exists = false) - { - $instance = static::fromAttributes($parent, [], $table, $exists); - - $instance->timestamps = $instance->hasTimestampAttributes($attributes); - - $instance->setRawAttributes( - array_merge($instance->getRawOriginal(), $attributes), $exists - ); - - return $instance; - } - - /** - * Set the keys for a select query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function setKeysForSelectQuery($query) - { - if (isset($this->attributes[$this->getKeyName()])) { - return parent::setKeysForSelectQuery($query); - } - - $query->where($this->foreignKey, $this->getOriginal( - $this->foreignKey, $this->getAttribute($this->foreignKey) - )); - - return $query->where($this->relatedKey, $this->getOriginal( - $this->relatedKey, $this->getAttribute($this->relatedKey) - )); - } - - /** - * Set the keys for a save update query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function setKeysForSaveQuery($query) - { - return $this->setKeysForSelectQuery($query); - } - - /** - * Delete the pivot model record from the database. - * - * @return int - */ - public function delete() - { - if (isset($this->attributes[$this->getKeyName()])) { - return (int) parent::delete(); - } - - if ($this->fireModelEvent('deleting') === false) { - return 0; - } - - $this->touchOwners(); - - return tap($this->getDeleteQuery()->delete(), function () { - $this->exists = false; - - $this->fireModelEvent('deleted', false); - }); - } - - /** - * Get the query builder for a delete operation on the pivot. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function getDeleteQuery() - { - return $this->newQueryWithoutRelationships()->where([ - $this->foreignKey => $this->getOriginal($this->foreignKey, $this->getAttribute($this->foreignKey)), - $this->relatedKey => $this->getOriginal($this->relatedKey, $this->getAttribute($this->relatedKey)), - ]); - } - - /** - * Get the table associated with the model. - * - * @return string - */ - public function getTable() - { - if (! isset($this->table)) { - $this->setTable(str_replace( - '\\', '', Str::snake(Str::singular(class_basename($this))) - )); - } - - return $this->table; - } - - /** - * Get the foreign key column name. - * - * @return string - */ - public function getForeignKey() - { - return $this->foreignKey; - } - - /** - * Get the "related key" column name. - * - * @return string - */ - public function getRelatedKey() - { - return $this->relatedKey; - } - - /** - * Get the "related key" column name. - * - * @return string - */ - public function getOtherKey() - { - return $this->getRelatedKey(); - } - - /** - * Set the key names for the pivot model instance. - * - * @param string $foreignKey - * @param string $relatedKey - * @return $this - */ - public function setPivotKeys($foreignKey, $relatedKey) - { - $this->foreignKey = $foreignKey; - - $this->relatedKey = $relatedKey; - - return $this; - } - - /** - * Determine if the pivot model or given attributes has timestamp attributes. - * - * @param array|null $attributes - * @return bool - */ - public function hasTimestampAttributes($attributes = null) - { - return array_key_exists($this->getCreatedAtColumn(), $attributes ?? $this->attributes); - } - - /** - * Get the name of the "created at" column. - * - * @return string - */ - public function getCreatedAtColumn() - { - return $this->pivotParent - ? $this->pivotParent->getCreatedAtColumn() - : parent::getCreatedAtColumn(); - } - - /** - * Get the name of the "updated at" column. - * - * @return string - */ - public function getUpdatedAtColumn() - { - return $this->pivotParent - ? $this->pivotParent->getUpdatedAtColumn() - : parent::getUpdatedAtColumn(); - } - - /** - * Get the queueable identity for the entity. - * - * @return mixed - */ - public function getQueueableId() - { - if (isset($this->attributes[$this->getKeyName()])) { - return $this->getKey(); - } - - return sprintf( - '%s:%s:%s:%s', - $this->foreignKey, $this->getAttribute($this->foreignKey), - $this->relatedKey, $this->getAttribute($this->relatedKey) - ); - } - - /** - * Get a new query to restore one or more models by their queueable IDs. - * - * @param int[]|string[]|string $ids - * @return \Illuminate\Database\Eloquent\Builder - */ - public function newQueryForRestoration($ids) - { - if (is_array($ids)) { - return $this->newQueryForCollectionRestoration($ids); - } - - if (! str_contains($ids, ':')) { - return parent::newQueryForRestoration($ids); - } - - $segments = explode(':', $ids); - - return $this->newQueryWithoutScopes() - ->where($segments[0], $segments[1]) - ->where($segments[2], $segments[3]); - } - - /** - * Get a new query to restore multiple models by their queueable IDs. - * - * @param int[]|string[] $ids - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function newQueryForCollectionRestoration(array $ids) - { - $ids = array_values($ids); - - if (! str_contains($ids[0], ':')) { - return parent::newQueryForRestoration($ids); - } - - $query = $this->newQueryWithoutScopes(); - - foreach ($ids as $id) { - $segments = explode(':', $id); - - $query->orWhere(function ($query) use ($segments) { - return $query->where($segments[0], $segments[1]) - ->where($segments[2], $segments[3]); - }); - } - - return $query; - } - - /** - * Unset all the loaded relations for the instance. - * - * @return $this - */ - public function unsetRelations() - { - $this->pivotParent = null; - $this->relations = []; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php deleted file mode 100644 index 25b9a58..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php +++ /dev/null @@ -1,310 +0,0 @@ -isOneOfMany = true; - - $this->relationName = $relation ?: $this->getDefaultOneOfManyJoinAlias( - $this->guessRelationship() - ); - - $keyName = $this->query->getModel()->getKeyName(); - - $columns = is_string($columns = $column) ? [ - $column => $aggregate, - $keyName => $aggregate, - ] : $column; - - if (! array_key_exists($keyName, $columns)) { - $columns[$keyName] = 'MAX'; - } - - if ($aggregate instanceof Closure) { - $closure = $aggregate; - } - - foreach ($columns as $column => $aggregate) { - if (! in_array(strtolower($aggregate), ['min', 'max'])) { - throw new InvalidArgumentException("Invalid aggregate [{$aggregate}] used within ofMany relation. Available aggregates: MIN, MAX"); - } - - $subQuery = $this->newOneOfManySubQuery( - $this->getOneOfManySubQuerySelectColumns(), - $column, $aggregate - ); - - if (isset($previous)) { - $this->addOneOfManyJoinSubQuery($subQuery, $previous['subQuery'], $previous['column']); - } - - if (isset($closure)) { - $closure($subQuery); - } - - if (! isset($previous)) { - $this->oneOfManySubQuery = $subQuery; - } - - if (array_key_last($columns) == $column) { - $this->addOneOfManyJoinSubQuery($this->query, $subQuery, $column); - } - - $previous = [ - 'subQuery' => $subQuery, - 'column' => $column, - ]; - } - - $this->addConstraints(); - - $columns = $this->query->getQuery()->columns; - - if (is_null($columns) || $columns === ['*']) { - $this->select([$this->qualifyColumn('*')]); - } - - return $this; - } - - /** - * Indicate that the relation is the latest single result of a larger one-to-many relationship. - * - * @param string|array|null $column - * @param string|null $relation - * @return $this - */ - public function latestOfMany($column = 'id', $relation = null) - { - return $this->ofMany(collect(Arr::wrap($column))->mapWithKeys(function ($column) { - return [$column => 'MAX']; - })->all(), 'MAX', $relation); - } - - /** - * Indicate that the relation is the oldest single result of a larger one-to-many relationship. - * - * @param string|array|null $column - * @param string|null $relation - * @return $this - */ - public function oldestOfMany($column = 'id', $relation = null) - { - return $this->ofMany(collect(Arr::wrap($column))->mapWithKeys(function ($column) { - return [$column => 'MIN']; - })->all(), 'MIN', $relation); - } - - /** - * Get the default alias for the one of many inner join clause. - * - * @param string $relation - * @return string - */ - protected function getDefaultOneOfManyJoinAlias($relation) - { - return $relation == $this->query->getModel()->getTable() - ? $relation.'_of_many' - : $relation; - } - - /** - * Get a new query for the related model, grouping the query by the given column, often the foreign key of the relationship. - * - * @param string|array $groupBy - * @param string|null $column - * @param string|null $aggregate - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function newOneOfManySubQuery($groupBy, $column = null, $aggregate = null) - { - $subQuery = $this->query->getModel() - ->newQuery() - ->withoutGlobalScopes($this->removedScopes()); - - foreach (Arr::wrap($groupBy) as $group) { - $subQuery->groupBy($this->qualifyRelatedColumn($group)); - } - - if (! is_null($column)) { - $subQuery->selectRaw($aggregate.'('.$subQuery->getQuery()->grammar->wrap($subQuery->qualifyColumn($column)).') as '.$subQuery->getQuery()->grammar->wrap($column.'_aggregate')); - } - - $this->addOneOfManySubQueryConstraints($subQuery, $groupBy, $column, $aggregate); - - return $subQuery; - } - - /** - * Add the join subquery to the given query on the given column and the relationship's foreign key. - * - * @param \Illuminate\Database\Eloquent\Builder $parent - * @param \Illuminate\Database\Eloquent\Builder $subQuery - * @param string $on - * @return void - */ - protected function addOneOfManyJoinSubQuery(Builder $parent, Builder $subQuery, $on) - { - $parent->beforeQuery(function ($parent) use ($subQuery, $on) { - $subQuery->applyBeforeQueryCallbacks(); - - $parent->joinSub($subQuery, $this->relationName, function ($join) use ($on) { - $join->on($this->qualifySubSelectColumn($on.'_aggregate'), '=', $this->qualifyRelatedColumn($on)); - - $this->addOneOfManyJoinSubQueryConstraints($join, $on); - }); - }); - } - - /** - * Merge the relationship query joins to the given query builder. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return void - */ - protected function mergeOneOfManyJoinsTo(Builder $query) - { - $query->getQuery()->beforeQueryCallbacks = $this->query->getQuery()->beforeQueryCallbacks; - - $query->applyBeforeQueryCallbacks(); - } - - /** - * Get the query builder that will contain the relationship constraints. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function getRelationQuery() - { - return $this->isOneOfMany() - ? $this->oneOfManySubQuery - : $this->query; - } - - /** - * Get the one of many inner join subselect builder instance. - * - * @return \Illuminate\Database\Eloquent\Builder|void - */ - public function getOneOfManySubQuery() - { - return $this->oneOfManySubQuery; - } - - /** - * Get the qualified column name for the one-of-many relationship using the subselect join query's alias. - * - * @param string $column - * @return string - */ - public function qualifySubSelectColumn($column) - { - return $this->getRelationName().'.'.last(explode('.', $column)); - } - - /** - * Qualify related column using the related table name if it is not already qualified. - * - * @param string $column - * @return string - */ - protected function qualifyRelatedColumn($column) - { - return str_contains($column, '.') ? $column : $this->query->getModel()->getTable().'.'.$column; - } - - /** - * Guess the "hasOne" relationship's name via backtrace. - * - * @return string - */ - protected function guessRelationship() - { - return debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function']; - } - - /** - * Determine whether the relationship is a one-of-many relationship. - * - * @return bool - */ - public function isOneOfMany() - { - return $this->isOneOfMany; - } - - /** - * Get the name of the relationship. - * - * @return string - */ - public function getRelationName() - { - return $this->relationName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php deleted file mode 100644 index ca06698..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php +++ /dev/null @@ -1,77 +0,0 @@ -compareKeys($this->getParentKey(), $this->getRelatedKeyFrom($model)) && - $this->related->getTable() === $model->getTable() && - $this->related->getConnectionName() === $model->getConnectionName(); - - if ($match && $this instanceof SupportsPartialRelations && $this->isOneOfMany()) { - return $this->query - ->whereKey($model->getKey()) - ->exists(); - } - - return $match; - } - - /** - * Determine if the model is not the related instance of the relationship. - * - * @param \Illuminate\Database\Eloquent\Model|null $model - * @return bool - */ - public function isNot($model) - { - return ! $this->is($model); - } - - /** - * Get the value of the parent model's key. - * - * @return mixed - */ - abstract public function getParentKey(); - - /** - * Get the value of the model's related key. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return mixed - */ - abstract protected function getRelatedKeyFrom(Model $model); - - /** - * Compare the parent key with the related key. - * - * @param mixed $parentKey - * @param mixed $relatedKey - * @return bool - */ - protected function compareKeys($parentKey, $relatedKey) - { - if (empty($parentKey) || empty($relatedKey)) { - return false; - } - - if (is_int($parentKey) || is_int($relatedKey)) { - return (int) $parentKey === (int) $relatedKey; - } - - return $parentKey === $relatedKey; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithDictionary.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithDictionary.php deleted file mode 100644 index 91b3bf5..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithDictionary.php +++ /dev/null @@ -1,36 +0,0 @@ -__toString(); - } - - if (function_exists('enum_exists') && - $attribute instanceof UnitEnum) { - return $attribute instanceof BackedEnum ? $attribute->value : $attribute->name; - } - - throw new InvalidArgumentException('Model attribute value is an object but does not have a __toString method.'); - } - - return $attribute; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php deleted file mode 100644 index 2241719..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php +++ /dev/null @@ -1,681 +0,0 @@ - [], 'detached' => [], - ]; - - $records = $this->formatRecordsList($this->parseIds($ids)); - - // Next, we will determine which IDs should get removed from the join table by - // checking which of the given ID/records is in the list of current records - // and removing all of those rows from this "intermediate" joining table. - $detach = array_values(array_intersect( - $this->newPivotQuery()->pluck($this->relatedPivotKey)->all(), - array_keys($records) - )); - - if (count($detach) > 0) { - $this->detach($detach, false); - - $changes['detached'] = $this->castKeys($detach); - } - - // Finally, for all of the records which were not "detached", we'll attach the - // records into the intermediate table. Then, we will add those attaches to - // this change list and get ready to return these results to the callers. - $attach = array_diff_key($records, array_flip($detach)); - - if (count($attach) > 0) { - $this->attach($attach, [], false); - - $changes['attached'] = array_keys($attach); - } - - // Once we have finished attaching or detaching the records, we will see if we - // have done any attaching or detaching, and if we have we will touch these - // relationships if they are configured to touch on any database updates. - if ($touch && (count($changes['attached']) || - count($changes['detached']))) { - $this->touchIfTouching(); - } - - return $changes; - } - - /** - * Sync the intermediate tables with a list of IDs without detaching. - * - * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids - * @return array - */ - public function syncWithoutDetaching($ids) - { - return $this->sync($ids, false); - } - - /** - * Sync the intermediate tables with a list of IDs or collection of models. - * - * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids - * @param bool $detaching - * @return array - */ - public function sync($ids, $detaching = true) - { - $changes = [ - 'attached' => [], 'detached' => [], 'updated' => [], - ]; - - // First we need to attach any of the associated models that are not currently - // in this joining table. We'll spin through the given IDs, checking to see - // if they exist in the array of current ones, and if not we will insert. - $current = $this->getCurrentlyAttachedPivots() - ->pluck($this->relatedPivotKey)->all(); - - $records = $this->formatRecordsList($this->parseIds($ids)); - - // Next, we will take the differences of the currents and given IDs and detach - // all of the entities that exist in the "current" array but are not in the - // array of the new IDs given to the method which will complete the sync. - if ($detaching) { - $detach = array_diff($current, array_keys($records)); - - if (count($detach) > 0) { - $this->detach($detach); - - $changes['detached'] = $this->castKeys($detach); - } - } - - // Now we are finally ready to attach the new records. Note that we'll disable - // touching until after the entire operation is complete so we don't fire a - // ton of touch operations until we are totally done syncing the records. - $changes = array_merge( - $changes, $this->attachNew($records, $current, false) - ); - - // Once we have finished attaching or detaching the records, we will see if we - // have done any attaching or detaching, and if we have we will touch these - // relationships if they are configured to touch on any database updates. - if (count($changes['attached']) || - count($changes['updated']) || - count($changes['detached'])) { - $this->touchIfTouching(); - } - - return $changes; - } - - /** - * Sync the intermediate tables with a list of IDs or collection of models with the given pivot values. - * - * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids - * @param array $values - * @param bool $detaching - * @return array - */ - public function syncWithPivotValues($ids, array $values, bool $detaching = true) - { - return $this->sync(collect($this->parseIds($ids))->mapWithKeys(function ($id) use ($values) { - return [$id => $values]; - }), $detaching); - } - - /** - * Format the sync / toggle record list so that it is keyed by ID. - * - * @param array $records - * @return array - */ - protected function formatRecordsList(array $records) - { - return collect($records)->mapWithKeys(function ($attributes, $id) { - if (! is_array($attributes)) { - [$id, $attributes] = [$attributes, []]; - } - - return [$id => $attributes]; - })->all(); - } - - /** - * Attach all of the records that aren't in the given current records. - * - * @param array $records - * @param array $current - * @param bool $touch - * @return array - */ - protected function attachNew(array $records, array $current, $touch = true) - { - $changes = ['attached' => [], 'updated' => []]; - - foreach ($records as $id => $attributes) { - // If the ID is not in the list of existing pivot IDs, we will insert a new pivot - // record, otherwise, we will just update this existing record on this joining - // table, so that the developers will easily update these records pain free. - if (! in_array($id, $current)) { - $this->attach($id, $attributes, $touch); - - $changes['attached'][] = $this->castKey($id); - } - - // Now we'll try to update an existing pivot record with the attributes that were - // given to the method. If the model is actually updated we will add it to the - // list of updated pivot records so we return them back out to the consumer. - elseif (count($attributes) > 0 && - $this->updateExistingPivot($id, $attributes, $touch)) { - $changes['updated'][] = $this->castKey($id); - } - } - - return $changes; - } - - /** - * Update an existing pivot record on the table. - * - * @param mixed $id - * @param array $attributes - * @param bool $touch - * @return int - */ - public function updateExistingPivot($id, array $attributes, $touch = true) - { - if ($this->using && - empty($this->pivotWheres) && - empty($this->pivotWhereIns) && - empty($this->pivotWhereNulls)) { - return $this->updateExistingPivotUsingCustomClass($id, $attributes, $touch); - } - - if ($this->hasPivotColumn($this->updatedAt())) { - $attributes = $this->addTimestampsToAttachment($attributes, true); - } - - $updated = $this->newPivotStatementForId($this->parseId($id))->update( - $this->castAttributes($attributes) - ); - - if ($touch) { - $this->touchIfTouching(); - } - - return $updated; - } - - /** - * Update an existing pivot record on the table via a custom class. - * - * @param mixed $id - * @param array $attributes - * @param bool $touch - * @return int - */ - protected function updateExistingPivotUsingCustomClass($id, array $attributes, $touch) - { - $pivot = $this->getCurrentlyAttachedPivots() - ->where($this->foreignPivotKey, $this->parent->{$this->parentKey}) - ->where($this->relatedPivotKey, $this->parseId($id)) - ->first(); - - $updated = $pivot ? $pivot->fill($attributes)->isDirty() : false; - - if ($updated) { - $pivot->save(); - } - - if ($touch) { - $this->touchIfTouching(); - } - - return (int) $updated; - } - - /** - * Attach a model to the parent. - * - * @param mixed $id - * @param array $attributes - * @param bool $touch - * @return void - */ - public function attach($id, array $attributes = [], $touch = true) - { - if ($this->using) { - $this->attachUsingCustomClass($id, $attributes); - } else { - // Here we will insert the attachment records into the pivot table. Once we have - // inserted the records, we will touch the relationships if necessary and the - // function will return. We can parse the IDs before inserting the records. - $this->newPivotStatement()->insert($this->formatAttachRecords( - $this->parseIds($id), $attributes - )); - } - - if ($touch) { - $this->touchIfTouching(); - } - } - - /** - * Attach a model to the parent using a custom class. - * - * @param mixed $id - * @param array $attributes - * @return void - */ - protected function attachUsingCustomClass($id, array $attributes) - { - $records = $this->formatAttachRecords( - $this->parseIds($id), $attributes - ); - - foreach ($records as $record) { - $this->newPivot($record, false)->save(); - } - } - - /** - * Create an array of records to insert into the pivot table. - * - * @param array $ids - * @param array $attributes - * @return array - */ - protected function formatAttachRecords($ids, array $attributes) - { - $records = []; - - $hasTimestamps = ($this->hasPivotColumn($this->createdAt()) || - $this->hasPivotColumn($this->updatedAt())); - - // To create the attachment records, we will simply spin through the IDs given - // and create a new record to insert for each ID. Each ID may actually be a - // key in the array, with extra attributes to be placed in other columns. - foreach ($ids as $key => $value) { - $records[] = $this->formatAttachRecord( - $key, $value, $attributes, $hasTimestamps - ); - } - - return $records; - } - - /** - * Create a full attachment record payload. - * - * @param int $key - * @param mixed $value - * @param array $attributes - * @param bool $hasTimestamps - * @return array - */ - protected function formatAttachRecord($key, $value, $attributes, $hasTimestamps) - { - [$id, $attributes] = $this->extractAttachIdAndAttributes($key, $value, $attributes); - - return array_merge( - $this->baseAttachRecord($id, $hasTimestamps), $this->castAttributes($attributes) - ); - } - - /** - * Get the attach record ID and extra attributes. - * - * @param mixed $key - * @param mixed $value - * @param array $attributes - * @return array - */ - protected function extractAttachIdAndAttributes($key, $value, array $attributes) - { - return is_array($value) - ? [$key, array_merge($value, $attributes)] - : [$value, $attributes]; - } - - /** - * Create a new pivot attachment record. - * - * @param int $id - * @param bool $timed - * @return array - */ - protected function baseAttachRecord($id, $timed) - { - $record[$this->relatedPivotKey] = $id; - - $record[$this->foreignPivotKey] = $this->parent->{$this->parentKey}; - - // If the record needs to have creation and update timestamps, we will make - // them by calling the parent model's "freshTimestamp" method which will - // provide us with a fresh timestamp in this model's preferred format. - if ($timed) { - $record = $this->addTimestampsToAttachment($record); - } - - foreach ($this->pivotValues as $value) { - $record[$value['column']] = $value['value']; - } - - return $record; - } - - /** - * Set the creation and update timestamps on an attach record. - * - * @param array $record - * @param bool $exists - * @return array - */ - protected function addTimestampsToAttachment(array $record, $exists = false) - { - $fresh = $this->parent->freshTimestamp(); - - if ($this->using) { - $pivotModel = new $this->using; - - $fresh = $fresh->format($pivotModel->getDateFormat()); - } - - if (! $exists && $this->hasPivotColumn($this->createdAt())) { - $record[$this->createdAt()] = $fresh; - } - - if ($this->hasPivotColumn($this->updatedAt())) { - $record[$this->updatedAt()] = $fresh; - } - - return $record; - } - - /** - * Determine whether the given column is defined as a pivot column. - * - * @param string $column - * @return bool - */ - public function hasPivotColumn($column) - { - return in_array($column, $this->pivotColumns); - } - - /** - * Detach models from the relationship. - * - * @param mixed $ids - * @param bool $touch - * @return int - */ - public function detach($ids = null, $touch = true) - { - if ($this->using && - ! empty($ids) && - empty($this->pivotWheres) && - empty($this->pivotWhereIns) && - empty($this->pivotWhereNulls)) { - $results = $this->detachUsingCustomClass($ids); - } else { - $query = $this->newPivotQuery(); - - // If associated IDs were passed to the method we will only delete those - // associations, otherwise all of the association ties will be broken. - // We'll return the numbers of affected rows when we do the deletes. - if (! is_null($ids)) { - $ids = $this->parseIds($ids); - - if (empty($ids)) { - return 0; - } - - $query->whereIn($this->getQualifiedRelatedPivotKeyName(), (array) $ids); - } - - // Once we have all of the conditions set on the statement, we are ready - // to run the delete on the pivot table. Then, if the touch parameter - // is true, we will go ahead and touch all related models to sync. - $results = $query->delete(); - } - - if ($touch) { - $this->touchIfTouching(); - } - - return $results; - } - - /** - * Detach models from the relationship using a custom class. - * - * @param mixed $ids - * @return int - */ - protected function detachUsingCustomClass($ids) - { - $results = 0; - - foreach ($this->parseIds($ids) as $id) { - $results += $this->newPivot([ - $this->foreignPivotKey => $this->parent->{$this->parentKey}, - $this->relatedPivotKey => $id, - ], true)->delete(); - } - - return $results; - } - - /** - * Get the pivot models that are currently attached. - * - * @return \Illuminate\Support\Collection - */ - protected function getCurrentlyAttachedPivots() - { - return $this->newPivotQuery()->get()->map(function ($record) { - $class = $this->using ?: Pivot::class; - - $pivot = $class::fromRawAttributes($this->parent, (array) $record, $this->getTable(), true); - - return $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey); - }); - } - - /** - * Create a new pivot model instance. - * - * @param array $attributes - * @param bool $exists - * @return \Illuminate\Database\Eloquent\Relations\Pivot - */ - public function newPivot(array $attributes = [], $exists = false) - { - $pivot = $this->related->newPivot( - $this->parent, $attributes, $this->table, $exists, $this->using - ); - - return $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey); - } - - /** - * Create a new existing pivot model instance. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Relations\Pivot - */ - public function newExistingPivot(array $attributes = []) - { - return $this->newPivot($attributes, true); - } - - /** - * Get a new plain query builder for the pivot table. - * - * @return \Illuminate\Database\Query\Builder - */ - public function newPivotStatement() - { - return $this->query->getQuery()->newQuery()->from($this->table); - } - - /** - * Get a new pivot statement for a given "other" ID. - * - * @param mixed $id - * @return \Illuminate\Database\Query\Builder - */ - public function newPivotStatementForId($id) - { - return $this->newPivotQuery()->whereIn($this->relatedPivotKey, $this->parseIds($id)); - } - - /** - * Create a new query builder for the pivot table. - * - * @return \Illuminate\Database\Query\Builder - */ - public function newPivotQuery() - { - $query = $this->newPivotStatement(); - - foreach ($this->pivotWheres as $arguments) { - $query->where(...$arguments); - } - - foreach ($this->pivotWhereIns as $arguments) { - $query->whereIn(...$arguments); - } - - foreach ($this->pivotWhereNulls as $arguments) { - $query->whereNull(...$arguments); - } - - return $query->where($this->getQualifiedForeignPivotKeyName(), $this->parent->{$this->parentKey}); - } - - /** - * Set the columns on the pivot table to retrieve. - * - * @param array|mixed $columns - * @return $this - */ - public function withPivot($columns) - { - $this->pivotColumns = array_merge( - $this->pivotColumns, is_array($columns) ? $columns : func_get_args() - ); - - return $this; - } - - /** - * Get all of the IDs from the given mixed value. - * - * @param mixed $value - * @return array - */ - protected function parseIds($value) - { - if ($value instanceof Model) { - return [$value->{$this->relatedKey}]; - } - - if ($value instanceof Collection) { - return $value->pluck($this->relatedKey)->all(); - } - - if ($value instanceof BaseCollection) { - return $value->toArray(); - } - - return (array) $value; - } - - /** - * Get the ID from the given mixed value. - * - * @param mixed $value - * @return mixed - */ - protected function parseId($value) - { - return $value instanceof Model ? $value->{$this->relatedKey} : $value; - } - - /** - * Cast the given keys to integers if they are numeric and string otherwise. - * - * @param array $keys - * @return array - */ - protected function castKeys(array $keys) - { - return array_map(function ($v) { - return $this->castKey($v); - }, $keys); - } - - /** - * Cast the given key to convert to primary key type. - * - * @param mixed $key - * @return mixed - */ - protected function castKey($key) - { - return $this->getTypeSwapValue( - $this->related->getKeyType(), - $key - ); - } - - /** - * Cast the given pivot attributes. - * - * @param array $attributes - * @return array - */ - protected function castAttributes($attributes) - { - return $this->using - ? $this->newPivot()->fill($attributes)->getAttributes() - : $attributes; - } - - /** - * Converts a given value to a given type value. - * - * @param string $type - * @param mixed $value - * @return mixed - */ - protected function getTypeSwapValue($type, $value) - { - return match (strtolower($type)) { - 'int', 'integer' => (int) $value, - 'real', 'float', 'double' => (float) $value, - 'string' => (string) $value, - default => $value, - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php deleted file mode 100644 index 74e758f..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php +++ /dev/null @@ -1,63 +0,0 @@ -withDefault = $callback; - - return $this; - } - - /** - * Get the default value for this relation. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @return \Illuminate\Database\Eloquent\Model|null - */ - protected function getDefaultFor(Model $parent) - { - if (! $this->withDefault) { - return; - } - - $instance = $this->newRelatedInstanceFor($parent); - - if (is_callable($this->withDefault)) { - return call_user_func($this->withDefault, $instance, $parent) ?: $instance; - } - - if (is_array($this->withDefault)) { - $instance->forceFill($this->withDefault); - } - - return $instance; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasMany.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasMany.php deleted file mode 100755 index b005d4f..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasMany.php +++ /dev/null @@ -1,49 +0,0 @@ -getParentKey()) - ? $this->query->get() - : $this->related->newCollection(); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) { - $model->setRelation($relation, $this->related->newCollection()); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $this->matchMany($models, $results, $relation); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php deleted file mode 100644 index b6ca908..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php +++ /dev/null @@ -1,772 +0,0 @@ -localKey = $localKey; - $this->firstKey = $firstKey; - $this->secondKey = $secondKey; - $this->farParent = $farParent; - $this->throughParent = $throughParent; - $this->secondLocalKey = $secondLocalKey; - - parent::__construct($query, $throughParent); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - $localValue = $this->farParent[$this->localKey]; - - $this->performJoin(); - - if (static::$constraints) { - $this->query->where($this->getQualifiedFirstKeyName(), '=', $localValue); - } - } - - /** - * Set the join clause on the query. - * - * @param \Illuminate\Database\Eloquent\Builder|null $query - * @return void - */ - protected function performJoin(Builder $query = null) - { - $query = $query ?: $this->query; - - $farKey = $this->getQualifiedFarKeyName(); - - $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $farKey); - - if ($this->throughParentSoftDeletes()) { - $query->withGlobalScope('SoftDeletableHasManyThrough', function ($query) { - $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); - }); - } - } - - /** - * Get the fully qualified parent key name. - * - * @return string - */ - public function getQualifiedParentKeyName() - { - return $this->parent->qualifyColumn($this->secondLocalKey); - } - - /** - * Determine whether "through" parent of the relation uses Soft Deletes. - * - * @return bool - */ - public function throughParentSoftDeletes() - { - return in_array(SoftDeletes::class, class_uses_recursive($this->throughParent)); - } - - /** - * Indicate that trashed "through" parents should be included in the query. - * - * @return $this - */ - public function withTrashedParents() - { - $this->query->withoutGlobalScope('SoftDeletableHasManyThrough'); - - return $this; - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - $whereIn = $this->whereInMethod($this->farParent, $this->localKey); - - $this->query->{$whereIn}( - $this->getQualifiedFirstKeyName(), $this->getKeys($models, $this->localKey) - ); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) { - $model->setRelation($relation, $this->related->newCollection()); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - $dictionary = $this->buildDictionary($results); - - // Once we have the dictionary we can simply spin through the parent models to - // link them up with their children using the keyed dictionary to make the - // matching very convenient and easy work. Then we'll just return them. - foreach ($models as $model) { - if (isset($dictionary[$key = $this->getDictionaryKey($model->getAttribute($this->localKey))])) { - $model->setRelation( - $relation, $this->related->newCollection($dictionary[$key]) - ); - } - } - - return $models; - } - - /** - * Build model dictionary keyed by the relation's foreign key. - * - * @param \Illuminate\Database\Eloquent\Collection $results - * @return array - */ - protected function buildDictionary(Collection $results) - { - $dictionary = []; - - // First we will create a dictionary of models keyed by the foreign key of the - // relationship as this will allow us to quickly access all of the related - // models without having to do nested looping which will be quite slow. - foreach ($results as $result) { - $dictionary[$result->laravel_through_key][] = $result; - } - - return $dictionary; - } - - /** - * Get the first related model record matching the attributes or instantiate it. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrNew(array $attributes) - { - if (is_null($instance = $this->where($attributes)->first())) { - $instance = $this->related->newInstance($attributes); - } - - return $instance; - } - - /** - * Create or update a related record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model - */ - public function updateOrCreate(array $attributes, array $values = []) - { - $instance = $this->firstOrNew($attributes); - - $instance->fill($values)->save(); - - return $instance; - } - - /** - * Add a basic where clause to the query, and return the first result. - * - * @param \Closure|string|array $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return \Illuminate\Database\Eloquent\Model|static - */ - public function firstWhere($column, $operator = null, $value = null, $boolean = 'and') - { - return $this->where($column, $operator, $value, $boolean)->first(); - } - - /** - * Execute the query and get the first related model. - * - * @param array $columns - * @return mixed - */ - public function first($columns = ['*']) - { - $results = $this->take(1)->get($columns); - - return count($results) > 0 ? $results->first() : null; - } - - /** - * Execute the query and get the first result or throw an exception. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|static - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - public function firstOrFail($columns = ['*']) - { - if (! is_null($model = $this->first($columns))) { - return $model; - } - - throw (new ModelNotFoundException)->setModel(get_class($this->related)); - } - - /** - * Execute the query and get the first result or call a callback. - * - * @param \Closure|array $columns - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Model|static|mixed - */ - public function firstOr($columns = ['*'], Closure $callback = null) - { - if ($columns instanceof Closure) { - $callback = $columns; - - $columns = ['*']; - } - - if (! is_null($model = $this->first($columns))) { - return $model; - } - - return $callback(); - } - - /** - * Find a related model by its primary key. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null - */ - public function find($id, $columns = ['*']) - { - if (is_array($id) || $id instanceof Arrayable) { - return $this->findMany($id, $columns); - } - - return $this->where( - $this->getRelated()->getQualifiedKeyName(), '=', $id - )->first($columns); - } - - /** - * Find multiple related models by their primary keys. - * - * @param \Illuminate\Contracts\Support\Arrayable|array $ids - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function findMany($ids, $columns = ['*']) - { - $ids = $ids instanceof Arrayable ? $ids->toArray() : $ids; - - if (empty($ids)) { - return $this->getRelated()->newCollection(); - } - - return $this->whereIn( - $this->getRelated()->getQualifiedKeyName(), $ids - )->get($columns); - } - - /** - * Find a related model by its primary key or throw an exception. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - public function findOrFail($id, $columns = ['*']) - { - $result = $this->find($id, $columns); - - $id = $id instanceof Arrayable ? $id->toArray() : $id; - - if (is_array($id)) { - if (count($result) === count(array_unique($id))) { - return $result; - } - } elseif (! is_null($result)) { - return $result; - } - - throw (new ModelNotFoundException)->setModel(get_class($this->related), $id); - } - - /** - * Find a related model by its primary key or call a callback. - * - * @param mixed $id - * @param \Closure|array $columns - * @param \Closure|null $callback - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|mixed - */ - public function findOr($id, $columns = ['*'], Closure $callback = null) - { - if ($columns instanceof Closure) { - $callback = $columns; - - $columns = ['*']; - } - - $result = $this->find($id, $columns); - - $id = $id instanceof Arrayable ? $id->toArray() : $id; - - if (is_array($id)) { - if (count($result) === count(array_unique($id))) { - return $result; - } - } elseif (! is_null($result)) { - return $result; - } - - return $callback(); - } - - /** - * Get the results of the relationship. - * - * @return mixed - */ - public function getResults() - { - return ! is_null($this->farParent->{$this->localKey}) - ? $this->get() - : $this->related->newCollection(); - } - - /** - * Execute the query as a "select" statement. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Collection - */ - public function get($columns = ['*']) - { - $builder = $this->prepareQueryBuilder($columns); - - $models = $builder->getModels(); - - // If we actually found models we will also eager load any relationships that - // have been specified as needing to be eager loaded. This will solve the - // n + 1 query problem for the developer and also increase performance. - if (count($models) > 0) { - $models = $builder->eagerLoadRelations($models); - } - - return $this->related->newCollection($models); - } - - /** - * Get a paginator for the "select" statement. - * - * @param int|null $perPage - * @param array $columns - * @param string $pageName - * @param int $page - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ - public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) - { - $this->query->addSelect($this->shouldSelect($columns)); - - return $this->query->paginate($perPage, $columns, $pageName, $page); - } - - /** - * Paginate the given query into a simple paginator. - * - * @param int|null $perPage - * @param array $columns - * @param string $pageName - * @param int|null $page - * @return \Illuminate\Contracts\Pagination\Paginator - */ - public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) - { - $this->query->addSelect($this->shouldSelect($columns)); - - return $this->query->simplePaginate($perPage, $columns, $pageName, $page); - } - - /** - * Paginate the given query into a cursor paginator. - * - * @param int|null $perPage - * @param array $columns - * @param string $cursorName - * @param string|null $cursor - * @return \Illuminate\Contracts\Pagination\CursorPaginator - */ - public function cursorPaginate($perPage = null, $columns = ['*'], $cursorName = 'cursor', $cursor = null) - { - $this->query->addSelect($this->shouldSelect($columns)); - - return $this->query->cursorPaginate($perPage, $columns, $cursorName, $cursor); - } - - /** - * Set the select clause for the relation query. - * - * @param array $columns - * @return array - */ - protected function shouldSelect(array $columns = ['*']) - { - if ($columns == ['*']) { - $columns = [$this->related->getTable().'.*']; - } - - return array_merge($columns, [$this->getQualifiedFirstKeyName().' as laravel_through_key']); - } - - /** - * Chunk the results of the query. - * - * @param int $count - * @param callable $callback - * @return bool - */ - public function chunk($count, callable $callback) - { - return $this->prepareQueryBuilder()->chunk($count, $callback); - } - - /** - * Chunk the results of a query by comparing numeric IDs. - * - * @param int $count - * @param callable $callback - * @param string|null $column - * @param string|null $alias - * @return bool - */ - public function chunkById($count, callable $callback, $column = null, $alias = null) - { - $column ??= $this->getRelated()->getQualifiedKeyName(); - - $alias ??= $this->getRelated()->getKeyName(); - - return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias); - } - - /** - * Get a generator for the given query. - * - * @return \Illuminate\Support\LazyCollection - */ - public function cursor() - { - return $this->prepareQueryBuilder()->cursor(); - } - - /** - * Execute a callback over each item while chunking. - * - * @param callable $callback - * @param int $count - * @return bool - */ - public function each(callable $callback, $count = 1000) - { - return $this->chunk($count, function ($results) use ($callback) { - foreach ($results as $key => $value) { - if ($callback($value, $key) === false) { - return false; - } - } - }); - } - - /** - * Query lazily, by chunks of the given size. - * - * @param int $chunkSize - * @return \Illuminate\Support\LazyCollection - */ - public function lazy($chunkSize = 1000) - { - return $this->prepareQueryBuilder()->lazy($chunkSize); - } - - /** - * Query lazily, by chunking the results of a query by comparing IDs. - * - * @param int $chunkSize - * @param string|null $column - * @param string|null $alias - * @return \Illuminate\Support\LazyCollection - */ - public function lazyById($chunkSize = 1000, $column = null, $alias = null) - { - $column ??= $this->getRelated()->getQualifiedKeyName(); - - $alias ??= $this->getRelated()->getKeyName(); - - return $this->prepareQueryBuilder()->lazyById($chunkSize, $column, $alias); - } - - /** - * Prepare the query builder for query execution. - * - * @param array $columns - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function prepareQueryBuilder($columns = ['*']) - { - $builder = $this->query->applyScopes(); - - return $builder->addSelect( - $this->shouldSelect($builder->getQuery()->columns ? [] : $columns) - ); - } - - /** - * Add the constraints for a relationship query. - * - * @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 = ['*']) - { - if ($parentQuery->getQuery()->from === $query->getQuery()->from) { - return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); - } - - if ($parentQuery->getQuery()->from === $this->throughParent->getTable()) { - return $this->getRelationExistenceQueryForThroughSelfRelation($query, $parentQuery, $columns); - } - - $this->performJoin($query); - - return $query->select($columns)->whereColumn( - $this->getQualifiedLocalKeyName(), '=', $this->getQualifiedFirstKeyName() - ); - } - - /** - * Add the constraints for a relationship query on the same table. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parentQuery - * @param array|mixed $columns - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) - { - $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); - - $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->secondKey); - - if ($this->throughParentSoftDeletes()) { - $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); - } - - $query->getModel()->setTable($hash); - - return $query->select($columns)->whereColumn( - $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $this->getQualifiedFirstKeyName() - ); - } - - /** - * Add the constraints for a relationship query on the same table as the through parent. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parentQuery - * @param array|mixed $columns - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationExistenceQueryForThroughSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) - { - $table = $this->throughParent->getTable().' as '.$hash = $this->getRelationCountHash(); - - $query->join($table, $hash.'.'.$this->secondLocalKey, '=', $this->getQualifiedFarKeyName()); - - if ($this->throughParentSoftDeletes()) { - $query->whereNull($hash.'.'.$this->throughParent->getDeletedAtColumn()); - } - - return $query->select($columns)->whereColumn( - $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $hash.'.'.$this->firstKey - ); - } - - /** - * Get the qualified foreign key on the related model. - * - * @return string - */ - public function getQualifiedFarKeyName() - { - return $this->getQualifiedForeignKeyName(); - } - - /** - * Get the foreign key on the "through" model. - * - * @return string - */ - public function getFirstKeyName() - { - return $this->firstKey; - } - - /** - * Get the qualified foreign key on the "through" model. - * - * @return string - */ - public function getQualifiedFirstKeyName() - { - return $this->throughParent->qualifyColumn($this->firstKey); - } - - /** - * Get the foreign key on the related model. - * - * @return string - */ - public function getForeignKeyName() - { - return $this->secondKey; - } - - /** - * Get the qualified foreign key on the related model. - * - * @return string - */ - public function getQualifiedForeignKeyName() - { - return $this->related->qualifyColumn($this->secondKey); - } - - /** - * Get the local key on the far parent model. - * - * @return string - */ - public function getLocalKeyName() - { - return $this->localKey; - } - - /** - * Get the qualified local key on the far parent model. - * - * @return string - */ - public function getQualifiedLocalKeyName() - { - return $this->farParent->qualifyColumn($this->localKey); - } - - /** - * Get the local key on the intermediary model. - * - * @return string - */ - public function getSecondLocalKeyName() - { - return $this->secondLocalKey; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOne.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOne.php deleted file mode 100755 index ed85f1e..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOne.php +++ /dev/null @@ -1,137 +0,0 @@ -getParentKey())) { - return $this->getDefaultFor($this->parent); - } - - return $this->query->first() ?: $this->getDefaultFor($this->parent); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) { - $model->setRelation($relation, $this->getDefaultFor($model)); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $this->matchOne($models, $results, $relation); - } - - /** - * 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 = ['*']) - { - if ($this->isOneOfMany()) { - $this->mergeOneOfManyJoinsTo($query); - } - - return parent::getRelationExistenceQuery($query, $parentQuery, $columns); - } - - /** - * Add constraints for inner join subselect for one of many relationships. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param string|null $column - * @param string|null $aggregate - * @return void - */ - public function addOneOfManySubQueryConstraints(Builder $query, $column = null, $aggregate = null) - { - $query->addSelect($this->foreignKey); - } - - /** - * Get the columns that should be selected by the one of many subquery. - * - * @return array|string - */ - public function getOneOfManySubQuerySelectColumns() - { - return $this->foreignKey; - } - - /** - * Add join query constraints for one of many relationships. - * - * @param \Illuminate\Database\Query\JoinClause $join - * @return void - */ - public function addOneOfManyJoinSubQueryConstraints(JoinClause $join) - { - $join->on($this->qualifySubSelectColumn($this->foreignKey), '=', $this->qualifyRelatedColumn($this->foreignKey)); - } - - /** - * Make a new related instance for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @return \Illuminate\Database\Eloquent\Model - */ - public function newRelatedInstanceFor(Model $parent) - { - return $this->related->newInstance()->setAttribute( - $this->getForeignKeyName(), $parent->{$this->localKey} - ); - } - - /** - * Get the value of the model's foreign key. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return mixed - */ - protected function getRelatedKeyFrom(Model $model) - { - return $model->getAttribute($this->getForeignKeyName()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php deleted file mode 100755 index 17ec20a..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php +++ /dev/null @@ -1,475 +0,0 @@ -localKey = $localKey; - $this->foreignKey = $foreignKey; - - parent::__construct($query, $parent); - } - - /** - * Create and return an un-saved instance of the related model. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function make(array $attributes = []) - { - return tap($this->related->newInstance($attributes), function ($instance) { - $this->setForeignAttributesForCreate($instance); - }); - } - - /** - * Create and return an un-saved instance of the related models. - * - * @param iterable $records - * @return \Illuminate\Database\Eloquent\Collection - */ - public function makeMany($records) - { - $instances = $this->related->newCollection(); - - foreach ($records as $record) { - $instances->push($this->make($record)); - } - - return $instances; - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - if (static::$constraints) { - $query = $this->getRelationQuery(); - - $query->where($this->foreignKey, '=', $this->getParentKey()); - - $query->whereNotNull($this->foreignKey); - } - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - $whereIn = $this->whereInMethod($this->parent, $this->localKey); - - $this->getRelationQuery()->{$whereIn}( - $this->foreignKey, $this->getKeys($models, $this->localKey) - ); - } - - /** - * Match the eagerly loaded results to their single parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function matchOne(array $models, Collection $results, $relation) - { - return $this->matchOneOrMany($models, $results, $relation, 'one'); - } - - /** - * Match the eagerly loaded results to their many parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function matchMany(array $models, Collection $results, $relation) - { - return $this->matchOneOrMany($models, $results, $relation, 'many'); - } - - /** - * Match the eagerly loaded results to their many parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @param string $type - * @return array - */ - protected function matchOneOrMany(array $models, Collection $results, $relation, $type) - { - $dictionary = $this->buildDictionary($results); - - // Once we have the dictionary we can simply spin through the parent models to - // link them up with their children using the keyed dictionary to make the - // matching very convenient and easy work. Then we'll just return them. - foreach ($models as $model) { - if (isset($dictionary[$key = $this->getDictionaryKey($model->getAttribute($this->localKey))])) { - $model->setRelation( - $relation, $this->getRelationValue($dictionary, $key, $type) - ); - } - } - - return $models; - } - - /** - * Get the value of a relationship by one or many type. - * - * @param array $dictionary - * @param string $key - * @param string $type - * @return mixed - */ - protected function getRelationValue(array $dictionary, $key, $type) - { - $value = $dictionary[$key]; - - return $type === 'one' ? reset($value) : $this->related->newCollection($value); - } - - /** - * Build model dictionary keyed by the relation's foreign key. - * - * @param \Illuminate\Database\Eloquent\Collection $results - * @return array - */ - protected function buildDictionary(Collection $results) - { - $foreign = $this->getForeignKeyName(); - - return $results->mapToDictionary(function ($result) use ($foreign) { - return [$this->getDictionaryKey($result->{$foreign}) => $result]; - })->all(); - } - - /** - * Find a model by its primary key or return a new instance of the related model. - * - * @param mixed $id - * @param array $columns - * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model - */ - public function findOrNew($id, $columns = ['*']) - { - if (is_null($instance = $this->find($id, $columns))) { - $instance = $this->related->newInstance(); - - $this->setForeignAttributesForCreate($instance); - } - - return $instance; - } - - /** - * Get the first related model record matching the attributes or instantiate it. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrNew(array $attributes = [], array $values = []) - { - if (is_null($instance = $this->where($attributes)->first())) { - $instance = $this->related->newInstance(array_merge($attributes, $values)); - - $this->setForeignAttributesForCreate($instance); - } - - return $instance; - } - - /** - * Get the first related record matching the attributes or create it. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model - */ - public function firstOrCreate(array $attributes = [], array $values = []) - { - if (is_null($instance = $this->where($attributes)->first())) { - $instance = $this->create(array_merge($attributes, $values)); - } - - return $instance; - } - - /** - * Create or update a related record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @return \Illuminate\Database\Eloquent\Model - */ - public function updateOrCreate(array $attributes, array $values = []) - { - return tap($this->firstOrNew($attributes), function ($instance) use ($values) { - $instance->fill($values); - - $instance->save(); - }); - } - - /** - * Attach a model instance to the parent model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Database\Eloquent\Model|false - */ - public function save(Model $model) - { - $this->setForeignAttributesForCreate($model); - - return $model->save() ? $model : false; - } - - /** - * Attach a model instance without raising any events to the parent model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Database\Eloquent\Model|false - */ - public function saveQuietly(Model $model) - { - return Model::withoutEvents(function () use ($model) { - return $this->save($model); - }); - } - - /** - * Attach a collection of models to the parent instance. - * - * @param iterable $models - * @return iterable - */ - public function saveMany($models) - { - foreach ($models as $model) { - $this->save($model); - } - - return $models; - } - - /** - * Attach a collection of models to the parent instance without raising any events to the parent model. - * - * @param iterable $models - * @return iterable - */ - public function saveManyQuietly($models) - { - return Model::withoutEvents(function () use ($models) { - return $this->saveMany($models); - }); - } - - /** - * Create a new instance of the related model. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function create(array $attributes = []) - { - return tap($this->related->newInstance($attributes), function ($instance) { - $this->setForeignAttributesForCreate($instance); - - $instance->save(); - }); - } - - /** - * Create a new instance of the related model without raising any events to the parent model. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function createQuietly(array $attributes = []) - { - return Model::withoutEvents(fn () => $this->create($attributes)); - } - - /** - * Create a new instance of the related model. Allow mass-assignment. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function forceCreate(array $attributes = []) - { - $attributes[$this->getForeignKeyName()] = $this->getParentKey(); - - return $this->related->forceCreate($attributes); - } - - /** - * Create a Collection of new instances of the related model. - * - * @param iterable $records - * @return \Illuminate\Database\Eloquent\Collection - */ - public function createMany(iterable $records) - { - $instances = $this->related->newCollection(); - - foreach ($records as $record) { - $instances->push($this->create($record)); - } - - return $instances; - } - - /** - * Set the foreign ID for creating a related model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return void - */ - protected function setForeignAttributesForCreate(Model $model) - { - $model->setAttribute($this->getForeignKeyName(), $this->getParentKey()); - } - - /** - * Add the constraints for a relationship query. - * - * @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 = ['*']) - { - if ($query->getQuery()->from == $parentQuery->getQuery()->from) { - return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); - } - - return parent::getRelationExistenceQuery($query, $parentQuery, $columns); - } - - /** - * Add the constraints for a relationship query on the same table. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \Illuminate\Database\Eloquent\Builder $parentQuery - * @param array|mixed $columns - * @return \Illuminate\Database\Eloquent\Builder - */ - public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) - { - $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); - - $query->getModel()->setTable($hash); - - return $query->select($columns)->whereColumn( - $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->getForeignKeyName() - ); - } - - /** - * Get the key for comparing against the parent key in "has" query. - * - * @return string - */ - public function getExistenceCompareKey() - { - return $this->getQualifiedForeignKeyName(); - } - - /** - * Get the key value of the parent's local key. - * - * @return mixed - */ - public function getParentKey() - { - return $this->parent->getAttribute($this->localKey); - } - - /** - * Get the fully qualified parent key name. - * - * @return string - */ - public function getQualifiedParentKeyName() - { - return $this->parent->qualifyColumn($this->localKey); - } - - /** - * Get the plain foreign key. - * - * @return string - */ - public function getForeignKeyName() - { - $segments = explode('.', $this->getQualifiedForeignKeyName()); - - return end($segments); - } - - /** - * Get the foreign key for the relationship. - * - * @return string - */ - public function getQualifiedForeignKeyName() - { - return $this->foreignKey; - } - - /** - * Get the local key for the relationship. - * - * @return string - */ - public function getLocalKeyName() - { - return $this->localKey; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOneThrough.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOneThrough.php deleted file mode 100644 index ed9c7ba..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/HasOneThrough.php +++ /dev/null @@ -1,77 +0,0 @@ -first() ?: $this->getDefaultFor($this->farParent); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) { - $model->setRelation($relation, $this->getDefaultFor($model)); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - $dictionary = $this->buildDictionary($results); - - // Once we have the dictionary we can simply spin through the parent models to - // link them up with their children using the keyed dictionary to make the - // matching very convenient and easy work. Then we'll just return them. - foreach ($models as $model) { - if (isset($dictionary[$key = $this->getDictionaryKey($model->getAttribute($this->localKey))])) { - $value = $dictionary[$key]; - $model->setRelation( - $relation, reset($value) - ); - } - } - - return $models; - } - - /** - * Make a new related instance for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @return \Illuminate\Database\Eloquent\Model - */ - public function newRelatedInstanceFor(Model $parent) - { - return $this->related->newInstance(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphMany.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphMany.php deleted file mode 100755 index 282ba2e..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphMany.php +++ /dev/null @@ -1,62 +0,0 @@ -getParentKey()) - ? $this->query->get() - : $this->related->newCollection(); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) { - $model->setRelation($relation, $this->related->newCollection()); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $this->matchMany($models, $results, $relation); - } - - /** - * Create a new instance of the related model. Allow mass-assignment. - * - * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model - */ - public function forceCreate(array $attributes = []) - { - $attributes[$this->getMorphType()] = $this->morphClass; - - return parent::forceCreate($attributes); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphOne.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphOne.php deleted file mode 100755 index fc8f4dc..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphOne.php +++ /dev/null @@ -1,137 +0,0 @@ -getParentKey())) { - return $this->getDefaultFor($this->parent); - } - - return $this->query->first() ?: $this->getDefaultFor($this->parent); - } - - /** - * Initialize the relation on a set of models. - * - * @param array $models - * @param string $relation - * @return array - */ - public function initRelation(array $models, $relation) - { - foreach ($models as $model) { - $model->setRelation($relation, $this->getDefaultFor($model)); - } - - return $models; - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $this->matchOne($models, $results, $relation); - } - - /** - * Get the relationship query. - * - * @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 = ['*']) - { - if ($this->isOneOfMany()) { - $this->mergeOneOfManyJoinsTo($query); - } - - return parent::getRelationExistenceQuery($query, $parentQuery, $columns); - } - - /** - * Add constraints for inner join subselect for one of many relationships. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param string|null $column - * @param string|null $aggregate - * @return void - */ - public function addOneOfManySubQueryConstraints(Builder $query, $column = null, $aggregate = null) - { - $query->addSelect($this->foreignKey, $this->morphType); - } - - /** - * Get the columns that should be selected by the one of many subquery. - * - * @return array|string - */ - public function getOneOfManySubQuerySelectColumns() - { - return [$this->foreignKey, $this->morphType]; - } - - /** - * Add join query constraints for one of many relationships. - * - * @param \Illuminate\Database\Query\JoinClause $join - * @return void - */ - public function addOneOfManyJoinSubQueryConstraints(JoinClause $join) - { - $join - ->on($this->qualifySubSelectColumn($this->morphType), '=', $this->qualifyRelatedColumn($this->morphType)) - ->on($this->qualifySubSelectColumn($this->foreignKey), '=', $this->qualifyRelatedColumn($this->foreignKey)); - } - - /** - * Make a new related instance for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @return \Illuminate\Database\Eloquent\Model - */ - public function newRelatedInstanceFor(Model $parent) - { - return $this->related->newInstance() - ->setAttribute($this->getForeignKeyName(), $parent->{$this->localKey}) - ->setAttribute($this->getMorphType(), $this->morphClass); - } - - /** - * Get the value of the model's foreign key. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return mixed - */ - protected function getRelatedKeyFrom(Model $model) - { - return $model->getAttribute($this->getForeignKeyName()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php deleted file mode 100755 index 6e2297f..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php +++ /dev/null @@ -1,127 +0,0 @@ -morphType = $type; - - $this->morphClass = $parent->getMorphClass(); - - parent::__construct($query, $parent, $id, $localKey); - } - - /** - * Set the base constraints on the relation query. - * - * @return void - */ - public function addConstraints() - { - if (static::$constraints) { - $this->getRelationQuery()->where($this->morphType, $this->morphClass); - - parent::addConstraints(); - } - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - parent::addEagerConstraints($models); - - $this->getRelationQuery()->where($this->morphType, $this->morphClass); - } - - /** - * Set the foreign ID and type for creating a related model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return void - */ - protected function setForeignAttributesForCreate(Model $model) - { - $model->{$this->getForeignKeyName()} = $this->getParentKey(); - - $model->{$this->getMorphType()} = $this->morphClass; - } - - /** - * Get the relationship query. - * - * @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 parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where( - $query->qualifyColumn($this->getMorphType()), $this->morphClass - ); - } - - /** - * Get the foreign key "type" name. - * - * @return string - */ - public function getQualifiedMorphType() - { - return $this->morphType; - } - - /** - * Get the plain morph type name without the table. - * - * @return string - */ - public function getMorphType() - { - return last(explode('.', $this->morphType)); - } - - /** - * Get the class name of the parent model. - * - * @return string - */ - public function getMorphClass() - { - return $this->morphClass; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php deleted file mode 100644 index 5ca8b48..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php +++ /dev/null @@ -1,182 +0,0 @@ -where($this->morphType, $this->morphClass); - - return parent::setKeysForSaveQuery($query); - } - - /** - * Set the keys for a select query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function setKeysForSelectQuery($query) - { - $query->where($this->morphType, $this->morphClass); - - return parent::setKeysForSelectQuery($query); - } - - /** - * Delete the pivot model record from the database. - * - * @return int - */ - public function delete() - { - if (isset($this->attributes[$this->getKeyName()])) { - return (int) parent::delete(); - } - - if ($this->fireModelEvent('deleting') === false) { - return 0; - } - - $query = $this->getDeleteQuery(); - - $query->where($this->morphType, $this->morphClass); - - return tap($query->delete(), function () { - $this->fireModelEvent('deleted', false); - }); - } - - /** - * Get the morph type for the pivot. - * - * @return string - */ - public function getMorphType() - { - return $this->morphType; - } - - /** - * Set the morph type for the pivot. - * - * @param string $morphType - * @return $this - */ - public function setMorphType($morphType) - { - $this->morphType = $morphType; - - return $this; - } - - /** - * Set the morph class for the pivot. - * - * @param string $morphClass - * @return \Illuminate\Database\Eloquent\Relations\MorphPivot - */ - public function setMorphClass($morphClass) - { - $this->morphClass = $morphClass; - - return $this; - } - - /** - * Get the queueable identity for the entity. - * - * @return mixed - */ - public function getQueueableId() - { - if (isset($this->attributes[$this->getKeyName()])) { - return $this->getKey(); - } - - return sprintf( - '%s:%s:%s:%s:%s:%s', - $this->foreignKey, $this->getAttribute($this->foreignKey), - $this->relatedKey, $this->getAttribute($this->relatedKey), - $this->morphType, $this->morphClass - ); - } - - /** - * Get a new query to restore one or more models by their queueable IDs. - * - * @param array|int $ids - * @return \Illuminate\Database\Eloquent\Builder - */ - public function newQueryForRestoration($ids) - { - if (is_array($ids)) { - return $this->newQueryForCollectionRestoration($ids); - } - - if (! str_contains($ids, ':')) { - return parent::newQueryForRestoration($ids); - } - - $segments = explode(':', $ids); - - return $this->newQueryWithoutScopes() - ->where($segments[0], $segments[1]) - ->where($segments[2], $segments[3]) - ->where($segments[4], $segments[5]); - } - - /** - * Get a new query to restore multiple models by their queueable IDs. - * - * @param array $ids - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function newQueryForCollectionRestoration(array $ids) - { - $ids = array_values($ids); - - if (! str_contains($ids[0], ':')) { - return parent::newQueryForRestoration($ids); - } - - $query = $this->newQueryWithoutScopes(); - - foreach ($ids as $id) { - $segments = explode(':', $id); - - $query->orWhere(function ($query) use ($segments) { - return $query->where($segments[0], $segments[1]) - ->where($segments[2], $segments[3]) - ->where($segments[4], $segments[5]); - }); - } - - return $query; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphTo.php deleted file mode 100644 index 262741f..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ /dev/null @@ -1,396 +0,0 @@ -morphType = $type; - - parent::__construct($query, $parent, $foreignKey, $ownerKey, $relation); - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - $this->buildDictionary($this->models = Collection::make($models)); - } - - /** - * Build a dictionary with the models. - * - * @param \Illuminate\Database\Eloquent\Collection $models - * @return void - */ - protected function buildDictionary(Collection $models) - { - foreach ($models as $model) { - if ($model->{$this->morphType}) { - $morphTypeKey = $this->getDictionaryKey($model->{$this->morphType}); - $foreignKeyKey = $this->getDictionaryKey($model->{$this->foreignKey}); - - $this->dictionary[$morphTypeKey][$foreignKeyKey][] = $model; - } - } - } - - /** - * Get the results of the relationship. - * - * Called via eager load method of Eloquent query builder. - * - * @return mixed - */ - public function getEager() - { - foreach (array_keys($this->dictionary) as $type) { - $this->matchToMorphParents($type, $this->getResultsByType($type)); - } - - return $this->models; - } - - /** - * Get all of the relation results for a type. - * - * @param string $type - * @return \Illuminate\Database\Eloquent\Collection - */ - protected function getResultsByType($type) - { - $instance = $this->createModelByType($type); - - $ownerKey = $this->ownerKey ?? $instance->getKeyName(); - - $query = $this->replayMacros($instance->newQuery()) - ->mergeConstraintsFrom($this->getQuery()) - ->with(array_merge( - $this->getQuery()->getEagerLoads(), - (array) ($this->morphableEagerLoads[get_class($instance)] ?? []) - )) - ->withCount( - (array) ($this->morphableEagerLoadCounts[get_class($instance)] ?? []) - ); - - if ($callback = ($this->morphableConstraints[get_class($instance)] ?? null)) { - $callback($query); - } - - $whereIn = $this->whereInMethod($instance, $ownerKey); - - return $query->{$whereIn}( - $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type, $instance->getKeyType()) - )->get(); - } - - /** - * Gather all of the foreign keys for a given type. - * - * @param string $type - * @param string $keyType - * @return array - */ - protected function gatherKeysByType($type, $keyType) - { - return $keyType !== 'string' - ? array_keys($this->dictionary[$type]) - : array_map(function ($modelId) { - return (string) $modelId; - }, array_filter(array_keys($this->dictionary[$type]))); - } - - /** - * Create a new model instance by type. - * - * @param string $type - * @return \Illuminate\Database\Eloquent\Model - */ - public function createModelByType($type) - { - $class = Model::getActualClassNameForMorph($type); - - return tap(new $class, function ($instance) { - if (! $instance->getConnectionName()) { - $instance->setConnection($this->getConnection()->getName()); - } - }); - } - - /** - * Match the eagerly loaded results to their parents. - * - * @param array $models - * @param \Illuminate\Database\Eloquent\Collection $results - * @param string $relation - * @return array - */ - public function match(array $models, Collection $results, $relation) - { - return $models; - } - - /** - * Match the results for a given type to their parents. - * - * @param string $type - * @param \Illuminate\Database\Eloquent\Collection $results - * @return void - */ - protected function matchToMorphParents($type, Collection $results) - { - foreach ($results as $result) { - $ownerKey = ! is_null($this->ownerKey) ? $this->getDictionaryKey($result->{$this->ownerKey}) : $result->getKey(); - - if (isset($this->dictionary[$type][$ownerKey])) { - foreach ($this->dictionary[$type][$ownerKey] as $model) { - $model->setRelation($this->relationName, $result); - } - } - } - } - - /** - * Associate the model instance to the given parent. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Database\Eloquent\Model - */ - public function associate($model) - { - if ($model instanceof Model) { - $foreignKey = $this->ownerKey && $model->{$this->ownerKey} - ? $this->ownerKey - : $model->getKeyName(); - } - - $this->parent->setAttribute( - $this->foreignKey, $model instanceof Model ? $model->{$foreignKey} : null - ); - - $this->parent->setAttribute( - $this->morphType, $model instanceof Model ? $model->getMorphClass() : null - ); - - return $this->parent->setRelation($this->relationName, $model); - } - - /** - * Dissociate previously associated model from the given parent. - * - * @return \Illuminate\Database\Eloquent\Model - */ - public function dissociate() - { - $this->parent->setAttribute($this->foreignKey, null); - - $this->parent->setAttribute($this->morphType, null); - - return $this->parent->setRelation($this->relationName, null); - } - - /** - * Touch all of the related models for the relationship. - * - * @return void - */ - public function touch() - { - if (! is_null($this->child->{$this->foreignKey})) { - parent::touch(); - } - } - - /** - * Make a new related instance for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $parent - * @return \Illuminate\Database\Eloquent\Model - */ - protected function newRelatedInstanceFor(Model $parent) - { - return $parent->{$this->getRelationName()}()->getRelated()->newInstance(); - } - - /** - * Get the foreign key "type" name. - * - * @return string - */ - public function getMorphType() - { - return $this->morphType; - } - - /** - * Get the dictionary used by the relationship. - * - * @return array - */ - public function getDictionary() - { - return $this->dictionary; - } - - /** - * Specify which relations to load for a given morph type. - * - * @param array $with - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - public function morphWith(array $with) - { - $this->morphableEagerLoads = array_merge( - $this->morphableEagerLoads, $with - ); - - return $this; - } - - /** - * Specify which relationship counts to load for a given morph type. - * - * @param array $withCount - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - public function morphWithCount(array $withCount) - { - $this->morphableEagerLoadCounts = array_merge( - $this->morphableEagerLoadCounts, $withCount - ); - - return $this; - } - - /** - * Specify constraints on the query for a given morph type. - * - * @param array $callbacks - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - public function constrain(array $callbacks) - { - $this->morphableConstraints = array_merge( - $this->morphableConstraints, $callbacks - ); - - return $this; - } - - /** - * Replay stored macro calls on the actual related instance. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function replayMacros(Builder $query) - { - foreach ($this->macroBuffer as $macro) { - $query->{$macro['method']}(...$macro['parameters']); - } - - return $query; - } - - /** - * Handle dynamic method calls to the relationship. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - try { - $result = parent::__call($method, $parameters); - - if (in_array($method, ['select', 'selectRaw', 'selectSub', 'addSelect', 'withoutGlobalScopes'])) { - $this->macroBuffer[] = compact('method', 'parameters'); - } - - return $result; - } - - // If we tried to call a method that does not exist on the parent Builder instance, - // we'll assume that we want to call a query macro (e.g. withTrashed) that only - // exists on related models. We will just store the call and replay it later. - catch (BadMethodCallException $e) { - $this->macroBuffer[] = compact('method', 'parameters'); - - return $this; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php deleted file mode 100644 index c2d5745..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php +++ /dev/null @@ -1,209 +0,0 @@ -inverse = $inverse; - $this->morphType = $name.'_type'; - $this->morphClass = $inverse ? $query->getModel()->getMorphClass() : $parent->getMorphClass(); - - parent::__construct( - $query, $parent, $table, $foreignPivotKey, - $relatedPivotKey, $parentKey, $relatedKey, $relationName - ); - } - - /** - * Set the where clause for the relation query. - * - * @return $this - */ - protected function addWhereConstraints() - { - parent::addWhereConstraints(); - - $this->query->where($this->qualifyPivotColumn($this->morphType), $this->morphClass); - - return $this; - } - - /** - * Set the constraints for an eager load of the relation. - * - * @param array $models - * @return void - */ - public function addEagerConstraints(array $models) - { - parent::addEagerConstraints($models); - - $this->query->where($this->qualifyPivotColumn($this->morphType), $this->morphClass); - } - - /** - * Create a new pivot attachment record. - * - * @param int $id - * @param bool $timed - * @return array - */ - protected function baseAttachRecord($id, $timed) - { - return Arr::add( - parent::baseAttachRecord($id, $timed), $this->morphType, $this->morphClass - ); - } - - /** - * Add the constraints for a relationship count query. - * - * @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 parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where( - $this->qualifyPivotColumn($this->morphType), $this->morphClass - ); - } - - /** - * Get the pivot models that are currently attached. - * - * @return \Illuminate\Support\Collection - */ - protected function getCurrentlyAttachedPivots() - { - return parent::getCurrentlyAttachedPivots()->map(function ($record) { - return $record instanceof MorphPivot - ? $record->setMorphType($this->morphType) - ->setMorphClass($this->morphClass) - : $record; - }); - } - - /** - * Create a new query builder for the pivot table. - * - * @return \Illuminate\Database\Query\Builder - */ - public function newPivotQuery() - { - return parent::newPivotQuery()->where($this->morphType, $this->morphClass); - } - - /** - * Create a new pivot model instance. - * - * @param array $attributes - * @param bool $exists - * @return \Illuminate\Database\Eloquent\Relations\Pivot - */ - public function newPivot(array $attributes = [], $exists = false) - { - $using = $this->using; - - $pivot = $using ? $using::fromRawAttributes($this->parent, $attributes, $this->table, $exists) - : MorphPivot::fromAttributes($this->parent, $attributes, $this->table, $exists); - - $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey) - ->setMorphType($this->morphType) - ->setMorphClass($this->morphClass); - - return $pivot; - } - - /** - * Get the pivot columns for the relation. - * - * "pivot_" is prefixed at each column for easy removal later. - * - * @return array - */ - protected function aliasedPivotColumns() - { - $defaults = [$this->foreignPivotKey, $this->relatedPivotKey, $this->morphType]; - - return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { - return $this->qualifyPivotColumn($column).' as pivot_'.$column; - })->unique()->all(); - } - - /** - * Get the foreign key "type" name. - * - * @return string - */ - public function getMorphType() - { - return $this->morphType; - } - - /** - * Get the class name of the parent model. - * - * @return string - */ - public function getMorphClass() - { - return $this->morphClass; - } - - /** - * Get the indicator for a reverse relationship. - * - * @return bool - */ - public function getInverse() - { - return $this->inverse; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Pivot.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Pivot.php deleted file mode 100755 index a65ecde..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Relations/Pivot.php +++ /dev/null @@ -1,25 +0,0 @@ -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 $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 and get the first result if it's the sole matching record. - * - * @param array|string $columns - * @return \Illuminate\Database\Eloquent\Model - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - * @throws \Illuminate\Database\MultipleRecordsFoundException - */ - public function sole($columns = ['*']) - { - $result = $this->take(2)->get($columns); - - $count = $result->count(); - - if ($count === 0) { - throw (new ModelNotFoundException)->setModel(get_class($this->related)); - } - - if ($count > 1) { - throw new MultipleRecordsFoundException($count); - } - - return $result->first(); - } - - /** - * 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() - { - $model = $this->getRelated(); - - if (! $model::isIgnoringTouch()) { - $this->rawUpdate([ - $model->getUpdatedAtColumn() => $model->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 a relationship join table hash. - * - * @param bool $incrementJoinCount - * @return string - */ - public function getRelationCountHash($incrementJoinCount = true) - { - return 'laravel_reserved_'.($incrementJoinCount ? static::$selfJoinCount++ : static::$selfJoinCount); - } - - /** - * Get all of the primary keys for an array of models. - * - * @param array $models - * @param string|null $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(null, true)->sort()->all(); - } - - /** - * Get the query builder that will contain the relationship constraints. - * - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function getRelationQuery() - { - return $this->query; - } - - /** - * 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 a base query builder instance. - * - * @return \Illuminate\Database\Query\Builder - */ - public function toBase() - { - return $this->query->toBase(); - } - - /** - * 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(); - } - - /** - * Get the name of the "where in" method for eager loading. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param string $key - * @return string - */ - protected function whereInMethod(Model $model, $key) - { - return $model->getKeyName() === last(explode('.', $key)) - && in_array($model->getKeyType(), ['int', 'integer']) - ? 'whereIntegerInRaw' - : 'whereIn'; - } - - /** - * Prevent polymorphic relationships from being used without model mappings. - * - * @param bool $requireMorphMap - * @return void - */ - public static function requireMorphMap($requireMorphMap = true) - { - static::$requireMorphMap = $requireMorphMap; - } - - /** - * Determine if polymorphic relationships require explicit model mapping. - * - * @return bool - */ - public static function requiresMorphMap() - { - return static::$requireMorphMap; - } - - /** - * Define the morph map for polymorphic relations and require all morphed models to be explicitly mapped. - * - * @param array $map - * @param bool $merge - * @return array - */ - public static function enforceMorphMap(array $map, $merge = true) - { - static::requireMorphMap(); - - return static::morphMap($map, $merge); - } - - /** - * 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 static::$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); - } - - return $this->forwardDecoratedCallTo($this->query, $method, $parameters); - } - - /** - * Force a clone of the underlying query builder when cloning. - * - * @return void - */ - public function __clone() - { - $this->query = clone $this->query; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/Scope.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/Scope.php deleted file mode 100644 index 63cba6a..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/Scope.php +++ /dev/null @@ -1,15 +0,0 @@ -casts[$this->getDeletedAtColumn()])) { - $this->casts[$this->getDeletedAtColumn()] = 'datetime'; - } - } - - /** - * Force a hard delete on a soft deleted model. - * - * @return bool|null - */ - public function forceDelete() - { - if ($this->fireModelEvent('forceDeleting') === false) { - return false; - } - - $this->forceDeleting = true; - - return tap($this->delete(), function ($deleted) { - $this->forceDeleting = false; - - if ($deleted) { - $this->fireModelEvent('forceDeleted', false); - } - }); - } - - /** - * Force a hard delete on a soft deleted model without raising any events. - * - * @return bool|null - */ - public function forceDeleteQuietly() - { - return static::withoutEvents(fn () => $this->forceDelete()); - } - - /** - * Perform the actual delete query on this model instance. - * - * @return mixed - */ - protected function performDeleteOnModel() - { - if ($this->forceDeleting) { - return tap($this->setKeysForSaveQuery($this->newModelQuery())->forceDelete(), function () { - $this->exists = false; - }); - } - - return $this->runSoftDelete(); - } - - /** - * Perform the actual delete query on this model instance. - * - * @return void - */ - protected function runSoftDelete() - { - $query = $this->setKeysForSaveQuery($this->newModelQuery()); - - $time = $this->freshTimestamp(); - - $columns = [$this->getDeletedAtColumn() => $this->fromDateTime($time)]; - - $this->{$this->getDeletedAtColumn()} = $time; - - if ($this->usesTimestamps() && ! is_null($this->getUpdatedAtColumn())) { - $this->{$this->getUpdatedAtColumn()} = $time; - - $columns[$this->getUpdatedAtColumn()] = $this->fromDateTime($time); - } - - $query->update($columns); - - $this->syncOriginalAttributes(array_keys($columns)); - - $this->fireModelEvent('trashed', false); - } - - /** - * Restore a soft-deleted model instance. - * - * @return bool - */ - public function restore() - { - // If the restoring event does not return false, we will proceed with this - // restore operation. Otherwise, we bail out so the developer will stop - // the restore totally. We will clear the deleted timestamp and save. - if ($this->fireModelEvent('restoring') === false) { - return false; - } - - $this->{$this->getDeletedAtColumn()} = null; - - // Once we have saved the model, we will fire the "restored" event so this - // developer will do anything they need to after a restore operation is - // totally finished. Then we will return the result of the save call. - $this->exists = true; - - $result = $this->save(); - - $this->fireModelEvent('restored', false); - - return $result; - } - - /** - * Restore a soft-deleted model instance without raising any events. - * - * @return bool - */ - public function restoreQuietly() - { - return static::withoutEvents(fn () => $this->restore()); - } - - /** - * Determine if the model instance has been soft-deleted. - * - * @return bool - */ - public function trashed() - { - return ! is_null($this->{$this->getDeletedAtColumn()}); - } - - /** - * Register a "softDeleted" model event callback with the dispatcher. - * - * @param \Closure|string $callback - * @return void - */ - public static function softDeleted($callback) - { - static::registerModelEvent('trashed', $callback); - } - - /** - * Register a "restoring" model event callback with the dispatcher. - * - * @param \Closure|string $callback - * @return void - */ - public static function restoring($callback) - { - static::registerModelEvent('restoring', $callback); - } - - /** - * Register a "restored" model event callback with the dispatcher. - * - * @param \Closure|string $callback - * @return void - */ - public static function restored($callback) - { - static::registerModelEvent('restored', $callback); - } - - /** - * Register a "forceDeleting" model event callback with the dispatcher. - * - * @param \Closure|string $callback - * @return void - */ - public static function forceDeleting($callback) - { - static::registerModelEvent('forceDeleting', $callback); - } - - /** - * Register a "forceDeleted" model event callback with the dispatcher. - * - * @param \Closure|string $callback - * @return void - */ - public static function forceDeleted($callback) - { - static::registerModelEvent('forceDeleted', $callback); - } - - /** - * Determine if the model is currently force deleting. - * - * @return bool - */ - public function isForceDeleting() - { - return $this->forceDeleting; - } - - /** - * Get the name of the "deleted at" column. - * - * @return string - */ - public function getDeletedAtColumn() - { - return defined(static::class.'::DELETED_AT') ? static::DELETED_AT : 'deleted_at'; - } - - /** - * Get the fully qualified "deleted at" column. - * - * @return string - */ - public function getQualifiedDeletedAtColumn() - { - return $this->qualifyColumn($this->getDeletedAtColumn()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Eloquent/SoftDeletingScope.php b/framework-9.50.2/src/Illuminate/Database/Eloquent/SoftDeletingScope.php deleted file mode 100644 index e6d91d9..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Eloquent/SoftDeletingScope.php +++ /dev/null @@ -1,148 +0,0 @@ -whereNull($model->getQualifiedDeletedAtColumn()); - } - - /** - * Extend the query builder with the needed functions. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - public function extend(Builder $builder) - { - foreach ($this->extensions as $extension) { - $this->{"add{$extension}"}($builder); - } - - $builder->onDelete(function (Builder $builder) { - $column = $this->getDeletedAtColumn($builder); - - return $builder->update([ - $column => $builder->getModel()->freshTimestampString(), - ]); - }); - } - - /** - * Get the "deleted at" column for the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return string - */ - protected function getDeletedAtColumn(Builder $builder) - { - if (count((array) $builder->getQuery()->joins) > 0) { - return $builder->getModel()->getQualifiedDeletedAtColumn(); - } - - return $builder->getModel()->getDeletedAtColumn(); - } - - /** - * Add the restore extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addRestore(Builder $builder) - { - $builder->macro('restore', function (Builder $builder) { - $builder->withTrashed(); - - return $builder->update([$builder->getModel()->getDeletedAtColumn() => null]); - }); - } - - /** - * Add the restore-or-create extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addRestoreOrCreate(Builder $builder) - { - $builder->macro('restoreOrCreate', function (Builder $builder, array $attributes = [], array $values = []) { - $builder->withTrashed(); - - return tap($builder->firstOrCreate($attributes, $values), function ($instance) { - $instance->restore(); - }); - }); - } - - /** - * Add the with-trashed extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addWithTrashed(Builder $builder) - { - $builder->macro('withTrashed', function (Builder $builder, $withTrashed = true) { - if (! $withTrashed) { - return $builder->withoutTrashed(); - } - - return $builder->withoutGlobalScope($this); - }); - } - - /** - * Add the without-trashed extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addWithoutTrashed(Builder $builder) - { - $builder->macro('withoutTrashed', function (Builder $builder) { - $model = $builder->getModel(); - - $builder->withoutGlobalScope($this)->whereNull( - $model->getQualifiedDeletedAtColumn() - ); - - return $builder; - }); - } - - /** - * Add the only-trashed extension to the builder. - * - * @param \Illuminate\Database\Eloquent\Builder $builder - * @return void - */ - protected function addOnlyTrashed(Builder $builder) - { - $builder->macro('onlyTrashed', function (Builder $builder) { - $model = $builder->getModel(); - - $builder->withoutGlobalScope($this)->whereNotNull( - $model->getQualifiedDeletedAtColumn() - ); - - return $builder; - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/ConnectionEstablished.php b/framework-9.50.2/src/Illuminate/Database/Events/ConnectionEstablished.php deleted file mode 100644 index 22a45b8..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/ConnectionEstablished.php +++ /dev/null @@ -1,8 +0,0 @@ -connection = $connection; - $this->connectionName = $connection->getName(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/DatabaseBusy.php b/framework-9.50.2/src/Illuminate/Database/Events/DatabaseBusy.php deleted file mode 100644 index 8e903a9..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/DatabaseBusy.php +++ /dev/null @@ -1,32 +0,0 @@ -connectionName = $connectionName; - $this->connections = $connections; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/DatabaseRefreshed.php b/framework-9.50.2/src/Illuminate/Database/Events/DatabaseRefreshed.php deleted file mode 100644 index 5b1fb45..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/DatabaseRefreshed.php +++ /dev/null @@ -1,10 +0,0 @@ -method = $method; - $this->migration = $migration; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/MigrationStarted.php b/framework-9.50.2/src/Illuminate/Database/Events/MigrationStarted.php deleted file mode 100644 index 3f206b4..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/MigrationStarted.php +++ /dev/null @@ -1,8 +0,0 @@ -method = $method; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/MigrationsStarted.php b/framework-9.50.2/src/Illuminate/Database/Events/MigrationsStarted.php deleted file mode 100644 index 5283b49..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/MigrationsStarted.php +++ /dev/null @@ -1,8 +0,0 @@ -model = $model; - $this->count = $count; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/NoPendingMigrations.php b/framework-9.50.2/src/Illuminate/Database/Events/NoPendingMigrations.php deleted file mode 100644 index 100f786..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/NoPendingMigrations.php +++ /dev/null @@ -1,24 +0,0 @@ -method = $method; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/QueryExecuted.php b/framework-9.50.2/src/Illuminate/Database/Events/QueryExecuted.php deleted file mode 100644 index 833a21e..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/QueryExecuted.php +++ /dev/null @@ -1,59 +0,0 @@ -sql = $sql; - $this->time = $time; - $this->bindings = $bindings; - $this->connection = $connection; - $this->connectionName = $connection->getName(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/SchemaDumped.php b/framework-9.50.2/src/Illuminate/Database/Events/SchemaDumped.php deleted file mode 100644 index 1cbbfff..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/SchemaDumped.php +++ /dev/null @@ -1,41 +0,0 @@ -connection = $connection; - $this->connectionName = $connection->getName(); - $this->path = $path; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/SchemaLoaded.php b/framework-9.50.2/src/Illuminate/Database/Events/SchemaLoaded.php deleted file mode 100644 index 061a079..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/SchemaLoaded.php +++ /dev/null @@ -1,41 +0,0 @@ -connection = $connection; - $this->connectionName = $connection->getName(); - $this->path = $path; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/StatementPrepared.php b/framework-9.50.2/src/Illuminate/Database/Events/StatementPrepared.php deleted file mode 100644 index 2f60323..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/StatementPrepared.php +++ /dev/null @@ -1,33 +0,0 @@ -statement = $statement; - $this->connection = $connection; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Events/TransactionBeginning.php b/framework-9.50.2/src/Illuminate/Database/Events/TransactionBeginning.php deleted file mode 100644 index 3287b5c..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Events/TransactionBeginning.php +++ /dev/null @@ -1,8 +0,0 @@ -isExpression($table)) { - return $this->wrap($this->tablePrefix.$table, true); - } - - return $this->getValue($table); - } - - /** - * Wrap a value in keyword identifiers. - * - * @param \Illuminate\Database\Query\Expression|string $value - * @param bool $prefixAlias - * @return string - */ - public function wrap($value, $prefixAlias = false) - { - if ($this->isExpression($value)) { - return $this->getValue($value); - } - - // If the value being wrapped has a column alias we will need to separate out - // the pieces so we can wrap each of the segments of the expression on its - // own, and then join these both back together using the "as" connector. - if (stripos($value, ' as ') !== false) { - return $this->wrapAliasedValue($value, $prefixAlias); - } - - // If the given value is a JSON selector we will wrap it differently than a - // traditional value. We will need to split this path and wrap each part - // wrapped, etc. Otherwise, we will simply wrap the value as a string. - if ($this->isJsonSelector($value)) { - return $this->wrapJsonSelector($value); - } - - return $this->wrapSegments(explode('.', $value)); - } - - /** - * Wrap a value that has an alias. - * - * @param string $value - * @param bool $prefixAlias - * @return string - */ - protected function wrapAliasedValue($value, $prefixAlias = false) - { - $segments = preg_split('/\s+as\s+/i', $value); - - // If we are wrapping a table we need to prefix the alias with the table prefix - // as well in order to generate proper syntax. If this is a column of course - // no prefix is necessary. The condition will be true when from wrapTable. - if ($prefixAlias) { - $segments[1] = $this->tablePrefix.$segments[1]; - } - - return $this->wrap($segments[0]).' as '.$this->wrapValue($segments[1]); - } - - /** - * Wrap the given value segments. - * - * @param array $segments - * @return string - */ - protected function wrapSegments($segments) - { - return collect($segments)->map(function ($segment, $key) use ($segments) { - return $key == 0 && count($segments) > 1 - ? $this->wrapTable($segment) - : $this->wrapValue($segment); - })->implode('.'); - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - if ($value !== '*') { - return '"'.str_replace('"', '""', $value).'"'; - } - - return $value; - } - - /** - * Wrap the given JSON selector. - * - * @param string $value - * @return string - * - * @throws \RuntimeException - */ - protected function wrapJsonSelector($value) - { - throw new RuntimeException('This database engine does not support JSON operations.'); - } - - /** - * Determine if the given string is a JSON selector. - * - * @param string $value - * @return bool - */ - protected function isJsonSelector($value) - { - return str_contains($value, '->'); - } - - /** - * Convert an array of column names into a delimited string. - * - * @param array $columns - * @return string - */ - public function columnize(array $columns) - { - return implode(', ', array_map([$this, 'wrap'], $columns)); - } - - /** - * Create query parameter place-holders for an array. - * - * @param array $values - * @return string - */ - public function parameterize(array $values) - { - return implode(', ', array_map([$this, 'parameter'], $values)); - } - - /** - * Get the appropriate query parameter place-holder for a value. - * - * @param mixed $value - * @return string - */ - public function parameter($value) - { - return $this->isExpression($value) ? $this->getValue($value) : '?'; - } - - /** - * Quote the given string literal. - * - * @param string|array $value - * @return string - */ - public function quoteString($value) - { - if (is_array($value)) { - return implode(', ', array_map([$this, __FUNCTION__], $value)); - } - - return "'$value'"; - } - - /** - * Determine if the given value is a raw expression. - * - * @param mixed $value - * @return bool - */ - public function isExpression($value) - { - return $value instanceof Expression; - } - - /** - * Get the value of a raw expression. - * - * @param \Illuminate\Database\Query\Expression $expression - * @return mixed - */ - public function getValue($expression) - { - return $expression->getValue(); - } - - /** - * Get the format for database stored dates. - * - * @return string - */ - public function getDateFormat() - { - return 'Y-m-d H:i:s'; - } - - /** - * Get the grammar's table prefix. - * - * @return string - */ - public function getTablePrefix() - { - return $this->tablePrefix; - } - - /** - * Set the grammar's table prefix. - * - * @param string $prefix - * @return $this - */ - public function setTablePrefix($prefix) - { - $this->tablePrefix = $prefix; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/LICENSE.md b/framework-9.50.2/src/Illuminate/Database/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Database/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Database/LazyLoadingViolationException.php b/framework-9.50.2/src/Illuminate/Database/LazyLoadingViolationException.php deleted file mode 100644 index 1bcd40c..0000000 --- a/framework-9.50.2/src/Illuminate/Database/LazyLoadingViolationException.php +++ /dev/null @@ -1,39 +0,0 @@ -model = $class; - $this->relation = $relation; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/LostConnectionException.php b/framework-9.50.2/src/Illuminate/Database/LostConnectionException.php deleted file mode 100644 index c8e57e3..0000000 --- a/framework-9.50.2/src/Illuminate/Database/LostConnectionException.php +++ /dev/null @@ -1,10 +0,0 @@ - MigrateCommand::class, - 'MigrateFresh' => FreshCommand::class, - 'MigrateInstall' => InstallCommand::class, - 'MigrateRefresh' => RefreshCommand::class, - 'MigrateReset' => ResetCommand::class, - 'MigrateRollback' => RollbackCommand::class, - 'MigrateStatus' => StatusCommand::class, - 'MigrateMake' => MigrateMakeCommand::class, - ]; - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->registerRepository(); - - $this->registerMigrator(); - - $this->registerCreator(); - - $this->registerCommands($this->commands); - } - - /** - * Register the migration repository service. - * - * @return void - */ - protected function registerRepository() - { - $this->app->singleton('migration.repository', function ($app) { - $table = $app['config']['database.migrations']; - - return new DatabaseMigrationRepository($app['db'], $table); - }); - } - - /** - * Register the migrator service. - * - * @return void - */ - protected function registerMigrator() - { - // The migrator is responsible for actually running and rollback the migration - // files in the application. We'll pass in our database connection resolver - // so the migrator can resolve any of these connections when it needs to. - $this->app->singleton('migrator', function ($app) { - $repository = $app['migration.repository']; - - return new Migrator($repository, $app['db'], $app['files'], $app['events']); - }); - } - - /** - * Register the migration creator. - * - * @return void - */ - protected function registerCreator() - { - $this->app->singleton('migration.creator', function ($app) { - return new MigrationCreator($app['files'], $app->basePath('stubs')); - }); - } - - /** - * Register the given commands. - * - * @param array $commands - * @return void - */ - protected function registerCommands(array $commands) - { - foreach (array_keys($commands) as $command) { - $this->{"register{$command}Command"}(); - } - - $this->commands(array_values($commands)); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerMigrateCommand() - { - $this->app->singleton(MigrateCommand::class, function ($app) { - return new MigrateCommand($app['migrator'], $app[Dispatcher::class]); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerMigrateFreshCommand() - { - $this->app->singleton(FreshCommand::class); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerMigrateInstallCommand() - { - $this->app->singleton(InstallCommand::class, function ($app) { - return new InstallCommand($app['migration.repository']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerMigrateMakeCommand() - { - $this->app->singleton(MigrateMakeCommand::class, function ($app) { - // Once we have the migration creator registered, we will create the command - // and inject the creator. The creator is responsible for the actual file - // creation of the migrations, and may be extended by these developers. - $creator = $app['migration.creator']; - - $composer = $app['composer']; - - return new MigrateMakeCommand($creator, $composer); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerMigrateRefreshCommand() - { - $this->app->singleton(RefreshCommand::class); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerMigrateResetCommand() - { - $this->app->singleton(ResetCommand::class, function ($app) { - return new ResetCommand($app['migrator']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerMigrateRollbackCommand() - { - $this->app->singleton(RollbackCommand::class, function ($app) { - return new RollbackCommand($app['migrator']); - }); - } - - /** - * Register the command. - * - * @return void - */ - protected function registerMigrateStatusCommand() - { - $this->app->singleton(StatusCommand::class, function ($app) { - return new StatusCommand($app['migrator']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array_merge([ - 'migrator', 'migration.repository', 'migration.creator', - ], array_values($this->commands)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php b/framework-9.50.2/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php deleted file mode 100755 index ed4ebfb..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php +++ /dev/null @@ -1,224 +0,0 @@ -table = $table; - $this->resolver = $resolver; - } - - /** - * Get the completed migrations. - * - * @return array - */ - public function getRan() - { - return $this->table() - ->orderBy('batch', 'asc') - ->orderBy('migration', 'asc') - ->pluck('migration')->all(); - } - - /** - * Get the list of migrations. - * - * @param int $steps - * @return array - */ - public function getMigrations($steps) - { - $query = $this->table()->where('batch', '>=', '1'); - - return $query->orderBy('batch', 'desc') - ->orderBy('migration', 'desc') - ->take($steps)->get()->all(); - } - - /** - * Get the last migration batch. - * - * @return array - */ - public function getLast() - { - $query = $this->table()->where('batch', $this->getLastBatchNumber()); - - return $query->orderBy('migration', 'desc')->get()->all(); - } - - /** - * Get the completed migrations with their batch numbers. - * - * @return array - */ - public function getMigrationBatches() - { - return $this->table() - ->orderBy('batch', 'asc') - ->orderBy('migration', 'asc') - ->pluck('batch', 'migration')->all(); - } - - /** - * Log that a migration was run. - * - * @param string $file - * @param int $batch - * @return void - */ - public function log($file, $batch) - { - $record = ['migration' => $file, 'batch' => $batch]; - - $this->table()->insert($record); - } - - /** - * Remove a migration from the log. - * - * @param object $migration - * @return void - */ - public function delete($migration) - { - $this->table()->where('migration', $migration->migration)->delete(); - } - - /** - * Get the next migration batch number. - * - * @return int - */ - public function getNextBatchNumber() - { - return $this->getLastBatchNumber() + 1; - } - - /** - * Get the last migration batch number. - * - * @return int - */ - public function getLastBatchNumber() - { - return $this->table()->max('batch'); - } - - /** - * Create the migration repository data store. - * - * @return void - */ - public function createRepository() - { - $schema = $this->getConnection()->getSchemaBuilder(); - - $schema->create($this->table, function ($table) { - // The migrations table is responsible for keeping track of which of the - // migrations have actually run for the application. We'll create the - // table to hold the migration file's path as well as the batch ID. - $table->increments('id'); - $table->string('migration'); - $table->integer('batch'); - }); - } - - /** - * Determine if the migration repository exists. - * - * @return bool - */ - public function repositoryExists() - { - $schema = $this->getConnection()->getSchemaBuilder(); - - return $schema->hasTable($this->table); - } - - /** - * Delete the migration repository data store. - * - * @return void - */ - public function deleteRepository() - { - $schema = $this->getConnection()->getSchemaBuilder(); - - $schema->drop($this->table); - } - - /** - * Get a query builder for the migration table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function table() - { - return $this->getConnection()->table($this->table)->useWritePdo(); - } - - /** - * Get the connection resolver instance. - * - * @return \Illuminate\Database\ConnectionResolverInterface - */ - public function getConnectionResolver() - { - return $this->resolver; - } - - /** - * Resolve the database connection instance. - * - * @return \Illuminate\Database\Connection - */ - public function getConnection() - { - return $this->resolver->connection($this->connection); - } - - /** - * Set the information source to gather data. - * - * @param string $name - * @return void - */ - public function setSource($name) - { - $this->connection = $name; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Migrations/Migration.php b/framework-9.50.2/src/Illuminate/Database/Migrations/Migration.php deleted file mode 100755 index a58f784..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Migrations/Migration.php +++ /dev/null @@ -1,30 +0,0 @@ -connection; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Migrations/MigrationCreator.php b/framework-9.50.2/src/Illuminate/Database/Migrations/MigrationCreator.php deleted file mode 100755 index d8f1ce9..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Migrations/MigrationCreator.php +++ /dev/null @@ -1,231 +0,0 @@ -files = $files; - $this->customStubPath = $customStubPath; - } - - /** - * Create a new migration at the given path. - * - * @param string $name - * @param string $path - * @param string|null $table - * @param bool $create - * @return string - * - * @throws \Exception - */ - public function create($name, $path, $table = null, $create = false) - { - $this->ensureMigrationDoesntAlreadyExist($name, $path); - - // First we will get the stub file for the migration, which serves as a type - // of template for the migration. Once we have those we will populate the - // various place-holders, save the file, and run the post create event. - $stub = $this->getStub($table, $create); - - $path = $this->getPath($name, $path); - - $this->files->ensureDirectoryExists(dirname($path)); - - $this->files->put( - $path, $this->populateStub($stub, $table) - ); - - // Next, we will fire any hooks that are supposed to fire after a migration is - // created. Once that is done we'll be ready to return the full path to the - // migration file so it can be used however it's needed by the developer. - $this->firePostCreateHooks($table, $path); - - return $path; - } - - /** - * Ensure that a migration with the given name doesn't already exist. - * - * @param string $name - * @param string $migrationPath - * @return void - * - * @throws \InvalidArgumentException - */ - protected function ensureMigrationDoesntAlreadyExist($name, $migrationPath = null) - { - if (! empty($migrationPath)) { - $migrationFiles = $this->files->glob($migrationPath.'/*.php'); - - foreach ($migrationFiles as $migrationFile) { - $this->files->requireOnce($migrationFile); - } - } - - if (class_exists($className = $this->getClassName($name))) { - throw new InvalidArgumentException("A {$className} class already exists."); - } - } - - /** - * Get the migration stub file. - * - * @param string|null $table - * @param bool $create - * @return string - */ - protected function getStub($table, $create) - { - if (is_null($table)) { - $stub = $this->files->exists($customPath = $this->customStubPath.'/migration.stub') - ? $customPath - : $this->stubPath().'/migration.stub'; - } elseif ($create) { - $stub = $this->files->exists($customPath = $this->customStubPath.'/migration.create.stub') - ? $customPath - : $this->stubPath().'/migration.create.stub'; - } else { - $stub = $this->files->exists($customPath = $this->customStubPath.'/migration.update.stub') - ? $customPath - : $this->stubPath().'/migration.update.stub'; - } - - return $this->files->get($stub); - } - - /** - * Populate the place-holders in the migration stub. - * - * @param string $stub - * @param string|null $table - * @return string - */ - protected function populateStub($stub, $table) - { - // Here we will replace the table place-holders with the table specified by - // the developer, which is useful for quickly creating a tables creation - // or update migration from the console instead of typing it manually. - if (! is_null($table)) { - $stub = str_replace( - ['DummyTable', '{{ table }}', '{{table}}'], - $table, $stub - ); - } - - return $stub; - } - - /** - * Get the class name of a migration name. - * - * @param string $name - * @return string - */ - protected function getClassName($name) - { - return Str::studly($name); - } - - /** - * Get the full path to the migration. - * - * @param string $name - * @param string $path - * @return string - */ - protected function getPath($name, $path) - { - return $path.'/'.$this->getDatePrefix().'_'.$name.'.php'; - } - - /** - * Fire the registered post create hooks. - * - * @param string|null $table - * @param string $path - * @return void - */ - protected function firePostCreateHooks($table, $path) - { - foreach ($this->postCreate as $callback) { - $callback($table, $path); - } - } - - /** - * Register a post migration create hook. - * - * @param \Closure $callback - * @return void - */ - public function afterCreate(Closure $callback) - { - $this->postCreate[] = $callback; - } - - /** - * Get the date prefix for the migration. - * - * @return string - */ - protected function getDatePrefix() - { - return date('Y_m_d_His'); - } - - /** - * Get the path to the stubs. - * - * @return string - */ - public function stubPath() - { - return __DIR__.'/stubs'; - } - - /** - * Get the filesystem instance. - * - * @return \Illuminate\Filesystem\Filesystem - */ - public function getFilesystem() - { - return $this->files; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php b/framework-9.50.2/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php deleted file mode 100755 index 840a5e1..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php +++ /dev/null @@ -1,88 +0,0 @@ -files = $files; - $this->events = $dispatcher; - $this->resolver = $resolver; - $this->repository = $repository; - } - - /** - * Run the pending migrations at a given path. - * - * @param array|string $paths - * @param array $options - * @return array - */ - public function run($paths = [], array $options = []) - { - // Once we grab all of the migration files for the path, we will compare them - // against the migrations that have already been run for this package then - // run each of the outstanding migrations against a database connection. - $files = $this->getMigrationFiles($paths); - - $this->requireFiles($migrations = $this->pendingMigrations( - $files, $this->repository->getRan() - )); - - // Once we have all these migrations that are outstanding we are ready to run - // we will go ahead and run them "up". This will execute each migration as - // an operation against a database. Then we'll return this list of them. - $this->runPending($migrations, $options); - - return $migrations; - } - - /** - * Get the migration files that have not yet run. - * - * @param array $files - * @param array $ran - * @return array - */ - protected function pendingMigrations($files, $ran) - { - return Collection::make($files) - ->reject(function ($file) use ($ran) { - return in_array($this->getMigrationName($file), $ran); - })->values()->all(); - } - - /** - * Run an array of migrations. - * - * @param array $migrations - * @param array $options - * @return void - */ - public function runPending(array $migrations, array $options = []) - { - // First we will just make sure that there are any migrations to run. If there - // aren't, we will just make a note of it to the developer so they're aware - // that all of the migrations have been run against this database system. - if (count($migrations) === 0) { - $this->fireMigrationEvent(new NoPendingMigrations('up')); - - $this->write(Info::class, 'Nothing to migrate'); - - return; - } - - // Next, we will get the next batch number for the migrations so we can insert - // correct batch number in the database migrations repository when we store - // each migration's execution. We will also extract a few of the options. - $batch = $this->repository->getNextBatchNumber(); - - $pretend = $options['pretend'] ?? false; - - $step = $options['step'] ?? false; - - $this->fireMigrationEvent(new MigrationsStarted('up')); - - $this->write(Info::class, 'Running migrations.'); - - // Once we have the array of migrations, we will spin through them and run the - // migrations "up" so the changes are made to the databases. We'll then log - // that the migration was run so we don't repeat it next time we execute. - foreach ($migrations as $file) { - $this->runUp($file, $batch, $pretend); - - if ($step) { - $batch++; - } - } - - $this->fireMigrationEvent(new MigrationsEnded('up')); - - if ($this->output) { - $this->output->writeln(''); - } - } - - /** - * Run "up" a migration instance. - * - * @param string $file - * @param int $batch - * @param bool $pretend - * @return void - */ - protected function runUp($file, $batch, $pretend) - { - // First we will resolve a "real" instance of the migration class from this - // migration file name. Once we have the instances we can run the actual - // command such as "up" or "down", or we can just simulate the action. - $migration = $this->resolvePath($file); - - $name = $this->getMigrationName($file); - - if ($pretend) { - return $this->pretendToRun($migration, 'up'); - } - - $this->write(Task::class, $name, fn () => $this->runMigration($migration, 'up')); - - // Once we have run a migrations class, we will log that it was run in this - // repository so that we don't try to run it next time we do a migration - // in the application. A migration repository keeps the migrate order. - $this->repository->log($name, $batch); - } - - /** - * Rollback the last migration operation. - * - * @param array|string $paths - * @param array $options - * @return array - */ - public function rollback($paths = [], array $options = []) - { - // We want to pull in the last batch of migrations that ran on the previous - // migration operation. We'll then reverse those migrations and run each - // of them "down" to reverse the last migration "operation" which ran. - $migrations = $this->getMigrationsForRollback($options); - - if (count($migrations) === 0) { - $this->fireMigrationEvent(new NoPendingMigrations('down')); - - $this->write(Info::class, 'Nothing to rollback.'); - - return []; - } - - return tap($this->rollbackMigrations($migrations, $paths, $options), function () { - if ($this->output) { - $this->output->writeln(''); - } - }); - } - - /** - * Get the migrations for a rollback operation. - * - * @param array $options - * @return array - */ - protected function getMigrationsForRollback(array $options) - { - if (($steps = $options['step'] ?? 0) > 0) { - return $this->repository->getMigrations($steps); - } - - return $this->repository->getLast(); - } - - /** - * Rollback the given migrations. - * - * @param array $migrations - * @param array|string $paths - * @param array $options - * @return array - */ - protected function rollbackMigrations(array $migrations, $paths, array $options) - { - $rolledBack = []; - - $this->requireFiles($files = $this->getMigrationFiles($paths)); - - $this->fireMigrationEvent(new MigrationsStarted('down')); - - $this->write(Info::class, 'Rolling back migrations.'); - - // Next we will run through all of the migrations and call the "down" method - // which will reverse each migration in order. This getLast method on the - // repository already returns these migration's names in reverse order. - foreach ($migrations as $migration) { - $migration = (object) $migration; - - if (! $file = Arr::get($files, $migration->migration)) { - $this->write(TwoColumnDetail::class, $migration->migration, 'Migration not found'); - - continue; - } - - $rolledBack[] = $file; - - $this->runDown( - $file, $migration, - $options['pretend'] ?? false - ); - } - - $this->fireMigrationEvent(new MigrationsEnded('down')); - - return $rolledBack; - } - - /** - * Rolls all of the currently applied migrations back. - * - * @param array|string $paths - * @param bool $pretend - * @return array - */ - public function reset($paths = [], $pretend = false) - { - // Next, we will reverse the migration list so we can run them back in the - // correct order for resetting this database. This will allow us to get - // the database back into its "empty" state ready for the migrations. - $migrations = array_reverse($this->repository->getRan()); - - if (count($migrations) === 0) { - $this->write(Info::class, 'Nothing to rollback.'); - - return []; - } - - return tap($this->resetMigrations($migrations, $paths, $pretend), function () { - if ($this->output) { - $this->output->writeln(''); - } - }); - } - - /** - * Reset the given migrations. - * - * @param array $migrations - * @param array $paths - * @param bool $pretend - * @return array - */ - protected function resetMigrations(array $migrations, array $paths, $pretend = false) - { - // Since the getRan method that retrieves the migration name just gives us the - // migration name, we will format the names into objects with the name as a - // property on the objects so that we can pass it to the rollback method. - $migrations = collect($migrations)->map(function ($m) { - return (object) ['migration' => $m]; - })->all(); - - return $this->rollbackMigrations( - $migrations, $paths, compact('pretend') - ); - } - - /** - * Run "down" a migration instance. - * - * @param string $file - * @param object $migration - * @param bool $pretend - * @return void - */ - protected function runDown($file, $migration, $pretend) - { - // First we will get the file name of the migration so we can resolve out an - // instance of the migration. Once we get an instance we can either run a - // pretend execution of the migration or we can run the real migration. - $instance = $this->resolvePath($file); - - $name = $this->getMigrationName($file); - - if ($pretend) { - return $this->pretendToRun($instance, 'down'); - } - - $this->write(Task::class, $name, fn () => $this->runMigration($instance, 'down')); - - // Once we have successfully run the migration "down" we will remove it from - // the migration repository so it will be considered to have not been run - // by the application then will be able to fire by any later operation. - $this->repository->delete($migration); - } - - /** - * Run a migration inside a transaction if the database supports it. - * - * @param object $migration - * @param string $method - * @return void - */ - protected function runMigration($migration, $method) - { - $connection = $this->resolveConnection( - $migration->getConnection() - ); - - $callback = function () use ($connection, $migration, $method) { - if (method_exists($migration, $method)) { - $this->fireMigrationEvent(new MigrationStarted($migration, $method)); - - $this->runMethod($connection, $migration, $method); - - $this->fireMigrationEvent(new MigrationEnded($migration, $method)); - } - }; - - $this->getSchemaGrammar($connection)->supportsSchemaTransactions() - && $migration->withinTransaction - ? $connection->transaction($callback) - : $callback(); - } - - /** - * Pretend to run the migrations. - * - * @param object $migration - * @param string $method - * @return void - */ - protected function pretendToRun($migration, $method) - { - try { - $name = get_class($migration); - - $reflectionClass = new ReflectionClass($migration); - - if ($reflectionClass->isAnonymous()) { - $name = $this->getMigrationName($reflectionClass->getFileName()); - } - - $this->write(TwoColumnDetail::class, $name); - $this->write(BulletList::class, collect($this->getQueries($migration, $method))->map(function ($query) { - return $query['query']; - })); - } catch (SchemaException $e) { - $name = get_class($migration); - - $this->write(Error::class, sprintf( - '[%s] failed to dump queries. This may be due to changing database columns using Doctrine, which is not supported while pretending to run migrations.', - $name, - )); - } - } - - /** - * Get all of the queries that would be run for a migration. - * - * @param object $migration - * @param string $method - * @return array - */ - protected function getQueries($migration, $method) - { - // Now that we have the connections we can resolve it and pretend to run the - // queries against the database returning the array of raw SQL statements - // that would get fired against the database system for this migration. - $db = $this->resolveConnection( - $migration->getConnection() - ); - - return $db->pretend(function () use ($db, $migration, $method) { - if (method_exists($migration, $method)) { - $this->runMethod($db, $migration, $method); - } - }); - } - - /** - * Run a migration method on the given connection. - * - * @param \Illuminate\Database\Connection $connection - * @param object $migration - * @param string $method - * @return void - */ - protected function runMethod($connection, $migration, $method) - { - $previousConnection = $this->resolver->getDefaultConnection(); - - try { - $this->resolver->setDefaultConnection($connection->getName()); - - $migration->{$method}(); - } finally { - $this->resolver->setDefaultConnection($previousConnection); - } - } - - /** - * Resolve a migration instance from a file. - * - * @param string $file - * @return object - */ - public function resolve($file) - { - $class = $this->getMigrationClass($file); - - return new $class; - } - - /** - * Resolve a migration instance from a migration path. - * - * @param string $path - * @return object - */ - protected function resolvePath(string $path) - { - $class = $this->getMigrationClass($this->getMigrationName($path)); - - if (class_exists($class) && realpath($path) == (new ReflectionClass($class))->getFileName()) { - return new $class; - } - - $migration = $this->files->getRequire($path); - - return is_object($migration) ? $migration : new $class; - } - - /** - * Generate a migration class name based on the migration file name. - * - * @param string $migrationName - * @return string - */ - protected function getMigrationClass(string $migrationName): string - { - return Str::studly(implode('_', array_slice(explode('_', $migrationName), 4))); - } - - /** - * Get all of the migration files in a given path. - * - * @param string|array $paths - * @return array - */ - public function getMigrationFiles($paths) - { - return Collection::make($paths)->flatMap(function ($path) { - return str_ends_with($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php'); - })->filter()->values()->keyBy(function ($file) { - return $this->getMigrationName($file); - })->sortBy(function ($file, $key) { - return $key; - })->all(); - } - - /** - * Require in all the migration files in a given path. - * - * @param array $files - * @return void - */ - public function requireFiles(array $files) - { - foreach ($files as $file) { - $this->files->requireOnce($file); - } - } - - /** - * Get the name of the migration. - * - * @param string $path - * @return string - */ - public function getMigrationName($path) - { - return str_replace('.php', '', basename($path)); - } - - /** - * Register a custom migration path. - * - * @param string $path - * @return void - */ - public function path($path) - { - $this->paths = array_unique(array_merge($this->paths, [$path])); - } - - /** - * Get all of the custom migration paths. - * - * @return array - */ - public function paths() - { - return $this->paths; - } - - /** - * Get the default connection name. - * - * @return string - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Execute the given callback using the given connection as the default connection. - * - * @param string $name - * @param callable $callback - * @return mixed - */ - public function usingConnection($name, callable $callback) - { - $previousConnection = $this->resolver->getDefaultConnection(); - - $this->setConnection($name); - - return tap($callback(), function () use ($previousConnection) { - $this->setConnection($previousConnection); - }); - } - - /** - * Set the default connection name. - * - * @param string $name - * @return void - */ - public function setConnection($name) - { - if (! is_null($name)) { - $this->resolver->setDefaultConnection($name); - } - - $this->repository->setSource($name); - - $this->connection = $name; - } - - /** - * Resolve the database connection instance. - * - * @param string $connection - * @return \Illuminate\Database\Connection - */ - public function resolveConnection($connection) - { - return $this->resolver->connection($connection ?: $this->connection); - } - - /** - * Get the schema grammar out of a migration connection. - * - * @param \Illuminate\Database\Connection $connection - * @return \Illuminate\Database\Schema\Grammars\Grammar - */ - protected function getSchemaGrammar($connection) - { - if (is_null($grammar = $connection->getSchemaGrammar())) { - $connection->useDefaultSchemaGrammar(); - - $grammar = $connection->getSchemaGrammar(); - } - - return $grammar; - } - - /** - * Get the migration repository instance. - * - * @return \Illuminate\Database\Migrations\MigrationRepositoryInterface - */ - public function getRepository() - { - return $this->repository; - } - - /** - * Determine if the migration repository exists. - * - * @return bool - */ - public function repositoryExists() - { - return $this->repository->repositoryExists(); - } - - /** - * Determine if any migrations have been run. - * - * @return bool - */ - public function hasRunAnyMigrations() - { - return $this->repositoryExists() && count($this->repository->getRan()) > 0; - } - - /** - * Delete the migration repository data store. - * - * @return void - */ - public function deleteRepository() - { - return $this->repository->deleteRepository(); - } - - /** - * Get the file system instance. - * - * @return \Illuminate\Filesystem\Filesystem - */ - public function getFilesystem() - { - return $this->files; - } - - /** - * Set the output implementation that should be used by the console. - * - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return $this - */ - public function setOutput(OutputInterface $output) - { - $this->output = $output; - - return $this; - } - - /** - * Write to the console's output. - * - * @param string $component - * @param array|string ...$arguments - * @return void - */ - protected function write($component, ...$arguments) - { - if ($this->output && class_exists($component)) { - (new $component($this->output))->render(...$arguments); - } else { - foreach ($arguments as $argument) { - if (is_callable($argument)) { - $argument(); - } - } - } - } - - /** - * Fire the given event for the migration. - * - * @param \Illuminate\Contracts\Database\Events\MigrationEvent $event - * @return void - */ - public function fireMigrationEvent($event) - { - if ($this->events) { - $this->events->dispatch($event); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.create.stub b/framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.create.stub deleted file mode 100755 index 0e0ec22..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.create.stub +++ /dev/null @@ -1,31 +0,0 @@ -id(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('{{ table }}'); - } -}; diff --git a/framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.stub b/framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.stub deleted file mode 100755 index 41dd1c8..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Migrations/stubs/migration.stub +++ /dev/null @@ -1,28 +0,0 @@ -count = $count; - - parent::__construct("$count records were found.", $code, $previous); - } - - /** - * Get the number of records found. - * - * @return int - */ - public function getCount() - { - return $this->count; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/MySqlConnection.php b/framework-9.50.2/src/Illuminate/Database/MySqlConnection.php deleted file mode 100755 index 54e3d47..0000000 --- a/framework-9.50.2/src/Illuminate/Database/MySqlConnection.php +++ /dev/null @@ -1,91 +0,0 @@ -getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION), 'MariaDB'); - } - - /** - * Get the default query grammar instance. - * - * @return \Illuminate\Database\Query\Grammars\MySqlGrammar - */ - protected function getDefaultQueryGrammar() - { - return $this->withTablePrefix(new QueryGrammar); - } - - /** - * Get a schema builder instance for the connection. - * - * @return \Illuminate\Database\Schema\MySqlBuilder - */ - public function getSchemaBuilder() - { - if (is_null($this->schemaGrammar)) { - $this->useDefaultSchemaGrammar(); - } - - return new MySqlBuilder($this); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\MySqlGrammar - */ - protected function getDefaultSchemaGrammar() - { - return $this->withTablePrefix(new SchemaGrammar); - } - - /** - * Get the schema state for the connection. - * - * @param \Illuminate\Filesystem\Filesystem|null $files - * @param callable|null $processFactory - * @return \Illuminate\Database\Schema\MySqlSchemaState - */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) - { - return new MySqlSchemaState($this, $files, $processFactory); - } - - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\MySqlProcessor - */ - protected function getDefaultPostProcessor() - { - return new MySqlProcessor; - } - - /** - * Get the Doctrine DBAL driver. - * - * @return \Illuminate\Database\PDO\MySqlDriver - */ - protected function getDoctrineDriver() - { - return new MySqlDriver; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/PDO/Concerns/ConnectsToDatabase.php b/framework-9.50.2/src/Illuminate/Database/PDO/Concerns/ConnectsToDatabase.php deleted file mode 100644 index d2a8d60..0000000 --- a/framework-9.50.2/src/Illuminate/Database/PDO/Concerns/ConnectsToDatabase.php +++ /dev/null @@ -1,30 +0,0 @@ -connection = $connection; - } - - /** - * Execute an SQL statement. - * - * @param string $statement - * @return int - */ - public function exec(string $statement): int - { - try { - $result = $this->connection->exec($statement); - - \assert($result !== false); - - return $result; - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * Prepare a new SQL statement. - * - * @param string $sql - * @return \Doctrine\DBAL\Driver\Statement - */ - public function prepare(string $sql): StatementInterface - { - try { - return $this->createStatement( - $this->connection->prepare($sql) - ); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * Execute a new query against the connection. - * - * @param string $sql - * @return \Doctrine\DBAL\Driver\Result - */ - public function query(string $sql): ResultInterface - { - try { - $stmt = $this->connection->query($sql); - - \assert($stmt instanceof PDOStatement); - - return new Result($stmt); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * Get the last insert ID. - * - * @param string|null $name - * @return mixed - */ - public function lastInsertId($name = null) - { - try { - if ($name === null) { - return $this->connection->lastInsertId(); - } - - return $this->connection->lastInsertId($name); - } catch (PDOException $exception) { - throw Exception::new($exception); - } - } - - /** - * Create a new statement instance. - * - * @param \PDOStatement $stmt - * @return \Doctrine\DBAL\Driver\PDO\Statement - */ - protected function createStatement(PDOStatement $stmt): Statement - { - return new Statement($stmt); - } - - /** - * Begin a new database transaction. - * - * @return void - */ - public function beginTransaction() - { - return $this->connection->beginTransaction(); - } - - /** - * Commit a database transaction. - * - * @return void - */ - public function commit() - { - return $this->connection->commit(); - } - - /** - * Rollback a database transaction. - * - * @return void - */ - public function rollBack() - { - return $this->connection->rollBack(); - } - - /** - * Wrap quotes around the given input. - * - * @param string $input - * @param string $type - * @return string - */ - public function quote($input, $type = ParameterType::STRING) - { - return $this->connection->quote($input, $type); - } - - /** - * Get the server version for the connection. - * - * @return string - */ - public function getServerVersion() - { - return $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION); - } - - /** - * Get the wrapped PDO connection. - * - * @return \PDO - */ - public function getWrappedConnection(): PDO - { - return $this->connection; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/PDO/MySqlDriver.php b/framework-9.50.2/src/Illuminate/Database/PDO/MySqlDriver.php deleted file mode 100644 index 54ac375..0000000 --- a/framework-9.50.2/src/Illuminate/Database/PDO/MySqlDriver.php +++ /dev/null @@ -1,19 +0,0 @@ -connection = $connection; - } - - /** - * Prepare a new SQL statement. - * - * @param string $sql - * @return \Doctrine\DBAL\Driver\Statement - */ - public function prepare(string $sql): StatementInterface - { - return new Statement( - $this->connection->prepare($sql) - ); - } - - /** - * Execute a new query against the connection. - * - * @param string $sql - * @return \Doctrine\DBAL\Driver\Result - */ - public function query(string $sql): Result - { - return $this->connection->query($sql); - } - - /** - * Execute an SQL statement. - * - * @param string $statement - * @return int - */ - public function exec(string $statement): int - { - return $this->connection->exec($statement); - } - - /** - * Get the last insert ID. - * - * @param string|null $name - * @return mixed - */ - public function lastInsertId($name = null) - { - if ($name === null) { - return $this->connection->lastInsertId($name); - } - - return $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?') - ->execute([$name]) - ->fetchOne(); - } - - /** - * Begin a new database transaction. - * - * @return void - */ - public function beginTransaction() - { - return $this->connection->beginTransaction(); - } - - /** - * Commit a database transaction. - * - * @return void - */ - public function commit() - { - return $this->connection->commit(); - } - - /** - * Rollback a database transaction. - * - * @return void - */ - public function rollBack() - { - return $this->connection->rollBack(); - } - - /** - * Wrap quotes around the given input. - * - * @param string $value - * @param int $type - * @return string - */ - public function quote($value, $type = ParameterType::STRING) - { - $val = $this->connection->quote($value, $type); - - // Fix for a driver version terminating all values with null byte... - if (\is_string($val) && str_contains($val, "\0")) { - $val = \substr($val, 0, -1); - } - - return $val; - } - - /** - * Get the server version for the connection. - * - * @return string - */ - public function getServerVersion() - { - return $this->connection->getServerVersion(); - } - - /** - * Get the wrapped PDO connection. - * - * @return \PDO - */ - public function getWrappedConnection(): PDO - { - return $this->connection->getWrappedConnection(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/PDO/SqlServerDriver.php b/framework-9.50.2/src/Illuminate/Database/PDO/SqlServerDriver.php deleted file mode 100644 index 1b0d957..0000000 --- a/framework-9.50.2/src/Illuminate/Database/PDO/SqlServerDriver.php +++ /dev/null @@ -1,32 +0,0 @@ -withTablePrefix(new QueryGrammar); - } - - /** - * Get a schema builder instance for the connection. - * - * @return \Illuminate\Database\Schema\PostgresBuilder - */ - public function getSchemaBuilder() - { - if (is_null($this->schemaGrammar)) { - $this->useDefaultSchemaGrammar(); - } - - return new PostgresBuilder($this); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\PostgresGrammar - */ - protected function getDefaultSchemaGrammar() - { - return $this->withTablePrefix(new SchemaGrammar); - } - - /** - * Get the schema state for the connection. - * - * @param \Illuminate\Filesystem\Filesystem|null $files - * @param callable|null $processFactory - * @return \Illuminate\Database\Schema\PostgresSchemaState - */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) - { - return new PostgresSchemaState($this, $files, $processFactory); - } - - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\PostgresProcessor - */ - protected function getDefaultPostProcessor() - { - return new PostgresProcessor; - } - - /** - * Get the Doctrine DBAL driver. - * - * @return \Illuminate\Database\PDO\PostgresDriver - */ - protected function getDoctrineDriver() - { - return new PostgresDriver; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Builder.php b/framework-9.50.2/src/Illuminate/Database/Query/Builder.php deleted file mode 100755 index ea3926e..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Builder.php +++ /dev/null @@ -1,3824 +0,0 @@ - [], - 'from' => [], - 'join' => [], - 'where' => [], - 'groupBy' => [], - 'having' => [], - 'order' => [], - 'union' => [], - 'unionOrder' => [], - ]; - - /** - * An aggregate function and column to be run. - * - * @var array - */ - public $aggregate; - - /** - * The columns that should be returned. - * - * @var array - */ - public $columns; - - /** - * Indicates if the query returns distinct results. - * - * Occasionally contains the columns that should be distinct. - * - * @var bool|array - */ - public $distinct = false; - - /** - * The table which the query is targeting. - * - * @var string - */ - public $from; - - /** - * The table joins for the query. - * - * @var array - */ - public $joins; - - /** - * The where constraints for the query. - * - * @var array - */ - public $wheres = []; - - /** - * The groupings for the query. - * - * @var array - */ - public $groups; - - /** - * The having constraints for the query. - * - * @var array - */ - public $havings; - - /** - * The orderings for the query. - * - * @var array - */ - public $orders; - - /** - * The maximum number of records to return. - * - * @var int - */ - public $limit; - - /** - * The number of records to skip. - * - * @var int - */ - public $offset; - - /** - * The query union statements. - * - * @var array - */ - public $unions; - - /** - * The maximum number of union records to return. - * - * @var int - */ - public $unionLimit; - - /** - * The number of union records to skip. - * - * @var int - */ - public $unionOffset; - - /** - * The orderings for the union query. - * - * @var array - */ - public $unionOrders; - - /** - * Indicates whether row locking is being used. - * - * @var string|bool - */ - public $lock; - - /** - * The callbacks that should be invoked before the query is executed. - * - * @var array - */ - public $beforeQueryCallbacks = []; - - /** - * All of the available clause operators. - * - * @var string[] - */ - public $operators = [ - '=', '<', '>', '<=', '>=', '<>', '!=', '<=>', - 'like', 'like binary', 'not like', 'ilike', - '&', '|', '^', '<<', '>>', '&~', 'is', 'is not', - 'rlike', 'not rlike', 'regexp', 'not regexp', - '~', '~*', '!~', '!~*', 'similar to', - 'not similar to', 'not ilike', '~~*', '!~~*', - ]; - - /** - * All of the available bitwise operators. - * - * @var string[] - */ - public $bitwiseOperators = [ - '&', '|', '^', '<<', '>>', '&~', - ]; - - /** - * Whether to use write pdo for the select. - * - * @var bool - */ - public $useWritePdo = false; - - /** - * Create a new query builder instance. - * - * @param \Illuminate\Database\ConnectionInterface $connection - * @param \Illuminate\Database\Query\Grammars\Grammar|null $grammar - * @param \Illuminate\Database\Query\Processors\Processor|null $processor - * @return void - */ - public function __construct(ConnectionInterface $connection, - Grammar $grammar = null, - Processor $processor = null) - { - $this->connection = $connection; - $this->grammar = $grammar ?: $connection->getQueryGrammar(); - $this->processor = $processor ?: $connection->getPostProcessor(); - } - - /** - * Set the columns to be selected. - * - * @param array|mixed $columns - * @return $this - */ - public function select($columns = ['*']) - { - $this->columns = []; - $this->bindings['select'] = []; - - $columns = is_array($columns) ? $columns : func_get_args(); - - foreach ($columns as $as => $column) { - if (is_string($as) && $this->isQueryable($column)) { - $this->selectSub($column, $as); - } else { - $this->columns[] = $column; - } - } - - return $this; - } - - /** - * Add a subselect expression to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query - * @param string $as - * @return $this - * - * @throws \InvalidArgumentException - */ - public function selectSub($query, $as) - { - [$query, $bindings] = $this->createSub($query); - - return $this->selectRaw( - '('.$query.') as '.$this->grammar->wrap($as), $bindings - ); - } - - /** - * Add a new "raw" select expression to the query. - * - * @param string $expression - * @param array $bindings - * @return $this - */ - public function selectRaw($expression, array $bindings = []) - { - $this->addSelect(new Expression($expression)); - - if ($bindings) { - $this->addBinding($bindings, 'select'); - } - - return $this; - } - - /** - * Makes "from" fetch from a subquery. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query - * @param string $as - * @return $this - * - * @throws \InvalidArgumentException - */ - public function fromSub($query, $as) - { - [$query, $bindings] = $this->createSub($query); - - return $this->fromRaw('('.$query.') as '.$this->grammar->wrapTable($as), $bindings); - } - - /** - * Add a raw from clause to the query. - * - * @param string $expression - * @param mixed $bindings - * @return $this - */ - public function fromRaw($expression, $bindings = []) - { - $this->from = new Expression($expression); - - $this->addBinding($bindings, 'from'); - - return $this; - } - - /** - * Creates a subquery and parse it. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query - * @return array - */ - protected function createSub($query) - { - // If the given query is a Closure, we will execute it while passing in a new - // query instance to the Closure. This will give the developer a chance to - // format and work with the query before we cast it to a raw SQL string. - if ($query instanceof Closure) { - $callback = $query; - - $callback($query = $this->forSubQuery()); - } - - return $this->parseSub($query); - } - - /** - * Parse the subquery into SQL and bindings. - * - * @param mixed $query - * @return array - * - * @throws \InvalidArgumentException - */ - protected function parseSub($query) - { - if ($query instanceof self || $query instanceof EloquentBuilder || $query instanceof Relation) { - $query = $this->prependDatabaseNameIfCrossDatabaseQuery($query); - - return [$query->toSql(), $query->getBindings()]; - } elseif (is_string($query)) { - return [$query, []]; - } else { - throw new InvalidArgumentException( - 'A subquery must be a query builder instance, a Closure, or a string.' - ); - } - } - - /** - * Prepend the database name if the given query is on another database. - * - * @param mixed $query - * @return mixed - */ - protected function prependDatabaseNameIfCrossDatabaseQuery($query) - { - if ($query->getConnection()->getDatabaseName() !== - $this->getConnection()->getDatabaseName()) { - $databaseName = $query->getConnection()->getDatabaseName(); - - if (! str_starts_with($query->from, $databaseName) && ! str_contains($query->from, '.')) { - $query->from($databaseName.'.'.$query->from); - } - } - - return $query; - } - - /** - * Add a new select column to the query. - * - * @param array|mixed $column - * @return $this - */ - public function addSelect($column) - { - $columns = is_array($column) ? $column : func_get_args(); - - foreach ($columns as $as => $column) { - if (is_string($as) && $this->isQueryable($column)) { - if (is_null($this->columns)) { - $this->select($this->from.'.*'); - } - - $this->selectSub($column, $as); - } else { - $this->columns[] = $column; - } - } - - return $this; - } - - /** - * Force the query to only return distinct results. - * - * @return $this - */ - public function distinct() - { - $columns = func_get_args(); - - if (count($columns) > 0) { - $this->distinct = is_array($columns[0]) || is_bool($columns[0]) ? $columns[0] : $columns; - } else { - $this->distinct = true; - } - - return $this; - } - - /** - * Set the table which the query is targeting. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $table - * @param string|null $as - * @return $this - */ - public function from($table, $as = null) - { - if ($this->isQueryable($table)) { - return $this->fromSub($table, $as); - } - - $this->from = $as ? "{$table} as {$as}" : $table; - - return $this; - } - - /** - * Add a join clause to the query. - * - * @param string $table - * @param \Closure|string $first - * @param string|null $operator - * @param string|null $second - * @param string $type - * @param bool $where - * @return $this - */ - public function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false) - { - $join = $this->newJoinClause($this, $type, $table); - - // If the first "column" of the join is really a Closure instance the developer - // is trying to build a join with a complex "on" clause containing more than - // one condition, so we'll add the join and call a Closure with the query. - if ($first instanceof Closure) { - $first($join); - - $this->joins[] = $join; - - $this->addBinding($join->getBindings(), 'join'); - } - - // If the column is simply a string, we can assume the join simply has a basic - // "on" clause with a single condition. So we will just build the join with - // this simple join clauses attached to it. There is not a join callback. - else { - $method = $where ? 'where' : 'on'; - - $this->joins[] = $join->$method($first, $operator, $second); - - $this->addBinding($join->getBindings(), 'join'); - } - - return $this; - } - - /** - * Add a "join where" clause to the query. - * - * @param string $table - * @param \Closure|string $first - * @param string $operator - * @param string $second - * @param string $type - * @return $this - */ - public function joinWhere($table, $first, $operator, $second, $type = 'inner') - { - return $this->join($table, $first, $operator, $second, $type, true); - } - - /** - * Add a subquery join clause to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query - * @param string $as - * @param \Closure|string $first - * @param string|null $operator - * @param string|null $second - * @param string $type - * @param bool $where - * @return $this - * - * @throws \InvalidArgumentException - */ - public function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false) - { - [$query, $bindings] = $this->createSub($query); - - $expression = '('.$query.') as '.$this->grammar->wrapTable($as); - - $this->addBinding($bindings, 'join'); - - return $this->join(new Expression($expression), $first, $operator, $second, $type, $where); - } - - /** - * Add a left join to the query. - * - * @param string $table - * @param \Closure|string $first - * @param string|null $operator - * @param string|null $second - * @return $this - */ - public function leftJoin($table, $first, $operator = null, $second = null) - { - return $this->join($table, $first, $operator, $second, 'left'); - } - - /** - * Add a "join where" clause to the query. - * - * @param string $table - * @param \Closure|string $first - * @param string $operator - * @param string $second - * @return $this - */ - public function leftJoinWhere($table, $first, $operator, $second) - { - return $this->joinWhere($table, $first, $operator, $second, 'left'); - } - - /** - * Add a subquery left join to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query - * @param string $as - * @param \Closure|string $first - * @param string|null $operator - * @param string|null $second - * @return $this - */ - public function leftJoinSub($query, $as, $first, $operator = null, $second = null) - { - return $this->joinSub($query, $as, $first, $operator, $second, 'left'); - } - - /** - * Add a right join to the query. - * - * @param string $table - * @param \Closure|string $first - * @param string|null $operator - * @param string|null $second - * @return $this - */ - public function rightJoin($table, $first, $operator = null, $second = null) - { - return $this->join($table, $first, $operator, $second, 'right'); - } - - /** - * Add a "right join where" clause to the query. - * - * @param string $table - * @param \Closure|string $first - * @param string $operator - * @param string $second - * @return $this - */ - public function rightJoinWhere($table, $first, $operator, $second) - { - return $this->joinWhere($table, $first, $operator, $second, 'right'); - } - - /** - * Add a subquery right join to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query - * @param string $as - * @param \Closure|string $first - * @param string|null $operator - * @param string|null $second - * @return $this - */ - public function rightJoinSub($query, $as, $first, $operator = null, $second = null) - { - return $this->joinSub($query, $as, $first, $operator, $second, 'right'); - } - - /** - * Add a "cross join" clause to the query. - * - * @param string $table - * @param \Closure|string|null $first - * @param string|null $operator - * @param string|null $second - * @return $this - */ - public function crossJoin($table, $first = null, $operator = null, $second = null) - { - if ($first) { - return $this->join($table, $first, $operator, $second, 'cross'); - } - - $this->joins[] = $this->newJoinClause($this, 'cross', $table); - - return $this; - } - - /** - * Add a subquery cross join to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query - * @param string $as - * @return $this - */ - public function crossJoinSub($query, $as) - { - [$query, $bindings] = $this->createSub($query); - - $expression = '('.$query.') as '.$this->grammar->wrapTable($as); - - $this->addBinding($bindings, 'join'); - - $this->joins[] = $this->newJoinClause($this, 'cross', new Expression($expression)); - - return $this; - } - - /** - * Get a new join clause. - * - * @param \Illuminate\Database\Query\Builder $parentQuery - * @param string $type - * @param string $table - * @return \Illuminate\Database\Query\JoinClause - */ - protected function newJoinClause(self $parentQuery, $type, $table) - { - return new JoinClause($parentQuery, $type, $table); - } - - /** - * Merge an array of where clauses and bindings. - * - * @param array $wheres - * @param array $bindings - * @return $this - */ - public function mergeWheres($wheres, $bindings) - { - $this->wheres = array_merge($this->wheres, (array) $wheres); - - $this->bindings['where'] = array_values( - array_merge($this->bindings['where'], (array) $bindings) - ); - - return $this; - } - - /** - * Add a basic where clause to the query. - * - * @param \Closure|string|array $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return $this - */ - public function where($column, $operator = null, $value = null, $boolean = 'and') - { - // If the column is an array, we will assume it is an array of key-value pairs - // and can add them each as a where clause. We will maintain the boolean we - // received when the method was called and pass it into the nested where. - if (is_array($column)) { - return $this->addArrayOfWheres($column, $boolean); - } - - // Here we will make some assumptions about the operator. If only 2 values are - // passed to the method, we will assume that the operator is an equals sign - // and keep going. Otherwise, we'll require the operator to be passed in. - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - // If the column is actually a Closure instance, we will assume the developer - // wants to begin a nested where statement which is wrapped in parentheses. - // We will add that Closure to the query and return back out immediately. - if ($column instanceof Closure && is_null($operator)) { - return $this->whereNested($column, $boolean); - } - - // If the column is a Closure instance and there is an operator value, we will - // assume the developer wants to run a subquery and then compare the result - // of that subquery with the given value that was provided to the method. - if ($this->isQueryable($column) && ! is_null($operator)) { - [$sub, $bindings] = $this->createSub($column); - - return $this->addBinding($bindings, 'where') - ->where(new Expression('('.$sub.')'), $operator, $value, $boolean); - } - - // If the given operator is not found in the list of valid operators we will - // assume that the developer is just short-cutting the '=' operators and - // we will set the operators to '=' and set the values appropriately. - if ($this->invalidOperator($operator)) { - [$value, $operator] = [$operator, '=']; - } - - // If the value is a Closure, it means the developer is performing an entire - // sub-select within the query and we will need to compile the sub-select - // within the where clause to get the appropriate query record results. - if ($value instanceof Closure) { - return $this->whereSub($column, $operator, $value, $boolean); - } - - // If the value is "null", we will just assume the developer wants to add a - // where null clause to the query. So, we will allow a short-cut here to - // that method for convenience so the developer doesn't have to check. - if (is_null($value)) { - return $this->whereNull($column, $boolean, $operator !== '='); - } - - $type = 'Basic'; - - // If the column is making a JSON reference we'll check to see if the value - // is a boolean. If it is, we'll add the raw boolean string as an actual - // value to the query to ensure this is properly handled by the query. - if (str_contains($column, '->') && is_bool($value)) { - $value = new Expression($value ? 'true' : 'false'); - - if (is_string($column)) { - $type = 'JsonBoolean'; - } - } - - if ($this->isBitwiseOperator($operator)) { - $type = 'Bitwise'; - } - - // Now that we are working with just a simple query we can put the elements - // in our array and add the query binding to our array of bindings that - // will be bound to each SQL statements when it is finally executed. - $this->wheres[] = compact( - 'type', 'column', 'operator', 'value', 'boolean' - ); - - if (! $value instanceof Expression) { - $this->addBinding($this->flattenValue($value), 'where'); - } - - return $this; - } - - /** - * Add an array of where clauses to the query. - * - * @param array $column - * @param string $boolean - * @param string $method - * @return $this - */ - protected function addArrayOfWheres($column, $boolean, $method = 'where') - { - return $this->whereNested(function ($query) use ($column, $method, $boolean) { - foreach ($column as $key => $value) { - if (is_numeric($key) && is_array($value)) { - $query->{$method}(...array_values($value)); - } else { - $query->{$method}($key, '=', $value, $boolean); - } - } - }, $boolean); - } - - /** - * Prepare the value and operator for a where clause. - * - * @param string $value - * @param string $operator - * @param bool $useDefault - * @return array - * - * @throws \InvalidArgumentException - */ - public function prepareValueAndOperator($value, $operator, $useDefault = false) - { - if ($useDefault) { - return [$operator, '=']; - } elseif ($this->invalidOperatorAndValue($operator, $value)) { - throw new InvalidArgumentException('Illegal operator and value combination.'); - } - - return [$value, $operator]; - } - - /** - * Determine if the given operator and value combination is legal. - * - * Prevents using Null values with invalid operators. - * - * @param string $operator - * @param mixed $value - * @return bool - */ - protected function invalidOperatorAndValue($operator, $value) - { - return is_null($value) && in_array($operator, $this->operators) && - ! in_array($operator, ['=', '<>', '!=']); - } - - /** - * Determine if the given operator is supported. - * - * @param string $operator - * @return bool - */ - protected function invalidOperator($operator) - { - return ! is_string($operator) || (! in_array(strtolower($operator), $this->operators, true) && - ! in_array(strtolower($operator), $this->grammar->getOperators(), true)); - } - - /** - * Determine if the operator is a bitwise operator. - * - * @param string $operator - * @return bool - */ - protected function isBitwiseOperator($operator) - { - return in_array(strtolower($operator), $this->bitwiseOperators, true) || - in_array(strtolower($operator), $this->grammar->getBitwiseOperators(), true); - } - - /** - * Add an "or where" clause to the query. - * - * @param \Closure|string|array $column - * @param mixed $operator - * @param mixed $value - * @return $this - */ - public function orWhere($column, $operator = null, $value = null) - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->where($column, $operator, $value, 'or'); - } - - /** - * Add a basic "where not" clause to the query. - * - * @param \Closure|string|array $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return $this - */ - public function whereNot($column, $operator = null, $value = null, $boolean = 'and') - { - if (is_array($column)) { - return $this->whereNested(function ($query) use ($column, $operator, $value, $boolean) { - $query->where($column, $operator, $value, $boolean); - }, $boolean.' not'); - } - - return $this->where($column, $operator, $value, $boolean.' not'); - } - - /** - * Add an "or where not" clause to the query. - * - * @param \Closure|string|array $column - * @param mixed $operator - * @param mixed $value - * @return $this - */ - public function orWhereNot($column, $operator = null, $value = null) - { - return $this->whereNot($column, $operator, $value, 'or'); - } - - /** - * Add a "where" clause comparing two columns to the query. - * - * @param string|array $first - * @param string|null $operator - * @param string|null $second - * @param string|null $boolean - * @return $this - */ - public function whereColumn($first, $operator = null, $second = null, $boolean = 'and') - { - // If the column is an array, we will assume it is an array of key-value pairs - // and can add them each as a where clause. We will maintain the boolean we - // received when the method was called and pass it into the nested where. - if (is_array($first)) { - return $this->addArrayOfWheres($first, $boolean, 'whereColumn'); - } - - // If the given operator is not found in the list of valid operators we will - // assume that the developer is just short-cutting the '=' operators and - // we will set the operators to '=' and set the values appropriately. - if ($this->invalidOperator($operator)) { - [$second, $operator] = [$operator, '=']; - } - - // Finally, we will add this where clause into this array of clauses that we - // are building for the query. All of them will be compiled via a grammar - // once the query is about to be executed and run against the database. - $type = 'Column'; - - $this->wheres[] = compact( - 'type', 'first', 'operator', 'second', 'boolean' - ); - - return $this; - } - - /** - * Add an "or where" clause comparing two columns to the query. - * - * @param string|array $first - * @param string|null $operator - * @param string|null $second - * @return $this - */ - public function orWhereColumn($first, $operator = null, $second = null) - { - return $this->whereColumn($first, $operator, $second, 'or'); - } - - /** - * Add a raw where clause to the query. - * - * @param string $sql - * @param mixed $bindings - * @param string $boolean - * @return $this - */ - public function whereRaw($sql, $bindings = [], $boolean = 'and') - { - $this->wheres[] = ['type' => 'raw', 'sql' => $sql, 'boolean' => $boolean]; - - $this->addBinding((array) $bindings, 'where'); - - return $this; - } - - /** - * Add a raw or where clause to the query. - * - * @param string $sql - * @param mixed $bindings - * @return $this - */ - public function orWhereRaw($sql, $bindings = []) - { - return $this->whereRaw($sql, $bindings, 'or'); - } - - /** - * Add a "where in" clause to the query. - * - * @param string $column - * @param mixed $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereIn($column, $values, $boolean = 'and', $not = false) - { - $type = $not ? 'NotIn' : 'In'; - - // If the value is a query builder instance we will assume the developer wants to - // look for any values that exist within this given query. So, we will add the - // query accordingly so that this query is properly executed when it is run. - if ($this->isQueryable($values)) { - [$query, $bindings] = $this->createSub($values); - - $values = [new Expression($query)]; - - $this->addBinding($bindings, 'where'); - } - - // Next, if the value is Arrayable we need to cast it to its raw array form so we - // have the underlying array value instead of an Arrayable object which is not - // able to be added as a binding, etc. We will then add to the wheres array. - if ($values instanceof Arrayable) { - $values = $values->toArray(); - } - - $this->wheres[] = compact('type', 'column', 'values', 'boolean'); - - if (count($values) !== count(Arr::flatten($values, 1))) { - throw new InvalidArgumentException('Nested arrays may not be passed to whereIn method.'); - } - - // Finally, we'll add a binding for each value unless that value is an expression - // in which case we will just skip over it since it will be the query as a raw - // string and not as a parameterized place-holder to be replaced by the PDO. - $this->addBinding($this->cleanBindings($values), 'where'); - - return $this; - } - - /** - * Add an "or where in" clause to the query. - * - * @param string $column - * @param mixed $values - * @return $this - */ - public function orWhereIn($column, $values) - { - return $this->whereIn($column, $values, 'or'); - } - - /** - * Add a "where not in" clause to the query. - * - * @param string $column - * @param mixed $values - * @param string $boolean - * @return $this - */ - public function whereNotIn($column, $values, $boolean = 'and') - { - return $this->whereIn($column, $values, $boolean, true); - } - - /** - * Add an "or where not in" clause to the query. - * - * @param string $column - * @param mixed $values - * @return $this - */ - public function orWhereNotIn($column, $values) - { - return $this->whereNotIn($column, $values, 'or'); - } - - /** - * Add a "where in raw" clause for integer values to the query. - * - * @param string $column - * @param \Illuminate\Contracts\Support\Arrayable|array $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereIntegerInRaw($column, $values, $boolean = 'and', $not = false) - { - $type = $not ? 'NotInRaw' : 'InRaw'; - - if ($values instanceof Arrayable) { - $values = $values->toArray(); - } - - $values = Arr::flatten($values); - - foreach ($values as &$value) { - $value = (int) $value; - } - - $this->wheres[] = compact('type', 'column', 'values', 'boolean'); - - return $this; - } - - /** - * Add an "or where in raw" clause for integer values to the query. - * - * @param string $column - * @param \Illuminate\Contracts\Support\Arrayable|array $values - * @return $this - */ - public function orWhereIntegerInRaw($column, $values) - { - return $this->whereIntegerInRaw($column, $values, 'or'); - } - - /** - * Add a "where not in raw" clause for integer values to the query. - * - * @param string $column - * @param \Illuminate\Contracts\Support\Arrayable|array $values - * @param string $boolean - * @return $this - */ - public function whereIntegerNotInRaw($column, $values, $boolean = 'and') - { - return $this->whereIntegerInRaw($column, $values, $boolean, true); - } - - /** - * Add an "or where not in raw" clause for integer values to the query. - * - * @param string $column - * @param \Illuminate\Contracts\Support\Arrayable|array $values - * @return $this - */ - public function orWhereIntegerNotInRaw($column, $values) - { - return $this->whereIntegerNotInRaw($column, $values, 'or'); - } - - /** - * Add a "where null" clause to the query. - * - * @param string|array $columns - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereNull($columns, $boolean = 'and', $not = false) - { - $type = $not ? 'NotNull' : 'Null'; - - foreach (Arr::wrap($columns) as $column) { - $this->wheres[] = compact('type', 'column', 'boolean'); - } - - return $this; - } - - /** - * Add an "or where null" clause to the query. - * - * @param string|array $column - * @return $this - */ - public function orWhereNull($column) - { - return $this->whereNull($column, 'or'); - } - - /** - * Add a "where not null" clause to the query. - * - * @param string|array $columns - * @param string $boolean - * @return $this - */ - public function whereNotNull($columns, $boolean = 'and') - { - return $this->whereNull($columns, $boolean, true); - } - - /** - * Add a where between statement to the query. - * - * @param string|\Illuminate\Database\Query\Expression $column - * @param iterable $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereBetween($column, iterable $values, $boolean = 'and', $not = false) - { - $type = 'between'; - - if ($values instanceof CarbonPeriod) { - $values = $values->toArray(); - } - - $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not'); - - $this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where'); - - return $this; - } - - /** - * Add a where between statement using columns to the query. - * - * @param string $column - * @param array $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereBetweenColumns($column, array $values, $boolean = 'and', $not = false) - { - $type = 'betweenColumns'; - - $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not'); - - return $this; - } - - /** - * Add an or where between statement to the query. - * - * @param string $column - * @param iterable $values - * @return $this - */ - public function orWhereBetween($column, iterable $values) - { - return $this->whereBetween($column, $values, 'or'); - } - - /** - * Add an or where between statement using columns to the query. - * - * @param string $column - * @param array $values - * @return $this - */ - public function orWhereBetweenColumns($column, array $values) - { - return $this->whereBetweenColumns($column, $values, 'or'); - } - - /** - * Add a where not between statement to the query. - * - * @param string $column - * @param iterable $values - * @param string $boolean - * @return $this - */ - public function whereNotBetween($column, iterable $values, $boolean = 'and') - { - return $this->whereBetween($column, $values, $boolean, true); - } - - /** - * Add a where not between statement using columns to the query. - * - * @param string $column - * @param array $values - * @param string $boolean - * @return $this - */ - public function whereNotBetweenColumns($column, array $values, $boolean = 'and') - { - return $this->whereBetweenColumns($column, $values, $boolean, true); - } - - /** - * Add an or where not between statement to the query. - * - * @param string $column - * @param iterable $values - * @return $this - */ - public function orWhereNotBetween($column, iterable $values) - { - return $this->whereNotBetween($column, $values, 'or'); - } - - /** - * Add an or where not between statement using columns to the query. - * - * @param string $column - * @param array $values - * @return $this - */ - public function orWhereNotBetweenColumns($column, array $values) - { - return $this->whereNotBetweenColumns($column, $values, 'or'); - } - - /** - * Add an "or where not null" clause to the query. - * - * @param string $column - * @return $this - */ - public function orWhereNotNull($column) - { - return $this->whereNotNull($column, 'or'); - } - - /** - * Add a "where date" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|null $value - * @param string $boolean - * @return $this - */ - public function whereDate($column, $operator, $value = null, $boolean = 'and') - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - $value = $this->flattenValue($value); - - if ($value instanceof DateTimeInterface) { - $value = $value->format('Y-m-d'); - } - - return $this->addDateBasedWhere('Date', $column, $operator, $value, $boolean); - } - - /** - * Add an "or where date" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|null $value - * @return $this - */ - public function orWhereDate($column, $operator, $value = null) - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->whereDate($column, $operator, $value, 'or'); - } - - /** - * Add a "where time" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|null $value - * @param string $boolean - * @return $this - */ - public function whereTime($column, $operator, $value = null, $boolean = 'and') - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - $value = $this->flattenValue($value); - - if ($value instanceof DateTimeInterface) { - $value = $value->format('H:i:s'); - } - - return $this->addDateBasedWhere('Time', $column, $operator, $value, $boolean); - } - - /** - * Add an "or where time" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|null $value - * @return $this - */ - public function orWhereTime($column, $operator, $value = null) - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->whereTime($column, $operator, $value, 'or'); - } - - /** - * Add a "where day" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|int|null $value - * @param string $boolean - * @return $this - */ - public function whereDay($column, $operator, $value = null, $boolean = 'and') - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - $value = $this->flattenValue($value); - - if ($value instanceof DateTimeInterface) { - $value = $value->format('d'); - } - - if (! $value instanceof Expression) { - $value = sprintf('%02d', $value); - } - - return $this->addDateBasedWhere('Day', $column, $operator, $value, $boolean); - } - - /** - * Add an "or where day" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|int|null $value - * @return $this - */ - public function orWhereDay($column, $operator, $value = null) - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->whereDay($column, $operator, $value, 'or'); - } - - /** - * Add a "where month" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|int|null $value - * @param string $boolean - * @return $this - */ - public function whereMonth($column, $operator, $value = null, $boolean = 'and') - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - $value = $this->flattenValue($value); - - if ($value instanceof DateTimeInterface) { - $value = $value->format('m'); - } - - if (! $value instanceof Expression) { - $value = sprintf('%02d', $value); - } - - return $this->addDateBasedWhere('Month', $column, $operator, $value, $boolean); - } - - /** - * Add an "or where month" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|int|null $value - * @return $this - */ - public function orWhereMonth($column, $operator, $value = null) - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->whereMonth($column, $operator, $value, 'or'); - } - - /** - * Add a "where year" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|int|null $value - * @param string $boolean - * @return $this - */ - public function whereYear($column, $operator, $value = null, $boolean = 'and') - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - $value = $this->flattenValue($value); - - if ($value instanceof DateTimeInterface) { - $value = $value->format('Y'); - } - - return $this->addDateBasedWhere('Year', $column, $operator, $value, $boolean); - } - - /** - * Add an "or where year" statement to the query. - * - * @param string $column - * @param string $operator - * @param \DateTimeInterface|string|int|null $value - * @return $this - */ - public function orWhereYear($column, $operator, $value = null) - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->whereYear($column, $operator, $value, 'or'); - } - - /** - * Add a date based (year, month, day, time) statement to the query. - * - * @param string $type - * @param string $column - * @param string $operator - * @param mixed $value - * @param string $boolean - * @return $this - */ - protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and') - { - $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value'); - - if (! $value instanceof Expression) { - $this->addBinding($value, 'where'); - } - - return $this; - } - - /** - * Add a nested where statement to the query. - * - * @param \Closure $callback - * @param string $boolean - * @return $this - */ - public function whereNested(Closure $callback, $boolean = 'and') - { - $callback($query = $this->forNestedWhere()); - - return $this->addNestedWhereQuery($query, $boolean); - } - - /** - * Create a new query instance for nested where condition. - * - * @return \Illuminate\Database\Query\Builder - */ - public function forNestedWhere() - { - return $this->newQuery()->from($this->from); - } - - /** - * Add another query builder as a nested where to the query builder. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $boolean - * @return $this - */ - public function addNestedWhereQuery($query, $boolean = 'and') - { - if (count($query->wheres)) { - $type = 'Nested'; - - $this->wheres[] = compact('type', 'query', 'boolean'); - - $this->addBinding($query->getRawBindings()['where'], 'where'); - } - - return $this; - } - - /** - * Add a full sub-select to the query. - * - * @param string $column - * @param string $operator - * @param \Closure $callback - * @param string $boolean - * @return $this - */ - protected function whereSub($column, $operator, Closure $callback, $boolean) - { - $type = 'Sub'; - - // Once we have the query instance we can simply execute it so it can add all - // of the sub-select's conditions to itself, and then we can cache it off - // in the array of where clauses for the "main" parent query instance. - $callback($query = $this->forSubQuery()); - - $this->wheres[] = compact( - 'type', 'column', 'operator', 'query', 'boolean' - ); - - $this->addBinding($query->getBindings(), 'where'); - - return $this; - } - - /** - * Add an exists clause to the query. - * - * @param \Closure $callback - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereExists(Closure $callback, $boolean = 'and', $not = false) - { - $query = $this->forSubQuery(); - - // Similar to the sub-select clause, we will create a new query instance so - // the developer may cleanly specify the entire exists query and we will - // compile the whole thing in the grammar and insert it into the SQL. - $callback($query); - - return $this->addWhereExistsQuery($query, $boolean, $not); - } - - /** - * Add an or exists clause to the query. - * - * @param \Closure $callback - * @param bool $not - * @return $this - */ - public function orWhereExists(Closure $callback, $not = false) - { - return $this->whereExists($callback, 'or', $not); - } - - /** - * Add a where not exists clause to the query. - * - * @param \Closure $callback - * @param string $boolean - * @return $this - */ - public function whereNotExists(Closure $callback, $boolean = 'and') - { - return $this->whereExists($callback, $boolean, true); - } - - /** - * Add a where not exists clause to the query. - * - * @param \Closure $callback - * @return $this - */ - public function orWhereNotExists(Closure $callback) - { - return $this->orWhereExists($callback, true); - } - - /** - * Add an exists clause to the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $boolean - * @param bool $not - * @return $this - */ - public function addWhereExistsQuery(self $query, $boolean = 'and', $not = false) - { - $type = $not ? 'NotExists' : 'Exists'; - - $this->wheres[] = compact('type', 'query', 'boolean'); - - $this->addBinding($query->getBindings(), 'where'); - - return $this; - } - - /** - * Adds a where condition using row values. - * - * @param array $columns - * @param string $operator - * @param array $values - * @param string $boolean - * @return $this - * - * @throws \InvalidArgumentException - */ - public function whereRowValues($columns, $operator, $values, $boolean = 'and') - { - if (count($columns) !== count($values)) { - throw new InvalidArgumentException('The number of columns must match the number of values'); - } - - $type = 'RowValues'; - - $this->wheres[] = compact('type', 'columns', 'operator', 'values', 'boolean'); - - $this->addBinding($this->cleanBindings($values)); - - return $this; - } - - /** - * Adds an or where condition using row values. - * - * @param array $columns - * @param string $operator - * @param array $values - * @return $this - */ - public function orWhereRowValues($columns, $operator, $values) - { - return $this->whereRowValues($columns, $operator, $values, 'or'); - } - - /** - * Add a "where JSON contains" clause to the query. - * - * @param string $column - * @param mixed $value - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereJsonContains($column, $value, $boolean = 'and', $not = false) - { - $type = 'JsonContains'; - - $this->wheres[] = compact('type', 'column', 'value', 'boolean', 'not'); - - if (! $value instanceof Expression) { - $this->addBinding($this->grammar->prepareBindingForJsonContains($value)); - } - - return $this; - } - - /** - * Add an "or where JSON contains" clause to the query. - * - * @param string $column - * @param mixed $value - * @return $this - */ - public function orWhereJsonContains($column, $value) - { - return $this->whereJsonContains($column, $value, 'or'); - } - - /** - * Add a "where JSON not contains" clause to the query. - * - * @param string $column - * @param mixed $value - * @param string $boolean - * @return $this - */ - public function whereJsonDoesntContain($column, $value, $boolean = 'and') - { - return $this->whereJsonContains($column, $value, $boolean, true); - } - - /** - * Add an "or where JSON not contains" clause to the query. - * - * @param string $column - * @param mixed $value - * @return $this - */ - public function orWhereJsonDoesntContain($column, $value) - { - return $this->whereJsonDoesntContain($column, $value, 'or'); - } - - /** - * Add a clause that determines if a JSON path exists to the query. - * - * @param string $column - * @param string $boolean - * @param bool $not - * @return $this - */ - public function whereJsonContainsKey($column, $boolean = 'and', $not = false) - { - $type = 'JsonContainsKey'; - - $this->wheres[] = compact('type', 'column', 'boolean', 'not'); - - return $this; - } - - /** - * Add an "or" clause that determines if a JSON path exists to the query. - * - * @param string $column - * @return $this - */ - public function orWhereJsonContainsKey($column) - { - return $this->whereJsonContainsKey($column, 'or'); - } - - /** - * Add a clause that determines if a JSON path does not exist to the query. - * - * @param string $column - * @param string $boolean - * @return $this - */ - public function whereJsonDoesntContainKey($column, $boolean = 'and') - { - return $this->whereJsonContainsKey($column, $boolean, true); - } - - /** - * Add an "or" clause that determines if a JSON path does not exist to the query. - * - * @param string $column - * @return $this - */ - public function orWhereJsonDoesntContainKey($column) - { - return $this->whereJsonDoesntContainKey($column, 'or'); - } - - /** - * Add a "where JSON length" clause to the query. - * - * @param string $column - * @param mixed $operator - * @param mixed $value - * @param string $boolean - * @return $this - */ - public function whereJsonLength($column, $operator, $value = null, $boolean = 'and') - { - $type = 'JsonLength'; - - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - $this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean'); - - if (! $value instanceof Expression) { - $this->addBinding((int) $this->flattenValue($value)); - } - - return $this; - } - - /** - * Add an "or where JSON length" clause to the query. - * - * @param string $column - * @param mixed $operator - * @param mixed $value - * @return $this - */ - public function orWhereJsonLength($column, $operator, $value = null) - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->whereJsonLength($column, $operator, $value, 'or'); - } - - /** - * Handles dynamic "where" clauses to the query. - * - * @param string $method - * @param array $parameters - * @return $this - */ - public function dynamicWhere($method, $parameters) - { - $finder = substr($method, 5); - - $segments = preg_split( - '/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE - ); - - // The connector variable will determine which connector will be used for the - // query condition. We will change it as we come across new boolean values - // in the dynamic method strings, which could contain a number of these. - $connector = 'and'; - - $index = 0; - - foreach ($segments as $segment) { - // If the segment is not a boolean connector, we can assume it is a column's name - // and we will add it to the query as a new constraint as a where clause, then - // we can keep iterating through the dynamic method string's segments again. - if ($segment !== 'And' && $segment !== 'Or') { - $this->addDynamic($segment, $connector, $parameters, $index); - - $index++; - } - - // Otherwise, we will store the connector so we know how the next where clause we - // find in the query should be connected to the previous ones, meaning we will - // have the proper boolean connector to connect the next where clause found. - else { - $connector = $segment; - } - } - - return $this; - } - - /** - * Add a single dynamic where clause statement to the query. - * - * @param string $segment - * @param string $connector - * @param array $parameters - * @param int $index - * @return void - */ - protected function addDynamic($segment, $connector, $parameters, $index) - { - // Once we have parsed out the columns and formatted the boolean operators we - // are ready to add it to this query as a where clause just like any other - // clause on the query. Then we'll increment the parameter index values. - $bool = strtolower($connector); - - $this->where(Str::snake($segment), '=', $parameters[$index], $bool); - } - - /** - * Add a "where fulltext" clause to the query. - * - * @param string|string[] $columns - * @param string $value - * @param string $boolean - * @return $this - */ - public function whereFullText($columns, $value, array $options = [], $boolean = 'and') - { - $type = 'Fulltext'; - - $columns = (array) $columns; - - $this->wheres[] = compact('type', 'columns', 'value', 'options', 'boolean'); - - $this->addBinding($value); - - return $this; - } - - /** - * Add a "or where fulltext" clause to the query. - * - * @param string|string[] $columns - * @param string $value - * @return $this - */ - public function orWhereFullText($columns, $value, array $options = []) - { - return $this->whereFulltext($columns, $value, $options, 'or'); - } - - /** - * Add a "group by" clause to the query. - * - * @param array|string ...$groups - * @return $this - */ - public function groupBy(...$groups) - { - foreach ($groups as $group) { - $this->groups = array_merge( - (array) $this->groups, - Arr::wrap($group) - ); - } - - return $this; - } - - /** - * Add a raw groupBy clause to the query. - * - * @param string $sql - * @param array $bindings - * @return $this - */ - public function groupByRaw($sql, array $bindings = []) - { - $this->groups[] = new Expression($sql); - - $this->addBinding($bindings, 'groupBy'); - - return $this; - } - - /** - * Add a "having" clause to the query. - * - * @param \Closure|string $column - * @param string|int|float|null $operator - * @param string|int|float|null $value - * @param string $boolean - * @return $this - */ - public function having($column, $operator = null, $value = null, $boolean = 'and') - { - $type = 'Basic'; - - // Here we will make some assumptions about the operator. If only 2 values are - // passed to the method, we will assume that the operator is an equals sign - // and keep going. Otherwise, we'll require the operator to be passed in. - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - if ($column instanceof Closure && is_null($operator)) { - return $this->havingNested($column, $boolean); - } - - // If the given operator is not found in the list of valid operators we will - // assume that the developer is just short-cutting the '=' operators and - // we will set the operators to '=' and set the values appropriately. - if ($this->invalidOperator($operator)) { - [$value, $operator] = [$operator, '=']; - } - - if ($this->isBitwiseOperator($operator)) { - $type = 'Bitwise'; - } - - $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); - - if (! $value instanceof Expression) { - $this->addBinding($this->flattenValue($value), 'having'); - } - - return $this; - } - - /** - * Add an "or having" clause to the query. - * - * @param \Closure|string $column - * @param string|int|float|null $operator - * @param string|int|float|null $value - * @return $this - */ - public function orHaving($column, $operator = null, $value = null) - { - [$value, $operator] = $this->prepareValueAndOperator( - $value, $operator, func_num_args() === 2 - ); - - return $this->having($column, $operator, $value, 'or'); - } - - /** - * Add a nested having statement to the query. - * - * @param \Closure $callback - * @param string $boolean - * @return $this - */ - public function havingNested(Closure $callback, $boolean = 'and') - { - $callback($query = $this->forNestedWhere()); - - return $this->addNestedHavingQuery($query, $boolean); - } - - /** - * Add another query builder as a nested having to the query builder. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $boolean - * @return $this - */ - public function addNestedHavingQuery($query, $boolean = 'and') - { - if (count($query->havings)) { - $type = 'Nested'; - - $this->havings[] = compact('type', 'query', 'boolean'); - - $this->addBinding($query->getRawBindings()['having'], 'having'); - } - - return $this; - } - - /** - * Add a "having null" clause to the query. - * - * @param string|array $columns - * @param string $boolean - * @param bool $not - * @return $this - */ - public function havingNull($columns, $boolean = 'and', $not = false) - { - $type = $not ? 'NotNull' : 'Null'; - - foreach (Arr::wrap($columns) as $column) { - $this->havings[] = compact('type', 'column', 'boolean'); - } - - return $this; - } - - /** - * Add an "or having null" clause to the query. - * - * @param string $column - * @return $this - */ - public function orHavingNull($column) - { - return $this->havingNull($column, 'or'); - } - - /** - * Add a "having not null" clause to the query. - * - * @param string|array $columns - * @param string $boolean - * @return $this - */ - public function havingNotNull($columns, $boolean = 'and') - { - return $this->havingNull($columns, $boolean, true); - } - - /** - * Add an "or having not null" clause to the query. - * - * @param string $column - * @return $this - */ - public function orHavingNotNull($column) - { - return $this->havingNotNull($column, 'or'); - } - - /** - * Add a "having between " clause to the query. - * - * @param string $column - * @param array $values - * @param string $boolean - * @param bool $not - * @return $this - */ - public function havingBetween($column, array $values, $boolean = 'and', $not = false) - { - $type = 'between'; - - $this->havings[] = compact('type', 'column', 'values', 'boolean', 'not'); - - $this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'having'); - - return $this; - } - - /** - * Add a raw having clause to the query. - * - * @param string $sql - * @param array $bindings - * @param string $boolean - * @return $this - */ - public function havingRaw($sql, array $bindings = [], $boolean = 'and') - { - $type = 'Raw'; - - $this->havings[] = compact('type', 'sql', 'boolean'); - - $this->addBinding($bindings, 'having'); - - return $this; - } - - /** - * Add a raw or having clause to the query. - * - * @param string $sql - * @param array $bindings - * @return $this - */ - public function orHavingRaw($sql, array $bindings = []) - { - return $this->havingRaw($sql, $bindings, 'or'); - } - - /** - * Add an "order by" clause to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Expression|string $column - * @param string $direction - * @return $this - * - * @throws \InvalidArgumentException - */ - public function orderBy($column, $direction = 'asc') - { - if ($this->isQueryable($column)) { - [$query, $bindings] = $this->createSub($column); - - $column = new Expression('('.$query.')'); - - $this->addBinding($bindings, $this->unions ? 'unionOrder' : 'order'); - } - - $direction = strtolower($direction); - - if (! in_array($direction, ['asc', 'desc'], true)) { - throw new InvalidArgumentException('Order direction must be "asc" or "desc".'); - } - - $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [ - 'column' => $column, - 'direction' => $direction, - ]; - - return $this; - } - - /** - * Add a descending "order by" clause to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Expression|string $column - * @return $this - */ - public function orderByDesc($column) - { - return $this->orderBy($column, 'desc'); - } - - /** - * Add an "order by" clause for a timestamp to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Query\Expression|string $column - * @return $this - */ - public function latest($column = 'created_at') - { - return $this->orderBy($column, 'desc'); - } - - /** - * Add an "order by" clause for a timestamp to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Query\Expression|string $column - * @return $this - */ - public function oldest($column = 'created_at') - { - return $this->orderBy($column, 'asc'); - } - - /** - * Put the query's results in random order. - * - * @param string|int $seed - * @return $this - */ - public function inRandomOrder($seed = '') - { - return $this->orderByRaw($this->grammar->compileRandom($seed)); - } - - /** - * Add a raw "order by" clause to the query. - * - * @param string $sql - * @param array $bindings - * @return $this - */ - public function orderByRaw($sql, $bindings = []) - { - $type = 'Raw'; - - $this->{$this->unions ? 'unionOrders' : 'orders'}[] = compact('type', 'sql'); - - $this->addBinding($bindings, $this->unions ? 'unionOrder' : 'order'); - - return $this; - } - - /** - * Alias to set the "offset" value of the query. - * - * @param int $value - * @return $this - */ - public function skip($value) - { - return $this->offset($value); - } - - /** - * Set the "offset" value of the query. - * - * @param int $value - * @return $this - */ - public function offset($value) - { - $property = $this->unions ? 'unionOffset' : 'offset'; - - $this->$property = max(0, (int) $value); - - return $this; - } - - /** - * Alias to set the "limit" value of the query. - * - * @param int $value - * @return $this - */ - public function take($value) - { - return $this->limit($value); - } - - /** - * Set the "limit" value of the query. - * - * @param int $value - * @return $this - */ - public function limit($value) - { - $property = $this->unions ? 'unionLimit' : 'limit'; - - if ($value >= 0) { - $this->$property = ! is_null($value) ? (int) $value : null; - } - - return $this; - } - - /** - * Set the limit and offset for a given page. - * - * @param int $page - * @param int $perPage - * @return $this - */ - public function forPage($page, $perPage = 15) - { - return $this->offset(($page - 1) * $perPage)->limit($perPage); - } - - /** - * Constrain the query to the previous "page" of results before a given ID. - * - * @param int $perPage - * @param int|null $lastId - * @param string $column - * @return $this - */ - public function forPageBeforeId($perPage = 15, $lastId = 0, $column = 'id') - { - $this->orders = $this->removeExistingOrdersFor($column); - - if (! is_null($lastId)) { - $this->where($column, '<', $lastId); - } - - return $this->orderBy($column, 'desc') - ->limit($perPage); - } - - /** - * Constrain the query to the next "page" of results after a given ID. - * - * @param int $perPage - * @param int|null $lastId - * @param string $column - * @return $this - */ - public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id') - { - $this->orders = $this->removeExistingOrdersFor($column); - - if (! is_null($lastId)) { - $this->where($column, '>', $lastId); - } - - return $this->orderBy($column, 'asc') - ->limit($perPage); - } - - /** - * Remove all existing orders and optionally add a new order. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Query\Expression|string|null $column - * @param string $direction - * @return $this - */ - public function reorder($column = null, $direction = 'asc') - { - $this->orders = null; - $this->unionOrders = null; - $this->bindings['order'] = []; - $this->bindings['unionOrder'] = []; - - if ($column) { - return $this->orderBy($column, $direction); - } - - return $this; - } - - /** - * Get an array with all orders with a given column removed. - * - * @param string $column - * @return array - */ - protected function removeExistingOrdersFor($column) - { - return Collection::make($this->orders) - ->reject(function ($order) use ($column) { - return isset($order['column']) - ? $order['column'] === $column : false; - })->values()->all(); - } - - /** - * Add a union statement to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query - * @param bool $all - * @return $this - */ - public function union($query, $all = false) - { - if ($query instanceof Closure) { - $query($query = $this->newQuery()); - } - - $this->unions[] = compact('query', 'all'); - - $this->addBinding($query->getBindings(), 'union'); - - return $this; - } - - /** - * Add a union all statement to the query. - * - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query - * @return $this - */ - public function unionAll($query) - { - return $this->union($query, true); - } - - /** - * Lock the selected rows in the table. - * - * @param string|bool $value - * @return $this - */ - public function lock($value = true) - { - $this->lock = $value; - - if (! is_null($this->lock)) { - $this->useWritePdo(); - } - - return $this; - } - - /** - * Lock the selected rows in the table for updating. - * - * @return $this - */ - public function lockForUpdate() - { - return $this->lock(true); - } - - /** - * Share lock the selected rows in the table. - * - * @return $this - */ - public function sharedLock() - { - return $this->lock(false); - } - - /** - * Register a closure to be invoked before the query is executed. - * - * @param callable $callback - * @return $this - */ - public function beforeQuery(callable $callback) - { - $this->beforeQueryCallbacks[] = $callback; - - return $this; - } - - /** - * Invoke the "before query" modification callbacks. - * - * @return void - */ - public function applyBeforeQueryCallbacks() - { - foreach ($this->beforeQueryCallbacks as $callback) { - $callback($this); - } - - $this->beforeQueryCallbacks = []; - } - - /** - * Get the SQL representation of the query. - * - * @return string - */ - public function toSql() - { - $this->applyBeforeQueryCallbacks(); - - return $this->grammar->compileSelect($this); - } - - /** - * Execute a query for a single record by ID. - * - * @param int|string $id - * @param array|string $columns - * @return mixed|static - */ - public function find($id, $columns = ['*']) - { - return $this->where('id', '=', $id)->first($columns); - } - - /** - * Execute a query for a single record by ID or call a callback. - * - * @param mixed $id - * @param \Closure|array|string $columns - * @param \Closure|null $callback - * @return mixed|static - */ - public function findOr($id, $columns = ['*'], Closure $callback = null) - { - if ($columns instanceof Closure) { - $callback = $columns; - - $columns = ['*']; - } - - if (! is_null($data = $this->find($id, $columns))) { - return $data; - } - - return $callback(); - } - - /** - * Get a single column's value from the first result of a query. - * - * @param string $column - * @return mixed - */ - public function value($column) - { - $result = (array) $this->first([$column]); - - return count($result) > 0 ? reset($result) : null; - } - - /** - * Get a single expression value from the first result of a query. - * - * @param string $expression - * @param array $bindings - * @return mixed - */ - public function rawValue(string $expression, array $bindings = []) - { - $result = (array) $this->selectRaw($expression, $bindings)->first(); - - return count($result) > 0 ? reset($result) : null; - } - - /** - * Get a single column's value from the first result of a query if it's the sole matching record. - * - * @param string $column - * @return mixed - * - * @throws \Illuminate\Database\RecordsNotFoundException - * @throws \Illuminate\Database\MultipleRecordsFoundException - */ - public function soleValue($column) - { - $result = (array) $this->sole([$column]); - - return reset($result); - } - - /** - * Execute the query as a "select" statement. - * - * @param array|string $columns - * @return \Illuminate\Support\Collection - */ - public function get($columns = ['*']) - { - return collect($this->onceWithColumns(Arr::wrap($columns), function () { - return $this->processor->processSelect($this, $this->runSelect()); - })); - } - - /** - * Run the query as a "select" statement against the connection. - * - * @return array - */ - protected function runSelect() - { - return $this->connection->select( - $this->toSql(), $this->getBindings(), ! $this->useWritePdo - ); - } - - /** - * Paginate the given query into a simple paginator. - * - * @param int|\Closure $perPage - * @param array|string $columns - * @param string $pageName - * @param int|null $page - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator - */ - public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) - { - $page = $page ?: Paginator::resolveCurrentPage($pageName); - - $total = $this->getCountForPagination(); - - $perPage = $perPage instanceof Closure ? $perPage($total) : $perPage; - - $results = $total ? $this->forPage($page, $perPage)->get($columns) : collect(); - - return $this->paginator($results, $total, $perPage, $page, [ - 'path' => Paginator::resolveCurrentPath(), - 'pageName' => $pageName, - ]); - } - - /** - * Get a paginator only supporting simple next and previous links. - * - * This is more efficient on larger data-sets, etc. - * - * @param int $perPage - * @param array|string $columns - * @param string $pageName - * @param int|null $page - * @return \Illuminate\Contracts\Pagination\Paginator - */ - public function simplePaginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) - { - $page = $page ?: Paginator::resolveCurrentPage($pageName); - - $this->offset(($page - 1) * $perPage)->limit($perPage + 1); - - return $this->simplePaginator($this->get($columns), $perPage, $page, [ - 'path' => Paginator::resolveCurrentPath(), - 'pageName' => $pageName, - ]); - } - - /** - * Get a paginator only supporting simple next and previous links. - * - * This is more efficient on larger data-sets, etc. - * - * @param int|null $perPage - * @param array|string $columns - * @param string $cursorName - * @param \Illuminate\Pagination\Cursor|string|null $cursor - * @return \Illuminate\Contracts\Pagination\CursorPaginator - */ - public function cursorPaginate($perPage = 15, $columns = ['*'], $cursorName = 'cursor', $cursor = null) - { - return $this->paginateUsingCursor($perPage, $columns, $cursorName, $cursor); - } - - /** - * Ensure the proper order by required for cursor pagination. - * - * @param bool $shouldReverse - * @return \Illuminate\Support\Collection - */ - protected function ensureOrderForCursorPagination($shouldReverse = false) - { - $this->enforceOrderBy(); - - return collect($this->orders ?? $this->unionOrders ?? [])->filter(function ($order) { - return Arr::has($order, 'direction'); - })->when($shouldReverse, function (Collection $orders) { - return $orders->map(function ($order) { - $order['direction'] = $order['direction'] === 'asc' ? 'desc' : 'asc'; - - return $order; - }); - })->values(); - } - - /** - * Get the count of the total records for the paginator. - * - * @param array $columns - * @return int - */ - public function getCountForPagination($columns = ['*']) - { - $results = $this->runPaginationCountQuery($columns); - - // Once we have run the pagination count query, we will get the resulting count and - // take into account what type of query it was. When there is a group by we will - // just return the count of the entire results set since that will be correct. - if (! isset($results[0])) { - return 0; - } elseif (is_object($results[0])) { - return (int) $results[0]->aggregate; - } - - return (int) array_change_key_case((array) $results[0])['aggregate']; - } - - /** - * Run a pagination count query. - * - * @param array $columns - * @return array - */ - protected function runPaginationCountQuery($columns = ['*']) - { - if ($this->groups || $this->havings) { - $clone = $this->cloneForPaginationCount(); - - if (is_null($clone->columns) && ! empty($this->joins)) { - $clone->select($this->from.'.*'); - } - - return $this->newQuery() - ->from(new Expression('('.$clone->toSql().') as '.$this->grammar->wrap('aggregate_table'))) - ->mergeBindings($clone) - ->setAggregate('count', $this->withoutSelectAliases($columns)) - ->get()->all(); - } - - $without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset']; - - return $this->cloneWithout($without) - ->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order']) - ->setAggregate('count', $this->withoutSelectAliases($columns)) - ->get()->all(); - } - - /** - * Clone the existing query instance for usage in a pagination subquery. - * - * @return self - */ - protected function cloneForPaginationCount() - { - return $this->cloneWithout(['orders', 'limit', 'offset']) - ->cloneWithoutBindings(['order']); - } - - /** - * Remove the column aliases since they will break count queries. - * - * @param array $columns - * @return array - */ - protected function withoutSelectAliases(array $columns) - { - return array_map(function ($column) { - return is_string($column) && ($aliasPosition = stripos($column, ' as ')) !== false - ? substr($column, 0, $aliasPosition) : $column; - }, $columns); - } - - /** - * Get a lazy collection for the given query. - * - * @return \Illuminate\Support\LazyCollection - */ - public function cursor() - { - if (is_null($this->columns)) { - $this->columns = ['*']; - } - - return new LazyCollection(function () { - yield from $this->connection->cursor( - $this->toSql(), $this->getBindings(), ! $this->useWritePdo - ); - }); - } - - /** - * Throw an exception if the query doesn't have an orderBy clause. - * - * @return void - * - * @throws \RuntimeException - */ - protected function enforceOrderBy() - { - if (empty($this->orders) && empty($this->unionOrders)) { - throw new RuntimeException('You must specify an orderBy clause when using this function.'); - } - } - - /** - * Get a collection instance containing the values of a given column. - * - * @param string $column - * @param string|null $key - * @return \Illuminate\Support\Collection - */ - public function pluck($column, $key = null) - { - // First, we will need to select the results of the query accounting for the - // given columns / key. Once we have the results, we will be able to take - // the results and get the exact data that was requested for the query. - $queryResult = $this->onceWithColumns( - is_null($key) ? [$column] : [$column, $key], - function () { - return $this->processor->processSelect( - $this, $this->runSelect() - ); - } - ); - - if (empty($queryResult)) { - return collect(); - } - - // If the columns are qualified with a table or have an alias, we cannot use - // those directly in the "pluck" operations since the results from the DB - // are only keyed by the column itself. We'll strip the table out here. - $column = $this->stripTableForPluck($column); - - $key = $this->stripTableForPluck($key); - - return is_array($queryResult[0]) - ? $this->pluckFromArrayColumn($queryResult, $column, $key) - : $this->pluckFromObjectColumn($queryResult, $column, $key); - } - - /** - * Strip off the table name or alias from a column identifier. - * - * @param string $column - * @return string|null - */ - protected function stripTableForPluck($column) - { - if (is_null($column)) { - return $column; - } - - $separator = str_contains(strtolower($column), ' as ') ? ' as ' : '\.'; - - return last(preg_split('~'.$separator.'~i', $column)); - } - - /** - * Retrieve column values from rows represented as objects. - * - * @param array $queryResult - * @param string $column - * @param string $key - * @return \Illuminate\Support\Collection - */ - protected function pluckFromObjectColumn($queryResult, $column, $key) - { - $results = []; - - if (is_null($key)) { - foreach ($queryResult as $row) { - $results[] = $row->$column; - } - } else { - foreach ($queryResult as $row) { - $results[$row->$key] = $row->$column; - } - } - - return collect($results); - } - - /** - * Retrieve column values from rows represented as arrays. - * - * @param array $queryResult - * @param string $column - * @param string $key - * @return \Illuminate\Support\Collection - */ - protected function pluckFromArrayColumn($queryResult, $column, $key) - { - $results = []; - - if (is_null($key)) { - foreach ($queryResult as $row) { - $results[] = $row[$column]; - } - } else { - foreach ($queryResult as $row) { - $results[$row[$key]] = $row[$column]; - } - } - - return collect($results); - } - - /** - * Concatenate values of a given column as a string. - * - * @param string $column - * @param string $glue - * @return string - */ - public function implode($column, $glue = '') - { - return $this->pluck($column)->implode($glue); - } - - /** - * Determine if any rows exist for the current query. - * - * @return bool - */ - public function exists() - { - $this->applyBeforeQueryCallbacks(); - - $results = $this->connection->select( - $this->grammar->compileExists($this), $this->getBindings(), ! $this->useWritePdo - ); - - // If the results have rows, we will get the row and see if the exists column is a - // boolean true. If there are no results for this query we will return false as - // there are no rows for this query at all, and we can return that info here. - if (isset($results[0])) { - $results = (array) $results[0]; - - return (bool) $results['exists']; - } - - return false; - } - - /** - * Determine if no rows exist for the current query. - * - * @return bool - */ - public function doesntExist() - { - return ! $this->exists(); - } - - /** - * Execute the given callback if no rows exist for the current query. - * - * @param \Closure $callback - * @return mixed - */ - public function existsOr(Closure $callback) - { - return $this->exists() ? true : $callback(); - } - - /** - * Execute the given callback if rows exist for the current query. - * - * @param \Closure $callback - * @return mixed - */ - public function doesntExistOr(Closure $callback) - { - return $this->doesntExist() ? true : $callback(); - } - - /** - * Retrieve the "count" result of the query. - * - * @param string $columns - * @return int - */ - public function count($columns = '*') - { - return (int) $this->aggregate(__FUNCTION__, Arr::wrap($columns)); - } - - /** - * Retrieve the minimum value of a given column. - * - * @param string $column - * @return mixed - */ - public function min($column) - { - return $this->aggregate(__FUNCTION__, [$column]); - } - - /** - * Retrieve the maximum value of a given column. - * - * @param string $column - * @return mixed - */ - public function max($column) - { - return $this->aggregate(__FUNCTION__, [$column]); - } - - /** - * Retrieve the sum of the values of a given column. - * - * @param string $column - * @return mixed - */ - public function sum($column) - { - $result = $this->aggregate(__FUNCTION__, [$column]); - - return $result ?: 0; - } - - /** - * Retrieve the average of the values of a given column. - * - * @param string $column - * @return mixed - */ - public function avg($column) - { - return $this->aggregate(__FUNCTION__, [$column]); - } - - /** - * Alias for the "avg" method. - * - * @param string $column - * @return mixed - */ - public function average($column) - { - return $this->avg($column); - } - - /** - * Execute an aggregate function on the database. - * - * @param string $function - * @param array $columns - * @return mixed - */ - public function aggregate($function, $columns = ['*']) - { - $results = $this->cloneWithout($this->unions || $this->havings ? [] : ['columns']) - ->cloneWithoutBindings($this->unions || $this->havings ? [] : ['select']) - ->setAggregate($function, $columns) - ->get($columns); - - if (! $results->isEmpty()) { - return array_change_key_case((array) $results[0])['aggregate']; - } - } - - /** - * Execute a numeric aggregate function on the database. - * - * @param string $function - * @param array $columns - * @return float|int - */ - public function numericAggregate($function, $columns = ['*']) - { - $result = $this->aggregate($function, $columns); - - // If there is no result, we can obviously just return 0 here. Next, we will check - // if the result is an integer or float. If it is already one of these two data - // types we can just return the result as-is, otherwise we will convert this. - if (! $result) { - return 0; - } - - if (is_int($result) || is_float($result)) { - return $result; - } - - // If the result doesn't contain a decimal place, we will assume it is an int then - // cast it to one. When it does we will cast it to a float since it needs to be - // cast to the expected data type for the developers out of pure convenience. - return ! str_contains((string) $result, '.') - ? (int) $result : (float) $result; - } - - /** - * Set the aggregate property without running the query. - * - * @param string $function - * @param array $columns - * @return $this - */ - protected function setAggregate($function, $columns) - { - $this->aggregate = compact('function', 'columns'); - - if (empty($this->groups)) { - $this->orders = null; - - $this->bindings['order'] = []; - } - - return $this; - } - - /** - * Execute the given callback while selecting the given columns. - * - * After running the callback, the columns are reset to the original value. - * - * @param array $columns - * @param callable $callback - * @return mixed - */ - protected function onceWithColumns($columns, $callback) - { - $original = $this->columns; - - if (is_null($original)) { - $this->columns = $columns; - } - - $result = $callback(); - - $this->columns = $original; - - return $result; - } - - /** - * Insert new records into the database. - * - * @param array $values - * @return bool - */ - public function insert(array $values) - { - // Since every insert gets treated like a batch insert, we will make sure the - // bindings are structured in a way that is convenient when building these - // inserts statements by verifying these elements are actually an array. - if (empty($values)) { - return true; - } - - if (! is_array(reset($values))) { - $values = [$values]; - } - - // Here, we will sort the insert keys for every record so that each insert is - // in the same order for the record. We need to make sure this is the case - // so there are not any errors or problems when inserting these records. - else { - foreach ($values as $key => $value) { - ksort($value); - - $values[$key] = $value; - } - } - - $this->applyBeforeQueryCallbacks(); - - // Finally, we will run this query against the database connection and return - // the results. We will need to also flatten these bindings before running - // the query so they are all in one huge, flattened array for execution. - return $this->connection->insert( - $this->grammar->compileInsert($this, $values), - $this->cleanBindings(Arr::flatten($values, 1)) - ); - } - - /** - * Insert new records into the database while ignoring errors. - * - * @param array $values - * @return int - */ - public function insertOrIgnore(array $values) - { - if (empty($values)) { - return 0; - } - - if (! is_array(reset($values))) { - $values = [$values]; - } else { - foreach ($values as $key => $value) { - ksort($value); - $values[$key] = $value; - } - } - - $this->applyBeforeQueryCallbacks(); - - return $this->connection->affectingStatement( - $this->grammar->compileInsertOrIgnore($this, $values), - $this->cleanBindings(Arr::flatten($values, 1)) - ); - } - - /** - * Insert a new record and get the value of the primary key. - * - * @param array $values - * @param string|null $sequence - * @return int - */ - public function insertGetId(array $values, $sequence = null) - { - $this->applyBeforeQueryCallbacks(); - - $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); - - $values = $this->cleanBindings($values); - - return $this->processor->processInsertGetId($this, $sql, $values, $sequence); - } - - /** - * Insert new records into the table using a subquery. - * - * @param array $columns - * @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query - * @return int - */ - public function insertUsing(array $columns, $query) - { - $this->applyBeforeQueryCallbacks(); - - [$sql, $bindings] = $this->createSub($query); - - return $this->connection->affectingStatement( - $this->grammar->compileInsertUsing($this, $columns, $sql), - $this->cleanBindings($bindings) - ); - } - - /** - * Update records in the database. - * - * @param array $values - * @return int - */ - public function update(array $values) - { - $this->applyBeforeQueryCallbacks(); - - $sql = $this->grammar->compileUpdate($this, $values); - - return $this->connection->update($sql, $this->cleanBindings( - $this->grammar->prepareBindingsForUpdate($this->bindings, $values) - )); - } - - /** - * Update records in a PostgreSQL database using the update from syntax. - * - * @param array $values - * @return int - */ - public function updateFrom(array $values) - { - if (! method_exists($this->grammar, 'compileUpdateFrom')) { - throw new LogicException('This database engine does not support the updateFrom method.'); - } - - $this->applyBeforeQueryCallbacks(); - - $sql = $this->grammar->compileUpdateFrom($this, $values); - - return $this->connection->update($sql, $this->cleanBindings( - $this->grammar->prepareBindingsForUpdateFrom($this->bindings, $values) - )); - } - - /** - * Insert or update a record matching the attributes, and fill it with values. - * - * @param array $attributes - * @param array $values - * @return bool - */ - public function updateOrInsert(array $attributes, array $values = []) - { - if (! $this->where($attributes)->exists()) { - return $this->insert(array_merge($attributes, $values)); - } - - if (empty($values)) { - return true; - } - - return (bool) $this->limit(1)->update($values); - } - - /** - * Insert new records or update the existing ones. - * - * @param array $values - * @param array|string $uniqueBy - * @param array|null $update - * @return int - */ - public function upsert(array $values, $uniqueBy, $update = null) - { - if (empty($values)) { - return 0; - } elseif ($update === []) { - return (int) $this->insert($values); - } - - if (! is_array(reset($values))) { - $values = [$values]; - } else { - foreach ($values as $key => $value) { - ksort($value); - - $values[$key] = $value; - } - } - - if (is_null($update)) { - $update = array_keys(reset($values)); - } - - $this->applyBeforeQueryCallbacks(); - - $bindings = $this->cleanBindings(array_merge( - Arr::flatten($values, 1), - collect($update)->reject(function ($value, $key) { - return is_int($key); - })->all() - )); - - return $this->connection->affectingStatement( - $this->grammar->compileUpsert($this, $values, (array) $uniqueBy, $update), - $bindings - ); - } - - /** - * Increment a column's value by a given amount. - * - * @param string $column - * @param float|int $amount - * @param array $extra - * @return int - * - * @throws \InvalidArgumentException - */ - public function increment($column, $amount = 1, array $extra = []) - { - if (! is_numeric($amount)) { - throw new InvalidArgumentException('Non-numeric value passed to increment method.'); - } - - return $this->incrementEach([$column => $amount], $extra); - } - - /** - * Increment the given column's values by the given amounts. - * - * @param array $columns - * @param array $extra - * @return int - * - * @throws \InvalidArgumentException - */ - public function incrementEach(array $columns, array $extra = []) - { - foreach ($columns as $column => $amount) { - if (! is_numeric($amount)) { - throw new InvalidArgumentException("Non-numeric value passed as increment amount for column: '$column'."); - } elseif (! is_string($column)) { - throw new InvalidArgumentException('Non-associative array passed to incrementEach method.'); - } - - $columns[$column] = $this->raw("{$this->grammar->wrap($column)} + $amount"); - } - - return $this->update(array_merge($columns, $extra)); - } - - /** - * Decrement a column's value by a given amount. - * - * @param string $column - * @param float|int $amount - * @param array $extra - * @return int - * - * @throws \InvalidArgumentException - */ - public function decrement($column, $amount = 1, array $extra = []) - { - if (! is_numeric($amount)) { - throw new InvalidArgumentException('Non-numeric value passed to decrement method.'); - } - - return $this->decrementEach([$column => $amount], $extra); - } - - /** - * Decrement the given column's values by the given amounts. - * - * @param array $columns - * @param array $extra - * @return int - * - * @throws \InvalidArgumentException - */ - public function decrementEach(array $columns, array $extra = []) - { - foreach ($columns as $column => $amount) { - if (! is_numeric($amount)) { - throw new InvalidArgumentException("Non-numeric value passed as decrement amount for column: '$column'."); - } elseif (! is_string($column)) { - throw new InvalidArgumentException('Non-associative array passed to decrementEach method.'); - } - - $columns[$column] = $this->raw("{$this->grammar->wrap($column)} - $amount"); - } - - return $this->update(array_merge($columns, $extra)); - } - - /** - * Delete records from the database. - * - * @param mixed $id - * @return int - */ - public function delete($id = null) - { - // If an ID is passed to the method, we will set the where clause to check the - // ID to let developers to simply and quickly remove a single row from this - // database without manually specifying the "where" clauses on the query. - if (! is_null($id)) { - $this->where($this->from.'.id', '=', $id); - } - - $this->applyBeforeQueryCallbacks(); - - return $this->connection->delete( - $this->grammar->compileDelete($this), $this->cleanBindings( - $this->grammar->prepareBindingsForDelete($this->bindings) - ) - ); - } - - /** - * Run a truncate statement on the table. - * - * @return void - */ - public function truncate() - { - $this->applyBeforeQueryCallbacks(); - - foreach ($this->grammar->compileTruncate($this) as $sql => $bindings) { - $this->connection->statement($sql, $bindings); - } - } - - /** - * Get a new instance of the query builder. - * - * @return \Illuminate\Database\Query\Builder - */ - public function newQuery() - { - return new static($this->connection, $this->grammar, $this->processor); - } - - /** - * Create a new query instance for a sub-query. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function forSubQuery() - { - return $this->newQuery(); - } - - /** - * Create a raw database expression. - * - * @param mixed $value - * @return \Illuminate\Database\Query\Expression - */ - public function raw($value) - { - return $this->connection->raw($value); - } - - /** - * Get the current query value bindings in a flattened array. - * - * @return array - */ - public function getBindings() - { - return Arr::flatten($this->bindings); - } - - /** - * Get the raw array of bindings. - * - * @return array - */ - public function getRawBindings() - { - return $this->bindings; - } - - /** - * Set the bindings on the query builder. - * - * @param array $bindings - * @param string $type - * @return $this - * - * @throws \InvalidArgumentException - */ - public function setBindings(array $bindings, $type = 'where') - { - if (! array_key_exists($type, $this->bindings)) { - throw new InvalidArgumentException("Invalid binding type: {$type}."); - } - - $this->bindings[$type] = $bindings; - - return $this; - } - - /** - * Add a binding to the query. - * - * @param mixed $value - * @param string $type - * @return $this - * - * @throws \InvalidArgumentException - */ - public function addBinding($value, $type = 'where') - { - if (! array_key_exists($type, $this->bindings)) { - throw new InvalidArgumentException("Invalid binding type: {$type}."); - } - - if (is_array($value)) { - $this->bindings[$type] = array_values(array_map( - [$this, 'castBinding'], - array_merge($this->bindings[$type], $value), - )); - } else { - $this->bindings[$type][] = $this->castBinding($value); - } - - return $this; - } - - /** - * Cast the given binding value. - * - * @param mixed $value - * @return mixed - */ - public function castBinding($value) - { - if (function_exists('enum_exists') && $value instanceof BackedEnum) { - return $value->value; - } - - return $value; - } - - /** - * Merge an array of bindings into our bindings. - * - * @param \Illuminate\Database\Query\Builder $query - * @return $this - */ - public function mergeBindings(self $query) - { - $this->bindings = array_merge_recursive($this->bindings, $query->bindings); - - return $this; - } - - /** - * Remove all of the expressions from a list of bindings. - * - * @param array $bindings - * @return array - */ - public function cleanBindings(array $bindings) - { - return collect($bindings) - ->reject(function ($binding) { - return $binding instanceof Expression; - }) - ->map([$this, 'castBinding']) - ->values() - ->all(); - } - - /** - * Get a scalar type value from an unknown type of input. - * - * @param mixed $value - * @return mixed - */ - protected function flattenValue($value) - { - return is_array($value) ? head(Arr::flatten($value)) : $value; - } - - /** - * Get the default key name of the table. - * - * @return string - */ - protected function defaultKeyName() - { - return 'id'; - } - - /** - * Get the database connection instance. - * - * @return \Illuminate\Database\ConnectionInterface - */ - public function getConnection() - { - return $this->connection; - } - - /** - * Get the database query processor instance. - * - * @return \Illuminate\Database\Query\Processors\Processor - */ - public function getProcessor() - { - return $this->processor; - } - - /** - * Get the query grammar instance. - * - * @return \Illuminate\Database\Query\Grammars\Grammar - */ - public function getGrammar() - { - return $this->grammar; - } - - /** - * Use the "write" PDO connection when executing the query. - * - * @return $this - */ - public function useWritePdo() - { - $this->useWritePdo = true; - - return $this; - } - - /** - * Determine if the value is a query builder instance or a Closure. - * - * @param mixed $value - * @return bool - */ - protected function isQueryable($value) - { - return $value instanceof self || - $value instanceof EloquentBuilder || - $value instanceof Relation || - $value instanceof Closure; - } - - /** - * Clone the query. - * - * @return static - */ - public function clone() - { - return clone $this; - } - - /** - * Clone the query without the given properties. - * - * @param array $properties - * @return static - */ - public function cloneWithout(array $properties) - { - return tap($this->clone(), function ($clone) use ($properties) { - foreach ($properties as $property) { - $clone->{$property} = null; - } - }); - } - - /** - * Clone the query without the given bindings. - * - * @param array $except - * @return static - */ - public function cloneWithoutBindings(array $except) - { - return tap($this->clone(), function ($clone) use ($except) { - foreach ($except as $type) { - $clone->bindings[$type] = []; - } - }); - } - - /** - * Dump the current SQL and bindings. - * - * @return $this - */ - public function dump() - { - dump($this->toSql(), $this->getBindings()); - - return $this; - } - - /** - * Die and dump the current SQL and bindings. - * - * @return never - */ - public function dd() - { - dd($this->toSql(), $this->getBindings()); - } - - /** - * Handle dynamic method calls into the method. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - if (str_starts_with($method, 'where')) { - return $this->dynamicWhere($method, $parameters); - } - - static::throwBadMethodCallException($method); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Expression.php b/framework-9.50.2/src/Illuminate/Database/Query/Expression.php deleted file mode 100755 index de69029..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Expression.php +++ /dev/null @@ -1,44 +0,0 @@ -value = $value; - } - - /** - * Get the value of the expression. - * - * @return mixed - */ - public function getValue() - { - return $this->value; - } - - /** - * Get the value of the expression. - * - * @return string - */ - public function __toString() - { - return (string) $this->getValue(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/Grammar.php b/framework-9.50.2/src/Illuminate/Database/Query/Grammars/Grammar.php deleted file mode 100755 index 5540c86..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/Grammar.php +++ /dev/null @@ -1,1347 +0,0 @@ -unions || $query->havings) && $query->aggregate) { - return $this->compileUnionAggregate($query); - } - - // If the query does not have any columns set, we'll set the columns to the - // * character to just get all of the columns from the database. Then we - // can build the query and concatenate all the pieces together as one. - $original = $query->columns; - - if (is_null($query->columns)) { - $query->columns = ['*']; - } - - // To compile the query, we'll spin through each component of the query and - // see if that component exists. If it does we'll just call the compiler - // function for the component which is responsible for making the SQL. - $sql = trim($this->concatenate( - $this->compileComponents($query)) - ); - - if ($query->unions) { - $sql = $this->wrapUnion($sql).' '.$this->compileUnions($query); - } - - $query->columns = $original; - - return $sql; - } - - /** - * Compile the components necessary for a select clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - protected function compileComponents(Builder $query) - { - $sql = []; - - foreach ($this->selectComponents as $component) { - if (isset($query->$component)) { - $method = 'compile'.ucfirst($component); - - $sql[$component] = $this->$method($query, $query->$component); - } - } - - return $sql; - } - - /** - * Compile an aggregated select clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $aggregate - * @return string - */ - protected function compileAggregate(Builder $query, $aggregate) - { - $column = $this->columnize($aggregate['columns']); - - // If the query has a "distinct" constraint and we're not asking for all columns - // we need to prepend "distinct" onto the column name so that the query takes - // it into account when it performs the aggregating operations on the data. - if (is_array($query->distinct)) { - $column = 'distinct '.$this->columnize($query->distinct); - } elseif ($query->distinct && $column !== '*') { - $column = 'distinct '.$column; - } - - return 'select '.$aggregate['function'].'('.$column.') as aggregate'; - } - - /** - * Compile the "select *" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $columns - * @return string|null - */ - protected function compileColumns(Builder $query, $columns) - { - // If the query is actually performing an aggregating select, we will let that - // compiler handle the building of the select clauses, as it will need some - // more syntax that is best handled by that function to keep things neat. - if (! is_null($query->aggregate)) { - return; - } - - if ($query->distinct) { - $select = 'select distinct '; - } else { - $select = 'select '; - } - - return $select.$this->columnize($columns); - } - - /** - * Compile the "from" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @return string - */ - protected function compileFrom(Builder $query, $table) - { - return 'from '.$this->wrapTable($table); - } - - /** - * Compile the "join" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $joins - * @return string - */ - protected function compileJoins(Builder $query, $joins) - { - return collect($joins)->map(function ($join) use ($query) { - $table = $this->wrapTable($join->table); - - $nestedJoins = is_null($join->joins) ? '' : ' '.$this->compileJoins($query, $join->joins); - - $tableAndNestedJoins = is_null($join->joins) ? $table : '('.$table.$nestedJoins.')'; - - return trim("{$join->type} join {$tableAndNestedJoins} {$this->compileWheres($join)}"); - })->implode(' '); - } - - /** - * Compile the "where" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileWheres(Builder $query) - { - // Each type of where clause has its own compiler function, which is responsible - // for actually creating the where clauses SQL. This helps keep the code nice - // and maintainable since each clause has a very small method that it uses. - if (is_null($query->wheres)) { - return ''; - } - - // If we actually have some where clauses, we will strip off the first boolean - // operator, which is added by the query builders for convenience so we can - // avoid checking for the first clauses in each of the compilers methods. - if (count($sql = $this->compileWheresToArray($query)) > 0) { - return $this->concatenateWhereClauses($query, $sql); - } - - return ''; - } - - /** - * Get an array of all the where clauses for the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - protected function compileWheresToArray($query) - { - return collect($query->wheres)->map(function ($where) use ($query) { - return $where['boolean'].' '.$this->{"where{$where['type']}"}($query, $where); - })->all(); - } - - /** - * Format the where clause statements into one string. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $sql - * @return string - */ - protected function concatenateWhereClauses($query, $sql) - { - $conjunction = $query instanceof JoinClause ? 'on' : 'where'; - - return $conjunction.' '.$this->removeLeadingBoolean(implode(' ', $sql)); - } - - /** - * Compile a raw where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereRaw(Builder $query, $where) - { - return $where['sql']; - } - - /** - * Compile a basic where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBasic(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - $operator = str_replace('?', '??', $where['operator']); - - return $this->wrap($where['column']).' '.$operator.' '.$value; - } - - /** - * Compile a bitwise operator where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBitwise(Builder $query, $where) - { - return $this->whereBasic($query, $where); - } - - /** - * Compile a "where in" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereIn(Builder $query, $where) - { - if (! empty($where['values'])) { - return $this->wrap($where['column']).' in ('.$this->parameterize($where['values']).')'; - } - - return '0 = 1'; - } - - /** - * Compile a "where not in" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotIn(Builder $query, $where) - { - if (! empty($where['values'])) { - return $this->wrap($where['column']).' not in ('.$this->parameterize($where['values']).')'; - } - - return '1 = 1'; - } - - /** - * Compile a "where not in raw" clause. - * - * For safety, whereIntegerInRaw ensures this method is only used with integer values. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotInRaw(Builder $query, $where) - { - if (! empty($where['values'])) { - return $this->wrap($where['column']).' not in ('.implode(', ', $where['values']).')'; - } - - return '1 = 1'; - } - - /** - * Compile a "where in raw" clause. - * - * For safety, whereIntegerInRaw ensures this method is only used with integer values. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereInRaw(Builder $query, $where) - { - if (! empty($where['values'])) { - return $this->wrap($where['column']).' in ('.implode(', ', $where['values']).')'; - } - - return '0 = 1'; - } - - /** - * Compile a "where null" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNull(Builder $query, $where) - { - return $this->wrap($where['column']).' is null'; - } - - /** - * Compile a "where not null" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotNull(Builder $query, $where) - { - return $this->wrap($where['column']).' is not null'; - } - - /** - * Compile a "between" where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBetween(Builder $query, $where) - { - $between = $where['not'] ? 'not between' : 'between'; - - $min = $this->parameter(is_array($where['values']) ? reset($where['values']) : $where['values'][0]); - - $max = $this->parameter(is_array($where['values']) ? end($where['values']) : $where['values'][1]); - - return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max; - } - - /** - * Compile a "between" where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBetweenColumns(Builder $query, $where) - { - $between = $where['not'] ? 'not between' : 'between'; - - $min = $this->wrap(is_array($where['values']) ? reset($where['values']) : $where['values'][0]); - - $max = $this->wrap(is_array($where['values']) ? end($where['values']) : $where['values'][1]); - - return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max; - } - - /** - * Compile a "where date" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDate(Builder $query, $where) - { - return $this->dateBasedWhere('date', $query, $where); - } - - /** - * Compile a "where time" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereTime(Builder $query, $where) - { - return $this->dateBasedWhere('time', $query, $where); - } - - /** - * Compile a "where day" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDay(Builder $query, $where) - { - return $this->dateBasedWhere('day', $query, $where); - } - - /** - * Compile a "where month" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereMonth(Builder $query, $where) - { - return $this->dateBasedWhere('month', $query, $where); - } - - /** - * Compile a "where year" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereYear(Builder $query, $where) - { - return $this->dateBasedWhere('year', $query, $where); - } - - /** - * Compile a date based where clause. - * - * @param string $type - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function dateBasedWhere($type, Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return $type.'('.$this->wrap($where['column']).') '.$where['operator'].' '.$value; - } - - /** - * Compile a where clause comparing two columns. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereColumn(Builder $query, $where) - { - return $this->wrap($where['first']).' '.$where['operator'].' '.$this->wrap($where['second']); - } - - /** - * Compile a nested where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNested(Builder $query, $where) - { - // Here we will calculate what portion of the string we need to remove. If this - // is a join clause query, we need to remove the "on" portion of the SQL and - // if it is a normal query we need to take the leading "where" of queries. - $offset = $query instanceof JoinClause ? 3 : 6; - - return '('.substr($this->compileWheres($where['query']), $offset).')'; - } - - /** - * Compile a where condition with a sub-select. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereSub(Builder $query, $where) - { - $select = $this->compileSelect($where['query']); - - return $this->wrap($where['column']).' '.$where['operator']." ($select)"; - } - - /** - * Compile a where exists clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereExists(Builder $query, $where) - { - return 'exists ('.$this->compileSelect($where['query']).')'; - } - - /** - * Compile a where exists clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotExists(Builder $query, $where) - { - return 'not exists ('.$this->compileSelect($where['query']).')'; - } - - /** - * Compile a where row values condition. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereRowValues(Builder $query, $where) - { - $columns = $this->columnize($where['columns']); - - $values = $this->parameterize($where['values']); - - return '('.$columns.') '.$where['operator'].' ('.$values.')'; - } - - /** - * Compile a "where JSON boolean" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereJsonBoolean(Builder $query, $where) - { - $column = $this->wrapJsonBooleanSelector($where['column']); - - $value = $this->wrapJsonBooleanValue( - $this->parameter($where['value']) - ); - - return $column.' '.$where['operator'].' '.$value; - } - - /** - * Compile a "where JSON contains" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereJsonContains(Builder $query, $where) - { - $not = $where['not'] ? 'not ' : ''; - - return $not.$this->compileJsonContains( - $where['column'], - $this->parameter($where['value']) - ); - } - - /** - * Compile a "JSON contains" statement into SQL. - * - * @param string $column - * @param string $value - * @return string - * - * @throws \RuntimeException - */ - protected function compileJsonContains($column, $value) - { - throw new RuntimeException('This database engine does not support JSON contains operations.'); - } - - /** - * Prepare the binding for a "JSON contains" statement. - * - * @param mixed $binding - * @return string - */ - public function prepareBindingForJsonContains($binding) - { - return json_encode($binding); - } - - /** - * Compile a "where JSON contains key" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereJsonContainsKey(Builder $query, $where) - { - $not = $where['not'] ? 'not ' : ''; - - return $not.$this->compileJsonContainsKey( - $where['column'] - ); - } - - /** - * Compile a "JSON contains key" statement into SQL. - * - * @param string $column - * @return string - * - * @throws \RuntimeException - */ - protected function compileJsonContainsKey($column) - { - throw new RuntimeException('This database engine does not support JSON contains key operations.'); - } - - /** - * Compile a "where JSON length" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereJsonLength(Builder $query, $where) - { - return $this->compileJsonLength( - $where['column'], - $where['operator'], - $this->parameter($where['value']) - ); - } - - /** - * Compile a "JSON length" statement into SQL. - * - * @param string $column - * @param string $operator - * @param string $value - * @return string - * - * @throws \RuntimeException - */ - protected function compileJsonLength($column, $operator, $value) - { - throw new RuntimeException('This database engine does not support JSON length operations.'); - } - - /** - * Compile a "JSON value cast" statement into SQL. - * - * @param string $value - * @return string - */ - public function compileJsonValueCast($value) - { - return $value; - } - - /** - * Compile a "where fulltext" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - public function whereFullText(Builder $query, $where) - { - throw new RuntimeException('This database engine does not support fulltext search operations.'); - } - - /** - * Compile the "group by" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $groups - * @return string - */ - protected function compileGroups(Builder $query, $groups) - { - return 'group by '.$this->columnize($groups); - } - - /** - * Compile the "having" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileHavings(Builder $query) - { - return 'having '.$this->removeLeadingBoolean(collect($query->havings)->map(function ($having) { - return $having['boolean'].' '.$this->compileHaving($having); - })->implode(' ')); - } - - /** - * Compile a single having clause. - * - * @param array $having - * @return string - */ - protected function compileHaving(array $having) - { - // If the having clause is "raw", we can just return the clause straight away - // without doing any more processing on it. Otherwise, we will compile the - // clause into SQL based on the components that make it up from builder. - if ($having['type'] === 'Raw') { - return $having['sql']; - } elseif ($having['type'] === 'between') { - return $this->compileHavingBetween($having); - } elseif ($having['type'] === 'Null') { - return $this->compileHavingNull($having); - } elseif ($having['type'] === 'NotNull') { - return $this->compileHavingNotNull($having); - } elseif ($having['type'] === 'bit') { - return $this->compileHavingBit($having); - } elseif ($having['type'] === 'Nested') { - return $this->compileNestedHavings($having); - } - - return $this->compileBasicHaving($having); - } - - /** - * Compile a basic having clause. - * - * @param array $having - * @return string - */ - protected function compileBasicHaving($having) - { - $column = $this->wrap($having['column']); - - $parameter = $this->parameter($having['value']); - - return $column.' '.$having['operator'].' '.$parameter; - } - - /** - * Compile a "between" having clause. - * - * @param array $having - * @return string - */ - protected function compileHavingBetween($having) - { - $between = $having['not'] ? 'not between' : 'between'; - - $column = $this->wrap($having['column']); - - $min = $this->parameter(head($having['values'])); - - $max = $this->parameter(last($having['values'])); - - return $column.' '.$between.' '.$min.' and '.$max; - } - - /** - * Compile a having null clause. - * - * @param array $having - * @return string - */ - protected function compileHavingNull($having) - { - $column = $this->wrap($having['column']); - - return $column.' is null'; - } - - /** - * Compile a having not null clause. - * - * @param array $having - * @return string - */ - protected function compileHavingNotNull($having) - { - $column = $this->wrap($having['column']); - - return $column.' is not null'; - } - - /** - * Compile a having clause involving a bit operator. - * - * @param array $having - * @return string - */ - protected function compileHavingBit($having) - { - $column = $this->wrap($having['column']); - - $parameter = $this->parameter($having['value']); - - return '('.$column.' '.$having['operator'].' '.$parameter.') != 0'; - } - - /** - * Compile a nested having clause. - * - * @param array $having - * @return string - */ - protected function compileNestedHavings($having) - { - return '('.substr($this->compileHavings($having['query']), 7).')'; - } - - /** - * Compile the "order by" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $orders - * @return string - */ - protected function compileOrders(Builder $query, $orders) - { - if (! empty($orders)) { - return 'order by '.implode(', ', $this->compileOrdersToArray($query, $orders)); - } - - return ''; - } - - /** - * Compile the query orders to an array. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $orders - * @return array - */ - protected function compileOrdersToArray(Builder $query, $orders) - { - return array_map(function ($order) { - return $order['sql'] ?? $this->wrap($order['column']).' '.$order['direction']; - }, $orders); - } - - /** - * Compile the random statement into SQL. - * - * @param string|int $seed - * @return string - */ - public function compileRandom($seed) - { - return 'RANDOM()'; - } - - /** - * Compile the "limit" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $limit - * @return string - */ - protected function compileLimit(Builder $query, $limit) - { - return 'limit '.(int) $limit; - } - - /** - * Compile the "offset" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $offset - * @return string - */ - protected function compileOffset(Builder $query, $offset) - { - return 'offset '.(int) $offset; - } - - /** - * Compile the "union" queries attached to the main query. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileUnions(Builder $query) - { - $sql = ''; - - foreach ($query->unions as $union) { - $sql .= $this->compileUnion($union); - } - - if (! empty($query->unionOrders)) { - $sql .= ' '.$this->compileOrders($query, $query->unionOrders); - } - - if (isset($query->unionLimit)) { - $sql .= ' '.$this->compileLimit($query, $query->unionLimit); - } - - if (isset($query->unionOffset)) { - $sql .= ' '.$this->compileOffset($query, $query->unionOffset); - } - - return ltrim($sql); - } - - /** - * Compile a single union statement. - * - * @param array $union - * @return string - */ - protected function compileUnion(array $union) - { - $conjunction = $union['all'] ? ' union all ' : ' union '; - - return $conjunction.$this->wrapUnion($union['query']->toSql()); - } - - /** - * Wrap a union subquery in parentheses. - * - * @param string $sql - * @return string - */ - protected function wrapUnion($sql) - { - return '('.$sql.')'; - } - - /** - * Compile a union aggregate query into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileUnionAggregate(Builder $query) - { - $sql = $this->compileAggregate($query, $query->aggregate); - - $query->aggregate = null; - - return $sql.' from ('.$this->compileSelect($query).') as '.$this->wrapTable('temp_table'); - } - - /** - * Compile an exists statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileExists(Builder $query) - { - $select = $this->compileSelect($query); - - return "select exists({$select}) as {$this->wrap('exists')}"; - } - - /** - * Compile an insert statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileInsert(Builder $query, array $values) - { - // Essentially we will force every insert to be treated as a batch insert which - // simply makes creating the SQL easier for us since we can utilize the same - // basic routine regardless of an amount of records given to us to insert. - $table = $this->wrapTable($query->from); - - if (empty($values)) { - return "insert into {$table} default values"; - } - - if (! is_array(reset($values))) { - $values = [$values]; - } - - $columns = $this->columnize(array_keys(reset($values))); - - // We need to build a list of parameter place-holders of values that are bound - // to the query. Each insert should have the exact same number of parameter - // bindings so we will loop through the record and parameterize them all. - $parameters = collect($values)->map(function ($record) { - return '('.$this->parameterize($record).')'; - })->implode(', '); - - return "insert into $table ($columns) values $parameters"; - } - - /** - * Compile an insert ignore statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - * - * @throws \RuntimeException - */ - public function compileInsertOrIgnore(Builder $query, array $values) - { - throw new RuntimeException('This database engine does not support inserting while ignoring errors.'); - } - - /** - * Compile an insert and get ID statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param string $sequence - * @return string - */ - public function compileInsertGetId(Builder $query, $values, $sequence) - { - return $this->compileInsert($query, $values); - } - - /** - * Compile an insert statement using a subquery into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $columns - * @param string $sql - * @return string - */ - public function compileInsertUsing(Builder $query, array $columns, string $sql) - { - return "insert into {$this->wrapTable($query->from)} ({$this->columnize($columns)}) $sql"; - } - - /** - * Compile an update statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileUpdate(Builder $query, array $values) - { - $table = $this->wrapTable($query->from); - - $columns = $this->compileUpdateColumns($query, $values); - - $where = $this->compileWheres($query); - - return trim( - isset($query->joins) - ? $this->compileUpdateWithJoins($query, $table, $columns, $where) - : $this->compileUpdateWithoutJoins($query, $table, $columns, $where) - ); - } - - /** - * Compile the columns for an update statement. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - protected function compileUpdateColumns(Builder $query, array $values) - { - return collect($values)->map(function ($value, $key) { - return $this->wrap($key).' = '.$this->parameter($value); - })->implode(', '); - } - - /** - * Compile an update statement without joins into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param string $columns - * @param string $where - * @return string - */ - protected function compileUpdateWithoutJoins(Builder $query, $table, $columns, $where) - { - return "update {$table} set {$columns} {$where}"; - } - - /** - * Compile an update statement with joins into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param string $columns - * @param string $where - * @return string - */ - protected function compileUpdateWithJoins(Builder $query, $table, $columns, $where) - { - $joins = $this->compileJoins($query, $query->joins); - - return "update {$table} {$joins} set {$columns} {$where}"; - } - - /** - * Compile an "upsert" statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param array $uniqueBy - * @param array $update - * @return string - * - * @throws \RuntimeException - */ - public function compileUpsert(Builder $query, array $values, array $uniqueBy, array $update) - { - throw new RuntimeException('This database engine does not support upserts.'); - } - - /** - * Prepare the bindings for an update statement. - * - * @param array $bindings - * @param array $values - * @return array - */ - public function prepareBindingsForUpdate(array $bindings, array $values) - { - $cleanBindings = Arr::except($bindings, ['select', 'join']); - - return array_values( - array_merge($bindings['join'], $values, Arr::flatten($cleanBindings)) - ); - } - - /** - * Compile a delete statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileDelete(Builder $query) - { - $table = $this->wrapTable($query->from); - - $where = $this->compileWheres($query); - - return trim( - isset($query->joins) - ? $this->compileDeleteWithJoins($query, $table, $where) - : $this->compileDeleteWithoutJoins($query, $table, $where) - ); - } - - /** - * Compile a delete statement without joins into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param string $where - * @return string - */ - protected function compileDeleteWithoutJoins(Builder $query, $table, $where) - { - return "delete from {$table} {$where}"; - } - - /** - * Compile a delete statement with joins into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param string $where - * @return string - */ - protected function compileDeleteWithJoins(Builder $query, $table, $where) - { - $alias = last(explode(' as ', $table)); - - $joins = $this->compileJoins($query, $query->joins); - - return "delete {$alias} from {$table} {$joins} {$where}"; - } - - /** - * Prepare the bindings for a delete statement. - * - * @param array $bindings - * @return array - */ - public function prepareBindingsForDelete(array $bindings) - { - return Arr::flatten( - Arr::except($bindings, 'select') - ); - } - - /** - * Compile a truncate table statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - public function compileTruncate(Builder $query) - { - return ['truncate table '.$this->wrapTable($query->from) => []]; - } - - /** - * Compile the lock into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param bool|string $value - * @return string - */ - protected function compileLock(Builder $query, $value) - { - return is_string($value) ? $value : ''; - } - - /** - * Determine if the grammar supports savepoints. - * - * @return bool - */ - public function supportsSavepoints() - { - return true; - } - - /** - * Compile the SQL statement to define a savepoint. - * - * @param string $name - * @return string - */ - public function compileSavepoint($name) - { - return 'SAVEPOINT '.$name; - } - - /** - * Compile the SQL statement to execute a savepoint rollback. - * - * @param string $name - * @return string - */ - public function compileSavepointRollBack($name) - { - return 'ROLLBACK TO SAVEPOINT '.$name; - } - - /** - * Wrap the given JSON selector for boolean values. - * - * @param string $value - * @return string - */ - protected function wrapJsonBooleanSelector($value) - { - return $this->wrapJsonSelector($value); - } - - /** - * Wrap the given JSON boolean value. - * - * @param string $value - * @return string - */ - protected function wrapJsonBooleanValue($value) - { - return $value; - } - - /** - * Concatenate an array of segments, removing empties. - * - * @param array $segments - * @return string - */ - protected function concatenate($segments) - { - return implode(' ', array_filter($segments, function ($value) { - return (string) $value !== ''; - })); - } - - /** - * Remove the leading boolean from a statement. - * - * @param string $value - * @return string - */ - protected function removeLeadingBoolean($value) - { - return preg_replace('/and |or /i', '', $value, 1); - } - - /** - * Get the grammar specific operators. - * - * @return array - */ - public function getOperators() - { - return $this->operators; - } - - /** - * Get the grammar specific bitwise operators. - * - * @return array - */ - public function getBitwiseOperators() - { - return $this->bitwiseOperators; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php b/framework-9.50.2/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php deleted file mode 100755 index f973349..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php +++ /dev/null @@ -1,365 +0,0 @@ -isJsonSelector($where['column'])) { - [$field, $path] = $this->wrapJsonFieldAndPath($where['column']); - - return '(json_extract('.$field.$path.') is null OR json_type(json_extract('.$field.$path.')) = \'NULL\')'; - } - - return parent::whereNull($query, $where); - } - - /** - * Add a "where not null" clause to the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereNotNull(Builder $query, $where) - { - if ($this->isJsonSelector($where['column'])) { - [$field, $path] = $this->wrapJsonFieldAndPath($where['column']); - - return '(json_extract('.$field.$path.') is not null AND json_type(json_extract('.$field.$path.')) != \'NULL\')'; - } - - return parent::whereNotNull($query, $where); - } - - /** - * Compile a "where fulltext" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - public function whereFullText(Builder $query, $where) - { - $columns = $this->columnize($where['columns']); - - $value = $this->parameter($where['value']); - - $mode = ($where['options']['mode'] ?? []) === 'boolean' - ? ' in boolean mode' - : ' in natural language mode'; - - $expanded = ($where['options']['expanded'] ?? []) && ($where['options']['mode'] ?? []) !== 'boolean' - ? ' with query expansion' - : ''; - - return "match ({$columns}) against (".$value."{$mode}{$expanded})"; - } - - /** - * Compile an insert ignore statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileInsertOrIgnore(Builder $query, array $values) - { - return Str::replaceFirst('insert', 'insert ignore', $this->compileInsert($query, $values)); - } - - /** - * Compile a "JSON contains" statement into SQL. - * - * @param string $column - * @param string $value - * @return string - */ - protected function compileJsonContains($column, $value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($column); - - return 'json_contains('.$field.', '.$value.$path.')'; - } - - /** - * Compile a "JSON contains key" statement into SQL. - * - * @param string $column - * @return string - */ - protected function compileJsonContainsKey($column) - { - [$field, $path] = $this->wrapJsonFieldAndPath($column); - - return 'ifnull(json_contains_path('.$field.', \'one\''.$path.'), 0)'; - } - - /** - * Compile a "JSON length" statement into SQL. - * - * @param string $column - * @param string $operator - * @param string $value - * @return string - */ - protected function compileJsonLength($column, $operator, $value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($column); - - return 'json_length('.$field.$path.') '.$operator.' '.$value; - } - - /** - * Compile a "JSON value cast" statement into SQL. - * - * @param string $value - * @return string - */ - public function compileJsonValueCast($value) - { - return 'cast('.$value.' as json)'; - } - - /** - * Compile the random statement into SQL. - * - * @param string|int $seed - * @return string - */ - public function compileRandom($seed) - { - return 'RAND('.$seed.')'; - } - - /** - * Compile the lock into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param bool|string $value - * @return string - */ - protected function compileLock(Builder $query, $value) - { - if (! is_string($value)) { - return $value ? 'for update' : 'lock in share mode'; - } - - return $value; - } - - /** - * Compile an insert statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileInsert(Builder $query, array $values) - { - if (empty($values)) { - $values = [[]]; - } - - return parent::compileInsert($query, $values); - } - - /** - * Compile the columns for an update statement. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - protected function compileUpdateColumns(Builder $query, array $values) - { - return collect($values)->map(function ($value, $key) { - if ($this->isJsonSelector($key)) { - return $this->compileJsonUpdateColumn($key, $value); - } - - return $this->wrap($key).' = '.$this->parameter($value); - })->implode(', '); - } - - /** - * Compile an "upsert" statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param array $uniqueBy - * @param array $update - * @return string - */ - public function compileUpsert(Builder $query, array $values, array $uniqueBy, array $update) - { - $useUpsertAlias = $query->connection->getConfig('use_upsert_alias'); - - $sql = $this->compileInsert($query, $values); - - if ($useUpsertAlias) { - $sql .= ' as laravel_upsert_alias'; - } - - $sql .= ' on duplicate key update '; - - $columns = collect($update)->map(function ($value, $key) use ($useUpsertAlias) { - if (! is_numeric($key)) { - return $this->wrap($key).' = '.$this->parameter($value); - } - - return $useUpsertAlias - ? $this->wrap($value).' = '.$this->wrap('laravel_upsert_alias').'.'.$this->wrap($value) - : $this->wrap($value).' = values('.$this->wrap($value).')'; - })->implode(', '); - - return $sql.$columns; - } - - /** - * Prepare a JSON column being updated using the JSON_SET function. - * - * @param string $key - * @param mixed $value - * @return string - */ - protected function compileJsonUpdateColumn($key, $value) - { - if (is_bool($value)) { - $value = $value ? 'true' : 'false'; - } elseif (is_array($value)) { - $value = 'cast(? as json)'; - } else { - $value = $this->parameter($value); - } - - [$field, $path] = $this->wrapJsonFieldAndPath($key); - - return "{$field} = json_set({$field}{$path}, {$value})"; - } - - /** - * Compile an update statement without joins into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param string $columns - * @param string $where - * @return string - */ - protected function compileUpdateWithoutJoins(Builder $query, $table, $columns, $where) - { - $sql = parent::compileUpdateWithoutJoins($query, $table, $columns, $where); - - if (! empty($query->orders)) { - $sql .= ' '.$this->compileOrders($query, $query->orders); - } - - if (isset($query->limit)) { - $sql .= ' '.$this->compileLimit($query, $query->limit); - } - - return $sql; - } - - /** - * Prepare the bindings for an update statement. - * - * Booleans, integers, and doubles are inserted into JSON updates as raw values. - * - * @param array $bindings - * @param array $values - * @return array - */ - public function prepareBindingsForUpdate(array $bindings, array $values) - { - $values = collect($values)->reject(function ($value, $column) { - return $this->isJsonSelector($column) && is_bool($value); - })->map(function ($value) { - return is_array($value) ? json_encode($value) : $value; - })->all(); - - return parent::prepareBindingsForUpdate($bindings, $values); - } - - /** - * Compile a delete query that does not use joins. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param string $where - * @return string - */ - protected function compileDeleteWithoutJoins(Builder $query, $table, $where) - { - $sql = parent::compileDeleteWithoutJoins($query, $table, $where); - - // When using MySQL, delete statements may contain order by statements and limits - // so we will compile both of those here. Once we have finished compiling this - // we will return the completed SQL statement so it will be executed for us. - if (! empty($query->orders)) { - $sql .= ' '.$this->compileOrders($query, $query->orders); - } - - if (isset($query->limit)) { - $sql .= ' '.$this->compileLimit($query, $query->limit); - } - - return $sql; - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - return $value === '*' ? $value : '`'.str_replace('`', '``', $value).'`'; - } - - /** - * Wrap the given JSON selector. - * - * @param string $value - * @return string - */ - protected function wrapJsonSelector($value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($value); - - return 'json_unquote(json_extract('.$field.$path.'))'; - } - - /** - * Wrap the given JSON selector for boolean values. - * - * @param string $value - * @return string - */ - protected function wrapJsonBooleanSelector($value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($value); - - return 'json_extract('.$field.$path.')'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/framework-9.50.2/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php deleted file mode 100755 index ad4678b..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php +++ /dev/null @@ -1,701 +0,0 @@ -', '<=', '>=', '<>', '!=', - 'like', 'not like', 'between', 'ilike', 'not ilike', - '~', '&', '|', '#', '<<', '>>', '<<=', '>>=', - '&&', '@>', '<@', '?', '?|', '?&', '||', '-', '@?', '@@', '#-', - 'is distinct from', 'is not distinct from', - ]; - - /** - * The grammar specific bitwise operators. - * - * @var array - */ - protected $bitwiseOperators = [ - '~', '&', '|', '#', '<<', '>>', '<<=', '>>=', - ]; - - /** - * Compile a basic where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBasic(Builder $query, $where) - { - if (str_contains(strtolower($where['operator']), 'like')) { - return sprintf( - '%s::text %s %s', - $this->wrap($where['column']), - $where['operator'], - $this->parameter($where['value']) - ); - } - - return parent::whereBasic($query, $where); - } - - /** - * Compile a bitwise operator where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBitwise(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - $operator = str_replace('?', '??', $where['operator']); - - return '('.$this->wrap($where['column']).' '.$operator.' '.$value.')::bool'; - } - - /** - * Compile a "where date" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDate(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return $this->wrap($where['column']).'::date '.$where['operator'].' '.$value; - } - - /** - * Compile a "where time" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereTime(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return $this->wrap($where['column']).'::time '.$where['operator'].' '.$value; - } - - /** - * Compile a date based where clause. - * - * @param string $type - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function dateBasedWhere($type, Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return 'extract('.$type.' from '.$this->wrap($where['column']).') '.$where['operator'].' '.$value; - } - - /** - * Compile a "where fulltext" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - public function whereFullText(Builder $query, $where) - { - $language = $where['options']['language'] ?? 'english'; - - if (! in_array($language, $this->validFullTextLanguages())) { - $language = 'english'; - } - - $columns = collect($where['columns'])->map(function ($column) use ($language) { - return "to_tsvector('{$language}', {$this->wrap($column)})"; - })->implode(' || '); - - $mode = 'plainto_tsquery'; - - if (($where['options']['mode'] ?? []) === 'phrase') { - $mode = 'phraseto_tsquery'; - } - - if (($where['options']['mode'] ?? []) === 'websearch') { - $mode = 'websearch_to_tsquery'; - } - - return "({$columns}) @@ {$mode}('{$language}', {$this->parameter($where['value'])})"; - } - - /** - * Get an array of valid full text languages. - * - * @return array - */ - protected function validFullTextLanguages() - { - return [ - 'simple', - 'arabic', - 'danish', - 'dutch', - 'english', - 'finnish', - 'french', - 'german', - 'hungarian', - 'indonesian', - 'irish', - 'italian', - 'lithuanian', - 'nepali', - 'norwegian', - 'portuguese', - 'romanian', - 'russian', - 'spanish', - 'swedish', - 'tamil', - 'turkish', - ]; - } - - /** - * Compile the "select *" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $columns - * @return string|null - */ - protected function compileColumns(Builder $query, $columns) - { - // If the query is actually performing an aggregating select, we will let that - // compiler handle the building of the select clauses, as it will need some - // more syntax that is best handled by that function to keep things neat. - if (! is_null($query->aggregate)) { - return; - } - - if (is_array($query->distinct)) { - $select = 'select distinct on ('.$this->columnize($query->distinct).') '; - } elseif ($query->distinct) { - $select = 'select distinct '; - } else { - $select = 'select '; - } - - return $select.$this->columnize($columns); - } - - /** - * Compile a "JSON contains" statement into SQL. - * - * @param string $column - * @param string $value - * @return string - */ - protected function compileJsonContains($column, $value) - { - $column = str_replace('->>', '->', $this->wrap($column)); - - return '('.$column.')::jsonb @> '.$value; - } - - /** - * Compile a "JSON contains key" statement into SQL. - * - * @param string $column - * @return string - */ - protected function compileJsonContainsKey($column) - { - $segments = explode('->', $column); - - $lastSegment = array_pop($segments); - - if (filter_var($lastSegment, FILTER_VALIDATE_INT) !== false) { - $i = $lastSegment; - } elseif (preg_match('/\[(-?[0-9]+)\]$/', $lastSegment, $matches)) { - $segments[] = Str::beforeLast($lastSegment, $matches[0]); - - $i = $matches[1]; - } - - $column = str_replace('->>', '->', $this->wrap(implode('->', $segments))); - - if (isset($i)) { - return vsprintf('case when %s then %s else false end', [ - 'jsonb_typeof(('.$column.")::jsonb) = 'array'", - 'jsonb_array_length(('.$column.')::jsonb) >= '.($i < 0 ? abs($i) : $i + 1), - ]); - } - - $key = "'".str_replace("'", "''", $lastSegment)."'"; - - return 'coalesce(('.$column.')::jsonb ?? '.$key.', false)'; - } - - /** - * Compile a "JSON length" statement into SQL. - * - * @param string $column - * @param string $operator - * @param string $value - * @return string - */ - protected function compileJsonLength($column, $operator, $value) - { - $column = str_replace('->>', '->', $this->wrap($column)); - - return 'jsonb_array_length(('.$column.')::jsonb) '.$operator.' '.$value; - } - - /** - * Compile a single having clause. - * - * @param array $having - * @return string - */ - protected function compileHaving(array $having) - { - if ($having['type'] === 'Bitwise') { - return $this->compileHavingBitwise($having); - } - - return parent::compileHaving($having); - } - - /** - * Compile a having clause involving a bitwise operator. - * - * @param array $having - * @return string - */ - protected function compileHavingBitwise($having) - { - $column = $this->wrap($having['column']); - - $parameter = $this->parameter($having['value']); - - return '('.$column.' '.$having['operator'].' '.$parameter.')::bool'; - } - - /** - * Compile the lock into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param bool|string $value - * @return string - */ - protected function compileLock(Builder $query, $value) - { - if (! is_string($value)) { - return $value ? 'for update' : 'for share'; - } - - return $value; - } - - /** - * Compile an insert ignore statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileInsertOrIgnore(Builder $query, array $values) - { - return $this->compileInsert($query, $values).' on conflict do nothing'; - } - - /** - * Compile an insert and get ID statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param string $sequence - * @return string - */ - public function compileInsertGetId(Builder $query, $values, $sequence) - { - return $this->compileInsert($query, $values).' returning '.$this->wrap($sequence ?: 'id'); - } - - /** - * Compile an update statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileUpdate(Builder $query, array $values) - { - if (isset($query->joins) || isset($query->limit)) { - return $this->compileUpdateWithJoinsOrLimit($query, $values); - } - - return parent::compileUpdate($query, $values); - } - - /** - * Compile the columns for an update statement. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - protected function compileUpdateColumns(Builder $query, array $values) - { - return collect($values)->map(function ($value, $key) { - $column = last(explode('.', $key)); - - if ($this->isJsonSelector($key)) { - return $this->compileJsonUpdateColumn($column, $value); - } - - return $this->wrap($column).' = '.$this->parameter($value); - })->implode(', '); - } - - /** - * Compile an "upsert" statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param array $uniqueBy - * @param array $update - * @return string - */ - public function compileUpsert(Builder $query, array $values, array $uniqueBy, array $update) - { - $sql = $this->compileInsert($query, $values); - - $sql .= ' on conflict ('.$this->columnize($uniqueBy).') do update set '; - - $columns = collect($update)->map(function ($value, $key) { - return is_numeric($key) - ? $this->wrap($value).' = '.$this->wrapValue('excluded').'.'.$this->wrap($value) - : $this->wrap($key).' = '.$this->parameter($value); - })->implode(', '); - - return $sql.$columns; - } - - /** - * Prepares a JSON column being updated using the JSONB_SET function. - * - * @param string $key - * @param mixed $value - * @return string - */ - protected function compileJsonUpdateColumn($key, $value) - { - $segments = explode('->', $key); - - $field = $this->wrap(array_shift($segments)); - - $path = "'{".implode(',', $this->wrapJsonPathAttributes($segments, '"'))."}'"; - - return "{$field} = jsonb_set({$field}::jsonb, {$path}, {$this->parameter($value)})"; - } - - /** - * Compile an update from statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileUpdateFrom(Builder $query, $values) - { - $table = $this->wrapTable($query->from); - - // Each one of the columns in the update statements needs to be wrapped in the - // keyword identifiers, also a place-holder needs to be created for each of - // the values in the list of bindings so we can make the sets statements. - $columns = $this->compileUpdateColumns($query, $values); - - $from = ''; - - if (isset($query->joins)) { - // When using Postgres, updates with joins list the joined tables in the from - // clause, which is different than other systems like MySQL. Here, we will - // compile out the tables that are joined and add them to a from clause. - $froms = collect($query->joins)->map(function ($join) { - return $this->wrapTable($join->table); - })->all(); - - if (count($froms) > 0) { - $from = ' from '.implode(', ', $froms); - } - } - - $where = $this->compileUpdateWheres($query); - - return trim("update {$table} set {$columns}{$from} {$where}"); - } - - /** - * Compile the additional where clauses for updates with joins. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileUpdateWheres(Builder $query) - { - $baseWheres = $this->compileWheres($query); - - if (! isset($query->joins)) { - return $baseWheres; - } - - // Once we compile the join constraints, we will either use them as the where - // clause or append them to the existing base where clauses. If we need to - // strip the leading boolean we will do so when using as the only where. - $joinWheres = $this->compileUpdateJoinWheres($query); - - if (trim($baseWheres) == '') { - return 'where '.$this->removeLeadingBoolean($joinWheres); - } - - return $baseWheres.' '.$joinWheres; - } - - /** - * Compile the "join" clause where clauses for an update. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileUpdateJoinWheres(Builder $query) - { - $joinWheres = []; - - // Here we will just loop through all of the join constraints and compile them - // all out then implode them. This should give us "where" like syntax after - // everything has been built and then we will join it to the real wheres. - foreach ($query->joins as $join) { - foreach ($join->wheres as $where) { - $method = "where{$where['type']}"; - - $joinWheres[] = $where['boolean'].' '.$this->$method($query, $where); - } - } - - return implode(' ', $joinWheres); - } - - /** - * Prepare the bindings for an update statement. - * - * @param array $bindings - * @param array $values - * @return array - */ - public function prepareBindingsForUpdateFrom(array $bindings, array $values) - { - $values = collect($values)->map(function ($value, $column) { - return is_array($value) || ($this->isJsonSelector($column) && ! $this->isExpression($value)) - ? json_encode($value) - : $value; - })->all(); - - $bindingsWithoutWhere = Arr::except($bindings, ['select', 'where']); - - return array_values( - array_merge($values, $bindings['where'], Arr::flatten($bindingsWithoutWhere)) - ); - } - - /** - * Compile an update statement with joins or limit into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - protected function compileUpdateWithJoinsOrLimit(Builder $query, array $values) - { - $table = $this->wrapTable($query->from); - - $columns = $this->compileUpdateColumns($query, $values); - - $alias = last(preg_split('/\s+as\s+/i', $query->from)); - - $selectSql = $this->compileSelect($query->select($alias.'.ctid')); - - return "update {$table} set {$columns} where {$this->wrap('ctid')} in ({$selectSql})"; - } - - /** - * Prepare the bindings for an update statement. - * - * @param array $bindings - * @param array $values - * @return array - */ - public function prepareBindingsForUpdate(array $bindings, array $values) - { - $values = collect($values)->map(function ($value, $column) { - return is_array($value) || ($this->isJsonSelector($column) && ! $this->isExpression($value)) - ? json_encode($value) - : $value; - })->all(); - - $cleanBindings = Arr::except($bindings, 'select'); - - return array_values( - array_merge($values, Arr::flatten($cleanBindings)) - ); - } - - /** - * Compile a delete statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileDelete(Builder $query) - { - if (isset($query->joins) || isset($query->limit)) { - return $this->compileDeleteWithJoinsOrLimit($query); - } - - return parent::compileDelete($query); - } - - /** - * Compile a delete statement with joins or limit into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileDeleteWithJoinsOrLimit(Builder $query) - { - $table = $this->wrapTable($query->from); - - $alias = last(preg_split('/\s+as\s+/i', $query->from)); - - $selectSql = $this->compileSelect($query->select($alias.'.ctid')); - - return "delete from {$table} where {$this->wrap('ctid')} in ({$selectSql})"; - } - - /** - * Compile a truncate table statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - public function compileTruncate(Builder $query) - { - return ['truncate '.$this->wrapTable($query->from).' restart identity cascade' => []]; - } - - /** - * Wrap the given JSON selector. - * - * @param string $value - * @return string - */ - protected function wrapJsonSelector($value) - { - $path = explode('->', $value); - - $field = $this->wrapSegments(explode('.', array_shift($path))); - - $wrappedPath = $this->wrapJsonPathAttributes($path); - - $attribute = array_pop($wrappedPath); - - if (! empty($wrappedPath)) { - return $field.'->'.implode('->', $wrappedPath).'->>'.$attribute; - } - - return $field.'->>'.$attribute; - } - - /** - * Wrap the given JSON selector for boolean values. - * - * @param string $value - * @return string - */ - protected function wrapJsonBooleanSelector($value) - { - $selector = str_replace( - '->>', '->', - $this->wrapJsonSelector($value) - ); - - return '('.$selector.')::jsonb'; - } - - /** - * Wrap the given JSON boolean value. - * - * @param string $value - * @return string - */ - protected function wrapJsonBooleanValue($value) - { - return "'".$value."'::jsonb"; - } - - /** - * Wrap the attributes of the given JSON path. - * - * @param array $path - * @return array - */ - protected function wrapJsonPathAttributes($path) - { - $quote = func_num_args() === 2 ? func_get_arg(1) : "'"; - - return collect($path)->map(function ($attribute) { - return $this->parseJsonPathArrayKeys($attribute); - })->collapse()->map(function ($attribute) use ($quote) { - return filter_var($attribute, FILTER_VALIDATE_INT) !== false - ? $attribute - : $quote.$attribute.$quote; - })->all(); - } - - /** - * Parse the given JSON path attribute for array keys. - * - * @param string $attribute - * @return array - */ - protected function parseJsonPathArrayKeys($attribute) - { - if (preg_match('/(\[[^\]]+\])+$/', $attribute, $parts)) { - $key = Str::beforeLast($attribute, $parts[0]); - - preg_match_all('/\[([^\]]+)\]/', $parts[0], $keys); - - return collect([$key]) - ->merge($keys[1]) - ->diff('') - ->values() - ->all(); - } - - return [$attribute]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php b/framework-9.50.2/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php deleted file mode 100755 index 81b890b..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php +++ /dev/null @@ -1,355 +0,0 @@ -', '<=', '>=', '<>', '!=', - 'like', 'not like', 'ilike', - '&', '|', '<<', '>>', - ]; - - /** - * Compile the lock into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param bool|string $value - * @return string - */ - protected function compileLock(Builder $query, $value) - { - return ''; - } - - /** - * Wrap a union subquery in parentheses. - * - * @param string $sql - * @return string - */ - protected function wrapUnion($sql) - { - return 'select * from ('.$sql.')'; - } - - /** - * Compile a "where date" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDate(Builder $query, $where) - { - return $this->dateBasedWhere('%Y-%m-%d', $query, $where); - } - - /** - * Compile a "where day" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDay(Builder $query, $where) - { - return $this->dateBasedWhere('%d', $query, $where); - } - - /** - * Compile a "where month" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereMonth(Builder $query, $where) - { - return $this->dateBasedWhere('%m', $query, $where); - } - - /** - * Compile a "where year" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereYear(Builder $query, $where) - { - return $this->dateBasedWhere('%Y', $query, $where); - } - - /** - * Compile a "where time" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereTime(Builder $query, $where) - { - return $this->dateBasedWhere('%H:%M:%S', $query, $where); - } - - /** - * Compile a date based where clause. - * - * @param string $type - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function dateBasedWhere($type, Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return "strftime('{$type}', {$this->wrap($where['column'])}) {$where['operator']} cast({$value} as text)"; - } - - /** - * Compile a "JSON length" statement into SQL. - * - * @param string $column - * @param string $operator - * @param string $value - * @return string - */ - protected function compileJsonLength($column, $operator, $value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($column); - - return 'json_array_length('.$field.$path.') '.$operator.' '.$value; - } - - /** - * Compile a "JSON contains key" statement into SQL. - * - * @param string $column - * @return string - */ - protected function compileJsonContainsKey($column) - { - [$field, $path] = $this->wrapJsonFieldAndPath($column); - - return 'json_type('.$field.$path.') is not null'; - } - - /** - * Compile an update statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileUpdate(Builder $query, array $values) - { - if (isset($query->joins) || isset($query->limit)) { - return $this->compileUpdateWithJoinsOrLimit($query, $values); - } - - return parent::compileUpdate($query, $values); - } - - /** - * Compile an insert ignore statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - public function compileInsertOrIgnore(Builder $query, array $values) - { - return Str::replaceFirst('insert', 'insert or ignore', $this->compileInsert($query, $values)); - } - - /** - * Compile the columns for an update statement. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - protected function compileUpdateColumns(Builder $query, array $values) - { - $jsonGroups = $this->groupJsonColumnsForUpdate($values); - - return collect($values)->reject(function ($value, $key) { - return $this->isJsonSelector($key); - })->merge($jsonGroups)->map(function ($value, $key) use ($jsonGroups) { - $column = last(explode('.', $key)); - - $value = isset($jsonGroups[$key]) ? $this->compileJsonPatch($column, $value) : $this->parameter($value); - - return $this->wrap($column).' = '.$value; - })->implode(', '); - } - - /** - * Compile an "upsert" statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param array $uniqueBy - * @param array $update - * @return string - */ - public function compileUpsert(Builder $query, array $values, array $uniqueBy, array $update) - { - $sql = $this->compileInsert($query, $values); - - $sql .= ' on conflict ('.$this->columnize($uniqueBy).') do update set '; - - $columns = collect($update)->map(function ($value, $key) { - return is_numeric($key) - ? $this->wrap($value).' = '.$this->wrapValue('excluded').'.'.$this->wrap($value) - : $this->wrap($key).' = '.$this->parameter($value); - })->implode(', '); - - return $sql.$columns; - } - - /** - * Group the nested JSON columns. - * - * @param array $values - * @return array - */ - protected function groupJsonColumnsForUpdate(array $values) - { - $groups = []; - - foreach ($values as $key => $value) { - if ($this->isJsonSelector($key)) { - Arr::set($groups, str_replace('->', '.', Str::after($key, '.')), $value); - } - } - - return $groups; - } - - /** - * Compile a "JSON" patch statement into SQL. - * - * @param string $column - * @param mixed $value - * @return string - */ - protected function compileJsonPatch($column, $value) - { - return "json_patch(ifnull({$this->wrap($column)}, json('{}')), json({$this->parameter($value)}))"; - } - - /** - * Compile an update statement with joins or limit into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @return string - */ - protected function compileUpdateWithJoinsOrLimit(Builder $query, array $values) - { - $table = $this->wrapTable($query->from); - - $columns = $this->compileUpdateColumns($query, $values); - - $alias = last(preg_split('/\s+as\s+/i', $query->from)); - - $selectSql = $this->compileSelect($query->select($alias.'.rowid')); - - return "update {$table} set {$columns} where {$this->wrap('rowid')} in ({$selectSql})"; - } - - /** - * Prepare the bindings for an update statement. - * - * @param array $bindings - * @param array $values - * @return array - */ - public function prepareBindingsForUpdate(array $bindings, array $values) - { - $groups = $this->groupJsonColumnsForUpdate($values); - - $values = collect($values)->reject(function ($value, $key) { - return $this->isJsonSelector($key); - })->merge($groups)->map(function ($value) { - return is_array($value) ? json_encode($value) : $value; - })->all(); - - $cleanBindings = Arr::except($bindings, 'select'); - - return array_values( - array_merge($values, Arr::flatten($cleanBindings)) - ); - } - - /** - * Compile a delete statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileDelete(Builder $query) - { - if (isset($query->joins) || isset($query->limit)) { - return $this->compileDeleteWithJoinsOrLimit($query); - } - - return parent::compileDelete($query); - } - - /** - * Compile a delete statement with joins or limit into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileDeleteWithJoinsOrLimit(Builder $query) - { - $table = $this->wrapTable($query->from); - - $alias = last(preg_split('/\s+as\s+/i', $query->from)); - - $selectSql = $this->compileSelect($query->select($alias.'.rowid')); - - return "delete from {$table} where {$this->wrap('rowid')} in ({$selectSql})"; - } - - /** - * Compile a truncate table statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - public function compileTruncate(Builder $query) - { - return [ - 'delete from sqlite_sequence where name = ?' => [$query->from], - 'delete from '.$this->wrapTable($query->from) => [], - ]; - } - - /** - * Wrap the given JSON selector. - * - * @param string $value - * @return string - */ - protected function wrapJsonSelector($value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($value); - - return 'json_extract('.$field.$path.')'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php b/framework-9.50.2/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php deleted file mode 100755 index 222a2f1..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php +++ /dev/null @@ -1,620 +0,0 @@ -', '<=', '>=', '!<', '!>', '<>', '!=', - 'like', 'not like', 'ilike', - '&', '&=', '|', '|=', '^', '^=', - ]; - - /** - * Compile a select query into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileSelect(Builder $query) - { - if (! $query->offset) { - return parent::compileSelect($query); - } - - if (is_null($query->columns)) { - $query->columns = ['*']; - } - - $components = $this->compileComponents($query); - - if (! empty($components['orders'])) { - return parent::compileSelect($query)." offset {$query->offset} rows fetch next {$query->limit} rows only"; - } - - // If an offset is present on the query, we will need to wrap the query in - // a big "ANSI" offset syntax block. This is very nasty compared to the - // other database systems but is necessary for implementing features. - return $this->compileAnsiOffset( - $query, $components - ); - } - - /** - * Compile the "select *" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $columns - * @return string|null - */ - protected function compileColumns(Builder $query, $columns) - { - if (! is_null($query->aggregate)) { - return; - } - - $select = $query->distinct ? 'select distinct ' : 'select '; - - // If there is a limit on the query, but not an offset, we will add the top - // clause to the query, which serves as a "limit" type clause within the - // SQL Server system similar to the limit keywords available in MySQL. - if (is_numeric($query->limit) && $query->limit > 0 && $query->offset <= 0) { - $select .= 'top '.((int) $query->limit).' '; - } - - return $select.$this->columnize($columns); - } - - /** - * Compile the "from" portion of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @return string - */ - protected function compileFrom(Builder $query, $table) - { - $from = parent::compileFrom($query, $table); - - if (is_string($query->lock)) { - return $from.' '.$query->lock; - } - - if (! is_null($query->lock)) { - return $from.' with(rowlock,'.($query->lock ? 'updlock,' : '').'holdlock)'; - } - - return $from; - } - - /** - * {@inheritdoc} - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBitwise(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - $operator = str_replace('?', '??', $where['operator']); - - return '('.$this->wrap($where['column']).' '.$operator.' '.$value.') != 0'; - } - - /** - * Compile a "where date" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereDate(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value; - } - - /** - * Compile a "where time" clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereTime(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - return 'cast('.$this->wrap($where['column']).' as time) '.$where['operator'].' '.$value; - } - - /** - * Compile a "JSON contains" statement into SQL. - * - * @param string $column - * @param string $value - * @return string - */ - protected function compileJsonContains($column, $value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($column); - - return $value.' in (select [value] from openjson('.$field.$path.'))'; - } - - /** - * Prepare the binding for a "JSON contains" statement. - * - * @param mixed $binding - * @return string - */ - public function prepareBindingForJsonContains($binding) - { - return is_bool($binding) ? json_encode($binding) : $binding; - } - - /** - * Compile a "JSON contains key" statement into SQL. - * - * @param string $column - * @return string - */ - protected function compileJsonContainsKey($column) - { - $segments = explode('->', $column); - - $lastSegment = array_pop($segments); - - if (preg_match('/\[([0-9]+)\]$/', $lastSegment, $matches)) { - $segments[] = Str::beforeLast($lastSegment, $matches[0]); - - $key = $matches[1]; - } else { - $key = "'".str_replace("'", "''", $lastSegment)."'"; - } - - [$field, $path] = $this->wrapJsonFieldAndPath(implode('->', $segments)); - - return $key.' in (select [key] from openjson('.$field.$path.'))'; - } - - /** - * Compile a "JSON length" statement into SQL. - * - * @param string $column - * @param string $operator - * @param string $value - * @return string - */ - protected function compileJsonLength($column, $operator, $value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($column); - - return '(select count(*) from openjson('.$field.$path.')) '.$operator.' '.$value; - } - - /** - * Compile a "JSON value cast" statement into SQL. - * - * @param string $value - * @return string - */ - public function compileJsonValueCast($value) - { - return 'json_query('.$value.')'; - } - - /** - * Compile a single having clause. - * - * @param array $having - * @return string - */ - protected function compileHaving(array $having) - { - if ($having['type'] === 'Bitwise') { - return $this->compileHavingBitwise($having); - } - - return parent::compileHaving($having); - } - - /** - * Compile a having clause involving a bitwise operator. - * - * @param array $having - * @return string - */ - protected function compileHavingBitwise($having) - { - $column = $this->wrap($having['column']); - - $parameter = $this->parameter($having['value']); - - return '('.$column.' '.$having['operator'].' '.$parameter.') != 0'; - } - - /** - * Create a full ANSI offset clause for the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $components - * @return string - */ - protected function compileAnsiOffset(Builder $query, $components) - { - // An ORDER BY clause is required to make this offset query work, so if one does - // not exist we'll just create a dummy clause to trick the database and so it - // does not complain about the queries for not having an "order by" clause. - if (empty($components['orders'])) { - $components['orders'] = 'order by (select 0)'; - } - - // We need to add the row number to the query so we can compare it to the offset - // and limit values given for the statements. So we will add an expression to - // the "select" that will give back the row numbers on each of the records. - $components['columns'] .= $this->compileOver($components['orders']); - - unset($components['orders']); - - if ($this->queryOrderContainsSubquery($query)) { - $query->bindings = $this->sortBindingsForSubqueryOrderBy($query); - } - - // Next we need to calculate the constraints that should be placed on the query - // to get the right offset and limit from our query but if there is no limit - // set we will just handle the offset only since that is all that matters. - $sql = $this->concatenate($components); - - return $this->compileTableExpression($sql, $query); - } - - /** - * Compile the over statement for a table expression. - * - * @param string $orderings - * @return string - */ - protected function compileOver($orderings) - { - return ", row_number() over ({$orderings}) as row_num"; - } - - /** - * Determine if the query's order by clauses contain a subquery. - * - * @param \Illuminate\Database\Query\Builder $query - * @return bool - */ - protected function queryOrderContainsSubquery($query) - { - if (! is_array($query->orders)) { - return false; - } - - return Arr::first($query->orders, function ($value) { - return $this->isExpression($value['column'] ?? null); - }, false) !== false; - } - - /** - * Move the order bindings to be after the "select" statement to account for an order by subquery. - * - * @param \Illuminate\Database\Query\Builder $query - * @return array - */ - protected function sortBindingsForSubqueryOrderBy($query) - { - return Arr::sort($query->bindings, function ($bindings, $key) { - return array_search($key, ['select', 'order', 'from', 'join', 'where', 'groupBy', 'having', 'union', 'unionOrder']); - }); - } - - /** - * Compile a common table expression for a query. - * - * @param string $sql - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileTableExpression($sql, $query) - { - $constraint = $this->compileRowConstraint($query); - - return "select * from ({$sql}) as temp_table where row_num {$constraint} order by row_num"; - } - - /** - * Compile the limit / offset row constraint for a query. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - protected function compileRowConstraint($query) - { - $start = (int) $query->offset + 1; - - if ($query->limit > 0) { - $finish = (int) $query->offset + (int) $query->limit; - - return "between {$start} and {$finish}"; - } - - return ">= {$start}"; - } - - /** - * Compile a delete statement without joins into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param string $where - * @return string - */ - protected function compileDeleteWithoutJoins(Builder $query, $table, $where) - { - $sql = parent::compileDeleteWithoutJoins($query, $table, $where); - - return ! is_null($query->limit) && $query->limit > 0 && $query->offset <= 0 - ? Str::replaceFirst('delete', 'delete top ('.$query->limit.')', $sql) - : $sql; - } - - /** - * Compile the random statement into SQL. - * - * @param string|int $seed - * @return string - */ - public function compileRandom($seed) - { - return 'NEWID()'; - } - - /** - * Compile the "limit" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $limit - * @return string - */ - protected function compileLimit(Builder $query, $limit) - { - return ''; - } - - /** - * Compile the "offset" portions of the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param int $offset - * @return string - */ - protected function compileOffset(Builder $query, $offset) - { - return ''; - } - - /** - * Compile the lock into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param bool|string $value - * @return string - */ - protected function compileLock(Builder $query, $value) - { - return ''; - } - - /** - * Wrap a union subquery in parentheses. - * - * @param string $sql - * @return string - */ - protected function wrapUnion($sql) - { - return 'select * from ('.$sql.') as '.$this->wrapTable('temp_table'); - } - - /** - * Compile an exists statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @return string - */ - public function compileExists(Builder $query) - { - $existsQuery = clone $query; - - $existsQuery->columns = []; - - return $this->compileSelect($existsQuery->selectRaw('1 [exists]')->limit(1)); - } - - /** - * Compile an update statement with joins into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $table - * @param string $columns - * @param string $where - * @return string - */ - protected function compileUpdateWithJoins(Builder $query, $table, $columns, $where) - { - $alias = last(explode(' as ', $table)); - - $joins = $this->compileJoins($query, $query->joins); - - return "update {$alias} set {$columns} from {$table} {$joins} {$where}"; - } - - /** - * Compile an "upsert" statement into SQL. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $values - * @param array $uniqueBy - * @param array $update - * @return string - */ - public function compileUpsert(Builder $query, array $values, array $uniqueBy, array $update) - { - $columns = $this->columnize(array_keys(reset($values))); - - $sql = 'merge '.$this->wrapTable($query->from).' '; - - $parameters = collect($values)->map(function ($record) { - return '('.$this->parameterize($record).')'; - })->implode(', '); - - $sql .= 'using (values '.$parameters.') '.$this->wrapTable('laravel_source').' ('.$columns.') '; - - $on = collect($uniqueBy)->map(function ($column) use ($query) { - return $this->wrap('laravel_source.'.$column).' = '.$this->wrap($query->from.'.'.$column); - })->implode(' and '); - - $sql .= 'on '.$on.' '; - - if ($update) { - $update = collect($update)->map(function ($value, $key) { - return is_numeric($key) - ? $this->wrap($value).' = '.$this->wrap('laravel_source.'.$value) - : $this->wrap($key).' = '.$this->parameter($value); - })->implode(', '); - - $sql .= 'when matched then update set '.$update.' '; - } - - $sql .= 'when not matched then insert ('.$columns.') values ('.$columns.');'; - - return $sql; - } - - /** - * Prepare the bindings for an update statement. - * - * @param array $bindings - * @param array $values - * @return array - */ - public function prepareBindingsForUpdate(array $bindings, array $values) - { - $cleanBindings = Arr::except($bindings, 'select'); - - return array_values( - array_merge($values, Arr::flatten($cleanBindings)) - ); - } - - /** - * Compile the SQL statement to define a savepoint. - * - * @param string $name - * @return string - */ - public function compileSavepoint($name) - { - return 'SAVE TRANSACTION '.$name; - } - - /** - * Compile the SQL statement to execute a savepoint rollback. - * - * @param string $name - * @return string - */ - public function compileSavepointRollBack($name) - { - return 'ROLLBACK TRANSACTION '.$name; - } - - /** - * Get the format for database stored dates. - * - * @return string - */ - public function getDateFormat() - { - return 'Y-m-d H:i:s.v'; - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - return $value === '*' ? $value : '['.str_replace(']', ']]', $value).']'; - } - - /** - * Wrap the given JSON selector. - * - * @param string $value - * @return string - */ - protected function wrapJsonSelector($value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($value); - - return 'json_value('.$field.$path.')'; - } - - /** - * Wrap the given JSON boolean value. - * - * @param string $value - * @return string - */ - protected function wrapJsonBooleanValue($value) - { - return "'".$value."'"; - } - - /** - * Wrap a table in keyword identifiers. - * - * @param \Illuminate\Database\Query\Expression|string $table - * @return string - */ - public function wrapTable($table) - { - if (! $this->isExpression($table)) { - return $this->wrapTableValuedFunction(parent::wrapTable($table)); - } - - return $this->getValue($table); - } - - /** - * Wrap a table in keyword identifiers. - * - * @param string $table - * @return string - */ - protected function wrapTableValuedFunction($table) - { - if (preg_match('/^(.+?)(\(.*?\))]$/', $table, $matches) === 1) { - $table = $matches[1].']'.$matches[2]; - } - - return $table; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/JoinClause.php b/framework-9.50.2/src/Illuminate/Database/Query/JoinClause.php deleted file mode 100755 index 57d650a..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/JoinClause.php +++ /dev/null @@ -1,146 +0,0 @@ -type = $type; - $this->table = $table; - $this->parentClass = get_class($parentQuery); - $this->parentGrammar = $parentQuery->getGrammar(); - $this->parentProcessor = $parentQuery->getProcessor(); - $this->parentConnection = $parentQuery->getConnection(); - - parent::__construct( - $this->parentConnection, $this->parentGrammar, $this->parentProcessor - ); - } - - /** - * Add an "on" clause to the join. - * - * On clauses can be chained, e.g. - * - * $join->on('contacts.user_id', '=', 'users.id') - * ->on('contacts.info_id', '=', 'info.id') - * - * will produce the following SQL: - * - * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` - * - * @param \Closure|string $first - * @param string|null $operator - * @param \Illuminate\Database\Query\Expression|string|null $second - * @param string $boolean - * @return $this - * - * @throws \InvalidArgumentException - */ - public function on($first, $operator = null, $second = null, $boolean = 'and') - { - if ($first instanceof Closure) { - return $this->whereNested($first, $boolean); - } - - return $this->whereColumn($first, $operator, $second, $boolean); - } - - /** - * Add an "or on" clause to the join. - * - * @param \Closure|string $first - * @param string|null $operator - * @param \Illuminate\Database\Query\Expression|string|null $second - * @return \Illuminate\Database\Query\JoinClause - */ - public function orOn($first, $operator = null, $second = null) - { - return $this->on($first, $operator, $second, 'or'); - } - - /** - * Get a new instance of the join clause builder. - * - * @return \Illuminate\Database\Query\JoinClause - */ - public function newQuery() - { - return new static($this->newParentQuery(), $this->type, $this->table); - } - - /** - * Create a new query instance for sub-query. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function forSubQuery() - { - return $this->newParentQuery()->newQuery(); - } - - /** - * Create a new parent query instance. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function newParentQuery() - { - $class = $this->parentClass; - - return new $class($this->parentConnection, $this->parentGrammar, $this->parentProcessor); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Processors/MySqlProcessor.php b/framework-9.50.2/src/Illuminate/Database/Query/Processors/MySqlProcessor.php deleted file mode 100644 index ce91838..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Processors/MySqlProcessor.php +++ /dev/null @@ -1,19 +0,0 @@ -column_name; - }, $results); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Processors/PostgresProcessor.php b/framework-9.50.2/src/Illuminate/Database/Query/Processors/PostgresProcessor.php deleted file mode 100755 index 5956a8f..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Processors/PostgresProcessor.php +++ /dev/null @@ -1,45 +0,0 @@ -getConnection(); - - $connection->recordsHaveBeenModified(); - - $result = $connection->selectFromWriteConnection($sql, $values)[0]; - - $sequence = $sequence ?: 'id'; - - $id = is_object($result) ? $result->{$sequence} : $result[$sequence]; - - return is_numeric($id) ? (int) $id : $id; - } - - /** - * Process the results of a column listing query. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return array_map(function ($result) { - return ((object) $result)->column_name; - }, $results); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Processors/Processor.php b/framework-9.50.2/src/Illuminate/Database/Query/Processors/Processor.php deleted file mode 100755 index 0069b43..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Processors/Processor.php +++ /dev/null @@ -1,49 +0,0 @@ -getConnection()->insert($sql, $values); - - $id = $query->getConnection()->getPdo()->lastInsertId($sequence); - - return is_numeric($id) ? (int) $id : $id; - } - - /** - * Process the results of a column listing query. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return $results; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php b/framework-9.50.2/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php deleted file mode 100644 index 65da1df..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php +++ /dev/null @@ -1,19 +0,0 @@ -name; - }, $results); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php b/framework-9.50.2/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php deleted file mode 100755 index 49476f0..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php +++ /dev/null @@ -1,70 +0,0 @@ -getConnection(); - - $connection->insert($sql, $values); - - if ($connection->getConfig('odbc') === true) { - $id = $this->processInsertGetIdForOdbc($connection); - } else { - $id = $connection->getPdo()->lastInsertId(); - } - - return is_numeric($id) ? (int) $id : $id; - } - - /** - * Process an "insert get ID" query for ODBC. - * - * @param \Illuminate\Database\Connection $connection - * @return int - * - * @throws \Exception - */ - protected function processInsertGetIdForOdbc(Connection $connection) - { - $result = $connection->selectFromWriteConnection( - 'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid' - ); - - if (! $result) { - throw new Exception('Unable to retrieve lastInsertID for ODBC.'); - } - - $row = $result[0]; - - return is_object($row) ? $row->insertid : $row['insertid']; - } - - /** - * Process the results of a column listing query. - * - * @param array $results - * @return array - */ - public function processColumnListing($results) - { - return array_map(function ($result) { - return ((object) $result)->name; - }, $results); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/QueryException.php b/framework-9.50.2/src/Illuminate/Database/QueryException.php deleted file mode 100644 index 74e5a31..0000000 --- a/framework-9.50.2/src/Illuminate/Database/QueryException.php +++ /dev/null @@ -1,79 +0,0 @@ -sql = $sql; - $this->bindings = $bindings; - $this->code = $previous->getCode(); - $this->message = $this->formatMessage($sql, $bindings, $previous); - - if ($previous instanceof PDOException) { - $this->errorInfo = $previous->errorInfo; - } - } - - /** - * Format the SQL error message. - * - * @param string $sql - * @param array $bindings - * @param \Throwable $previous - * @return string - */ - protected function formatMessage($sql, $bindings, Throwable $previous) - { - return $previous->getMessage().' (SQL: '.Str::replaceArray('?', $bindings, $sql).')'; - } - - /** - * Get the SQL for the query. - * - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * Get the bindings for the query. - * - * @return array - */ - public function getBindings() - { - return $this->bindings; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/README.md b/framework-9.50.2/src/Illuminate/Database/README.md deleted file mode 100755 index 9019936..0000000 --- a/framework-9.50.2/src/Illuminate/Database/README.md +++ /dev/null @@ -1,69 +0,0 @@ -## Illuminate Database - -The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style ORM, and schema builder. It currently supports MySQL, Postgres, SQL Server, and SQLite. It also serves as the database layer of the Laravel PHP framework. - -### Usage Instructions - -First, create a new "Capsule" manager instance. Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible. - -```PHP -use Illuminate\Database\Capsule\Manager as Capsule; - -$capsule = new Capsule; - -$capsule->addConnection([ - 'driver' => 'mysql', - 'host' => 'localhost', - 'database' => 'database', - 'username' => 'root', - 'password' => 'password', - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', -]); - -// Set the event dispatcher used by Eloquent models... (optional) -use Illuminate\Events\Dispatcher; -use Illuminate\Container\Container; -$capsule->setEventDispatcher(new Dispatcher(new Container)); - -// Make this Capsule instance available globally via static methods... (optional) -$capsule->setAsGlobal(); - -// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) -$capsule->bootEloquent(); -``` - -> `composer require "illuminate/events"` required when you need to use observers with Eloquent. - -Once the Capsule instance has been registered. You may use it like so: - -**Using The Query Builder** - -```PHP -$users = Capsule::table('users')->where('votes', '>', 100)->get(); -``` -Other core methods may be accessed directly from the Capsule in the same manner as from the DB facade: -```PHP -$results = Capsule::select('select * from users where id = ?', [1]); -``` - -**Using The Schema Builder** - -```PHP -Capsule::schema()->create('users', function ($table) { - $table->increments('id'); - $table->string('email')->unique(); - $table->timestamps(); -}); -``` - -**Using The Eloquent ORM** - -```PHP -class User extends Illuminate\Database\Eloquent\Model {} - -$users = User::where('votes', '>', 1)->get(); -``` - -For further documentation on using the various database facilities this library provides, consult the [Laravel framework documentation](https://laravel.com/docs). diff --git a/framework-9.50.2/src/Illuminate/Database/RecordsNotFoundException.php b/framework-9.50.2/src/Illuminate/Database/RecordsNotFoundException.php deleted file mode 100755 index 3e0d955..0000000 --- a/framework-9.50.2/src/Illuminate/Database/RecordsNotFoundException.php +++ /dev/null @@ -1,10 +0,0 @@ -getForeignKeyConstraintsConfigurationValue(); - - if ($enableForeignKeyConstraints === null) { - return; - } - - $enableForeignKeyConstraints - ? $this->getSchemaBuilder()->enableForeignKeyConstraints() - : $this->getSchemaBuilder()->disableForeignKeyConstraints(); - } - - /** - * Get the default query grammar instance. - * - * @return \Illuminate\Database\Query\Grammars\SQLiteGrammar - */ - protected function getDefaultQueryGrammar() - { - return $this->withTablePrefix(new QueryGrammar); - } - - /** - * Get a schema builder instance for the connection. - * - * @return \Illuminate\Database\Schema\SQLiteBuilder - */ - public function getSchemaBuilder() - { - if (is_null($this->schemaGrammar)) { - $this->useDefaultSchemaGrammar(); - } - - return new SQLiteBuilder($this); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\SQLiteGrammar - */ - protected function getDefaultSchemaGrammar() - { - return $this->withTablePrefix(new SchemaGrammar); - } - - /** - * Get the schema state for the connection. - * - * @param \Illuminate\Filesystem\Filesystem|null $files - * @param callable|null $processFactory - * - * @throws \RuntimeException - */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) - { - return new SqliteSchemaState($this, $files, $processFactory); - } - - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\SQLiteProcessor - */ - protected function getDefaultPostProcessor() - { - return new SQLiteProcessor; - } - - /** - * Get the Doctrine DBAL driver. - * - * @return \Illuminate\Database\PDO\SQLiteDriver - */ - protected function getDoctrineDriver() - { - return new SQLiteDriver; - } - - /** - * Get the database connection foreign key constraints configuration option. - * - * @return bool|null - */ - protected function getForeignKeyConstraintsConfigurationValue() - { - return $this->getConfig('foreign_key_constraints'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/SQLiteDatabaseDoesNotExistException.php b/framework-9.50.2/src/Illuminate/Database/SQLiteDatabaseDoesNotExistException.php deleted file mode 100644 index f93cfe4..0000000 --- a/framework-9.50.2/src/Illuminate/Database/SQLiteDatabaseDoesNotExistException.php +++ /dev/null @@ -1,28 +0,0 @@ -path = $path; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Blueprint.php b/framework-9.50.2/src/Illuminate/Database/Schema/Blueprint.php deleted file mode 100755 index 3ea7d15..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Blueprint.php +++ /dev/null @@ -1,1829 +0,0 @@ -table = $table; - $this->prefix = $prefix; - - if (! is_null($callback)) { - $callback($this); - } - } - - /** - * Execute the blueprint against the database. - * - * @param \Illuminate\Database\Connection $connection - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @return void - */ - public function build(Connection $connection, Grammar $grammar) - { - foreach ($this->toSql($connection, $grammar) as $statement) { - $connection->statement($statement); - } - } - - /** - * Get the raw SQL statements for the blueprint. - * - * @param \Illuminate\Database\Connection $connection - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @return array - */ - public function toSql(Connection $connection, Grammar $grammar) - { - $this->addImpliedCommands($grammar); - - $statements = []; - - // Each type of command has a corresponding compiler function on the schema - // grammar which is used to build the necessary SQL statements to build - // the blueprint element, so we'll just call that compilers function. - $this->ensureCommandsAreValid($connection); - - foreach ($this->commands as $command) { - $method = 'compile'.ucfirst($command->name); - - if (method_exists($grammar, $method) || $grammar::hasMacro($method)) { - if (! is_null($sql = $grammar->$method($this, $command, $connection))) { - $statements = array_merge($statements, (array) $sql); - } - } - } - - return $statements; - } - - /** - * Ensure the commands on the blueprint are valid for the connection type. - * - * @param \Illuminate\Database\Connection $connection - * @return void - * - * @throws \BadMethodCallException - */ - protected function ensureCommandsAreValid(Connection $connection) - { - if ($connection instanceof SQLiteConnection) { - if ($this->commandsNamed(['dropColumn', 'renameColumn'])->count() > 1 - && ! $connection->usingNativeSchemaOperations()) { - throw new BadMethodCallException( - "SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification." - ); - } - - if ($this->commandsNamed(['dropForeign'])->count() > 0) { - throw new BadMethodCallException( - "SQLite doesn't support dropping foreign keys (you would need to re-create the table)." - ); - } - } - } - - /** - * Get all of the commands matching the given names. - * - * @param array $names - * @return \Illuminate\Support\Collection - */ - protected function commandsNamed(array $names) - { - return collect($this->commands)->filter(function ($command) use ($names) { - return in_array($command->name, $names); - }); - } - - /** - * Add the commands that are implied by the blueprint's state. - * - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @return void - */ - protected function addImpliedCommands(Grammar $grammar) - { - if (count($this->getAddedColumns()) > 0 && ! $this->creating()) { - array_unshift($this->commands, $this->createCommand('add')); - } - - if (count($this->getChangedColumns()) > 0 && ! $this->creating()) { - array_unshift($this->commands, $this->createCommand('change')); - } - - $this->addFluentIndexes(); - - $this->addFluentCommands($grammar); - } - - /** - * Add the index commands fluently specified on columns. - * - * @return void - */ - protected function addFluentIndexes() - { - foreach ($this->columns as $column) { - foreach (['primary', 'unique', 'index', 'fulltext', 'fullText', 'spatialIndex'] as $index) { - // If the index has been specified on the given column, but is simply equal - // to "true" (boolean), no name has been specified for this index so the - // index method can be called without a name and it will generate one. - if ($column->{$index} === true) { - $this->{$index}($column->name); - $column->{$index} = null; - - continue 2; - } - - // If the index has been specified on the given column, but it equals false - // and the column is supposed to be changed, we will call the drop index - // method with an array of column to drop it by its conventional name. - elseif ($column->{$index} === false && $column->change) { - $this->{'drop'.ucfirst($index)}([$column->name]); - $column->{$index} = null; - - continue 2; - } - - // If the index has been specified on the given column, and it has a string - // value, we'll go ahead and call the index method and pass the name for - // the index since the developer specified the explicit name for this. - elseif (isset($column->{$index})) { - $this->{$index}($column->name, $column->{$index}); - $column->{$index} = null; - - continue 2; - } - } - } - } - - /** - * Add the fluent commands specified on any columns. - * - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @return void - */ - public function addFluentCommands(Grammar $grammar) - { - foreach ($this->columns as $column) { - foreach ($grammar->getFluentCommands() as $commandName) { - $attributeName = lcfirst($commandName); - - if (! isset($column->{$attributeName})) { - continue; - } - - $value = $column->{$attributeName}; - - $this->addCommand( - $commandName, compact('value', 'column') - ); - } - } - } - - /** - * Determine if the blueprint has a create command. - * - * @return bool - */ - public function creating() - { - return collect($this->commands)->contains(function ($command) { - return $command->name === 'create'; - }); - } - - /** - * Indicate that the table needs to be created. - * - * @return \Illuminate\Support\Fluent - */ - public function create() - { - return $this->addCommand('create'); - } - - /** - * Indicate that the table needs to be temporary. - * - * @return void - */ - public function temporary() - { - $this->temporary = true; - } - - /** - * Indicate that the table should be dropped. - * - * @return \Illuminate\Support\Fluent - */ - public function drop() - { - return $this->addCommand('drop'); - } - - /** - * Indicate that the table should be dropped if it exists. - * - * @return \Illuminate\Support\Fluent - */ - public function dropIfExists() - { - return $this->addCommand('dropIfExists'); - } - - /** - * Indicate that the given columns should be dropped. - * - * @param array|mixed $columns - * @return \Illuminate\Support\Fluent - */ - public function dropColumn($columns) - { - $columns = is_array($columns) ? $columns : func_get_args(); - - return $this->addCommand('dropColumn', compact('columns')); - } - - /** - * Indicate that the given columns should be renamed. - * - * @param string $from - * @param string $to - * @return \Illuminate\Support\Fluent - */ - public function renameColumn($from, $to) - { - return $this->addCommand('renameColumn', compact('from', 'to')); - } - - /** - * Indicate that the given primary key should be dropped. - * - * @param string|array|null $index - * @return \Illuminate\Support\Fluent - */ - public function dropPrimary($index = null) - { - return $this->dropIndexCommand('dropPrimary', 'primary', $index); - } - - /** - * Indicate that the given unique key should be dropped. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropUnique($index) - { - return $this->dropIndexCommand('dropUnique', 'unique', $index); - } - - /** - * Indicate that the given index should be dropped. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropIndex($index) - { - return $this->dropIndexCommand('dropIndex', 'index', $index); - } - - /** - * Indicate that the given fulltext index should be dropped. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropFullText($index) - { - return $this->dropIndexCommand('dropFullText', 'fulltext', $index); - } - - /** - * Indicate that the given spatial index should be dropped. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropSpatialIndex($index) - { - return $this->dropIndexCommand('dropSpatialIndex', 'spatialIndex', $index); - } - - /** - * Indicate that the given foreign key should be dropped. - * - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - public function dropForeign($index) - { - return $this->dropIndexCommand('dropForeign', 'foreign', $index); - } - - /** - * Indicate that the given column and foreign key should be dropped. - * - * @param string $column - * @return \Illuminate\Support\Fluent - */ - public function dropConstrainedForeignId($column) - { - $this->dropForeign([$column]); - - return $this->dropColumn($column); - } - - /** - * Indicate that the given foreign key should be dropped. - * - * @param \Illuminate\Database\Eloquent\Model|string $model - * @param string|null $column - * @return \Illuminate\Support\Fluent - */ - public function dropForeignIdFor($model, $column = null) - { - if (is_string($model)) { - $model = new $model; - } - - return $this->dropForeign([$column ?: $model->getForeignKey()]); - } - - /** - * Indicate that the given foreign key should be dropped. - * - * @param \Illuminate\Database\Eloquent\Model|string $model - * @param string|null $column - * @return \Illuminate\Support\Fluent - */ - public function dropConstrainedForeignIdFor($model, $column = null) - { - if (is_string($model)) { - $model = new $model; - } - - return $this->dropConstrainedForeignId($column ?: $model->getForeignKey()); - } - - /** - * Indicate that the given indexes should be renamed. - * - * @param string $from - * @param string $to - * @return \Illuminate\Support\Fluent - */ - public function renameIndex($from, $to) - { - return $this->addCommand('renameIndex', compact('from', 'to')); - } - - /** - * Indicate that the timestamp columns should be dropped. - * - * @return void - */ - public function dropTimestamps() - { - $this->dropColumn('created_at', 'updated_at'); - } - - /** - * Indicate that the timestamp columns should be dropped. - * - * @return void - */ - public function dropTimestampsTz() - { - $this->dropTimestamps(); - } - - /** - * Indicate that the soft delete column should be dropped. - * - * @param string $column - * @return void - */ - public function dropSoftDeletes($column = 'deleted_at') - { - $this->dropColumn($column); - } - - /** - * Indicate that the soft delete column should be dropped. - * - * @param string $column - * @return void - */ - public function dropSoftDeletesTz($column = 'deleted_at') - { - $this->dropSoftDeletes($column); - } - - /** - * Indicate that the remember token column should be dropped. - * - * @return void - */ - public function dropRememberToken() - { - $this->dropColumn('remember_token'); - } - - /** - * Indicate that the polymorphic columns should be dropped. - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function dropMorphs($name, $indexName = null) - { - $this->dropIndex($indexName ?: $this->createIndexName('index', ["{$name}_type", "{$name}_id"])); - - $this->dropColumn("{$name}_type", "{$name}_id"); - } - - /** - * Rename the table to a given name. - * - * @param string $to - * @return \Illuminate\Support\Fluent - */ - public function rename($to) - { - return $this->addCommand('rename', compact('to')); - } - - /** - * Specify the primary key(s) for the table. - * - * @param string|array $columns - * @param string|null $name - * @param string|null $algorithm - * @return \Illuminate\Database\Schema\IndexDefinition - */ - public function primary($columns, $name = null, $algorithm = null) - { - return $this->indexCommand('primary', $columns, $name, $algorithm); - } - - /** - * Specify a unique index for the table. - * - * @param string|array $columns - * @param string|null $name - * @param string|null $algorithm - * @return \Illuminate\Database\Schema\IndexDefinition - */ - public function unique($columns, $name = null, $algorithm = null) - { - return $this->indexCommand('unique', $columns, $name, $algorithm); - } - - /** - * Specify an index for the table. - * - * @param string|array $columns - * @param string|null $name - * @param string|null $algorithm - * @return \Illuminate\Database\Schema\IndexDefinition - */ - public function index($columns, $name = null, $algorithm = null) - { - return $this->indexCommand('index', $columns, $name, $algorithm); - } - - /** - * Specify an fulltext for the table. - * - * @param string|array $columns - * @param string|null $name - * @param string|null $algorithm - * @return \Illuminate\Database\Schema\IndexDefinition - */ - public function fullText($columns, $name = null, $algorithm = null) - { - return $this->indexCommand('fulltext', $columns, $name, $algorithm); - } - - /** - * Specify a spatial index for the table. - * - * @param string|array $columns - * @param string|null $name - * @return \Illuminate\Database\Schema\IndexDefinition - */ - public function spatialIndex($columns, $name = null) - { - return $this->indexCommand('spatialIndex', $columns, $name); - } - - /** - * Specify a raw index for the table. - * - * @param string $expression - * @param string $name - * @return \Illuminate\Database\Schema\IndexDefinition - */ - public function rawIndex($expression, $name) - { - return $this->index([new Expression($expression)], $name); - } - - /** - * Specify a foreign key for the table. - * - * @param string|array $columns - * @param string|null $name - * @return \Illuminate\Database\Schema\ForeignKeyDefinition - */ - public function foreign($columns, $name = null) - { - $command = new ForeignKeyDefinition( - $this->indexCommand('foreign', $columns, $name)->getAttributes() - ); - - $this->commands[count($this->commands) - 1] = $command; - - return $command; - } - - /** - * Create a new auto-incrementing big integer (8-byte) column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function id($column = 'id') - { - return $this->bigIncrements($column); - } - - /** - * Create a new auto-incrementing integer (4-byte) column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function increments($column) - { - return $this->unsignedInteger($column, true); - } - - /** - * Create a new auto-incrementing integer (4-byte) column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function integerIncrements($column) - { - return $this->unsignedInteger($column, true); - } - - /** - * Create a new auto-incrementing tiny integer (1-byte) column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function tinyIncrements($column) - { - return $this->unsignedTinyInteger($column, true); - } - - /** - * Create a new auto-incrementing small integer (2-byte) column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function smallIncrements($column) - { - return $this->unsignedSmallInteger($column, true); - } - - /** - * Create a new auto-incrementing medium integer (3-byte) column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function mediumIncrements($column) - { - return $this->unsignedMediumInteger($column, true); - } - - /** - * Create a new auto-incrementing big integer (8-byte) column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function bigIncrements($column) - { - return $this->unsignedBigInteger($column, true); - } - - /** - * Create a new char column on the table. - * - * @param string $column - * @param int|null $length - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function char($column, $length = null) - { - $length = ! is_null($length) ? $length : Builder::$defaultStringLength; - - return $this->addColumn('char', $column, compact('length')); - } - - /** - * Create a new string column on the table. - * - * @param string $column - * @param int|null $length - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function string($column, $length = null) - { - $length = $length ?: Builder::$defaultStringLength; - - return $this->addColumn('string', $column, compact('length')); - } - - /** - * Create a new tiny text column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function tinyText($column) - { - return $this->addColumn('tinyText', $column); - } - - /** - * Create a new text column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function text($column) - { - return $this->addColumn('text', $column); - } - - /** - * Create a new medium text column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function mediumText($column) - { - return $this->addColumn('mediumText', $column); - } - - /** - * Create a new long text column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function longText($column) - { - return $this->addColumn('longText', $column); - } - - /** - * Create a new integer (4-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function integer($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('integer', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new tiny integer (1-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function tinyInteger($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('tinyInteger', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new small integer (2-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function smallInteger($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('smallInteger', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new medium integer (3-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function mediumInteger($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('mediumInteger', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new big integer (8-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @param bool $unsigned - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function bigInteger($column, $autoIncrement = false, $unsigned = false) - { - return $this->addColumn('bigInteger', $column, compact('autoIncrement', 'unsigned')); - } - - /** - * Create a new unsigned integer (4-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function unsignedInteger($column, $autoIncrement = false) - { - return $this->integer($column, $autoIncrement, true); - } - - /** - * Create a new unsigned tiny integer (1-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function unsignedTinyInteger($column, $autoIncrement = false) - { - return $this->tinyInteger($column, $autoIncrement, true); - } - - /** - * Create a new unsigned small integer (2-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function unsignedSmallInteger($column, $autoIncrement = false) - { - return $this->smallInteger($column, $autoIncrement, true); - } - - /** - * Create a new unsigned medium integer (3-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function unsignedMediumInteger($column, $autoIncrement = false) - { - return $this->mediumInteger($column, $autoIncrement, true); - } - - /** - * Create a new unsigned big integer (8-byte) column on the table. - * - * @param string $column - * @param bool $autoIncrement - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function unsignedBigInteger($column, $autoIncrement = false) - { - return $this->bigInteger($column, $autoIncrement, true); - } - - /** - * Create a new unsigned big integer (8-byte) column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ForeignIdColumnDefinition - */ - public function foreignId($column) - { - return $this->addColumnDefinition(new ForeignIdColumnDefinition($this, [ - 'type' => 'bigInteger', - 'name' => $column, - 'autoIncrement' => false, - 'unsigned' => true, - ])); - } - - /** - * Create a foreign ID column for the given model. - * - * @param \Illuminate\Database\Eloquent\Model|string $model - * @param string|null $column - * @return \Illuminate\Database\Schema\ForeignIdColumnDefinition - */ - public function foreignIdFor($model, $column = null) - { - if (is_string($model)) { - $model = new $model; - } - - return $model->getKeyType() === 'int' && $model->getIncrementing() - ? $this->foreignId($column ?: $model->getForeignKey()) - : $this->foreignUuid($column ?: $model->getForeignKey()); - } - - /** - * Create a new float column on the table. - * - * @param string $column - * @param int $total - * @param int $places - * @param bool $unsigned - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function float($column, $total = 8, $places = 2, $unsigned = false) - { - return $this->addColumn('float', $column, compact('total', 'places', 'unsigned')); - } - - /** - * Create a new double column on the table. - * - * @param string $column - * @param int|null $total - * @param int|null $places - * @param bool $unsigned - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function double($column, $total = null, $places = null, $unsigned = false) - { - return $this->addColumn('double', $column, compact('total', 'places', 'unsigned')); - } - - /** - * Create a new decimal column on the table. - * - * @param string $column - * @param int $total - * @param int $places - * @param bool $unsigned - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function decimal($column, $total = 8, $places = 2, $unsigned = false) - { - return $this->addColumn('decimal', $column, compact('total', 'places', 'unsigned')); - } - - /** - * Create a new unsigned float column on the table. - * - * @param string $column - * @param int $total - * @param int $places - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function unsignedFloat($column, $total = 8, $places = 2) - { - return $this->float($column, $total, $places, true); - } - - /** - * Create a new unsigned double column on the table. - * - * @param string $column - * @param int $total - * @param int $places - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function unsignedDouble($column, $total = null, $places = null) - { - return $this->double($column, $total, $places, true); - } - - /** - * Create a new unsigned decimal column on the table. - * - * @param string $column - * @param int $total - * @param int $places - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function unsignedDecimal($column, $total = 8, $places = 2) - { - return $this->decimal($column, $total, $places, true); - } - - /** - * Create a new boolean column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function boolean($column) - { - return $this->addColumn('boolean', $column); - } - - /** - * Create a new enum column on the table. - * - * @param string $column - * @param array $allowed - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function enum($column, array $allowed) - { - return $this->addColumn('enum', $column, compact('allowed')); - } - - /** - * Create a new set column on the table. - * - * @param string $column - * @param array $allowed - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function set($column, array $allowed) - { - return $this->addColumn('set', $column, compact('allowed')); - } - - /** - * Create a new json column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function json($column) - { - return $this->addColumn('json', $column); - } - - /** - * Create a new jsonb column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function jsonb($column) - { - return $this->addColumn('jsonb', $column); - } - - /** - * Create a new date column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function date($column) - { - return $this->addColumn('date', $column); - } - - /** - * Create a new date-time column on the table. - * - * @param string $column - * @param int|null $precision - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function dateTime($column, $precision = 0) - { - return $this->addColumn('dateTime', $column, compact('precision')); - } - - /** - * Create a new date-time column (with time zone) on the table. - * - * @param string $column - * @param int|null $precision - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function dateTimeTz($column, $precision = 0) - { - return $this->addColumn('dateTimeTz', $column, compact('precision')); - } - - /** - * Create a new time column on the table. - * - * @param string $column - * @param int|null $precision - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function time($column, $precision = 0) - { - return $this->addColumn('time', $column, compact('precision')); - } - - /** - * Create a new time column (with time zone) on the table. - * - * @param string $column - * @param int|null $precision - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function timeTz($column, $precision = 0) - { - return $this->addColumn('timeTz', $column, compact('precision')); - } - - /** - * Create a new timestamp column on the table. - * - * @param string $column - * @param int|null $precision - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function timestamp($column, $precision = 0) - { - return $this->addColumn('timestamp', $column, compact('precision')); - } - - /** - * Create a new timestamp (with time zone) column on the table. - * - * @param string $column - * @param int|null $precision - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function timestampTz($column, $precision = 0) - { - return $this->addColumn('timestampTz', $column, compact('precision')); - } - - /** - * Add nullable creation and update timestamps to the table. - * - * @param int|null $precision - * @return void - */ - public function timestamps($precision = 0) - { - $this->timestamp('created_at', $precision)->nullable(); - - $this->timestamp('updated_at', $precision)->nullable(); - } - - /** - * Add nullable creation and update timestamps to the table. - * - * Alias for self::timestamps(). - * - * @param int|null $precision - * @return void - */ - public function nullableTimestamps($precision = 0) - { - $this->timestamps($precision); - } - - /** - * Add creation and update timestampTz columns to the table. - * - * @param int|null $precision - * @return void - */ - public function timestampsTz($precision = 0) - { - $this->timestampTz('created_at', $precision)->nullable(); - - $this->timestampTz('updated_at', $precision)->nullable(); - } - - /** - * Add a "deleted at" timestamp for the table. - * - * @param string $column - * @param int|null $precision - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function softDeletes($column = 'deleted_at', $precision = 0) - { - return $this->timestamp($column, $precision)->nullable(); - } - - /** - * Add a "deleted at" timestampTz for the table. - * - * @param string $column - * @param int|null $precision - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function softDeletesTz($column = 'deleted_at', $precision = 0) - { - return $this->timestampTz($column, $precision)->nullable(); - } - - /** - * Create a new year column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function year($column) - { - return $this->addColumn('year', $column); - } - - /** - * Create a new binary column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function binary($column) - { - return $this->addColumn('binary', $column); - } - - /** - * Create a new UUID column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function uuid($column = 'uuid') - { - return $this->addColumn('uuid', $column); - } - - /** - * Create a new UUID column on the table with a foreign key constraint. - * - * @param string $column - * @return \Illuminate\Database\Schema\ForeignIdColumnDefinition - */ - public function foreignUuid($column) - { - return $this->addColumnDefinition(new ForeignIdColumnDefinition($this, [ - 'type' => 'uuid', - 'name' => $column, - ])); - } - - /** - * Create a new ULID column on the table. - * - * @param string $column - * @param int|null $length - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function ulid($column = 'uuid', $length = 26) - { - return $this->char($column, $length); - } - - /** - * Create a new ULID column on the table with a foreign key constraint. - * - * @param string $column - * @param int|null $length - * @return \Illuminate\Database\Schema\ForeignIdColumnDefinition - */ - public function foreignUlid($column, $length = 26) - { - return $this->addColumnDefinition(new ForeignIdColumnDefinition($this, [ - 'type' => 'char', - 'name' => $column, - 'length' => $length, - ])); - } - - /** - * Create a new IP address column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function ipAddress($column = 'ip_address') - { - return $this->addColumn('ipAddress', $column); - } - - /** - * Create a new MAC address column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function macAddress($column = 'mac_address') - { - return $this->addColumn('macAddress', $column); - } - - /** - * Create a new geometry column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function geometry($column) - { - return $this->addColumn('geometry', $column); - } - - /** - * Create a new point column on the table. - * - * @param string $column - * @param int|null $srid - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function point($column, $srid = null) - { - return $this->addColumn('point', $column, compact('srid')); - } - - /** - * Create a new linestring column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function lineString($column) - { - return $this->addColumn('linestring', $column); - } - - /** - * Create a new polygon column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function polygon($column) - { - return $this->addColumn('polygon', $column); - } - - /** - * Create a new geometrycollection column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function geometryCollection($column) - { - return $this->addColumn('geometrycollection', $column); - } - - /** - * Create a new multipoint column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function multiPoint($column) - { - return $this->addColumn('multipoint', $column); - } - - /** - * Create a new multilinestring column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function multiLineString($column) - { - return $this->addColumn('multilinestring', $column); - } - - /** - * Create a new multipolygon column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function multiPolygon($column) - { - return $this->addColumn('multipolygon', $column); - } - - /** - * Create a new multipolygon column on the table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function multiPolygonZ($column) - { - return $this->addColumn('multipolygonz', $column); - } - - /** - * Create a new generated, computed column on the table. - * - * @param string $column - * @param string $expression - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function computed($column, $expression) - { - return $this->addColumn('computed', $column, compact('expression')); - } - - /** - * Add the proper columns for a polymorphic table. - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function morphs($name, $indexName = null) - { - if (Builder::$defaultMorphKeyType === 'uuid') { - $this->uuidMorphs($name, $indexName); - } elseif (Builder::$defaultMorphKeyType === 'ulid') { - $this->ulidMorphs($name, $indexName); - } else { - $this->numericMorphs($name, $indexName); - } - } - - /** - * Add nullable columns for a polymorphic table. - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function nullableMorphs($name, $indexName = null) - { - if (Builder::$defaultMorphKeyType === 'uuid') { - $this->nullableUuidMorphs($name, $indexName); - } elseif (Builder::$defaultMorphKeyType === 'ulid') { - $this->nullableUlidMorphs($name, $indexName); - } else { - $this->nullableNumericMorphs($name, $indexName); - } - } - - /** - * Add the proper columns for a polymorphic table using numeric IDs (incremental). - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function numericMorphs($name, $indexName = null) - { - $this->string("{$name}_type"); - - $this->unsignedBigInteger("{$name}_id"); - - $this->index(["{$name}_type", "{$name}_id"], $indexName); - } - - /** - * Add nullable columns for a polymorphic table using numeric IDs (incremental). - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function nullableNumericMorphs($name, $indexName = null) - { - $this->string("{$name}_type")->nullable(); - - $this->unsignedBigInteger("{$name}_id")->nullable(); - - $this->index(["{$name}_type", "{$name}_id"], $indexName); - } - - /** - * Add the proper columns for a polymorphic table using UUIDs. - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function uuidMorphs($name, $indexName = null) - { - $this->string("{$name}_type"); - - $this->uuid("{$name}_id"); - - $this->index(["{$name}_type", "{$name}_id"], $indexName); - } - - /** - * Add nullable columns for a polymorphic table using UUIDs. - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function nullableUuidMorphs($name, $indexName = null) - { - $this->string("{$name}_type")->nullable(); - - $this->uuid("{$name}_id")->nullable(); - - $this->index(["{$name}_type", "{$name}_id"], $indexName); - } - - /** - * Add the proper columns for a polymorphic table using ULIDs. - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function ulidMorphs($name, $indexName = null) - { - $this->string("{$name}_type"); - - $this->ulid("{$name}_id"); - - $this->index(["{$name}_type", "{$name}_id"], $indexName); - } - - /** - * Add nullable columns for a polymorphic table using ULIDs. - * - * @param string $name - * @param string|null $indexName - * @return void - */ - public function nullableUlidMorphs($name, $indexName = null) - { - $this->string("{$name}_type")->nullable(); - - $this->ulid("{$name}_id")->nullable(); - - $this->index(["{$name}_type", "{$name}_id"], $indexName); - } - - /** - * Adds the `remember_token` column to the table. - * - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function rememberToken() - { - return $this->string('remember_token', 100)->nullable(); - } - - /** - * Add a comment to the table. - * - * @param string $comment - * @return \Illuminate\Support\Fluent - */ - public function comment($comment) - { - return $this->addCommand('tableComment', compact('comment')); - } - - /** - * Add a new index command to the blueprint. - * - * @param string $type - * @param string|array $columns - * @param string $index - * @param string|null $algorithm - * @return \Illuminate\Support\Fluent - */ - protected function indexCommand($type, $columns, $index, $algorithm = null) - { - $columns = (array) $columns; - - // If no name was specified for this index, we will create one using a basic - // convention of the table name, followed by the columns, followed by an - // index type, such as primary or index, which makes the index unique. - $index = $index ?: $this->createIndexName($type, $columns); - - return $this->addCommand( - $type, compact('index', 'columns', 'algorithm') - ); - } - - /** - * Create a new drop index command on the blueprint. - * - * @param string $command - * @param string $type - * @param string|array $index - * @return \Illuminate\Support\Fluent - */ - protected function dropIndexCommand($command, $type, $index) - { - $columns = []; - - // If the given "index" is actually an array of columns, the developer means - // to drop an index merely by specifying the columns involved without the - // conventional name, so we will build the index name from the columns. - if (is_array($index)) { - $index = $this->createIndexName($type, $columns = $index); - } - - return $this->indexCommand($command, $columns, $index); - } - - /** - * Create a default index name for the table. - * - * @param string $type - * @param array $columns - * @return string - */ - protected function createIndexName($type, array $columns) - { - $index = strtolower($this->prefix.$this->table.'_'.implode('_', $columns).'_'.$type); - - return str_replace(['-', '.'], '_', $index); - } - - /** - * Add a new column to the blueprint. - * - * @param string $type - * @param string $name - * @param array $parameters - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - public function addColumn($type, $name, array $parameters = []) - { - return $this->addColumnDefinition(new ColumnDefinition( - array_merge(compact('type', 'name'), $parameters) - )); - } - - /** - * Add a new column definition to the blueprint. - * - * @param \Illuminate\Database\Schema\ColumnDefinition $definition - * @return \Illuminate\Database\Schema\ColumnDefinition - */ - protected function addColumnDefinition($definition) - { - $this->columns[] = $definition; - - if ($this->after) { - $definition->after($this->after); - - $this->after = $definition->name; - } - - return $definition; - } - - /** - * Add the columns from the callback after the given column. - * - * @param string $column - * @param \Closure $callback - * @return void - */ - public function after($column, Closure $callback) - { - $this->after = $column; - - $callback($this); - - $this->after = null; - } - - /** - * Remove a column from the schema blueprint. - * - * @param string $name - * @return $this - */ - public function removeColumn($name) - { - $this->columns = array_values(array_filter($this->columns, function ($c) use ($name) { - return $c['name'] != $name; - })); - - return $this; - } - - /** - * Add a new command to the blueprint. - * - * @param string $name - * @param array $parameters - * @return \Illuminate\Support\Fluent - */ - protected function addCommand($name, array $parameters = []) - { - $this->commands[] = $command = $this->createCommand($name, $parameters); - - return $command; - } - - /** - * Create a new Fluent command. - * - * @param string $name - * @param array $parameters - * @return \Illuminate\Support\Fluent - */ - protected function createCommand($name, array $parameters = []) - { - return new Fluent(array_merge(compact('name'), $parameters)); - } - - /** - * Get the table the blueprint describes. - * - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Get the columns on the blueprint. - * - * @return \Illuminate\Database\Schema\ColumnDefinition[] - */ - public function getColumns() - { - return $this->columns; - } - - /** - * Get the commands on the blueprint. - * - * @return \Illuminate\Support\Fluent[] - */ - public function getCommands() - { - return $this->commands; - } - - /** - * Get the columns on the blueprint that should be added. - * - * @return \Illuminate\Database\Schema\ColumnDefinition[] - */ - public function getAddedColumns() - { - return array_filter($this->columns, function ($column) { - return ! $column->change; - }); - } - - /** - * Get the columns on the blueprint that should be changed. - * - * @return \Illuminate\Database\Schema\ColumnDefinition[] - */ - public function getChangedColumns() - { - return array_filter($this->columns, function ($column) { - return (bool) $column->change; - }); - } - - /** - * Determine if the blueprint has auto-increment columns. - * - * @return bool - */ - public function hasAutoIncrementColumn() - { - return ! is_null(collect($this->getAddedColumns())->first(function ($column) { - return $column->autoIncrement === true; - })); - } - - /** - * Get the auto-increment column starting values. - * - * @return array - */ - public function autoIncrementingStartingValues() - { - if (! $this->hasAutoIncrementColumn()) { - return []; - } - - return collect($this->getAddedColumns())->mapWithKeys(function ($column) { - return $column->autoIncrement === true - ? [$column->name => $column->get('startingValue', $column->get('from'))] - : [$column->name => null]; - })->filter()->all(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Builder.php b/framework-9.50.2/src/Illuminate/Database/Schema/Builder.php deleted file mode 100755 index 88cd965..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Builder.php +++ /dev/null @@ -1,495 +0,0 @@ -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; - } - - /** - * Set the default morph key type for migrations. - * - * @param string $type - * @return void - * - * @throws \InvalidArgumentException - */ - public static function defaultMorphKeyType(string $type) - { - if (! in_array($type, ['int', 'uuid', 'ulid'])) { - throw new InvalidArgumentException("Morph key type must be 'int', 'uuid', or 'ulid'."); - } - - static::$defaultMorphKeyType = $type; - } - - /** - * Set the default morph key type for migrations to UUIDs. - * - * @return void - */ - public static function morphUsingUuids() - { - return static::defaultMorphKeyType('uuid'); - } - - /** - * Set the default morph key type for migrations to ULIDs. - * - * @return void - */ - public static function morphUsingUlids() - { - return static::defaultMorphKeyType('ulid'); - } - - /** - * Attempt to use native schema operations for dropping and renaming columns, even if Doctrine DBAL is installed. - * - * @param bool $value - * @return void - */ - public static function useNativeSchemaOperationsIfPossible(bool $value = true) - { - static::$alwaysUsesNativeSchemaOperationsIfPossible = $value; - } - - /** - * Create a database in the schema. - * - * @param string $name - * @return bool - * - * @throws \LogicException - */ - public function createDatabase($name) - { - throw new LogicException('This database driver does not support creating databases.'); - } - - /** - * Drop a database from the schema if the database exists. - * - * @param string $name - * @return bool - * - * @throws \LogicException - */ - public function dropDatabaseIfExists($name) - { - throw new LogicException('This database driver does not support dropping databases.'); - } - - /** - * Determine if the given table exists. - * - * @param string $table - * @return bool - */ - public function hasTable($table) - { - $table = $this->connection->getTablePrefix().$table; - - return count($this->connection->selectFromWriteConnection( - $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; - } - - /** - * Execute a table builder callback if the given table has a given column. - * - * @param string $table - * @param string $column - * @param \Closure $callback - * @return void - */ - public function whenTableHasColumn(string $table, string $column, Closure $callback) - { - if ($this->hasColumn($table, $column)) { - $this->table($table, fn (Blueprint $table) => $callback($table)); - } - } - - /** - * Execute a table builder callback if the given table doesn't have a given column. - * - * @param string $table - * @param string $column - * @param \Closure $callback - * @return void - */ - public function whenTableDoesntHaveColumn(string $table, string $column, Closure $callback) - { - if (! $this->hasColumn($table, $column)) { - $this->table($table, fn (Blueprint $table) => $callback($table)); - } - } - - /** - * 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->selectFromWriteConnection($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 columns from a table schema. - * - * @param string $table - * @param string|array $columns - * @return void - */ - public function dropColumns($table, $columns) - { - $this->table($table, function (Blueprint $blueprint) use ($columns) { - $blueprint->dropColumn($columns); - }); - } - - /** - * 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.'); - } - - /** - * Drop all views from the database. - * - * @return void - * - * @throws \LogicException - */ - public function dropAllViews() - { - throw new LogicException('This database driver does not support dropping all views.'); - } - - /** - * Drop all types from the database. - * - * @return void - * - * @throws \LogicException - */ - public function dropAllTypes() - { - throw new LogicException('This database driver does not support dropping all types.'); - } - - /** - * Get all of the table names for the database. - * - * @return void - * - * @throws \LogicException - */ - public function getAllTables() - { - throw new LogicException('This database driver does not support getting 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() - ); - } - - /** - * Disable foreign key constraints during the execution of a callback. - * - * @param \Closure $callback - * @return mixed - */ - public function withoutForeignKeyConstraints(Closure $callback) - { - $this->disableForeignKeyConstraints(); - - $result = $callback(); - - $this->enableForeignKeyConstraints(); - - return $result; - } - - /** - * 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) - { - $prefix = $this->connection->getConfig('prefix_indexes') - ? $this->connection->getConfig('prefix') - : ''; - - if (isset($this->resolver)) { - return call_user_func($this->resolver, $table, $callback, $prefix); - } - - return Container::getInstance()->make(Blueprint::class, compact('table', 'callback', 'prefix')); - } - - /** - * 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; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/ColumnDefinition.php b/framework-9.50.2/src/Illuminate/Database/Schema/ColumnDefinition.php deleted file mode 100644 index 51265ac..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/ColumnDefinition.php +++ /dev/null @@ -1,38 +0,0 @@ -blueprint = $blueprint; - } - - /** - * Create a foreign key constraint on this column referencing the "id" column of the conventionally related table. - * - * @param string|null $table - * @param string $column - * @return \Illuminate\Database\Schema\ForeignKeyDefinition - */ - public function constrained($table = null, $column = 'id') - { - return $this->references($column)->on($table ?? Str::of($this->name)->beforeLast('_'.$column)->plural()); - } - - /** - * Specify which column this foreign ID references on another table. - * - * @param string $column - * @return \Illuminate\Database\Schema\ForeignKeyDefinition - */ - public function references($column) - { - return $this->blueprint->foreign($this->name)->references($column); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/ForeignKeyDefinition.php b/framework-9.50.2/src/Illuminate/Database/Schema/ForeignKeyDefinition.php deleted file mode 100644 index 3bb8b71..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/ForeignKeyDefinition.php +++ /dev/null @@ -1,76 +0,0 @@ -onUpdate('cascade'); - } - - /** - * Indicate that updates should be restricted. - * - * @return $this - */ - public function restrictOnUpdate() - { - return $this->onUpdate('restrict'); - } - - /** - * Indicate that deletes should cascade. - * - * @return $this - */ - public function cascadeOnDelete() - { - return $this->onDelete('cascade'); - } - - /** - * Indicate that deletes should be restricted. - * - * @return $this - */ - public function restrictOnDelete() - { - return $this->onDelete('restrict'); - } - - /** - * Indicate that deletes should set the foreign key value to null. - * - * @return $this - */ - public function nullOnDelete() - { - return $this->onDelete('set null'); - } - - /** - * Indicate that deletes should have "no action". - * - * @return $this - */ - public function noActionOnDelete() - { - return $this->onDelete('no action'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php b/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php deleted file mode 100644 index 9579222..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php +++ /dev/null @@ -1,235 +0,0 @@ -isDoctrineAvailable()) { - throw new RuntimeException(sprintf( - 'Changing columns for table "%s" requires Doctrine DBAL. Please install the doctrine/dbal package.', - $blueprint->getTable() - )); - } - - $schema = $connection->getDoctrineSchemaManager(); - $databasePlatform = $schema->getDatabasePlatform(); - $databasePlatform->registerDoctrineTypeMapping('enum', 'string'); - - $tableDiff = static::getChangedDiff( - $grammar, $blueprint, $schema - ); - - if ($tableDiff !== false) { - return (array) $databasePlatform->getAlterTableSQL($tableDiff); - } - - return []; - } - - /** - * Get the Doctrine table difference for the given changes. - * - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema - * @return \Doctrine\DBAL\Schema\TableDiff|bool - */ - protected static function getChangedDiff($grammar, Blueprint $blueprint, SchemaManager $schema) - { - $current = $schema->listTableDetails($grammar->getTablePrefix().$blueprint->getTable()); - - return (new Comparator)->diffTable( - $current, static::getTableWithColumnChanges($blueprint, $current) - ); - } - - /** - * Get a copy of the given Doctrine table after making the column changes. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Doctrine\DBAL\Schema\Table $table - * @return \Doctrine\DBAL\Schema\Table - */ - protected static function getTableWithColumnChanges(Blueprint $blueprint, Table $table) - { - $table = clone $table; - - foreach ($blueprint->getChangedColumns() as $fluent) { - $column = static::getDoctrineColumn($table, $fluent); - - // Here we will spin through each fluent column definition and map it to the proper - // Doctrine column definitions - which is necessary because Laravel and Doctrine - // use some different terminology for various column attributes on the tables. - foreach ($fluent->getAttributes() as $key => $value) { - if (! is_null($option = static::mapFluentOptionToDoctrine($key))) { - if (method_exists($column, $method = 'set'.ucfirst($option))) { - $column->{$method}(static::mapFluentValueToDoctrine($option, $value)); - continue; - } - - $column->setCustomSchemaOption($option, static::mapFluentValueToDoctrine($option, $value)); - } - } - } - - return $table; - } - - /** - * Get the Doctrine column instance for a column change. - * - * @param \Doctrine\DBAL\Schema\Table $table - * @param \Illuminate\Support\Fluent $fluent - * @return \Doctrine\DBAL\Schema\Column - */ - protected static function getDoctrineColumn(Table $table, Fluent $fluent) - { - return $table->changeColumn( - $fluent['name'], static::getDoctrineColumnChangeOptions($fluent) - )->getColumn($fluent['name']); - } - - /** - * Get the Doctrine column change options. - * - * @param \Illuminate\Support\Fluent $fluent - * @return array - */ - protected static function getDoctrineColumnChangeOptions(Fluent $fluent) - { - $options = ['type' => static::getDoctrineColumnType($fluent['type'])]; - - if (in_array($fluent['type'], ['tinyText', 'text', 'mediumText', 'longText'])) { - $options['length'] = static::calculateDoctrineTextLength($fluent['type']); - } - - if ($fluent['type'] === 'char') { - $options['fixed'] = true; - } - - if (static::doesntNeedCharacterOptions($fluent['type'])) { - $options['customSchemaOptions'] = [ - 'collation' => '', - 'charset' => '', - ]; - } - - return $options; - } - - /** - * Get the doctrine column type. - * - * @param string $type - * @return \Doctrine\DBAL\Types\Type - */ - protected static function getDoctrineColumnType($type) - { - $type = strtolower($type); - - return Type::getType(match ($type) { - 'biginteger' => 'bigint', - 'smallinteger' => 'smallint', - 'tinytext', 'mediumtext', 'longtext' => 'text', - 'binary' => 'blob', - 'uuid' => 'guid', - 'char' => 'string', - 'double' => 'float', - default => $type, - }); - } - - /** - * Calculate the proper column length to force the Doctrine text type. - * - * @param string $type - * @return int - */ - protected static function calculateDoctrineTextLength($type) - { - return match ($type) { - 'tinyText' => 1, - 'mediumText' => 65535 + 1, - 'longText' => 16777215 + 1, - default => 255 + 1, - }; - } - - /** - * Determine if the given type does not need character / collation options. - * - * @param string $type - * @return bool - */ - protected static function doesntNeedCharacterOptions($type) - { - return in_array($type, [ - 'bigInteger', - 'binary', - 'boolean', - 'date', - 'dateTime', - 'decimal', - 'double', - 'float', - 'integer', - 'json', - 'mediumInteger', - 'smallInteger', - 'time', - 'timestamp', - 'tinyInteger', - ]); - } - - /** - * Get the matching Doctrine option for a given Fluent attribute name. - * - * @param string $attribute - * @return string|null - */ - protected static function mapFluentOptionToDoctrine($attribute) - { - return match ($attribute) { - 'type', 'name' => null, - 'nullable' => 'notnull', - 'total' => 'precision', - 'places' => 'scale', - default => $attribute, - }; - } - - /** - * Get the matching Doctrine value for a given Fluent attribute. - * - * @param string $option - * @param mixed $value - * @return mixed - */ - protected static function mapFluentValueToDoctrine($option, $value) - { - return $option === 'notnull' ? ! $value : $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/Grammar.php b/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/Grammar.php deleted file mode 100755 index ea8333e..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/Grammar.php +++ /dev/null @@ -1,345 +0,0 @@ -wrapTable($blueprint), - $this->wrap($command->index) - ); - - // Once we have the initial portion of the SQL statement we will add on the - // key name, table name, and referenced columns. These will complete the - // main portion of the SQL statement and this SQL will almost be done. - $sql .= sprintf('foreign key (%s) references %s (%s)', - $this->columnize($command->columns), - $this->wrapTable($command->on), - $this->columnize((array) $command->references) - ); - - // Once we have the basic foreign key creation statement constructed we can - // build out the syntax for what should happen on an update or delete of - // the affected columns, which will get something like "cascade", etc. - if (! is_null($command->onDelete)) { - $sql .= " on delete {$command->onDelete}"; - } - - if (! is_null($command->onUpdate)) { - $sql .= " on update {$command->onUpdate}"; - } - - return $sql; - } - - /** - * Compile the blueprint's column definitions. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return array - */ - protected function getColumns(Blueprint $blueprint) - { - $columns = []; - - foreach ($blueprint->getAddedColumns() as $column) { - // Each of the column types has their own compiler functions, which are tasked - // with turning the column definition into its SQL format for this platform - // used by the connection. The column's modifiers are compiled and added. - $sql = $this->wrap($column).' '.$this->getType($column); - - $columns[] = $this->addModifiers($sql, $blueprint, $column); - } - - return $columns; - } - - /** - * Get the SQL for the column data type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function getType(Fluent $column) - { - return $this->{'type'.ucfirst($column->type)}($column); - } - - /** - * Create the column definition for a generated, computed column type. - * - * @param \Illuminate\Support\Fluent $column - * @return void - * - * @throws \RuntimeException - */ - protected function typeComputed(Fluent $column) - { - throw new RuntimeException('This database driver does not support the computed type.'); - } - - /** - * Add the column modifiers to the definition. - * - * @param string $sql - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function addModifiers($sql, Blueprint $blueprint, Fluent $column) - { - foreach ($this->modifiers as $modifier) { - if (method_exists($this, $method = "modify{$modifier}")) { - $sql .= $this->{$method}($blueprint, $column); - } - } - - return $sql; - } - - /** - * Get the primary key command if it exists on the blueprint. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param string $name - * @return \Illuminate\Support\Fluent|null - */ - protected function getCommandByName(Blueprint $blueprint, $name) - { - $commands = $this->getCommandsByName($blueprint, $name); - - if (count($commands) > 0) { - return reset($commands); - } - } - - /** - * Get all of the commands with a given name. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param string $name - * @return array - */ - protected function getCommandsByName(Blueprint $blueprint, $name) - { - return array_filter($blueprint->getCommands(), function ($value) use ($name) { - return $value->name == $name; - }); - } - - /** - * Add a prefix to an array of values. - * - * @param string $prefix - * @param array $values - * @return array - */ - public function prefixArray($prefix, array $values) - { - return array_map(function ($value) use ($prefix) { - return $prefix.' '.$value; - }, $values); - } - - /** - * Wrap a table in keyword identifiers. - * - * @param mixed $table - * @return string - */ - public function wrapTable($table) - { - return parent::wrapTable( - $table instanceof Blueprint ? $table->getTable() : $table - ); - } - - /** - * Wrap a value in keyword identifiers. - * - * @param \Illuminate\Database\Query\Expression|string $value - * @param bool $prefixAlias - * @return string - */ - public function wrap($value, $prefixAlias = false) - { - return parent::wrap( - $value instanceof Fluent ? $value->name : $value, $prefixAlias - ); - } - - /** - * Format a value so that it can be used in "default" clauses. - * - * @param mixed $value - * @return string - */ - protected function getDefaultValue($value) - { - if ($value instanceof Expression) { - return $value; - } - - return is_bool($value) - ? "'".(int) $value."'" - : "'".(string) $value."'"; - } - - /** - * Create an empty Doctrine DBAL TableDiff from the Blueprint. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema - * @return \Doctrine\DBAL\Schema\TableDiff - */ - public function getDoctrineTableDiff(Blueprint $blueprint, SchemaManager $schema) - { - $table = $this->getTablePrefix().$blueprint->getTable(); - - return tap(new TableDiff($table), function ($tableDiff) use ($schema, $table) { - $tableDiff->fromTable = $schema->listTableDetails($table); - }); - } - - /** - * Get the fluent commands for the grammar. - * - * @return array - */ - public function getFluentCommands() - { - return $this->fluentCommands; - } - - /** - * Check if this Grammar supports schema changes wrapped in a transaction. - * - * @return bool - */ - public function supportsSchemaTransactions() - { - return $this->transactions; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php deleted file mode 100755 index f87acfd..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php +++ /dev/null @@ -1,1221 +0,0 @@ -wrapValue($name), - $this->wrapValue($connection->getConfig('charset')), - $this->wrapValue($connection->getConfig('collation')), - ); - } - - /** - * Compile a drop database if exists command. - * - * @param string $name - * @return string - */ - public function compileDropDatabaseIfExists($name) - { - return sprintf( - 'drop database if exists %s', - $this->wrapValue($name) - ); - } - - /** - * Compile the query to determine the list of tables. - * - * @return string - */ - public function compileTableExists() - { - return "select * from information_schema.tables where table_schema = ? and table_name = ? and table_type = 'BASE TABLE'"; - } - - /** - * Compile the query to determine the list of columns. - * - * @return string - */ - public function compileColumnListing() - { - return 'select column_name as `column_name` from information_schema.columns where table_schema = ? and table_name = ?'; - } - - /** - * Compile a create table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array - */ - public function compileCreate(Blueprint $blueprint, Fluent $command, Connection $connection) - { - $sql = $this->compileCreateTable( - $blueprint, $command, $connection - ); - - // Once we have the primary SQL, we can add the encoding option to the SQL for - // the table. Then, we can check if a storage engine has been supplied for - // the table. If so, we will add the engine declaration to the SQL query. - $sql = $this->compileCreateEncoding( - $sql, $connection, $blueprint - ); - - // Finally, we will append the engine configuration onto this SQL statement as - // the final thing we do before returning this finished SQL. Once this gets - // added the query will be ready to execute against the real connections. - return array_values(array_filter(array_merge([$this->compileCreateEngine( - $sql, $connection, $blueprint - )], $this->compileAutoIncrementStartingValues($blueprint)))); - } - - /** - * Create the main create table clause. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array - */ - protected function compileCreateTable($blueprint, $command, $connection) - { - return trim(sprintf('%s table %s (%s)', - $blueprint->temporary ? 'create temporary' : 'create', - $this->wrapTable($blueprint), - implode(', ', $this->getColumns($blueprint)) - )); - } - - /** - * Append the character set specifications to a command. - * - * @param string $sql - * @param \Illuminate\Database\Connection $connection - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return string - */ - protected function compileCreateEncoding($sql, Connection $connection, Blueprint $blueprint) - { - // First we will set the character set if one has been set on either the create - // blueprint itself or on the root configuration for the connection that the - // table is being created on. We will add these to the create table query. - if (isset($blueprint->charset)) { - $sql .= ' default character set '.$blueprint->charset; - } elseif (! is_null($charset = $connection->getConfig('charset'))) { - $sql .= ' default character set '.$charset; - } - - // Next we will add the collation to the create table statement if one has been - // added to either this create table blueprint or the configuration for this - // connection that the query is targeting. We'll add it to this SQL query. - if (isset($blueprint->collation)) { - $sql .= " collate '{$blueprint->collation}'"; - } elseif (! is_null($collation = $connection->getConfig('collation'))) { - $sql .= " collate '{$collation}'"; - } - - return $sql; - } - - /** - * Append the engine specifications to a command. - * - * @param string $sql - * @param \Illuminate\Database\Connection $connection - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return string - */ - protected function compileCreateEngine($sql, Connection $connection, Blueprint $blueprint) - { - if (isset($blueprint->engine)) { - return $sql.' engine = '.$blueprint->engine; - } elseif (! is_null($engine = $connection->getConfig('engine'))) { - return $sql.' engine = '.$engine; - } - - return $sql; - } - - /** - * Compile an add column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return array - */ - public function compileAdd(Blueprint $blueprint, Fluent $command) - { - $columns = $this->prefixArray('add', $this->getColumns($blueprint)); - - return array_values(array_merge( - ['alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns)], - $this->compileAutoIncrementStartingValues($blueprint) - )); - } - - /** - * Compile the auto-incrementing column starting values. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return array - */ - public function compileAutoIncrementStartingValues(Blueprint $blueprint) - { - return collect($blueprint->autoIncrementingStartingValues())->map(function ($value, $column) use ($blueprint) { - return 'alter table '.$this->wrapTable($blueprint->getTable()).' auto_increment = '.$value; - })->all(); - } - - /** - * Compile a rename column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array|string - */ - public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection) - { - return $connection->usingNativeSchemaOperations() - ? sprintf('alter table %s rename column %s to %s', - $this->wrapTable($blueprint), - $this->wrap($command->from), - $this->wrap($command->to) - ) - : parent::compileRenameColumn($blueprint, $command, $connection); - } - - /** - * Compile a primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compilePrimary(Blueprint $blueprint, Fluent $command) - { - return sprintf('alter table %s add primary key %s(%s)', - $this->wrapTable($blueprint), - $command->algorithm ? 'using '.$command->algorithm : '', - $this->columnize($command->columns) - ); - } - - /** - * Compile a unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileUnique(Blueprint $blueprint, Fluent $command) - { - return $this->compileKey($blueprint, $command, 'unique'); - } - - /** - * Compile a plain index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileIndex(Blueprint $blueprint, Fluent $command) - { - return $this->compileKey($blueprint, $command, 'index'); - } - - /** - * Compile a fulltext index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileFullText(Blueprint $blueprint, Fluent $command) - { - return $this->compileKey($blueprint, $command, 'fulltext'); - } - - /** - * Compile a spatial index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) - { - return $this->compileKey($blueprint, $command, 'spatial index'); - } - - /** - * Compile an index creation command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param string $type - * @return string - */ - protected function compileKey(Blueprint $blueprint, Fluent $command, $type) - { - return sprintf('alter table %s add %s %s%s(%s)', - $this->wrapTable($blueprint), - $type, - $this->wrap($command->index), - $command->algorithm ? ' using '.$command->algorithm : '', - $this->columnize($command->columns) - ); - } - - /** - * Compile a drop table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDrop(Blueprint $blueprint, Fluent $command) - { - return 'drop table '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop table (if exists) command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIfExists(Blueprint $blueprint, Fluent $command) - { - return 'drop table if exists '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropColumn(Blueprint $blueprint, Fluent $command) - { - $columns = $this->prefixArray('drop', $this->wrapArray($command->columns)); - - return 'alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns); - } - - /** - * Compile a drop primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropPrimary(Blueprint $blueprint, Fluent $command) - { - return 'alter table '.$this->wrapTable($blueprint).' drop primary key'; - } - - /** - * Compile a drop unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropUnique(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "alter table {$this->wrapTable($blueprint)} drop index {$index}"; - } - - /** - * Compile a drop index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIndex(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "alter table {$this->wrapTable($blueprint)} drop index {$index}"; - } - - /** - * Compile a drop fulltext index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropFullText(Blueprint $blueprint, Fluent $command) - { - return $this->compileDropIndex($blueprint, $command); - } - - /** - * Compile a drop spatial index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) - { - return $this->compileDropIndex($blueprint, $command); - } - - /** - * Compile a drop foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropForeign(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "alter table {$this->wrapTable($blueprint)} drop foreign key {$index}"; - } - - /** - * Compile a rename table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRename(Blueprint $blueprint, Fluent $command) - { - $from = $this->wrapTable($blueprint); - - return "rename table {$from} to ".$this->wrapTable($command->to); - } - - /** - * Compile a rename index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRenameIndex(Blueprint $blueprint, Fluent $command) - { - return sprintf('alter table %s rename index %s to %s', - $this->wrapTable($blueprint), - $this->wrap($command->from), - $this->wrap($command->to) - ); - } - - /** - * Compile the SQL needed to drop all tables. - * - * @param array $tables - * @return string - */ - public function compileDropAllTables($tables) - { - return 'drop table '.implode(',', $this->wrapArray($tables)); - } - - /** - * Compile the SQL needed to drop all views. - * - * @param array $views - * @return string - */ - public function compileDropAllViews($views) - { - return 'drop view '.implode(',', $this->wrapArray($views)); - } - - /** - * Compile the SQL needed to retrieve all table names. - * - * @return string - */ - public function compileGetAllTables() - { - return 'SHOW FULL TABLES WHERE table_type = \'BASE TABLE\''; - } - - /** - * Compile the SQL needed to retrieve all view names. - * - * @return string - */ - public function compileGetAllViews() - { - return 'SHOW FULL TABLES WHERE table_type = \'VIEW\''; - } - - /** - * Compile the command to enable foreign key constraints. - * - * @return string - */ - public function compileEnableForeignKeyConstraints() - { - return 'SET FOREIGN_KEY_CHECKS=1;'; - } - - /** - * Compile the command to disable foreign key constraints. - * - * @return string - */ - public function compileDisableForeignKeyConstraints() - { - return 'SET FOREIGN_KEY_CHECKS=0;'; - } - - /** - * Compile a table comment command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileTableComment(Blueprint $blueprint, Fluent $command) - { - return sprintf('alter table %s comment = %s', - $this->wrapTable($blueprint), - "'".str_replace("'", "''", $command->comment)."'" - ); - } - - /** - * Create the column definition for a char type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeChar(Fluent $column) - { - return "char({$column->length})"; - } - - /** - * Create the column definition for a string type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeString(Fluent $column) - { - return "varchar({$column->length})"; - } - - /** - * Create the column definition for a tiny text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyText(Fluent $column) - { - return 'tinytext'; - } - - /** - * Create the column definition for a text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a medium text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumText(Fluent $column) - { - return 'mediumtext'; - } - - /** - * Create the column definition for a long text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLongText(Fluent $column) - { - return 'longtext'; - } - - /** - * Create the column definition for a big integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBigInteger(Fluent $column) - { - return 'bigint'; - } - - /** - * Create the column definition for an integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeInteger(Fluent $column) - { - return 'int'; - } - - /** - * Create the column definition for a medium integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumInteger(Fluent $column) - { - return 'mediumint'; - } - - /** - * Create the column definition for a tiny integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyInteger(Fluent $column) - { - return 'tinyint'; - } - - /** - * Create the column definition for a small integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSmallInteger(Fluent $column) - { - return 'smallint'; - } - - /** - * Create the column definition for a float type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeFloat(Fluent $column) - { - return $this->typeDouble($column); - } - - /** - * Create the column definition for a double type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDouble(Fluent $column) - { - if ($column->total && $column->places) { - return "double({$column->total}, {$column->places})"; - } - - return 'double'; - } - - /** - * Create the column definition for a decimal type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDecimal(Fluent $column) - { - return "decimal({$column->total}, {$column->places})"; - } - - /** - * Create the column definition for a boolean type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBoolean(Fluent $column) - { - return 'tinyint(1)'; - } - - /** - * Create the column definition for an enumeration type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeEnum(Fluent $column) - { - return sprintf('enum(%s)', $this->quoteString($column->allowed)); - } - - /** - * Create the column definition for a set enumeration type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSet(Fluent $column) - { - return sprintf('set(%s)', $this->quoteString($column->allowed)); - } - - /** - * Create the column definition for a json type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJson(Fluent $column) - { - return 'json'; - } - - /** - * Create the column definition for a jsonb type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJsonb(Fluent $column) - { - return 'json'; - } - - /** - * Create the column definition for a date type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDate(Fluent $column) - { - return 'date'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTime(Fluent $column) - { - $columnType = $column->precision ? "datetime($column->precision)" : 'datetime'; - - $current = $column->precision ? "CURRENT_TIMESTAMP($column->precision)" : 'CURRENT_TIMESTAMP'; - - $columnType = $column->useCurrent ? "$columnType default $current" : $columnType; - - return $column->useCurrentOnUpdate ? "$columnType on update $current" : $columnType; - } - - /** - * Create the column definition for a date-time (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTimeTz(Fluent $column) - { - return $this->typeDateTime($column); - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTime(Fluent $column) - { - return $column->precision ? "time($column->precision)" : 'time'; - } - - /** - * Create the column definition for a time (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimeTz(Fluent $column) - { - return $this->typeTime($column); - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestamp(Fluent $column) - { - $columnType = $column->precision ? "timestamp($column->precision)" : 'timestamp'; - - $current = $column->precision ? "CURRENT_TIMESTAMP($column->precision)" : 'CURRENT_TIMESTAMP'; - - $columnType = $column->useCurrent ? "$columnType default $current" : $columnType; - - return $column->useCurrentOnUpdate ? "$columnType on update $current" : $columnType; - } - - /** - * Create the column definition for a timestamp (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestampTz(Fluent $column) - { - return $this->typeTimestamp($column); - } - - /** - * Create the column definition for a year type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeYear(Fluent $column) - { - return 'year'; - } - - /** - * Create the column definition for a binary type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBinary(Fluent $column) - { - return 'blob'; - } - - /** - * Create the column definition for a uuid type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeUuid(Fluent $column) - { - return 'char(36)'; - } - - /** - * Create the column definition for an IP address type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeIpAddress(Fluent $column) - { - return 'varchar(45)'; - } - - /** - * Create the column definition for a MAC address type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMacAddress(Fluent $column) - { - return 'varchar(17)'; - } - - /** - * Create the column definition for a spatial Geometry type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeGeometry(Fluent $column) - { - return 'geometry'; - } - - /** - * Create the column definition for a spatial Point type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typePoint(Fluent $column) - { - return 'point'; - } - - /** - * Create the column definition for a spatial LineString type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeLineString(Fluent $column) - { - return 'linestring'; - } - - /** - * Create the column definition for a spatial Polygon type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typePolygon(Fluent $column) - { - return 'polygon'; - } - - /** - * Create the column definition for a spatial GeometryCollection type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeGeometryCollection(Fluent $column) - { - return 'geometrycollection'; - } - - /** - * Create the column definition for a spatial MultiPoint type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiPoint(Fluent $column) - { - return 'multipoint'; - } - - /** - * Create the column definition for a spatial MultiLineString type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiLineString(Fluent $column) - { - return 'multilinestring'; - } - - /** - * Create the column definition for a spatial MultiPolygon type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiPolygon(Fluent $column) - { - return 'multipolygon'; - } - - /** - * Create the column definition for a generated, computed column type. - * - * @param \Illuminate\Support\Fluent $column - * @return void - * - * @throws \RuntimeException - */ - protected function typeComputed(Fluent $column) - { - throw new RuntimeException('This database driver requires a type, see the virtualAs / storedAs modifiers.'); - } - - /** - * Get the SQL for a generated virtual column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column) - { - if (! is_null($virtualAs = $column->virtualAsJson)) { - if ($this->isJsonSelector($virtualAs)) { - $virtualAs = $this->wrapJsonSelector($virtualAs); - } - - return " as ({$virtualAs})"; - } - - if (! is_null($virtualAs = $column->virtualAs)) { - return " as ({$virtualAs})"; - } - } - - /** - * Get the SQL for a generated stored column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) - { - if (! is_null($storedAs = $column->storedAsJson)) { - if ($this->isJsonSelector($storedAs)) { - $storedAs = $this->wrapJsonSelector($storedAs); - } - - return " as ({$storedAs}) stored"; - } - - if (! is_null($storedAs = $column->storedAs)) { - return " as ({$storedAs}) stored"; - } - } - - /** - * Get the SQL for an unsigned column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyUnsigned(Blueprint $blueprint, Fluent $column) - { - if ($column->unsigned) { - return ' unsigned'; - } - } - - /** - * Get the SQL for a character set column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyCharset(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->charset)) { - return ' character set '.$column->charset; - } - } - - /** - * Get the SQL for a collation column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyCollate(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->collation)) { - return " collate '{$column->collation}'"; - } - } - - /** - * Get the SQL for a nullable column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyNullable(Blueprint $blueprint, Fluent $column) - { - if (is_null($column->virtualAs) && - is_null($column->virtualAsJson) && - is_null($column->storedAs) && - is_null($column->storedAsJson)) { - return $column->nullable ? ' null' : ' not null'; - } - - if ($column->nullable === false) { - return ' not null'; - } - } - - /** - * Get the SQL for an invisible column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyInvisible(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->invisible)) { - return ' invisible'; - } - } - - /** - * Get the SQL for a default column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyDefault(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->default)) { - return ' default '.$this->getDefaultValue($column->default); - } - } - - /** - * Get the SQL for an auto-increment column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyIncrement(Blueprint $blueprint, Fluent $column) - { - if (in_array($column->type, $this->serials) && $column->autoIncrement) { - return ' auto_increment primary key'; - } - } - - /** - * Get the SQL for a "first" column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyFirst(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->first)) { - return ' first'; - } - } - - /** - * Get the SQL for an "after" column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyAfter(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->after)) { - return ' after '.$this->wrap($column->after); - } - } - - /** - * Get the SQL for a "comment" column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyComment(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->comment)) { - return " comment '".addslashes($column->comment)."'"; - } - } - - /** - * Get the SQL for a SRID column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifySrid(Blueprint $blueprint, Fluent $column) - { - if (is_int($column->srid) && $column->srid > 0) { - return ' srid '.$column->srid; - } - } - - /** - * Wrap a single string in keyword identifiers. - * - * @param string $value - * @return string - */ - protected function wrapValue($value) - { - if ($value !== '*') { - return '`'.str_replace('`', '``', $value).'`'; - } - - return $value; - } - - /** - * Wrap the given JSON selector. - * - * @param string $value - * @return string - */ - protected function wrapJsonSelector($value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($value); - - return 'json_unquote(json_extract('.$field.$path.'))'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php b/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php deleted file mode 100755 index ef60d0f..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php +++ /dev/null @@ -1,1141 +0,0 @@ -wrapValue($name), - $this->wrapValue($connection->getConfig('charset')), - ); - } - - /** - * Compile a drop database if exists command. - * - * @param string $name - * @return string - */ - public function compileDropDatabaseIfExists($name) - { - return sprintf( - 'drop database if exists %s', - $this->wrapValue($name) - ); - } - - /** - * Compile the query to determine if a table exists. - * - * @return string - */ - public function compileTableExists() - { - return "select * from information_schema.tables where table_catalog = ? and table_schema = ? and table_name = ? and table_type = 'BASE TABLE'"; - } - - /** - * Compile the query to determine the list of columns. - * - * @return string - */ - public function compileColumnListing() - { - return 'select column_name from information_schema.columns where table_catalog = ? and table_schema = ? and table_name = ?'; - } - - /** - * Compile a create table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return array - */ - public function compileCreate(Blueprint $blueprint, Fluent $command) - { - return array_values(array_filter(array_merge([sprintf('%s table %s (%s)', - $blueprint->temporary ? 'create temporary' : 'create', - $this->wrapTable($blueprint), - implode(', ', $this->getColumns($blueprint)) - )], $this->compileAutoIncrementStartingValues($blueprint)))); - } - - /** - * Compile a column addition command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileAdd(Blueprint $blueprint, Fluent $command) - { - return array_values(array_filter(array_merge([sprintf('alter table %s %s', - $this->wrapTable($blueprint), - implode(', ', $this->prefixArray('add column', $this->getColumns($blueprint))) - )], $this->compileAutoIncrementStartingValues($blueprint)))); - } - - /** - * Compile the auto-incrementing column starting values. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return array - */ - public function compileAutoIncrementStartingValues(Blueprint $blueprint) - { - return collect($blueprint->autoIncrementingStartingValues())->map(function ($value, $column) use ($blueprint) { - return 'alter sequence '.$blueprint->getTable().'_'.$column.'_seq restart with '.$value; - })->all(); - } - - /** - * Compile a rename column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array|string - */ - public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection) - { - return $connection->usingNativeSchemaOperations() - ? sprintf('alter table %s rename column %s to %s', - $this->wrapTable($blueprint), - $this->wrap($command->from), - $this->wrap($command->to) - ) - : parent::compileRenameColumn($blueprint, $command, $connection); - } - - /** - * Compile a primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compilePrimary(Blueprint $blueprint, Fluent $command) - { - $columns = $this->columnize($command->columns); - - return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})"; - } - - /** - * Compile a unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileUnique(Blueprint $blueprint, Fluent $command) - { - $sql = sprintf('alter table %s add constraint %s unique (%s)', - $this->wrapTable($blueprint), - $this->wrap($command->index), - $this->columnize($command->columns) - ); - - if (! is_null($command->deferrable)) { - $sql .= $command->deferrable ? ' deferrable' : ' not deferrable'; - } - - if ($command->deferrable && ! is_null($command->initiallyImmediate)) { - $sql .= $command->initiallyImmediate ? ' initially immediate' : ' initially deferred'; - } - - return $sql; - } - - /** - * Compile a plain index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileIndex(Blueprint $blueprint, Fluent $command) - { - return sprintf('create index %s on %s%s (%s)', - $this->wrap($command->index), - $this->wrapTable($blueprint), - $command->algorithm ? ' using '.$command->algorithm : '', - $this->columnize($command->columns) - ); - } - - /** - * Compile a fulltext index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - * - * @throws \RuntimeException - */ - public function compileFulltext(Blueprint $blueprint, Fluent $command) - { - $language = $command->language ?: 'english'; - - $columns = array_map(function ($column) use ($language) { - return "to_tsvector({$this->quoteString($language)}, {$this->wrap($column)})"; - }, $command->columns); - - return sprintf('create index %s on %s using gin ((%s))', - $this->wrap($command->index), - $this->wrapTable($blueprint), - implode(' || ', $columns) - ); - } - - /** - * Compile a spatial index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) - { - $command->algorithm = 'gist'; - - return $this->compileIndex($blueprint, $command); - } - - /** - * Compile a foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileForeign(Blueprint $blueprint, Fluent $command) - { - $sql = parent::compileForeign($blueprint, $command); - - if (! is_null($command->deferrable)) { - $sql .= $command->deferrable ? ' deferrable' : ' not deferrable'; - } - - if ($command->deferrable && ! is_null($command->initiallyImmediate)) { - $sql .= $command->initiallyImmediate ? ' initially immediate' : ' initially deferred'; - } - - if (! is_null($command->notValid)) { - $sql .= ' not valid'; - } - - return $sql; - } - - /** - * Compile a drop table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDrop(Blueprint $blueprint, Fluent $command) - { - return 'drop table '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop table (if exists) command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIfExists(Blueprint $blueprint, Fluent $command) - { - return 'drop table if exists '.$this->wrapTable($blueprint); - } - - /** - * Compile the SQL needed to drop all tables. - * - * @param array $tables - * @return string - */ - public function compileDropAllTables($tables) - { - return 'drop table '.implode(',', $this->escapeNames($tables)).' cascade'; - } - - /** - * Compile the SQL needed to drop all views. - * - * @param array $views - * @return string - */ - public function compileDropAllViews($views) - { - return 'drop view '.implode(',', $this->escapeNames($views)).' cascade'; - } - - /** - * Compile the SQL needed to drop all types. - * - * @param array $types - * @return string - */ - public function compileDropAllTypes($types) - { - return 'drop type '.implode(',', $this->escapeNames($types)).' cascade'; - } - - /** - * Compile the SQL needed to retrieve all table names. - * - * @param string|array $searchPath - * @return string - */ - public function compileGetAllTables($searchPath) - { - return "select tablename, concat('\"', schemaname, '\".\"', tablename, '\"') as qualifiedname from pg_catalog.pg_tables where schemaname in ('".implode("','", (array) $searchPath)."')"; - } - - /** - * Compile the SQL needed to retrieve all view names. - * - * @param string|array $searchPath - * @return string - */ - public function compileGetAllViews($searchPath) - { - return "select viewname, concat('\"', schemaname, '\".\"', viewname, '\"') as qualifiedname from pg_catalog.pg_views where schemaname in ('".implode("','", (array) $searchPath)."')"; - } - - /** - * Compile the SQL needed to retrieve all type names. - * - * @return string - */ - public function compileGetAllTypes() - { - return 'select distinct pg_type.typname from pg_type inner join pg_enum on pg_enum.enumtypid = pg_type.oid'; - } - - /** - * Compile a drop column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropColumn(Blueprint $blueprint, Fluent $command) - { - $columns = $this->prefixArray('drop column', $this->wrapArray($command->columns)); - - return 'alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns); - } - - /** - * Compile a drop primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropPrimary(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap("{$blueprint->getTable()}_pkey"); - - return 'alter table '.$this->wrapTable($blueprint)." drop constraint {$index}"; - } - - /** - * Compile a drop unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropUnique(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; - } - - /** - * Compile a drop index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIndex(Blueprint $blueprint, Fluent $command) - { - return "drop index {$this->wrap($command->index)}"; - } - - /** - * Compile a drop fulltext index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropFullText(Blueprint $blueprint, Fluent $command) - { - return $this->compileDropIndex($blueprint, $command); - } - - /** - * Compile a drop spatial index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) - { - return $this->compileDropIndex($blueprint, $command); - } - - /** - * Compile a drop foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropForeign(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; - } - - /** - * Compile a rename table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRename(Blueprint $blueprint, Fluent $command) - { - $from = $this->wrapTable($blueprint); - - return "alter table {$from} rename to ".$this->wrapTable($command->to); - } - - /** - * Compile a rename index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRenameIndex(Blueprint $blueprint, Fluent $command) - { - return sprintf('alter index %s rename to %s', - $this->wrap($command->from), - $this->wrap($command->to) - ); - } - - /** - * Compile the command to enable foreign key constraints. - * - * @return string - */ - public function compileEnableForeignKeyConstraints() - { - return 'SET CONSTRAINTS ALL IMMEDIATE;'; - } - - /** - * Compile the command to disable foreign key constraints. - * - * @return string - */ - public function compileDisableForeignKeyConstraints() - { - return 'SET CONSTRAINTS ALL DEFERRED;'; - } - - /** - * Compile a comment command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileComment(Blueprint $blueprint, Fluent $command) - { - return sprintf('comment on column %s.%s is %s', - $this->wrapTable($blueprint), - $this->wrap($command->column->name), - "'".str_replace("'", "''", $command->value)."'" - ); - } - - /** - * Compile a table comment command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileTableComment(Blueprint $blueprint, Fluent $command) - { - return sprintf('comment on table %s is %s', - $this->wrapTable($blueprint), - "'".str_replace("'", "''", $command->comment)."'" - ); - } - - /** - * Quote-escape the given tables, views, or types. - * - * @param array $names - * @return array - */ - public function escapeNames($names) - { - return array_map(static function ($name) { - return '"'.collect(explode('.', $name)) - ->map(fn ($segment) => trim($segment, '\'"')) - ->implode('"."').'"'; - }, $names); - } - - /** - * Create the column definition for a char type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeChar(Fluent $column) - { - if ($column->length) { - return "char({$column->length})"; - } - - return 'char'; - } - - /** - * Create the column definition for a string type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeString(Fluent $column) - { - if ($column->length) { - return "varchar({$column->length})"; - } - - return 'varchar'; - } - - /** - * Create the column definition for a tiny text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyText(Fluent $column) - { - return 'varchar(255)'; - } - - /** - * Create the column definition for a text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a medium text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a long text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLongText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for an integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeInteger(Fluent $column) - { - return $this->generatableColumn('integer', $column); - } - - /** - * Create the column definition for a big integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBigInteger(Fluent $column) - { - return $this->generatableColumn('bigint', $column); - } - - /** - * Create the column definition for a medium integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumInteger(Fluent $column) - { - return $this->generatableColumn('integer', $column); - } - - /** - * Create the column definition for a tiny integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyInteger(Fluent $column) - { - return $this->generatableColumn('smallint', $column); - } - - /** - * Create the column definition for a small integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSmallInteger(Fluent $column) - { - return $this->generatableColumn('smallint', $column); - } - - /** - * Create the column definition for a generatable column. - * - * @param string $type - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function generatableColumn($type, Fluent $column) - { - if (! $column->autoIncrement && is_null($column->generatedAs)) { - return $type; - } - - if ($column->autoIncrement && is_null($column->generatedAs)) { - return with([ - 'integer' => 'serial', - 'bigint' => 'bigserial', - 'smallint' => 'smallserial', - ])[$type]; - } - - $options = ''; - - if (! is_bool($column->generatedAs) && ! empty($column->generatedAs)) { - $options = sprintf(' (%s)', $column->generatedAs); - } - - return sprintf( - '%s generated %s as identity%s', - $type, - $column->always ? 'always' : 'by default', - $options - ); - } - - /** - * Create the column definition for a float type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeFloat(Fluent $column) - { - return $this->typeDouble($column); - } - - /** - * Create the column definition for a double type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDouble(Fluent $column) - { - return 'double precision'; - } - - /** - * Create the column definition for a real type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeReal(Fluent $column) - { - return 'real'; - } - - /** - * Create the column definition for a decimal type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDecimal(Fluent $column) - { - return "decimal({$column->total}, {$column->places})"; - } - - /** - * Create the column definition for a boolean type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBoolean(Fluent $column) - { - return 'boolean'; - } - - /** - * Create the column definition for an enumeration type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeEnum(Fluent $column) - { - return sprintf( - 'varchar(255) check ("%s" in (%s))', - $column->name, - $this->quoteString($column->allowed) - ); - } - - /** - * Create the column definition for a json type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJson(Fluent $column) - { - return 'json'; - } - - /** - * Create the column definition for a jsonb type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJsonb(Fluent $column) - { - return 'jsonb'; - } - - /** - * Create the column definition for a date type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDate(Fluent $column) - { - return 'date'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTime(Fluent $column) - { - return $this->typeTimestamp($column); - } - - /** - * Create the column definition for a date-time (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTimeTz(Fluent $column) - { - return $this->typeTimestampTz($column); - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTime(Fluent $column) - { - return 'time'.(is_null($column->precision) ? '' : "($column->precision)").' without time zone'; - } - - /** - * Create the column definition for a time (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimeTz(Fluent $column) - { - return 'time'.(is_null($column->precision) ? '' : "($column->precision)").' with time zone'; - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestamp(Fluent $column) - { - $columnType = 'timestamp'.(is_null($column->precision) ? '' : "($column->precision)").' without time zone'; - - return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; - } - - /** - * Create the column definition for a timestamp (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestampTz(Fluent $column) - { - $columnType = 'timestamp'.(is_null($column->precision) ? '' : "($column->precision)").' with time zone'; - - return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; - } - - /** - * Create the column definition for a year type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeYear(Fluent $column) - { - return $this->typeInteger($column); - } - - /** - * Create the column definition for a binary type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBinary(Fluent $column) - { - return 'bytea'; - } - - /** - * Create the column definition for a uuid type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeUuid(Fluent $column) - { - return 'uuid'; - } - - /** - * Create the column definition for an IP address type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeIpAddress(Fluent $column) - { - return 'inet'; - } - - /** - * Create the column definition for a MAC address type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMacAddress(Fluent $column) - { - return 'macaddr'; - } - - /** - * Create the column definition for a spatial Geometry type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeGeometry(Fluent $column) - { - return $this->formatPostGisType('geometry', $column); - } - - /** - * Create the column definition for a spatial Point type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typePoint(Fluent $column) - { - return $this->formatPostGisType('point', $column); - } - - /** - * Create the column definition for a spatial LineString type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLineString(Fluent $column) - { - return $this->formatPostGisType('linestring', $column); - } - - /** - * Create the column definition for a spatial Polygon type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typePolygon(Fluent $column) - { - return $this->formatPostGisType('polygon', $column); - } - - /** - * Create the column definition for a spatial GeometryCollection type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeGeometryCollection(Fluent $column) - { - return $this->formatPostGisType('geometrycollection', $column); - } - - /** - * Create the column definition for a spatial MultiPoint type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMultiPoint(Fluent $column) - { - return $this->formatPostGisType('multipoint', $column); - } - - /** - * Create the column definition for a spatial MultiLineString type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiLineString(Fluent $column) - { - return $this->formatPostGisType('multilinestring', $column); - } - - /** - * Create the column definition for a spatial MultiPolygon type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMultiPolygon(Fluent $column) - { - return $this->formatPostGisType('multipolygon', $column); - } - - /** - * Create the column definition for a spatial MultiPolygonZ type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMultiPolygonZ(Fluent $column) - { - return $this->formatPostGisType('multipolygonz', $column); - } - - /** - * Format the column definition for a PostGIS spatial type. - * - * @param string $type - * @param \Illuminate\Support\Fluent $column - * @return string - */ - private function formatPostGisType($type, Fluent $column) - { - if ($column->isGeometry === null) { - return sprintf('geography(%s, %s)', $type, $column->projection ?? '4326'); - } - - if ($column->projection !== null) { - return sprintf('geometry(%s, %s)', $type, $column->projection); - } - - return "geometry({$type})"; - } - - /** - * Get the SQL for a collation column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyCollate(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->collation)) { - return ' collate '.$this->wrapValue($column->collation); - } - } - - /** - * Get the SQL for a nullable column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyNullable(Blueprint $blueprint, Fluent $column) - { - return $column->nullable ? ' null' : ' not null'; - } - - /** - * Get the SQL for a default column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyDefault(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->default)) { - return ' default '.$this->getDefaultValue($column->default); - } - } - - /** - * Get the SQL for an auto-increment column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyIncrement(Blueprint $blueprint, Fluent $column) - { - if ((in_array($column->type, $this->serials) || ($column->generatedAs !== null)) && $column->autoIncrement) { - return ' primary key'; - } - } - - /** - * Get the SQL for a generated virtual column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column) - { - if ($column->virtualAs !== null) { - return " generated always as ({$column->virtualAs})"; - } - } - - /** - * Get the SQL for a generated stored column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) - { - if ($column->storedAs !== null) { - return " generated always as ({$column->storedAs}) stored"; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/RenameColumn.php b/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/RenameColumn.php deleted file mode 100644 index 0db0c50..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/RenameColumn.php +++ /dev/null @@ -1,84 +0,0 @@ -getDoctrineSchemaManager(); - $databasePlatform = $schema->getDatabasePlatform(); - $databasePlatform->registerDoctrineTypeMapping('enum', 'string'); - - $column = $connection->getDoctrineColumn( - $grammar->getTablePrefix().$blueprint->getTable(), $command->from - ); - - return (array) $databasePlatform->getAlterTableSQL(static::getRenamedDiff( - $grammar, $blueprint, $command, $column, $schema - )); - } - - /** - * Get a new column instance with the new column name. - * - * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Doctrine\DBAL\Schema\Column $column - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema - * @return \Doctrine\DBAL\Schema\TableDiff - */ - protected static function getRenamedDiff(Grammar $grammar, Blueprint $blueprint, Fluent $command, Column $column, SchemaManager $schema) - { - return static::setRenamedColumns( - $grammar->getDoctrineTableDiff($blueprint, $schema), $command, $column - ); - } - - /** - * Set the renamed columns on the table diff. - * - * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff - * @param \Illuminate\Support\Fluent $command - * @param \Doctrine\DBAL\Schema\Column $column - * @return \Doctrine\DBAL\Schema\TableDiff - */ - protected static function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column) - { - $tableDiff->renamedColumns = [ - $command->from => new Column($command->to, $column->getType(), self::getWritableColumnOptions($column)), - ]; - - return $tableDiff; - } - - /** - * Get the writable column options. - * - * @param \Doctrine\DBAL\Schema\Column $column - * @return array - */ - private static function getWritableColumnOptions(Column $column) - { - return array_filter($column->toArray(), function (string $name) use ($column) { - return method_exists($column, 'set'.$name); - }, ARRAY_FILTER_USE_KEY); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php deleted file mode 100755 index c9d1c55..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ /dev/null @@ -1,1005 +0,0 @@ -wrap(str_replace('.', '__', $table)).')'; - } - - /** - * Compile a create table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileCreate(Blueprint $blueprint, Fluent $command) - { - return sprintf('%s table %s (%s%s%s)', - $blueprint->temporary ? 'create temporary' : 'create', - $this->wrapTable($blueprint), - implode(', ', $this->getColumns($blueprint)), - (string) $this->addForeignKeys($blueprint), - (string) $this->addPrimaryKeys($blueprint) - ); - } - - /** - * Get the foreign key syntax for a table creation statement. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return string|null - */ - protected function addForeignKeys(Blueprint $blueprint) - { - $foreigns = $this->getCommandsByName($blueprint, 'foreign'); - - return collect($foreigns)->reduce(function ($sql, $foreign) { - // Once we have all the foreign key commands for the table creation statement - // we'll loop through each of them and add them to the create table SQL we - // are building, since SQLite needs foreign keys on the tables creation. - $sql .= $this->getForeignKey($foreign); - - if (! is_null($foreign->onDelete)) { - $sql .= " on delete {$foreign->onDelete}"; - } - - // If this foreign key specifies the action to be taken on update we will add - // that to the statement here. We'll append it to this SQL and then return - // the SQL so we can keep adding any other foreign constraints onto this. - if (! is_null($foreign->onUpdate)) { - $sql .= " on update {$foreign->onUpdate}"; - } - - return $sql; - }, ''); - } - - /** - * Get the SQL for the foreign key. - * - * @param \Illuminate\Support\Fluent $foreign - * @return string - */ - protected function getForeignKey($foreign) - { - // We need to columnize the columns that the foreign key is being defined for - // so that it is a properly formatted list. Once we have done this, we can - // return the foreign key SQL declaration to the calling method for use. - return sprintf(', foreign key(%s) references %s(%s)', - $this->columnize($foreign->columns), - $this->wrapTable($foreign->on), - $this->columnize((array) $foreign->references) - ); - } - - /** - * Get the primary key syntax for a table creation statement. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @return string|null - */ - protected function addPrimaryKeys(Blueprint $blueprint) - { - if (! is_null($primary = $this->getCommandByName($blueprint, 'primary'))) { - return ", primary key ({$this->columnize($primary->columns)})"; - } - } - - /** - * Compile alter table commands for adding columns. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return array - */ - public function compileAdd(Blueprint $blueprint, Fluent $command) - { - $columns = $this->prefixArray('add column', $this->getColumns($blueprint)); - - return collect($columns)->reject(function ($column) { - return preg_match('/as \(.*\) stored/', $column) > 0; - })->map(function ($column) use ($blueprint) { - return 'alter table '.$this->wrapTable($blueprint).' '.$column; - })->all(); - } - - /** - * Compile a rename column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array|string - */ - public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection) - { - return $connection->usingNativeSchemaOperations() - ? sprintf('alter table %s rename column %s to %s', - $this->wrapTable($blueprint), - $this->wrap($command->from), - $this->wrap($command->to) - ) - : parent::compileRenameColumn($blueprint, $command, $connection); - } - - /** - * Compile a unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileUnique(Blueprint $blueprint, Fluent $command) - { - return sprintf('create unique index %s on %s (%s)', - $this->wrap($command->index), - $this->wrapTable($blueprint), - $this->columnize($command->columns) - ); - } - - /** - * Compile a plain index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileIndex(Blueprint $blueprint, Fluent $command) - { - return sprintf('create index %s on %s (%s)', - $this->wrap($command->index), - $this->wrapTable($blueprint), - $this->columnize($command->columns) - ); - } - - /** - * Compile a spatial index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return void - * - * @throws \RuntimeException - */ - public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) - { - throw new RuntimeException('The database driver in use does not support spatial indexes.'); - } - - /** - * Compile a foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileForeign(Blueprint $blueprint, Fluent $command) - { - // Handled on table creation... - } - - /** - * Compile a drop table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDrop(Blueprint $blueprint, Fluent $command) - { - return 'drop table '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop table (if exists) command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIfExists(Blueprint $blueprint, Fluent $command) - { - return 'drop table if exists '.$this->wrapTable($blueprint); - } - - /** - * Compile the SQL needed to drop all tables. - * - * @return string - */ - public function compileDropAllTables() - { - return "delete from sqlite_master where type in ('table', 'index', 'trigger')"; - } - - /** - * Compile the SQL needed to drop all views. - * - * @return string - */ - public function compileDropAllViews() - { - return "delete from sqlite_master where type in ('view')"; - } - - /** - * Compile the SQL needed to retrieve all table names. - * - * @return string - */ - public function compileGetAllTables() - { - return 'select type, name from sqlite_master where type = \'table\' and name not like \'sqlite_%\''; - } - - /** - * Compile the SQL needed to retrieve all view names. - * - * @return string - */ - public function compileGetAllViews() - { - return 'select type, name from sqlite_master where type = \'view\''; - } - - /** - * Compile the SQL needed to rebuild the database. - * - * @return string - */ - public function compileRebuild() - { - return 'vacuum'; - } - - /** - * Compile a drop column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array - */ - public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection) - { - if ($connection->usingNativeSchemaOperations()) { - $table = $this->wrapTable($blueprint); - - $columns = $this->prefixArray('drop column', $this->wrapArray($command->columns)); - - return collect($columns)->map(fn ($column) => 'alter table '.$table.' '.$column - )->all(); - } else { - $tableDiff = $this->getDoctrineTableDiff( - $blueprint, $schema = $connection->getDoctrineSchemaManager() - ); - - foreach ($command->columns as $name) { - $tableDiff->removedColumns[$name] = $connection->getDoctrineColumn( - $this->getTablePrefix().$blueprint->getTable(), $name - ); - } - - return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); - } - } - - /** - * Compile a drop unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropUnique(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "drop index {$index}"; - } - - /** - * Compile a drop index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIndex(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "drop index {$index}"; - } - - /** - * Compile a drop spatial index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return void - * - * @throws \RuntimeException - */ - public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) - { - throw new RuntimeException('The database driver in use does not support spatial indexes.'); - } - - /** - * Compile a rename table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRename(Blueprint $blueprint, Fluent $command) - { - $from = $this->wrapTable($blueprint); - - return "alter table {$from} rename to ".$this->wrapTable($command->to); - } - - /** - * Compile a rename index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array - * - * @throws \RuntimeException - */ - public function compileRenameIndex(Blueprint $blueprint, Fluent $command, Connection $connection) - { - $schemaManager = $connection->getDoctrineSchemaManager(); - - $indexes = $schemaManager->listTableIndexes($this->getTablePrefix().$blueprint->getTable()); - - $index = Arr::get($indexes, $command->from); - - if (! $index) { - throw new RuntimeException("Index [{$command->from}] does not exist."); - } - - $newIndex = new Index( - $command->to, $index->getColumns(), $index->isUnique(), - $index->isPrimary(), $index->getFlags(), $index->getOptions() - ); - - $platform = $schemaManager->getDatabasePlatform(); - - return [ - $platform->getDropIndexSQL($command->from, $this->getTablePrefix().$blueprint->getTable()), - $platform->getCreateIndexSQL($newIndex, $this->getTablePrefix().$blueprint->getTable()), - ]; - } - - /** - * Compile the command to enable foreign key constraints. - * - * @return string - */ - public function compileEnableForeignKeyConstraints() - { - return 'PRAGMA foreign_keys = ON;'; - } - - /** - * Compile the command to disable foreign key constraints. - * - * @return string - */ - public function compileDisableForeignKeyConstraints() - { - return 'PRAGMA foreign_keys = OFF;'; - } - - /** - * Compile the SQL needed to enable a writable schema. - * - * @return string - */ - public function compileEnableWriteableSchema() - { - return 'PRAGMA writable_schema = 1;'; - } - - /** - * Compile the SQL needed to disable a writable schema. - * - * @return string - */ - public function compileDisableWriteableSchema() - { - return 'PRAGMA writable_schema = 0;'; - } - - /** - * Create the column definition for a char type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeChar(Fluent $column) - { - return 'varchar'; - } - - /** - * Create the column definition for a string type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeString(Fluent $column) - { - return 'varchar'; - } - - /** - * Create the column definition for a tiny text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a medium text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a long text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLongText(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for an integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a big integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBigInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a medium integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a tiny integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a small integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSmallInteger(Fluent $column) - { - return 'integer'; - } - - /** - * Create the column definition for a float type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeFloat(Fluent $column) - { - return 'float'; - } - - /** - * Create the column definition for a double type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDouble(Fluent $column) - { - return 'float'; - } - - /** - * Create the column definition for a decimal type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDecimal(Fluent $column) - { - return 'numeric'; - } - - /** - * Create the column definition for a boolean type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBoolean(Fluent $column) - { - return 'tinyint(1)'; - } - - /** - * Create the column definition for an enumeration type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeEnum(Fluent $column) - { - return sprintf( - 'varchar check ("%s" in (%s))', - $column->name, - $this->quoteString($column->allowed) - ); - } - - /** - * Create the column definition for a json type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJson(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a jsonb type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJsonb(Fluent $column) - { - return 'text'; - } - - /** - * Create the column definition for a date type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDate(Fluent $column) - { - return 'date'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTime(Fluent $column) - { - return $this->typeTimestamp($column); - } - - /** - * Create the column definition for a date-time (with time zone) type. - * - * Note: "SQLite does not have a storage class set aside for storing dates and/or times." - * - * @link https://www.sqlite.org/datatype3.html - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTimeTz(Fluent $column) - { - return $this->typeDateTime($column); - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTime(Fluent $column) - { - return 'time'; - } - - /** - * Create the column definition for a time (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimeTz(Fluent $column) - { - return $this->typeTime($column); - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestamp(Fluent $column) - { - return $column->useCurrent ? 'datetime default CURRENT_TIMESTAMP' : 'datetime'; - } - - /** - * Create the column definition for a timestamp (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestampTz(Fluent $column) - { - return $this->typeTimestamp($column); - } - - /** - * Create the column definition for a year type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeYear(Fluent $column) - { - return $this->typeInteger($column); - } - - /** - * Create the column definition for a binary type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBinary(Fluent $column) - { - return 'blob'; - } - - /** - * Create the column definition for a uuid type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeUuid(Fluent $column) - { - return 'varchar'; - } - - /** - * Create the column definition for an IP address type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeIpAddress(Fluent $column) - { - return 'varchar'; - } - - /** - * Create the column definition for a MAC address type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMacAddress(Fluent $column) - { - return 'varchar'; - } - - /** - * Create the column definition for a spatial Geometry type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeGeometry(Fluent $column) - { - return 'geometry'; - } - - /** - * Create the column definition for a spatial Point type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typePoint(Fluent $column) - { - return 'point'; - } - - /** - * Create the column definition for a spatial LineString type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeLineString(Fluent $column) - { - return 'linestring'; - } - - /** - * Create the column definition for a spatial Polygon type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typePolygon(Fluent $column) - { - return 'polygon'; - } - - /** - * Create the column definition for a spatial GeometryCollection type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeGeometryCollection(Fluent $column) - { - return 'geometrycollection'; - } - - /** - * Create the column definition for a spatial MultiPoint type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiPoint(Fluent $column) - { - return 'multipoint'; - } - - /** - * Create the column definition for a spatial MultiLineString type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiLineString(Fluent $column) - { - return 'multilinestring'; - } - - /** - * Create the column definition for a spatial MultiPolygon type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiPolygon(Fluent $column) - { - return 'multipolygon'; - } - - /** - * Create the column definition for a generated, computed column type. - * - * @param \Illuminate\Support\Fluent $column - * @return void - * - * @throws \RuntimeException - */ - protected function typeComputed(Fluent $column) - { - throw new RuntimeException('This database driver requires a type, see the virtualAs / storedAs modifiers.'); - } - - /** - * Get the SQL for a generated virtual column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column) - { - if (! is_null($virtualAs = $column->virtualAsJson)) { - if ($this->isJsonSelector($virtualAs)) { - $virtualAs = $this->wrapJsonSelector($virtualAs); - } - - return " as ({$virtualAs})"; - } - - if (! is_null($virtualAs = $column->virtualAs)) { - return " as ({$virtualAs})"; - } - } - - /** - * Get the SQL for a generated stored column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) - { - if (! is_null($storedAs = $column->storedAsJson)) { - if ($this->isJsonSelector($storedAs)) { - $storedAs = $this->wrapJsonSelector($storedAs); - } - - return " as ({$storedAs}) stored"; - } - - if (! is_null($storedAs = $column->storedAs)) { - return " as ({$column->storedAs}) stored"; - } - } - - /** - * Get the SQL for a nullable column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyNullable(Blueprint $blueprint, Fluent $column) - { - if (is_null($column->virtualAs) && - is_null($column->virtualAsJson) && - is_null($column->storedAs) && - is_null($column->storedAsJson)) { - return $column->nullable ? '' : ' not null'; - } - - if ($column->nullable === false) { - return ' not null'; - } - } - - /** - * Get the SQL for a default column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyDefault(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->default) && is_null($column->virtualAs) && is_null($column->virtualAsJson) && is_null($column->storedAs)) { - return ' default '.$this->getDefaultValue($column->default); - } - } - - /** - * Get the SQL for an auto-increment column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyIncrement(Blueprint $blueprint, Fluent $column) - { - if (in_array($column->type, $this->serials) && $column->autoIncrement) { - return ' primary key autoincrement'; - } - } - - /** - * Wrap the given JSON selector. - * - * @param string $value - * @return string - */ - protected function wrapJsonSelector($value) - { - [$field, $path] = $this->wrapJsonFieldAndPath($value); - - return 'json_extract('.$field.$path.')'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php deleted file mode 100755 index 4d7271c..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php +++ /dev/null @@ -1,973 +0,0 @@ -wrapValue($name), - ); - } - - /** - * Compile a drop database if exists command. - * - * @param string $name - * @return string - */ - public function compileDropDatabaseIfExists($name) - { - return sprintf( - 'drop database if exists %s', - $this->wrapValue($name) - ); - } - - /** - * Compile the query to determine if a table exists. - * - * @return string - */ - public function compileTableExists() - { - return "select * from sys.sysobjects where id = object_id(?) and xtype in ('U', 'V')"; - } - - /** - * Compile the query to determine the list of columns. - * - * @param string $table - * @return string - */ - public function compileColumnListing($table) - { - return "select name from sys.columns where object_id = object_id('$table')"; - } - - /** - * Compile a create table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileCreate(Blueprint $blueprint, Fluent $command) - { - $columns = implode(', ', $this->getColumns($blueprint)); - - return 'create table '.$this->wrapTable($blueprint)." ($columns)"; - } - - /** - * Compile a column addition table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileAdd(Blueprint $blueprint, Fluent $command) - { - return sprintf('alter table %s add %s', - $this->wrapTable($blueprint), - implode(', ', $this->getColumns($blueprint)) - ); - } - - /** - * Compile a rename column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @param \Illuminate\Database\Connection $connection - * @return array|string - */ - public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection) - { - return $connection->usingNativeSchemaOperations() - ? sprintf("sp_rename '%s', %s, 'COLUMN'", - $this->wrap($blueprint->getTable().'.'.$command->from), - $this->wrap($command->to) - ) - : parent::compileRenameColumn($blueprint, $command, $connection); - } - - /** - * Compile a primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compilePrimary(Blueprint $blueprint, Fluent $command) - { - return sprintf('alter table %s add constraint %s primary key (%s)', - $this->wrapTable($blueprint), - $this->wrap($command->index), - $this->columnize($command->columns) - ); - } - - /** - * Compile a unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileUnique(Blueprint $blueprint, Fluent $command) - { - return sprintf('create unique index %s on %s (%s)', - $this->wrap($command->index), - $this->wrapTable($blueprint), - $this->columnize($command->columns) - ); - } - - /** - * Compile a plain index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileIndex(Blueprint $blueprint, Fluent $command) - { - return sprintf('create index %s on %s (%s)', - $this->wrap($command->index), - $this->wrapTable($blueprint), - $this->columnize($command->columns) - ); - } - - /** - * Compile a spatial index key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) - { - return sprintf('create spatial index %s on %s (%s)', - $this->wrap($command->index), - $this->wrapTable($blueprint), - $this->columnize($command->columns) - ); - } - - /** - * Compile a drop table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDrop(Blueprint $blueprint, Fluent $command) - { - return 'drop table '.$this->wrapTable($blueprint); - } - - /** - * Compile a drop table (if exists) command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIfExists(Blueprint $blueprint, Fluent $command) - { - return sprintf('if exists (select * from sys.sysobjects where id = object_id(%s, \'U\')) drop table %s', - "'".str_replace("'", "''", $this->getTablePrefix().$blueprint->getTable())."'", - $this->wrapTable($blueprint) - ); - } - - /** - * Compile the SQL needed to drop all tables. - * - * @return string - */ - public function compileDropAllTables() - { - return "EXEC sp_msforeachtable 'DROP TABLE ?'"; - } - - /** - * Compile a drop column command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropColumn(Blueprint $blueprint, Fluent $command) - { - $columns = $this->wrapArray($command->columns); - - $dropExistingConstraintsSql = $this->compileDropDefaultConstraint($blueprint, $command).';'; - - return $dropExistingConstraintsSql.'alter table '.$this->wrapTable($blueprint).' drop column '.implode(', ', $columns); - } - - /** - * Compile a drop default constraint command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropDefaultConstraint(Blueprint $blueprint, Fluent $command) - { - $columns = "'".implode("','", $command->columns)."'"; - - $tableName = $this->getTablePrefix().$blueprint->getTable(); - - $sql = "DECLARE @sql NVARCHAR(MAX) = '';"; - $sql .= "SELECT @sql += 'ALTER TABLE [dbo].[{$tableName}] DROP CONSTRAINT ' + OBJECT_NAME([default_object_id]) + ';' "; - $sql .= 'FROM sys.columns '; - $sql .= "WHERE [object_id] = OBJECT_ID('[dbo].[{$tableName}]') AND [name] in ({$columns}) AND [default_object_id] <> 0;"; - $sql .= 'EXEC(@sql)'; - - return $sql; - } - - /** - * Compile a drop primary key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropPrimary(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; - } - - /** - * Compile a drop unique key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropUnique(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "drop index {$index} on {$this->wrapTable($blueprint)}"; - } - - /** - * Compile a drop index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropIndex(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "drop index {$index} on {$this->wrapTable($blueprint)}"; - } - - /** - * Compile a drop spatial index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) - { - return $this->compileDropIndex($blueprint, $command); - } - - /** - * Compile a drop foreign key command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileDropForeign(Blueprint $blueprint, Fluent $command) - { - $index = $this->wrap($command->index); - - return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; - } - - /** - * Compile a rename table command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRename(Blueprint $blueprint, Fluent $command) - { - $from = $this->wrapTable($blueprint); - - return "sp_rename {$from}, ".$this->wrapTable($command->to); - } - - /** - * Compile a rename index command. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $command - * @return string - */ - public function compileRenameIndex(Blueprint $blueprint, Fluent $command) - { - return sprintf("sp_rename N'%s', %s, N'INDEX'", - $this->wrap($blueprint->getTable().'.'.$command->from), - $this->wrap($command->to) - ); - } - - /** - * Compile the command to enable foreign key constraints. - * - * @return string - */ - public function compileEnableForeignKeyConstraints() - { - return 'EXEC sp_msforeachtable @command1="print \'?\'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all";'; - } - - /** - * Compile the command to disable foreign key constraints. - * - * @return string - */ - public function compileDisableForeignKeyConstraints() - { - return 'EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";'; - } - - /** - * Compile the command to drop all foreign keys. - * - * @return string - */ - public function compileDropAllForeignKeys() - { - return "DECLARE @sql NVARCHAR(MAX) = N''; - SELECT @sql += 'ALTER TABLE ' - + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.' + + QUOTENAME(OBJECT_NAME(parent_object_id)) - + ' DROP CONSTRAINT ' + QUOTENAME(name) + ';' - FROM sys.foreign_keys; - - EXEC sp_executesql @sql;"; - } - - /** - * Compile the command to drop all views. - * - * @return string - */ - public function compileDropAllViews() - { - return "DECLARE @sql NVARCHAR(MAX) = N''; - SELECT @sql += 'DROP VIEW ' + QUOTENAME(OBJECT_SCHEMA_NAME(object_id)) + '.' + QUOTENAME(name) + ';' - FROM sys.views; - - EXEC sp_executesql @sql;"; - } - - /** - * Compile the SQL needed to retrieve all table names. - * - * @return string - */ - public function compileGetAllTables() - { - return "select name, type from sys.tables where type = 'U'"; - } - - /** - * Compile the SQL needed to retrieve all view names. - * - * @return string - */ - public function compileGetAllViews() - { - return "select name, type from sys.objects where type = 'V'"; - } - - /** - * Create the column definition for a char type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeChar(Fluent $column) - { - return "nchar({$column->length})"; - } - - /** - * Create the column definition for a string type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeString(Fluent $column) - { - return "nvarchar({$column->length})"; - } - - /** - * Create the column definition for a tiny text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyText(Fluent $column) - { - return 'nvarchar(255)'; - } - - /** - * Create the column definition for a text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeText(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a medium text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumText(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a long text type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeLongText(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for an integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeInteger(Fluent $column) - { - return 'int'; - } - - /** - * Create the column definition for a big integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBigInteger(Fluent $column) - { - return 'bigint'; - } - - /** - * Create the column definition for a medium integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMediumInteger(Fluent $column) - { - return 'int'; - } - - /** - * Create the column definition for a tiny integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTinyInteger(Fluent $column) - { - return 'tinyint'; - } - - /** - * Create the column definition for a small integer type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeSmallInteger(Fluent $column) - { - return 'smallint'; - } - - /** - * Create the column definition for a float type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeFloat(Fluent $column) - { - return 'float'; - } - - /** - * Create the column definition for a double type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDouble(Fluent $column) - { - return 'float'; - } - - /** - * Create the column definition for a decimal type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDecimal(Fluent $column) - { - return "decimal({$column->total}, {$column->places})"; - } - - /** - * Create the column definition for a boolean type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBoolean(Fluent $column) - { - return 'bit'; - } - - /** - * Create the column definition for an enumeration type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeEnum(Fluent $column) - { - return sprintf( - 'nvarchar(255) check ("%s" in (%s))', - $column->name, - $this->quoteString($column->allowed) - ); - } - - /** - * Create the column definition for a json type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJson(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a jsonb type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeJsonb(Fluent $column) - { - return 'nvarchar(max)'; - } - - /** - * Create the column definition for a date type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDate(Fluent $column) - { - return 'date'; - } - - /** - * Create the column definition for a date-time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTime(Fluent $column) - { - return $this->typeTimestamp($column); - } - - /** - * Create the column definition for a date-time (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeDateTimeTz(Fluent $column) - { - return $this->typeTimestampTz($column); - } - - /** - * Create the column definition for a time type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTime(Fluent $column) - { - return $column->precision ? "time($column->precision)" : 'time'; - } - - /** - * Create the column definition for a time (with time zone) type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimeTz(Fluent $column) - { - return $this->typeTime($column); - } - - /** - * Create the column definition for a timestamp type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestamp(Fluent $column) - { - $columnType = $column->precision ? "datetime2($column->precision)" : 'datetime'; - - return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; - } - - /** - * Create the column definition for a timestamp (with time zone) type. - * - * @link https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetimeoffset-transact-sql?view=sql-server-ver15 - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeTimestampTz(Fluent $column) - { - $columnType = $column->precision ? "datetimeoffset($column->precision)" : 'datetimeoffset'; - - return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; - } - - /** - * Create the column definition for a year type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeYear(Fluent $column) - { - return $this->typeInteger($column); - } - - /** - * Create the column definition for a binary type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeBinary(Fluent $column) - { - return 'varbinary(max)'; - } - - /** - * Create the column definition for a uuid type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeUuid(Fluent $column) - { - return 'uniqueidentifier'; - } - - /** - * Create the column definition for an IP address type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeIpAddress(Fluent $column) - { - return 'nvarchar(45)'; - } - - /** - * Create the column definition for a MAC address type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - protected function typeMacAddress(Fluent $column) - { - return 'nvarchar(17)'; - } - - /** - * Create the column definition for a spatial Geometry type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeGeometry(Fluent $column) - { - return 'geography'; - } - - /** - * Create the column definition for a spatial Point type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typePoint(Fluent $column) - { - return 'geography'; - } - - /** - * Create the column definition for a spatial LineString type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeLineString(Fluent $column) - { - return 'geography'; - } - - /** - * Create the column definition for a spatial Polygon type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typePolygon(Fluent $column) - { - return 'geography'; - } - - /** - * Create the column definition for a spatial GeometryCollection type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeGeometryCollection(Fluent $column) - { - return 'geography'; - } - - /** - * Create the column definition for a spatial MultiPoint type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiPoint(Fluent $column) - { - return 'geography'; - } - - /** - * Create the column definition for a spatial MultiLineString type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiLineString(Fluent $column) - { - return 'geography'; - } - - /** - * Create the column definition for a spatial MultiPolygon type. - * - * @param \Illuminate\Support\Fluent $column - * @return string - */ - public function typeMultiPolygon(Fluent $column) - { - return 'geography'; - } - - /** - * Create the column definition for a generated, computed column type. - * - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function typeComputed(Fluent $column) - { - return "as ({$column->expression})"; - } - - /** - * Get the SQL for a collation column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyCollate(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->collation)) { - return ' collate '.$column->collation; - } - } - - /** - * Get the SQL for a nullable column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyNullable(Blueprint $blueprint, Fluent $column) - { - if ($column->type !== 'computed') { - return $column->nullable ? ' null' : ' not null'; - } - } - - /** - * Get the SQL for a default column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyDefault(Blueprint $blueprint, Fluent $column) - { - if (! is_null($column->default)) { - return ' default '.$this->getDefaultValue($column->default); - } - } - - /** - * Get the SQL for an auto-increment column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyIncrement(Blueprint $blueprint, Fluent $column) - { - if (in_array($column->type, $this->serials) && $column->autoIncrement) { - return ' identity primary key'; - } - } - - /** - * Get the SQL for a generated stored column modifier. - * - * @param \Illuminate\Database\Schema\Blueprint $blueprint - * @param \Illuminate\Support\Fluent $column - * @return string|null - */ - protected function modifyPersisted(Blueprint $blueprint, Fluent $column) - { - if ($column->persisted) { - return ' persisted'; - } - } - - /** - * Wrap a table in keyword identifiers. - * - * @param \Illuminate\Database\Query\Expression|string $table - * @return string - */ - public function wrapTable($table) - { - if ($table instanceof Blueprint && $table->temporary) { - $this->setTablePrefix('#'); - } - - return parent::wrapTable($table); - } - - /** - * Quote the given string literal. - * - * @param string|array $value - * @return string - */ - public function quoteString($value) - { - if (is_array($value)) { - return implode(', ', array_map([$this, __FUNCTION__], $value)); - } - - return "N'$value'"; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/IndexDefinition.php b/framework-9.50.2/src/Illuminate/Database/Schema/IndexDefinition.php deleted file mode 100644 index fc5d78e..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/IndexDefinition.php +++ /dev/null @@ -1,16 +0,0 @@ -connection->statement( - $this->grammar->compileCreateDatabase($name, $this->connection) - ); - } - - /** - * Drop a database from the schema if the database exists. - * - * @param string $name - * @return bool - */ - public function dropDatabaseIfExists($name) - { - return $this->connection->statement( - $this->grammar->compileDropDatabaseIfExists($name) - ); - } - - /** - * Determine if the given table exists. - * - * @param string $table - * @return bool - */ - public function hasTable($table) - { - $table = $this->connection->getTablePrefix().$table; - - return count($this->connection->selectFromWriteConnection( - $this->grammar->compileTableExists(), [$this->connection->getDatabaseName(), $table] - )) > 0; - } - - /** - * Get the column listing for a given table. - * - * @param string $table - * @return array - */ - public function getColumnListing($table) - { - $table = $this->connection->getTablePrefix().$table; - - $results = $this->connection->selectFromWriteConnection( - $this->grammar->compileColumnListing(), [$this->connection->getDatabaseName(), $table] - ); - - return $this->connection->getPostProcessor()->processColumnListing($results); - } - - /** - * Drop all tables from the database. - * - * @return void - */ - public function dropAllTables() - { - $tables = []; - - foreach ($this->getAllTables() as $row) { - $row = (array) $row; - - $tables[] = reset($row); - } - - if (empty($tables)) { - return; - } - - $this->disableForeignKeyConstraints(); - - $this->connection->statement( - $this->grammar->compileDropAllTables($tables) - ); - - $this->enableForeignKeyConstraints(); - } - - /** - * Drop all views from the database. - * - * @return void - */ - public function dropAllViews() - { - $views = []; - - foreach ($this->getAllViews() as $row) { - $row = (array) $row; - - $views[] = reset($row); - } - - if (empty($views)) { - return; - } - - $this->connection->statement( - $this->grammar->compileDropAllViews($views) - ); - } - - /** - * Get all of the table names for the database. - * - * @return array - */ - public function getAllTables() - { - return $this->connection->select( - $this->grammar->compileGetAllTables() - ); - } - - /** - * Get all of the view names for the database. - * - * @return array - */ - public function getAllViews() - { - return $this->connection->select( - $this->grammar->compileGetAllViews() - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/MySqlSchemaState.php b/framework-9.50.2/src/Illuminate/Database/Schema/MySqlSchemaState.php deleted file mode 100644 index 0cd3486..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/MySqlSchemaState.php +++ /dev/null @@ -1,170 +0,0 @@ -executeDumpProcess($this->makeProcess( - $this->baseDumpCommand().' --routines --result-file="${:LARAVEL_LOAD_PATH}" --no-data' - ), $this->output, array_merge($this->baseVariables($this->connection->getConfig()), [ - 'LARAVEL_LOAD_PATH' => $path, - ])); - - $this->removeAutoIncrementingState($path); - - $this->appendMigrationData($path); - } - - /** - * Remove the auto-incrementing state from the given schema dump. - * - * @param string $path - * @return void - */ - protected function removeAutoIncrementingState(string $path) - { - $this->files->put($path, preg_replace( - '/\s+AUTO_INCREMENT=[0-9]+/iu', - '', - $this->files->get($path) - )); - } - - /** - * Append the migration data to the schema dump. - * - * @param string $path - * @return void - */ - protected function appendMigrationData(string $path) - { - $process = $this->executeDumpProcess($this->makeProcess( - $this->baseDumpCommand().' '.$this->migrationTable.' --no-create-info --skip-extended-insert --skip-routines --compact' - ), null, array_merge($this->baseVariables($this->connection->getConfig()), [ - // - ])); - - $this->files->append($path, $process->getOutput()); - } - - /** - * Load the given schema file into the database. - * - * @param string $path - * @return void - */ - public function load($path) - { - $command = 'mysql '.$this->connectionString().' --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"'; - - $process = $this->makeProcess($command)->setTimeout(null); - - $process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ - 'LARAVEL_LOAD_PATH' => $path, - ])); - } - - /** - * Get the base dump command arguments for MySQL as a string. - * - * @return string - */ - protected function baseDumpCommand() - { - $command = 'mysqldump '.$this->connectionString().' --no-tablespaces --skip-add-locks --skip-comments --skip-set-charset --tz-utc --column-statistics=0'; - - if (! $this->connection->isMaria()) { - $command .= ' --set-gtid-purged=OFF'; - } - - return $command.' "${:LARAVEL_LOAD_DATABASE}"'; - } - - /** - * Generate a basic connection string (--socket, --host, --port, --user, --password) for the database. - * - * @return string - */ - protected function connectionString() - { - $value = ' --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}"'; - - $config = $this->connection->getConfig(); - - $value .= $config['unix_socket'] ?? false - ? ' --socket="${:LARAVEL_LOAD_SOCKET}"' - : ' --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}"'; - - if (isset($config['options'][\PDO::MYSQL_ATTR_SSL_CA])) { - $value .= ' --ssl-ca="${:LARAVEL_LOAD_SSL_CA}"'; - } - - return $value; - } - - /** - * Get the base variables for a dump / load command. - * - * @param array $config - * @return array - */ - protected function baseVariables(array $config) - { - $config['host'] ??= ''; - - return [ - 'LARAVEL_LOAD_SOCKET' => $config['unix_socket'] ?? '', - 'LARAVEL_LOAD_HOST' => is_array($config['host']) ? $config['host'][0] : $config['host'], - 'LARAVEL_LOAD_PORT' => $config['port'] ?? '', - 'LARAVEL_LOAD_USER' => $config['username'], - 'LARAVEL_LOAD_PASSWORD' => $config['password'] ?? '', - 'LARAVEL_LOAD_DATABASE' => $config['database'], - 'LARAVEL_LOAD_SSL_CA' => $config['options'][\PDO::MYSQL_ATTR_SSL_CA] ?? '', - ]; - } - - /** - * Execute the given dump process. - * - * @param \Symfony\Component\Process\Process $process - * @param callable $output - * @param array $variables - * @return \Symfony\Component\Process\Process - */ - protected function executeDumpProcess(Process $process, $output, array $variables) - { - try { - $process->setTimeout(null)->mustRun($output, $variables); - } catch (Exception $e) { - if (Str::contains($e->getMessage(), ['column-statistics', 'column_statistics'])) { - return $this->executeDumpProcess(Process::fromShellCommandLine( - str_replace(' --column-statistics=0', '', $process->getCommandLine()) - ), $output, $variables); - } - - if (str_contains($e->getMessage(), 'set-gtid-purged')) { - return $this->executeDumpProcess(Process::fromShellCommandLine( - str_replace(' --set-gtid-purged=OFF', '', $process->getCommandLine()) - ), $output, $variables); - } - - throw $e; - } - - return $process; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/PostgresBuilder.php b/framework-9.50.2/src/Illuminate/Database/Schema/PostgresBuilder.php deleted file mode 100755 index adfbd68..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/PostgresBuilder.php +++ /dev/null @@ -1,248 +0,0 @@ -connection->statement( - $this->grammar->compileCreateDatabase($name, $this->connection) - ); - } - - /** - * Drop a database from the schema if the database exists. - * - * @param string $name - * @return bool - */ - public function dropDatabaseIfExists($name) - { - return $this->connection->statement( - $this->grammar->compileDropDatabaseIfExists($name) - ); - } - - /** - * Determine if the given table exists. - * - * @param string $table - * @return bool - */ - public function hasTable($table) - { - [$database, $schema, $table] = $this->parseSchemaAndTable($table); - - $table = $this->connection->getTablePrefix().$table; - - return count($this->connection->selectFromWriteConnection( - $this->grammar->compileTableExists(), [$database, $schema, $table] - )) > 0; - } - - /** - * Drop all tables from the database. - * - * @return void - */ - public function dropAllTables() - { - $tables = []; - - $excludedTables = $this->grammar->escapeNames( - $this->connection->getConfig('dont_drop') ?? ['spatial_ref_sys'] - ); - - foreach ($this->getAllTables() as $row) { - $row = (array) $row; - - if (empty(array_intersect($this->grammar->escapeNames($row), $excludedTables))) { - $tables[] = $row['qualifiedname'] ?? reset($row); - } - } - - if (empty($tables)) { - return; - } - - $this->connection->statement( - $this->grammar->compileDropAllTables($tables) - ); - } - - /** - * Drop all views from the database. - * - * @return void - */ - public function dropAllViews() - { - $views = []; - - foreach ($this->getAllViews() as $row) { - $row = (array) $row; - - $views[] = $row['qualifiedname'] ?? reset($row); - } - - if (empty($views)) { - return; - } - - $this->connection->statement( - $this->grammar->compileDropAllViews($views) - ); - } - - /** - * Drop all types from the database. - * - * @return void - */ - public function dropAllTypes() - { - $types = []; - - foreach ($this->getAllTypes() as $row) { - $row = (array) $row; - - $types[] = reset($row); - } - - if (empty($types)) { - return; - } - - $this->connection->statement( - $this->grammar->compileDropAllTypes($types) - ); - } - - /** - * Get all of the table names for the database. - * - * @return array - */ - public function getAllTables() - { - return $this->connection->select( - $this->grammar->compileGetAllTables( - $this->parseSearchPath( - $this->connection->getConfig('search_path') ?: $this->connection->getConfig('schema') - ) - ) - ); - } - - /** - * Get all of the view names for the database. - * - * @return array - */ - public function getAllViews() - { - return $this->connection->select( - $this->grammar->compileGetAllViews( - $this->parseSearchPath( - $this->connection->getConfig('search_path') ?: $this->connection->getConfig('schema') - ) - ) - ); - } - - /** - * Get all of the type names for the database. - * - * @return array - */ - public function getAllTypes() - { - return $this->connection->select( - $this->grammar->compileGetAllTypes() - ); - } - - /** - * Get the column listing for a given table. - * - * @param string $table - * @return array - */ - public function getColumnListing($table) - { - [$database, $schema, $table] = $this->parseSchemaAndTable($table); - - $table = $this->connection->getTablePrefix().$table; - - $results = $this->connection->selectFromWriteConnection( - $this->grammar->compileColumnListing(), [$database, $schema, $table] - ); - - return $this->connection->getPostProcessor()->processColumnListing($results); - } - - /** - * Parse the database object reference and extract the database, schema, and table. - * - * @param string $reference - * @return array - */ - protected function parseSchemaAndTable($reference) - { - $searchPath = $this->parseSearchPath( - $this->connection->getConfig('search_path') ?: $this->connection->getConfig('schema') ?: 'public' - ); - - $parts = explode('.', $reference); - - $database = $this->connection->getConfig('database'); - - // If the reference contains a database name, we will use that instead of the - // default database name for the connection. This allows the database name - // to be specified in the query instead of at the full connection level. - if (count($parts) === 3) { - $database = $parts[0]; - array_shift($parts); - } - - // We will use the default schema unless the schema has been specified in the - // query. If the schema has been specified in the query then we can use it - // instead of a default schema configured in the connection search path. - $schema = $searchPath[0]; - - if (count($parts) === 2) { - $schema = $parts[0]; - array_shift($parts); - } - - return [$database, $schema, $parts[0]]; - } - - /** - * Parse the "search_path" configuration value into an array. - * - * @param string|array|null $searchPath - * @return array - */ - protected function parseSearchPath($searchPath) - { - return array_map(function ($schema) { - return $schema === '$user' - ? $this->connection->getConfig('username') - : $schema; - }, $this->baseParseSearchPath($searchPath)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/PostgresSchemaState.php b/framework-9.50.2/src/Illuminate/Database/Schema/PostgresSchemaState.php deleted file mode 100644 index cfb100d..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/PostgresSchemaState.php +++ /dev/null @@ -1,79 +0,0 @@ -baseDumpCommand().' --schema-only > '.$path, - $this->baseDumpCommand().' -t '.$this->migrationTable.' --data-only >> '.$path, - ]); - - $commands->map(function ($command, $path) { - $this->makeProcess($command)->mustRun($this->output, array_merge($this->baseVariables($this->connection->getConfig()), [ - 'LARAVEL_LOAD_PATH' => $path, - ])); - }); - } - - /** - * Load the given schema file into the database. - * - * @param string $path - * @return void - */ - public function load($path) - { - $command = 'pg_restore --no-owner --no-acl --clean --if-exists --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}" "${:LARAVEL_LOAD_PATH}"'; - - if (str_ends_with($path, '.sql')) { - $command = 'psql --file="${:LARAVEL_LOAD_PATH}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}"'; - } - - $process = $this->makeProcess($command); - - $process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ - 'LARAVEL_LOAD_PATH' => $path, - ])); - } - - /** - * Get the base dump command arguments for PostgreSQL as a string. - * - * @return string - */ - protected function baseDumpCommand() - { - return 'pg_dump --no-owner --no-acl --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}"'; - } - - /** - * Get the base variables for a dump / load command. - * - * @param array $config - * @return array - */ - protected function baseVariables(array $config) - { - $config['host'] ??= ''; - - return [ - 'LARAVEL_LOAD_HOST' => is_array($config['host']) ? $config['host'][0] : $config['host'], - 'LARAVEL_LOAD_PORT' => $config['port'], - 'LARAVEL_LOAD_USER' => $config['username'], - 'PGPASSWORD' => $config['password'], - 'LARAVEL_LOAD_DATABASE' => $config['database'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/SQLiteBuilder.php b/framework-9.50.2/src/Illuminate/Database/Schema/SQLiteBuilder.php deleted file mode 100644 index 4e74f92..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/SQLiteBuilder.php +++ /dev/null @@ -1,102 +0,0 @@ -connection->getDatabaseName() !== ':memory:') { - return $this->refreshDatabaseFile(); - } - - $this->connection->select($this->grammar->compileEnableWriteableSchema()); - - $this->connection->select($this->grammar->compileDropAllTables()); - - $this->connection->select($this->grammar->compileDisableWriteableSchema()); - - $this->connection->select($this->grammar->compileRebuild()); - } - - /** - * Drop all views from the database. - * - * @return void - */ - public function dropAllViews() - { - $this->connection->select($this->grammar->compileEnableWriteableSchema()); - - $this->connection->select($this->grammar->compileDropAllViews()); - - $this->connection->select($this->grammar->compileDisableWriteableSchema()); - - $this->connection->select($this->grammar->compileRebuild()); - } - - /** - * Get all of the table names for the database. - * - * @return array - */ - public function getAllTables() - { - return $this->connection->select( - $this->grammar->compileGetAllTables() - ); - } - - /** - * Get all of the view names for the database. - * - * @return array - */ - public function getAllViews() - { - return $this->connection->select( - $this->grammar->compileGetAllViews() - ); - } - - /** - * Empty the database file. - * - * @return void - */ - public function refreshDatabaseFile() - { - file_put_contents($this->connection->getDatabaseName(), ''); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/SchemaState.php b/framework-9.50.2/src/Illuminate/Database/Schema/SchemaState.php deleted file mode 100644 index 8f998ca..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/SchemaState.php +++ /dev/null @@ -1,122 +0,0 @@ -connection = $connection; - - $this->files = $files ?: new Filesystem; - - $this->processFactory = $processFactory ?: function (...$arguments) { - return Process::fromShellCommandline(...$arguments)->setTimeout(null); - }; - - $this->handleOutputUsing(function () { - // - }); - } - - /** - * Dump the database's schema into a file. - * - * @param \Illuminate\Database\Connection $connection - * @param string $path - * @return void - */ - abstract public function dump(Connection $connection, $path); - - /** - * Load the given schema file into the database. - * - * @param string $path - * @return void - */ - abstract public function load($path); - - /** - * Create a new process instance. - * - * @param array ...$arguments - * @return \Symfony\Component\Process\Process - */ - public function makeProcess(...$arguments) - { - return call_user_func($this->processFactory, ...$arguments); - } - - /** - * Specify the name of the application's migration table. - * - * @param string $table - * @return $this - */ - public function withMigrationTable(string $table) - { - $this->migrationTable = $table; - - return $this; - } - - /** - * Specify the callback that should be used to handle process output. - * - * @param callable $output - * @return $this - */ - public function handleOutputUsing(callable $output) - { - $this->output = $output; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/SqlServerBuilder.php b/framework-9.50.2/src/Illuminate/Database/Schema/SqlServerBuilder.php deleted file mode 100644 index c323e12..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/SqlServerBuilder.php +++ /dev/null @@ -1,78 +0,0 @@ -connection->statement( - $this->grammar->compileCreateDatabase($name, $this->connection) - ); - } - - /** - * Drop a database from the schema if the database exists. - * - * @param string $name - * @return bool - */ - public function dropDatabaseIfExists($name) - { - return $this->connection->statement( - $this->grammar->compileDropDatabaseIfExists($name) - ); - } - - /** - * Drop all tables from the database. - * - * @return void - */ - public function dropAllTables() - { - $this->connection->statement($this->grammar->compileDropAllForeignKeys()); - - $this->connection->statement($this->grammar->compileDropAllTables()); - } - - /** - * Drop all views from the database. - * - * @return void - */ - public function dropAllViews() - { - $this->connection->statement($this->grammar->compileDropAllViews()); - } - - /** - * Drop all tables from the database. - * - * @return array - */ - public function getAllTables() - { - return $this->connection->select( - $this->grammar->compileGetAllTables() - ); - } - - /** - * Get all of the view names for the database. - * - * @return array - */ - public function getAllViews() - { - return $this->connection->select( - $this->grammar->compileGetAllViews() - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Schema/SqliteSchemaState.php b/framework-9.50.2/src/Illuminate/Database/Schema/SqliteSchemaState.php deleted file mode 100644 index 10efc7c..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Schema/SqliteSchemaState.php +++ /dev/null @@ -1,99 +0,0 @@ -makeProcess( - $this->baseCommand().' .schema' - ))->setTimeout(null)->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ - // - ])); - - $migrations = collect(preg_split("/\r\n|\n|\r/", $process->getOutput()))->filter(function ($line) { - return stripos($line, 'sqlite_sequence') === false && - strlen($line) > 0; - })->all(); - - $this->files->put($path, implode(PHP_EOL, $migrations).PHP_EOL); - - $this->appendMigrationData($path); - } - - /** - * Append the migration data to the schema dump. - * - * @param string $path - * @return void - */ - protected function appendMigrationData(string $path) - { - with($process = $this->makeProcess( - $this->baseCommand().' ".dump \''.$this->migrationTable.'\'"' - ))->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ - // - ])); - - $migrations = collect(preg_split("/\r\n|\n|\r/", $process->getOutput()))->filter(function ($line) { - return preg_match('/^\s*(--|INSERT\s)/iu', $line) === 1 && - strlen($line) > 0; - })->all(); - - $this->files->append($path, implode(PHP_EOL, $migrations).PHP_EOL); - } - - /** - * Load the given schema file into the database. - * - * @param string $path - * @return void - */ - public function load($path) - { - if ($this->connection->getDatabaseName() === ':memory:') { - $this->connection->getPdo()->exec($this->files->get($path)); - - return; - } - - $process = $this->makeProcess($this->baseCommand().' < "${:LARAVEL_LOAD_PATH}"'); - - $process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [ - 'LARAVEL_LOAD_PATH' => $path, - ])); - } - - /** - * Get the base sqlite command arguments as a string. - * - * @return string - */ - protected function baseCommand() - { - return 'sqlite3 "${:LARAVEL_LOAD_DATABASE}"'; - } - - /** - * Get the base variables for a dump / load command. - * - * @param array $config - * @return array - */ - protected function baseVariables(array $config) - { - return [ - 'LARAVEL_LOAD_DATABASE' => $config['database'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/Seeder.php b/framework-9.50.2/src/Illuminate/Database/Seeder.php deleted file mode 100755 index ba4cd4a..0000000 --- a/framework-9.50.2/src/Illuminate/Database/Seeder.php +++ /dev/null @@ -1,195 +0,0 @@ -resolve($class); - - $name = get_class($seeder); - - if ($silent === false && isset($this->command)) { - with(new TwoColumnDetail($this->command->getOutput()))->render( - $name, - 'RUNNING' - ); - } - - $startTime = microtime(true); - - $seeder->__invoke($parameters); - - if ($silent === false && isset($this->command)) { - $runTime = number_format((microtime(true) - $startTime) * 1000, 2); - - with(new TwoColumnDetail($this->command->getOutput()))->render( - $name, - "$runTime ms DONE" - ); - - $this->command->getOutput()->writeln(''); - } - - static::$called[] = $class; - } - - return $this; - } - - /** - * Run the given seeder class. - * - * @param array|string $class - * @param array $parameters - * @return void - */ - public function callWith($class, array $parameters = []) - { - $this->call($class, false, $parameters); - } - - /** - * Silently run the given seeder class. - * - * @param array|string $class - * @param array $parameters - * @return void - */ - public function callSilent($class, array $parameters = []) - { - $this->call($class, true, $parameters); - } - - /** - * Run the given seeder class once. - * - * @param array|string $class - * @param bool $silent - * @return void - */ - public function callOnce($class, $silent = false, array $parameters = []) - { - if (in_array($class, static::$called)) { - return; - } - - $this->call($class, $silent, $parameters); - } - - /** - * Resolve an instance of the given seeder class. - * - * @param string $class - * @return \Illuminate\Database\Seeder - */ - protected function resolve($class) - { - if (isset($this->container)) { - $instance = $this->container->make($class); - - $instance->setContainer($this->container); - } else { - $instance = new $class; - } - - if (isset($this->command)) { - $instance->setCommand($this->command); - } - - return $instance; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } - - /** - * Set the console command instance. - * - * @param \Illuminate\Console\Command $command - * @return $this - */ - public function setCommand(Command $command) - { - $this->command = $command; - - return $this; - } - - /** - * Run the database seeds. - * - * @param array $parameters - * @return mixed - * - * @throws \InvalidArgumentException - */ - public function __invoke(array $parameters = []) - { - if (! method_exists($this, 'run')) { - throw new InvalidArgumentException('Method [run] missing from '.get_class($this)); - } - - $callback = fn () => isset($this->container) - ? $this->container->call([$this, 'run'], $parameters) - : $this->run(...$parameters); - - $uses = array_flip(class_uses_recursive(static::class)); - - if (isset($uses[WithoutModelEvents::class])) { - $callback = $this->withoutModelEvents($callback); - } - - return $callback(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/SqlServerConnection.php b/framework-9.50.2/src/Illuminate/Database/SqlServerConnection.php deleted file mode 100755 index feb4577..0000000 --- a/framework-9.50.2/src/Illuminate/Database/SqlServerConnection.php +++ /dev/null @@ -1,123 +0,0 @@ -getDriverName() === 'sqlsrv') { - return parent::transaction($callback, $attempts); - } - - $this->getPdo()->exec('BEGIN TRAN'); - - // We'll simply execute the given callback within a try / catch block - // and if we catch any exception we can rollback the transaction - // so that none of the changes are persisted to the database. - try { - $result = $callback($this); - - $this->getPdo()->exec('COMMIT TRAN'); - } - - // If we catch an exception, we will rollback so nothing gets messed - // up in the database. Then we'll re-throw the exception so it can - // be handled how the developer sees fit for their applications. - catch (Throwable $e) { - $this->getPdo()->exec('ROLLBACK TRAN'); - - throw $e; - } - - return $result; - } - } - - /** - * Get the default query grammar instance. - * - * @return \Illuminate\Database\Query\Grammars\SqlServerGrammar - */ - protected function getDefaultQueryGrammar() - { - return $this->withTablePrefix(new QueryGrammar); - } - - /** - * Get a schema builder instance for the connection. - * - * @return \Illuminate\Database\Schema\SqlServerBuilder - */ - public function getSchemaBuilder() - { - if (is_null($this->schemaGrammar)) { - $this->useDefaultSchemaGrammar(); - } - - return new SqlServerBuilder($this); - } - - /** - * Get the default schema grammar instance. - * - * @return \Illuminate\Database\Schema\Grammars\SqlServerGrammar - */ - protected function getDefaultSchemaGrammar() - { - return $this->withTablePrefix(new SchemaGrammar); - } - - /** - * Get the schema state for the connection. - * - * @param \Illuminate\Filesystem\Filesystem|null $files - * @param callable|null $processFactory - * - * @throws \RuntimeException - */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) - { - throw new RuntimeException('Schema dumping is not supported when using SQL Server.'); - } - - /** - * Get the default post processor instance. - * - * @return \Illuminate\Database\Query\Processors\SqlServerProcessor - */ - protected function getDefaultPostProcessor() - { - return new SqlServerProcessor; - } - - /** - * Get the Doctrine DBAL driver. - * - * @return \Illuminate\Database\PDO\SqlServerDriver - */ - protected function getDoctrineDriver() - { - return new SqlServerDriver; - } -} diff --git a/framework-9.50.2/src/Illuminate/Database/composer.json b/framework-9.50.2/src/Illuminate/Database/composer.json deleted file mode 100644 index 0ab0e8c..0000000 --- a/framework-9.50.2/src/Illuminate/Database/composer.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "illuminate/database", - "description": "The Illuminate Database package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "keywords": ["laravel", "database", "sql", "orm"], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "brick/math": "^0.9.3|^0.10.2|^0.11", - "illuminate/collections": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0", - "symfony/console": "^6.0.9" - }, - "autoload": { - "psr-4": { - "Illuminate\\Database\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).", - "fakerphp/faker": "Required to use the eloquent factory builder (^1.21).", - "illuminate/console": "Required to use the database commands (^9.0).", - "illuminate/events": "Required to use the observers with Eloquent (^9.0).", - "illuminate/filesystem": "Required to use the migrations (^9.0).", - "illuminate/pagination": "Required to paginate the result set (^9.0).", - "symfony/finder": "Required to use Eloquent model factories (^6.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Encryption/Encrypter.php b/framework-9.50.2/src/Illuminate/Encryption/Encrypter.php deleted file mode 100755 index 5a8d82e..0000000 --- a/framework-9.50.2/src/Illuminate/Encryption/Encrypter.php +++ /dev/null @@ -1,288 +0,0 @@ - ['size' => 16, 'aead' => false], - 'aes-256-cbc' => ['size' => 32, 'aead' => false], - 'aes-128-gcm' => ['size' => 16, 'aead' => true], - 'aes-256-gcm' => ['size' => 32, 'aead' => true], - ]; - - /** - * Create a new encrypter instance. - * - * @param string $key - * @param string $cipher - * @return void - * - * @throws \RuntimeException - */ - public function __construct($key, $cipher = 'aes-128-cbc') - { - $key = (string) $key; - - if (! static::supported($key, $cipher)) { - $ciphers = implode(', ', array_keys(self::$supportedCiphers)); - - throw new RuntimeException("Unsupported cipher or incorrect key length. Supported ciphers are: {$ciphers}."); - } - - $this->key = $key; - $this->cipher = $cipher; - } - - /** - * Determine if the given key and cipher combination is valid. - * - * @param string $key - * @param string $cipher - * @return bool - */ - public static function supported($key, $cipher) - { - if (! isset(self::$supportedCiphers[strtolower($cipher)])) { - return false; - } - - return mb_strlen($key, '8bit') === self::$supportedCiphers[strtolower($cipher)]['size']; - } - - /** - * Create a new encryption key for the given cipher. - * - * @param string $cipher - * @return string - */ - public static function generateKey($cipher) - { - return random_bytes(self::$supportedCiphers[strtolower($cipher)]['size'] ?? 32); - } - - /** - * Encrypt the given value. - * - * @param mixed $value - * @param bool $serialize - * @return string - * - * @throws \Illuminate\Contracts\Encryption\EncryptException - */ - public function encrypt($value, $serialize = true) - { - $iv = random_bytes(openssl_cipher_iv_length(strtolower($this->cipher))); - - $value = \openssl_encrypt( - $serialize ? serialize($value) : $value, - strtolower($this->cipher), $this->key, 0, $iv, $tag - ); - - if ($value === false) { - throw new EncryptException('Could not encrypt the data.'); - } - - $iv = base64_encode($iv); - $tag = base64_encode($tag ?? ''); - - $mac = self::$supportedCiphers[strtolower($this->cipher)]['aead'] - ? '' // For AEAD-algorithms, the tag / MAC is returned by openssl_encrypt... - : $this->hash($iv, $value); - - $json = json_encode(compact('iv', 'value', 'mac', 'tag'), JSON_UNESCAPED_SLASHES); - - if (json_last_error() !== JSON_ERROR_NONE) { - throw new EncryptException('Could not encrypt the data.'); - } - - return base64_encode($json); - } - - /** - * Encrypt a string without serialization. - * - * @param string $value - * @return string - * - * @throws \Illuminate\Contracts\Encryption\EncryptException - */ - public function encryptString($value) - { - return $this->encrypt($value, false); - } - - /** - * Decrypt the given value. - * - * @param string $payload - * @param bool $unserialize - * @return mixed - * - * @throws \Illuminate\Contracts\Encryption\DecryptException - */ - public function decrypt($payload, $unserialize = true) - { - $payload = $this->getJsonPayload($payload); - - $iv = base64_decode($payload['iv']); - - $this->ensureTagIsValid( - $tag = empty($payload['tag']) ? null : base64_decode($payload['tag']) - ); - - // Here we will decrypt the value. If we are able to successfully decrypt it - // we will then unserialize it and return it out to the caller. If we are - // unable to decrypt this value we will throw out an exception message. - $decrypted = \openssl_decrypt( - $payload['value'], strtolower($this->cipher), $this->key, 0, $iv, $tag ?? '' - ); - - if ($decrypted === false) { - throw new DecryptException('Could not decrypt the data.'); - } - - return $unserialize ? unserialize($decrypted) : $decrypted; - } - - /** - * Decrypt the given string without unserialization. - * - * @param string $payload - * @return string - * - * @throws \Illuminate\Contracts\Encryption\DecryptException - */ - public function decryptString($payload) - { - return $this->decrypt($payload, false); - } - - /** - * Create a MAC for the given value. - * - * @param string $iv - * @param mixed $value - * @return string - */ - protected function hash($iv, $value) - { - return hash_hmac('sha256', $iv.$value, $this->key); - } - - /** - * Get the JSON array from the given payload. - * - * @param string $payload - * @return array - * - * @throws \Illuminate\Contracts\Encryption\DecryptException - */ - protected function getJsonPayload($payload) - { - $payload = json_decode(base64_decode($payload), true); - - // If the payload is not valid JSON or does not have the proper keys set we will - // assume it is invalid and bail out of the routine since we will not be able - // to decrypt the given value. We'll also check the MAC for this encryption. - if (! $this->validPayload($payload)) { - throw new DecryptException('The payload is invalid.'); - } - - if (! self::$supportedCiphers[strtolower($this->cipher)]['aead'] && ! $this->validMac($payload)) { - throw new DecryptException('The MAC is invalid.'); - } - - return $payload; - } - - /** - * Verify that the encryption payload is valid. - * - * @param mixed $payload - * @return bool - */ - protected function validPayload($payload) - { - if (! is_array($payload)) { - return false; - } - - foreach (['iv', 'value', 'mac'] as $item) { - if (! isset($payload[$item]) || ! is_string($payload[$item])) { - return false; - } - } - - if (isset($payload['tag']) && ! is_string($payload['tag'])) { - return false; - } - - return strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length(strtolower($this->cipher)); - } - - /** - * Determine if the MAC for the given payload is valid. - * - * @param array $payload - * @return bool - */ - protected function validMac(array $payload) - { - return hash_equals( - $this->hash($payload['iv'], $payload['value']), $payload['mac'] - ); - } - - /** - * Ensure the given tag is a valid tag given the selected cipher. - * - * @param string $tag - * @return void - */ - protected function ensureTagIsValid($tag) - { - if (self::$supportedCiphers[strtolower($this->cipher)]['aead'] && strlen($tag) !== 16) { - throw new DecryptException('Could not decrypt the data.'); - } - - if (! self::$supportedCiphers[strtolower($this->cipher)]['aead'] && is_string($tag)) { - throw new DecryptException('Unable to use tag because the cipher algorithm does not support AEAD.'); - } - } - - /** - * Get the encryption key that the encrypter is currently using. - * - * @return string - */ - public function getKey() - { - return $this->key; - } -} diff --git a/framework-9.50.2/src/Illuminate/Encryption/EncryptionServiceProvider.php b/framework-9.50.2/src/Illuminate/Encryption/EncryptionServiceProvider.php deleted file mode 100755 index a4d27a3..0000000 --- a/framework-9.50.2/src/Illuminate/Encryption/EncryptionServiceProvider.php +++ /dev/null @@ -1,83 +0,0 @@ -registerEncrypter(); - $this->registerSerializableClosureSecurityKey(); - } - - /** - * Register the encrypter. - * - * @return void - */ - protected function registerEncrypter() - { - $this->app->singleton('encrypter', function ($app) { - $config = $app->make('config')->get('app'); - - return new Encrypter($this->parseKey($config), $config['cipher']); - }); - } - - /** - * Configure Serializable Closure signing for security. - * - * @return void - */ - protected function registerSerializableClosureSecurityKey() - { - $config = $this->app->make('config')->get('app'); - - if (! class_exists(SerializableClosure::class) || empty($config['key'])) { - return; - } - - SerializableClosure::setSecretKey($this->parseKey($config)); - } - - /** - * Parse the encryption key. - * - * @param array $config - * @return string - */ - protected function parseKey(array $config) - { - if (Str::startsWith($key = $this->key($config), $prefix = 'base64:')) { - $key = base64_decode(Str::after($key, $prefix)); - } - - return $key; - } - - /** - * Extract the encryption key from the given configuration. - * - * @param array $config - * @return string - * - * @throws \Illuminate\Encryption\MissingAppKeyException - */ - protected function key(array $config) - { - return tap($config['key'], function ($key) { - if (empty($key)) { - throw new MissingAppKeyException; - } - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Encryption/LICENSE.md b/framework-9.50.2/src/Illuminate/Encryption/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Encryption/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Encryption/MissingAppKeyException.php b/framework-9.50.2/src/Illuminate/Encryption/MissingAppKeyException.php deleted file mode 100644 index d8ffcd1..0000000 --- a/framework-9.50.2/src/Illuminate/Encryption/MissingAppKeyException.php +++ /dev/null @@ -1,19 +0,0 @@ -data = $data; - $this->class = $class; - $this->method = $method; - } - - /** - * Handle the queued job. - * - * @param \Illuminate\Container\Container $container - * @return void - */ - public function handle(Container $container) - { - $this->prepareData(); - - $handler = $this->setJobInstanceIfNecessary( - $this->job, $container->make($this->class) - ); - - $handler->{$this->method}(...array_values($this->data)); - } - - /** - * Set the job instance of the given class if necessary. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param object $instance - * @return object - */ - protected function setJobInstanceIfNecessary(Job $job, $instance) - { - if (in_array(InteractsWithQueue::class, class_uses_recursive($instance))) { - $instance->setJob($job); - } - - return $instance; - } - - /** - * Call the failed method on the job instance. - * - * The event instance and the exception will be passed. - * - * @param \Throwable $e - * @return void - */ - public function failed($e) - { - $this->prepareData(); - - $handler = Container::getInstance()->make($this->class); - - $parameters = array_merge(array_values($this->data), [$e]); - - if (method_exists($handler, 'failed')) { - $handler->failed(...$parameters); - } - } - - /** - * Unserialize the data if needed. - * - * @return void - */ - protected function prepareData() - { - if (is_string($this->data)) { - $this->data = unserialize($this->data); - } - } - - /** - * Get the display name for the queued job. - * - * @return string - */ - public function displayName() - { - return $this->class; - } - - /** - * Prepare the instance for cloning. - * - * @return void - */ - public function __clone() - { - $this->data = array_map(function ($data) { - return is_object($data) ? clone $data : $data; - }, $this->data); - } -} diff --git a/framework-9.50.2/src/Illuminate/Events/Dispatcher.php b/framework-9.50.2/src/Illuminate/Events/Dispatcher.php deleted file mode 100755 index 1876897..0000000 --- a/framework-9.50.2/src/Illuminate/Events/Dispatcher.php +++ /dev/null @@ -1,705 +0,0 @@ -container = $container ?: new Container; - } - - /** - * Register an event listener with the dispatcher. - * - * @param \Closure|string|array $events - * @param \Closure|string|array|null $listener - * @return void - */ - public function listen($events, $listener = null) - { - if ($events instanceof Closure) { - return collect($this->firstClosureParameterTypes($events)) - ->each(function ($event) use ($events) { - $this->listen($event, $events); - }); - } elseif ($events instanceof QueuedClosure) { - return collect($this->firstClosureParameterTypes($events->closure)) - ->each(function ($event) use ($events) { - $this->listen($event, $events->resolve()); - }); - } elseif ($listener instanceof QueuedClosure) { - $listener = $listener->resolve(); - } - - foreach ((array) $events as $event) { - if (str_contains($event, '*')) { - $this->setupWildcardListen($event, $listener); - } else { - $this->listeners[$event][] = $listener; - } - } - } - - /** - * Setup a wildcard listener callback. - * - * @param string $event - * @param \Closure|string $listener - * @return void - */ - protected function setupWildcardListen($event, $listener) - { - $this->wildcards[$event][] = $listener; - - $this->wildcardsCache = []; - } - - /** - * Determine if a given event has listeners. - * - * @param string $eventName - * @return bool - */ - public function hasListeners($eventName) - { - return isset($this->listeners[$eventName]) || - isset($this->wildcards[$eventName]) || - $this->hasWildcardListeners($eventName); - } - - /** - * Determine if the given event has any wildcard listeners. - * - * @param string $eventName - * @return bool - */ - public function hasWildcardListeners($eventName) - { - foreach ($this->wildcards as $key => $listeners) { - if (Str::is($key, $eventName)) { - return true; - } - } - - return false; - } - - /** - * Register an event and payload to be fired later. - * - * @param string $event - * @param object|array $payload - * @return void - */ - public function push($event, $payload = []) - { - $this->listen($event.'_pushed', function () use ($event, $payload) { - $this->dispatch($event, $payload); - }); - } - - /** - * Flush a set of pushed events. - * - * @param string $event - * @return void - */ - public function flush($event) - { - $this->dispatch($event.'_pushed'); - } - - /** - * Register an event subscriber with the dispatcher. - * - * @param object|string $subscriber - * @return void - */ - public function subscribe($subscriber) - { - $subscriber = $this->resolveSubscriber($subscriber); - - $events = $subscriber->subscribe($this); - - if (is_array($events)) { - foreach ($events as $event => $listeners) { - foreach (Arr::wrap($listeners) as $listener) { - if (is_string($listener) && method_exists($subscriber, $listener)) { - $this->listen($event, [get_class($subscriber), $listener]); - - continue; - } - - $this->listen($event, $listener); - } - } - } - } - - /** - * Resolve the subscriber instance. - * - * @param object|string $subscriber - * @return mixed - */ - protected function resolveSubscriber($subscriber) - { - if (is_string($subscriber)) { - return $this->container->make($subscriber); - } - - return $subscriber; - } - - /** - * Fire an event until the first non-null response is returned. - * - * @param string|object $event - * @param mixed $payload - * @return array|null - */ - public function until($event, $payload = []) - { - return $this->dispatch($event, $payload, true); - } - - /** - * Fire an event and call the listeners. - * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * @return array|null - */ - public function dispatch($event, $payload = [], $halt = false) - { - // When the given "event" is actually an object we will assume it is an event - // object and use the class as the event name and this event itself as the - // payload to the handler, which makes object based events quite simple. - [$event, $payload] = $this->parseEventAndPayload( - $event, $payload - ); - - if ($this->shouldBroadcast($payload)) { - $this->broadcastEvent($payload[0]); - } - - $responses = []; - - foreach ($this->getListeners($event) as $listener) { - $response = $listener($event, $payload); - - // If a response is returned from the listener and event halting is enabled - // we will just return this response, and not call the rest of the event - // listeners. Otherwise we will add the response on the response list. - if ($halt && ! is_null($response)) { - return $response; - } - - // If a boolean false is returned from a listener, we will stop propagating - // the event to any further listeners down in the chain, else we keep on - // looping through the listeners and firing every one in our sequence. - if ($response === false) { - break; - } - - $responses[] = $response; - } - - return $halt ? null : $responses; - } - - /** - * Parse the given event and payload and prepare them for dispatching. - * - * @param mixed $event - * @param mixed $payload - * @return array - */ - protected function parseEventAndPayload($event, $payload) - { - if (is_object($event)) { - [$payload, $event] = [[$event], get_class($event)]; - } - - return [$event, Arr::wrap($payload)]; - } - - /** - * Determine if the payload has a broadcastable event. - * - * @param array $payload - * @return bool - */ - protected function shouldBroadcast(array $payload) - { - return isset($payload[0]) && - $payload[0] instanceof ShouldBroadcast && - $this->broadcastWhen($payload[0]); - } - - /** - * Check if the event should be broadcasted by the condition. - * - * @param mixed $event - * @return bool - */ - protected function broadcastWhen($event) - { - return method_exists($event, 'broadcastWhen') - ? $event->broadcastWhen() : true; - } - - /** - * Broadcast the given event class. - * - * @param \Illuminate\Contracts\Broadcasting\ShouldBroadcast $event - * @return void - */ - protected function broadcastEvent($event) - { - $this->container->make(BroadcastFactory::class)->queue($event); - } - - /** - * Get all of the listeners for a given event name. - * - * @param string $eventName - * @return array - */ - public function getListeners($eventName) - { - $listeners = array_merge( - $this->prepareListeners($eventName), - $this->wildcardsCache[$eventName] ?? $this->getWildcardListeners($eventName) - ); - - return class_exists($eventName, false) - ? $this->addInterfaceListeners($eventName, $listeners) - : $listeners; - } - - /** - * Get the wildcard listeners for the event. - * - * @param string $eventName - * @return array - */ - protected function getWildcardListeners($eventName) - { - $wildcards = []; - - foreach ($this->wildcards as $key => $listeners) { - if (Str::is($key, $eventName)) { - foreach ($listeners as $listener) { - $wildcards[] = $this->makeListener($listener, true); - } - } - } - - return $this->wildcardsCache[$eventName] = $wildcards; - } - - /** - * Add the listeners for the event's interfaces to the given array. - * - * @param string $eventName - * @param array $listeners - * @return array - */ - protected function addInterfaceListeners($eventName, array $listeners = []) - { - foreach (class_implements($eventName) as $interface) { - if (isset($this->listeners[$interface])) { - foreach ($this->prepareListeners($interface) as $names) { - $listeners = array_merge($listeners, (array) $names); - } - } - } - - return $listeners; - } - - /** - * Prepare the listeners for a given event. - * - * @param string $eventName - * @return \Closure[] - */ - protected function prepareListeners(string $eventName) - { - $listeners = []; - - foreach ($this->listeners[$eventName] ?? [] as $listener) { - $listeners[] = $this->makeListener($listener); - } - - return $listeners; - } - - /** - * Register an event listener with the dispatcher. - * - * @param \Closure|string|array $listener - * @param bool $wildcard - * @return \Closure - */ - public function makeListener($listener, $wildcard = false) - { - if (is_string($listener)) { - return $this->createClassListener($listener, $wildcard); - } - - if (is_array($listener) && isset($listener[0]) && is_string($listener[0])) { - return $this->createClassListener($listener, $wildcard); - } - - return function ($event, $payload) use ($listener, $wildcard) { - if ($wildcard) { - return $listener($event, $payload); - } - - return $listener(...array_values($payload)); - }; - } - - /** - * Create a class based listener using the IoC container. - * - * @param string $listener - * @param bool $wildcard - * @return \Closure - */ - public function createClassListener($listener, $wildcard = false) - { - return function ($event, $payload) use ($listener, $wildcard) { - if ($wildcard) { - return call_user_func($this->createClassCallable($listener), $event, $payload); - } - - $callable = $this->createClassCallable($listener); - - return $callable(...array_values($payload)); - }; - } - - /** - * Create the class based event callable. - * - * @param array|string $listener - * @return callable - */ - protected function createClassCallable($listener) - { - [$class, $method] = is_array($listener) - ? $listener - : $this->parseClassCallable($listener); - - if (! method_exists($class, $method)) { - $method = '__invoke'; - } - - if ($this->handlerShouldBeQueued($class)) { - return $this->createQueuedHandlerCallable($class, $method); - } - - $listener = $this->container->make($class); - - return $this->handlerShouldBeDispatchedAfterDatabaseTransactions($listener) - ? $this->createCallbackForListenerRunningAfterCommits($listener, $method) - : [$listener, $method]; - } - - /** - * Parse the class listener into class and method. - * - * @param string $listener - * @return array - */ - protected function parseClassCallable($listener) - { - return Str::parseCallback($listener, 'handle'); - } - - /** - * Determine if the event handler class should be queued. - * - * @param string $class - * @return bool - */ - protected function handlerShouldBeQueued($class) - { - try { - return (new ReflectionClass($class))->implementsInterface( - ShouldQueue::class - ); - } catch (Exception $e) { - return false; - } - } - - /** - * Create a callable for putting an event handler on the queue. - * - * @param string $class - * @param string $method - * @return \Closure - */ - protected function createQueuedHandlerCallable($class, $method) - { - return function () use ($class, $method) { - $arguments = array_map(function ($a) { - return is_object($a) ? clone $a : $a; - }, func_get_args()); - - if ($this->handlerWantsToBeQueued($class, $arguments)) { - $this->queueHandler($class, $method, $arguments); - } - }; - } - - /** - * Determine if the given event handler should be dispatched after all database transactions have committed. - * - * @param object|mixed $listener - * @return bool - */ - protected function handlerShouldBeDispatchedAfterDatabaseTransactions($listener) - { - return ($listener->afterCommit ?? null) && $this->container->bound('db.transactions'); - } - - /** - * Create a callable for dispatching a listener after database transactions. - * - * @param mixed $listener - * @param string $method - * @return \Closure - */ - protected function createCallbackForListenerRunningAfterCommits($listener, $method) - { - return function () use ($method, $listener) { - $payload = func_get_args(); - - $this->container->make('db.transactions')->addCallback( - function () use ($listener, $method, $payload) { - $listener->$method(...$payload); - } - ); - }; - } - - /** - * Determine if the event handler wants to be queued. - * - * @param string $class - * @param array $arguments - * @return bool - */ - protected function handlerWantsToBeQueued($class, $arguments) - { - $instance = $this->container->make($class); - - if (method_exists($instance, 'shouldQueue')) { - return $instance->shouldQueue($arguments[0]); - } - - return true; - } - - /** - * Queue the handler class. - * - * @param string $class - * @param string $method - * @param array $arguments - * @return void - */ - protected function queueHandler($class, $method, $arguments) - { - [$listener, $job] = $this->createListenerAndJob($class, $method, $arguments); - - $connection = $this->resolveQueue()->connection(method_exists($listener, 'viaConnection') - ? (isset($arguments[0]) ? $listener->viaConnection($arguments[0]) : $listener->viaConnection()) - : $listener->connection ?? null); - - $queue = method_exists($listener, 'viaQueue') - ? (isset($arguments[0]) ? $listener->viaQueue($arguments[0]) : $listener->viaQueue()) - : $listener->queue ?? null; - - isset($listener->delay) - ? $connection->laterOn($queue, $listener->delay, $job) - : $connection->pushOn($queue, $job); - } - - /** - * Create the listener and job for a queued listener. - * - * @param string $class - * @param string $method - * @param array $arguments - * @return array - */ - protected function createListenerAndJob($class, $method, $arguments) - { - $listener = (new ReflectionClass($class))->newInstanceWithoutConstructor(); - - return [$listener, $this->propagateListenerOptions( - $listener, new CallQueuedListener($class, $method, $arguments) - )]; - } - - /** - * Propagate listener options to the job. - * - * @param mixed $listener - * @param \Illuminate\Events\CallQueuedListener $job - * @return mixed - */ - protected function propagateListenerOptions($listener, $job) - { - return tap($job, function ($job) use ($listener) { - $data = array_values($job->data); - - $job->afterCommit = property_exists($listener, 'afterCommit') ? $listener->afterCommit : null; - $job->backoff = method_exists($listener, 'backoff') ? $listener->backoff(...$data) : ($listener->backoff ?? null); - $job->maxExceptions = $listener->maxExceptions ?? null; - $job->retryUntil = method_exists($listener, 'retryUntil') ? $listener->retryUntil(...$data) : null; - $job->shouldBeEncrypted = $listener instanceof ShouldBeEncrypted; - $job->timeout = $listener->timeout ?? null; - $job->tries = $listener->tries ?? null; - - $job->through(array_merge( - method_exists($listener, 'middleware') ? $listener->middleware(...$data) : [], - $listener->middleware ?? [] - )); - }); - } - - /** - * Remove a set of listeners from the dispatcher. - * - * @param string $event - * @return void - */ - public function forget($event) - { - if (str_contains($event, '*')) { - unset($this->wildcards[$event]); - } else { - unset($this->listeners[$event]); - } - - foreach ($this->wildcardsCache as $key => $listeners) { - if (Str::is($event, $key)) { - unset($this->wildcardsCache[$key]); - } - } - } - - /** - * Forget all of the pushed listeners. - * - * @return void - */ - public function forgetPushed() - { - foreach ($this->listeners as $key => $value) { - if (str_ends_with($key, '_pushed')) { - $this->forget($key); - } - } - } - - /** - * Get the queue implementation from the resolver. - * - * @return \Illuminate\Contracts\Queue\Queue - */ - protected function resolveQueue() - { - return call_user_func($this->queueResolver); - } - - /** - * Set the queue resolver implementation. - * - * @param callable $resolver - * @return $this - */ - public function setQueueResolver(callable $resolver) - { - $this->queueResolver = $resolver; - - return $this; - } - - /** - * Gets the raw, unprepared listeners. - * - * @return array - */ - public function getRawListeners() - { - return $this->listeners; - } -} diff --git a/framework-9.50.2/src/Illuminate/Events/EventServiceProvider.php b/framework-9.50.2/src/Illuminate/Events/EventServiceProvider.php deleted file mode 100755 index 15fb60b..0000000 --- a/framework-9.50.2/src/Illuminate/Events/EventServiceProvider.php +++ /dev/null @@ -1,23 +0,0 @@ -app->singleton('events', function ($app) { - return (new Dispatcher($app))->setQueueResolver(function () use ($app) { - return $app->make(QueueFactoryContract::class); - }); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Events/InvokeQueuedClosure.php b/framework-9.50.2/src/Illuminate/Events/InvokeQueuedClosure.php deleted file mode 100644 index bc68b19..0000000 --- a/framework-9.50.2/src/Illuminate/Events/InvokeQueuedClosure.php +++ /dev/null @@ -1,34 +0,0 @@ -getClosure(), ...$arguments); - } - - /** - * Handle a job failure. - * - * @param \Laravel\SerializableClosure\SerializableClosure $closure - * @param array $arguments - * @param array $catchCallbacks - * @param \Throwable $exception - * @return void - */ - public function failed($closure, array $arguments, array $catchCallbacks, $exception) - { - $arguments[] = $exception; - - collect($catchCallbacks)->each->__invoke(...$arguments); - } -} diff --git a/framework-9.50.2/src/Illuminate/Events/LICENSE.md b/framework-9.50.2/src/Illuminate/Events/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Events/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Events/NullDispatcher.php b/framework-9.50.2/src/Illuminate/Events/NullDispatcher.php deleted file mode 100644 index 3164fbb..0000000 --- a/framework-9.50.2/src/Illuminate/Events/NullDispatcher.php +++ /dev/null @@ -1,144 +0,0 @@ -dispatcher = $dispatcher; - } - - /** - * Don't fire an event. - * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * @return void - */ - public function dispatch($event, $payload = [], $halt = false) - { - // - } - - /** - * Don't register an event and payload to be fired later. - * - * @param string $event - * @param array $payload - * @return void - */ - public function push($event, $payload = []) - { - // - } - - /** - * Don't dispatch an event. - * - * @param string|object $event - * @param mixed $payload - * @return array|null - */ - public function until($event, $payload = []) - { - // - } - - /** - * Register an event listener with the dispatcher. - * - * @param \Closure|string|array $events - * @param \Closure|string|array|null $listener - * @return void - */ - public function listen($events, $listener = null) - { - $this->dispatcher->listen($events, $listener); - } - - /** - * Determine if a given event has listeners. - * - * @param string $eventName - * @return bool - */ - public function hasListeners($eventName) - { - return $this->dispatcher->hasListeners($eventName); - } - - /** - * Register an event subscriber with the dispatcher. - * - * @param object|string $subscriber - * @return void - */ - public function subscribe($subscriber) - { - $this->dispatcher->subscribe($subscriber); - } - - /** - * Flush a set of pushed events. - * - * @param string $event - * @return void - */ - public function flush($event) - { - $this->dispatcher->flush($event); - } - - /** - * Remove a set of listeners from the dispatcher. - * - * @param string $event - * @return void - */ - public function forget($event) - { - $this->dispatcher->forget($event); - } - - /** - * Forget all of the queued listeners. - * - * @return void - */ - public function forgetPushed() - { - $this->dispatcher->forgetPushed(); - } - - /** - * Dynamically pass method calls to the underlying dispatcher. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->forwardDecoratedCallTo($this->dispatcher, $method, $parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Events/QueuedClosure.php b/framework-9.50.2/src/Illuminate/Events/QueuedClosure.php deleted file mode 100644 index 31a462a..0000000 --- a/framework-9.50.2/src/Illuminate/Events/QueuedClosure.php +++ /dev/null @@ -1,125 +0,0 @@ -closure = $closure; - } - - /** - * Set the desired connection for the job. - * - * @param string|null $connection - * @return $this - */ - public function onConnection($connection) - { - $this->connection = $connection; - - return $this; - } - - /** - * Set the desired queue for the job. - * - * @param string|null $queue - * @return $this - */ - public function onQueue($queue) - { - $this->queue = $queue; - - return $this; - } - - /** - * Set the desired delay in seconds for the job. - * - * @param \DateTimeInterface|\DateInterval|int|null $delay - * @return $this - */ - public function delay($delay) - { - $this->delay = $delay; - - return $this; - } - - /** - * Specify a callback that should be invoked if the queued listener job fails. - * - * @param \Closure $closure - * @return $this - */ - public function catch(Closure $closure) - { - $this->catchCallbacks[] = $closure; - - return $this; - } - - /** - * Resolve the actual event listener callback. - * - * @return \Closure - */ - public function resolve() - { - return function (...$arguments) { - dispatch(new CallQueuedListener(InvokeQueuedClosure::class, 'handle', [ - 'closure' => new SerializableClosure($this->closure), - 'arguments' => $arguments, - 'catch' => collect($this->catchCallbacks)->map(function ($callback) { - return new SerializableClosure($callback); - })->all(), - ]))->onConnection($this->connection)->onQueue($this->queue)->delay($this->delay); - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Events/composer.json b/framework-9.50.2/src/Illuminate/Events/composer.json deleted file mode 100755 index d074212..0000000 --- a/framework-9.50.2/src/Illuminate/Events/composer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "illuminate/events", - "description": "The Illuminate Events package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/bus": "^9.0", - "illuminate/collections": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Events\\": "" - }, - "files": [ - "functions.php" - ] - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Events/functions.php b/framework-9.50.2/src/Illuminate/Events/functions.php deleted file mode 100644 index df1b0fe..0000000 --- a/framework-9.50.2/src/Illuminate/Events/functions.php +++ /dev/null @@ -1,18 +0,0 @@ -client = $client; - } - - /** - * Get the URL for the file at the given path. - * - * @param string $path - * @return string - * - * @throws \RuntimeException - */ - public function url($path) - { - // If an explicit base URL has been set on the disk configuration then we will use - // it as the base URL instead of the default path. This allows the developer to - // have full control over the base path for this filesystem's generated URLs. - if (isset($this->config['url'])) { - return $this->concatPathToUrl($this->config['url'], $this->prefixer->prefixPath($path)); - } - - return $this->client->getObjectUrl( - $this->config['bucket'], $this->prefixer->prefixPath($path) - ); - } - - /** - * Determine if temporary URLs can be generated. - * - * @return bool - */ - public function providesTemporaryUrls() - { - return true; - } - - /** - * Get a temporary URL for the file at the given path. - * - * @param string $path - * @param \DateTimeInterface $expiration - * @param array $options - * @return string - */ - public function temporaryUrl($path, $expiration, array $options = []) - { - $command = $this->client->getCommand('GetObject', array_merge([ - 'Bucket' => $this->config['bucket'], - 'Key' => $this->prefixer->prefixPath($path), - ], $options)); - - $uri = $this->client->createPresignedRequest( - $command, $expiration, $options - )->getUri(); - - // If an explicit base URL has been set on the disk configuration then we will use - // it as the base URL instead of the default path. This allows the developer to - // have full control over the base path for this filesystem's generated URLs. - if (isset($this->config['temporary_url'])) { - $uri = $this->replaceBaseUrl($uri, $this->config['temporary_url']); - } - - return (string) $uri; - } - - /** - * Get the underlying S3 client. - * - * @return \Aws\S3\S3Client - */ - public function getClient() - { - return $this->client; - } -} diff --git a/framework-9.50.2/src/Illuminate/Filesystem/Filesystem.php b/framework-9.50.2/src/Illuminate/Filesystem/Filesystem.php deleted file mode 100644 index 41095fc..0000000 --- a/framework-9.50.2/src/Illuminate/Filesystem/Filesystem.php +++ /dev/null @@ -1,775 +0,0 @@ -exists($path); - } - - /** - * Get the contents of a file. - * - * @param string $path - * @param bool $lock - * @return string - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function get($path, $lock = false) - { - if ($this->isFile($path)) { - return $lock ? $this->sharedGet($path) : file_get_contents($path); - } - - throw new FileNotFoundException("File does not exist at path {$path}."); - } - - /** - * Get contents of a file with shared access. - * - * @param string $path - * @return string - */ - public function sharedGet($path) - { - $contents = ''; - - $handle = fopen($path, 'rb'); - - if ($handle) { - try { - if (flock($handle, LOCK_SH)) { - clearstatcache(true, $path); - - $contents = fread($handle, $this->size($path) ?: 1); - - flock($handle, LOCK_UN); - } - } finally { - fclose($handle); - } - } - - return $contents; - } - - /** - * Get the returned value of a file. - * - * @param string $path - * @param array $data - * @return mixed - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function getRequire($path, array $data = []) - { - if ($this->isFile($path)) { - $__path = $path; - $__data = $data; - - return (static function () use ($__path, $__data) { - extract($__data, EXTR_SKIP); - - return require $__path; - })(); - } - - throw new FileNotFoundException("File does not exist at path {$path}."); - } - - /** - * Require the given file once. - * - * @param string $path - * @param array $data - * @return mixed - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function requireOnce($path, array $data = []) - { - if ($this->isFile($path)) { - $__path = $path; - $__data = $data; - - return (static function () use ($__path, $__data) { - extract($__data, EXTR_SKIP); - - return require_once $__path; - })(); - } - - throw new FileNotFoundException("File does not exist at path {$path}."); - } - - /** - * Get the contents of a file one line at a time. - * - * @param string $path - * @return \Illuminate\Support\LazyCollection - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function lines($path) - { - if (! $this->isFile($path)) { - throw new FileNotFoundException( - "File does not exist at path {$path}." - ); - } - - return LazyCollection::make(function () use ($path) { - $file = new SplFileObject($path); - - $file->setFlags(SplFileObject::DROP_NEW_LINE); - - while (! $file->eof()) { - yield $file->fgets(); - } - }); - } - - /** - * Get the hash of the file at the given path. - * - * @param string $path - * @param string $algorithm - * @return string - */ - public function hash($path, $algorithm = 'md5') - { - return hash_file($algorithm, $path); - } - - /** - * Write the contents of a file. - * - * @param string $path - * @param string $contents - * @param bool $lock - * @return int|bool - */ - public function put($path, $contents, $lock = false) - { - return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); - } - - /** - * Write the contents of a file, replacing it atomically if it already exists. - * - * @param string $path - * @param string $content - * @param int|null $mode - * @return void - */ - public function replace($path, $content, $mode = null) - { - // If the path already exists and is a symlink, get the real path... - clearstatcache(true, $path); - - $path = realpath($path) ?: $path; - - $tempPath = tempnam(dirname($path), basename($path)); - - // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600... - if (! is_null($mode)) { - chmod($tempPath, $mode); - } else { - chmod($tempPath, 0777 - umask()); - } - - file_put_contents($tempPath, $content); - - rename($tempPath, $path); - } - - /** - * Replace a given string within a given file. - * - * @param array|string $search - * @param array|string $replace - * @param string $path - * @return void - */ - public function replaceInFile($search, $replace, $path) - { - file_put_contents($path, str_replace($search, $replace, file_get_contents($path))); - } - - /** - * Prepend to a file. - * - * @param string $path - * @param string $data - * @return int - */ - public function prepend($path, $data) - { - if ($this->exists($path)) { - return $this->put($path, $data.$this->get($path)); - } - - return $this->put($path, $data); - } - - /** - * Append to a file. - * - * @param string $path - * @param string $data - * @return int - */ - public function append($path, $data) - { - return file_put_contents($path, $data, FILE_APPEND); - } - - /** - * Get or set UNIX mode of a file or directory. - * - * @param string $path - * @param int|null $mode - * @return mixed - */ - public function chmod($path, $mode = null) - { - if ($mode) { - return chmod($path, $mode); - } - - return substr(sprintf('%o', fileperms($path)), -4); - } - - /** - * Delete the file at a given path. - * - * @param string|array $paths - * @return bool - */ - public function delete($paths) - { - $paths = is_array($paths) ? $paths : func_get_args(); - - $success = true; - - foreach ($paths as $path) { - try { - if (@unlink($path)) { - clearstatcache(false, $path); - } else { - $success = false; - } - } catch (ErrorException $e) { - $success = false; - } - } - - return $success; - } - - /** - * Move a file to a new location. - * - * @param string $path - * @param string $target - * @return bool - */ - public function move($path, $target) - { - return rename($path, $target); - } - - /** - * Copy a file to a new location. - * - * @param string $path - * @param string $target - * @return bool - */ - public function copy($path, $target) - { - return copy($path, $target); - } - - /** - * Create a symlink to the target file or directory. On Windows, a hard link is created if the target is a file. - * - * @param string $target - * @param string $link - * @return void - */ - public function link($target, $link) - { - if (! windows_os()) { - return symlink($target, $link); - } - - $mode = $this->isDirectory($target) ? 'J' : 'H'; - - exec("mklink /{$mode} ".escapeshellarg($link).' '.escapeshellarg($target)); - } - - /** - * Create a relative symlink to the target file or directory. - * - * @param string $target - * @param string $link - * @return void - * - * @throws \RuntimeException - */ - public function relativeLink($target, $link) - { - if (! class_exists(SymfonyFilesystem::class)) { - throw new RuntimeException( - 'To enable support for relative links, please install the symfony/filesystem package.' - ); - } - - $relativeTarget = (new SymfonyFilesystem)->makePathRelative($target, dirname($link)); - - $this->link($this->isFile($target) ? rtrim($relativeTarget, '/') : $relativeTarget, $link); - } - - /** - * Extract the file name from a file path. - * - * @param string $path - * @return string - */ - public function name($path) - { - return pathinfo($path, PATHINFO_FILENAME); - } - - /** - * Extract the trailing name component from a file path. - * - * @param string $path - * @return string - */ - public function basename($path) - { - return pathinfo($path, PATHINFO_BASENAME); - } - - /** - * Extract the parent directory from a file path. - * - * @param string $path - * @return string - */ - public function dirname($path) - { - return pathinfo($path, PATHINFO_DIRNAME); - } - - /** - * Extract the file extension from a file path. - * - * @param string $path - * @return string - */ - public function extension($path) - { - return pathinfo($path, PATHINFO_EXTENSION); - } - - /** - * Guess the file extension from the mime-type of a given file. - * - * @param string $path - * @return string|null - * - * @throws \RuntimeException - */ - public function guessExtension($path) - { - if (! class_exists(MimeTypes::class)) { - throw new RuntimeException( - 'To enable support for guessing extensions, please install the symfony/mime package.' - ); - } - - return (new MimeTypes)->getExtensions($this->mimeType($path))[0] ?? null; - } - - /** - * Get the file type of a given file. - * - * @param string $path - * @return string - */ - public function type($path) - { - return filetype($path); - } - - /** - * Get the mime-type of a given file. - * - * @param string $path - * @return string|false - */ - public function mimeType($path) - { - return finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); - } - - /** - * Get the file size of a given file. - * - * @param string $path - * @return int - */ - public function size($path) - { - return filesize($path); - } - - /** - * Get the file's last modification time. - * - * @param string $path - * @return int - */ - public function lastModified($path) - { - return filemtime($path); - } - - /** - * Determine if the given path is a directory. - * - * @param string $directory - * @return bool - */ - public function isDirectory($directory) - { - return is_dir($directory); - } - - /** - * Determine if the given path is a directory that does not contain any other files or directories. - * - * @param string $directory - * @param bool $ignoreDotFiles - * @return bool - */ - public function isEmptyDirectory($directory, $ignoreDotFiles = false) - { - return ! Finder::create()->ignoreDotFiles($ignoreDotFiles)->in($directory)->depth(0)->hasResults(); - } - - /** - * Determine if the given path is readable. - * - * @param string $path - * @return bool - */ - public function isReadable($path) - { - return is_readable($path); - } - - /** - * Determine if the given path is writable. - * - * @param string $path - * @return bool - */ - public function isWritable($path) - { - return is_writable($path); - } - - /** - * Determine if two files are the same by comparing their hashes. - * - * @param string $firstFile - * @param string $secondFile - * @return bool - */ - public function hasSameHash($firstFile, $secondFile) - { - $hash = @md5_file($firstFile); - - return $hash && $hash === @md5_file($secondFile); - } - - /** - * Determine if the given path is a file. - * - * @param string $file - * @return bool - */ - public function isFile($file) - { - return is_file($file); - } - - /** - * Find path names matching a given pattern. - * - * @param string $pattern - * @param int $flags - * @return array - */ - public function glob($pattern, $flags = 0) - { - return glob($pattern, $flags); - } - - /** - * Get an array of all files in a directory. - * - * @param string $directory - * @param bool $hidden - * @return \Symfony\Component\Finder\SplFileInfo[] - */ - public function files($directory, $hidden = false) - { - return iterator_to_array( - Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(), - false - ); - } - - /** - * Get all of the files from the given directory (recursive). - * - * @param string $directory - * @param bool $hidden - * @return \Symfony\Component\Finder\SplFileInfo[] - */ - public function allFiles($directory, $hidden = false) - { - return iterator_to_array( - Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(), - false - ); - } - - /** - * Get all of the directories within a given directory. - * - * @param string $directory - * @return array - */ - public function directories($directory) - { - $directories = []; - - foreach (Finder::create()->in($directory)->directories()->depth(0)->sortByName() as $dir) { - $directories[] = $dir->getPathname(); - } - - return $directories; - } - - /** - * Ensure a directory exists. - * - * @param string $path - * @param int $mode - * @param bool $recursive - * @return void - */ - public function ensureDirectoryExists($path, $mode = 0755, $recursive = true) - { - if (! $this->isDirectory($path)) { - $this->makeDirectory($path, $mode, $recursive); - } - } - - /** - * Create a directory. - * - * @param string $path - * @param int $mode - * @param bool $recursive - * @param bool $force - * @return bool - */ - public function makeDirectory($path, $mode = 0755, $recursive = false, $force = false) - { - if ($force) { - return @mkdir($path, $mode, $recursive); - } - - return mkdir($path, $mode, $recursive); - } - - /** - * Move a directory. - * - * @param string $from - * @param string $to - * @param bool $overwrite - * @return bool - */ - public function moveDirectory($from, $to, $overwrite = false) - { - if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) { - return false; - } - - return @rename($from, $to) === true; - } - - /** - * Copy a directory from one location to another. - * - * @param string $directory - * @param string $destination - * @param int|null $options - * @return bool - */ - public function copyDirectory($directory, $destination, $options = null) - { - if (! $this->isDirectory($directory)) { - return false; - } - - $options = $options ?: FilesystemIterator::SKIP_DOTS; - - // If the destination directory does not actually exist, we will go ahead and - // create it recursively, which just gets the destination prepared to copy - // the files over. Once we make the directory we'll proceed the copying. - $this->ensureDirectoryExists($destination, 0777); - - $items = new FilesystemIterator($directory, $options); - - foreach ($items as $item) { - // As we spin through items, we will check to see if the current file is actually - // a directory or a file. When it is actually a directory we will need to call - // back into this function recursively to keep copying these nested folders. - $target = $destination.'/'.$item->getBasename(); - - if ($item->isDir()) { - $path = $item->getPathname(); - - if (! $this->copyDirectory($path, $target, $options)) { - return false; - } - } - - // If the current items is just a regular file, we will just copy this to the new - // location and keep looping. If for some reason the copy fails we'll bail out - // and return false, so the developer is aware that the copy process failed. - elseif (! $this->copy($item->getPathname(), $target)) { - return false; - } - } - - return true; - } - - /** - * Recursively delete a directory. - * - * The directory itself may be optionally preserved. - * - * @param string $directory - * @param bool $preserve - * @return bool - */ - public function deleteDirectory($directory, $preserve = false) - { - if (! $this->isDirectory($directory)) { - return false; - } - - $items = new FilesystemIterator($directory); - - foreach ($items as $item) { - // If the item is a directory, we can just recurse into the function and - // delete that sub-directory otherwise we'll just delete the file and - // keep iterating through each file until the directory is cleaned. - if ($item->isDir() && ! $item->isLink()) { - $this->deleteDirectory($item->getPathname()); - } - - // If the item is just a file, we can go ahead and delete it since we're - // just looping through and waxing all of the files in this directory - // and calling directories recursively, so we delete the real path. - else { - $this->delete($item->getPathname()); - } - } - - if (! $preserve) { - @rmdir($directory); - } - - return true; - } - - /** - * Remove all of the directories within a given directory. - * - * @param string $directory - * @return bool - */ - public function deleteDirectories($directory) - { - $allDirectories = $this->directories($directory); - - if (! empty($allDirectories)) { - foreach ($allDirectories as $directoryName) { - $this->deleteDirectory($directoryName); - } - - return true; - } - - return false; - } - - /** - * Empty the specified directory of all files and folders. - * - * @param string $directory - * @return bool - */ - public function cleanDirectory($directory) - { - return $this->deleteDirectory($directory, true); - } -} diff --git a/framework-9.50.2/src/Illuminate/Filesystem/FilesystemAdapter.php b/framework-9.50.2/src/Illuminate/Filesystem/FilesystemAdapter.php deleted file mode 100644 index 87606c9..0000000 --- a/framework-9.50.2/src/Illuminate/Filesystem/FilesystemAdapter.php +++ /dev/null @@ -1,953 +0,0 @@ -driver = $driver; - $this->adapter = $adapter; - $this->config = $config; - $separator = $config['directory_separator'] ?? DIRECTORY_SEPARATOR; - - $this->prefixer = new PathPrefixer($config['root'] ?? '', $separator); - - if (isset($config['prefix'])) { - $this->prefixer = new PathPrefixer($this->prefixer->prefixPath($config['prefix']), $separator); - } - } - - /** - * Assert that the given file or directory exists. - * - * @param string|array $path - * @param string|null $content - * @return $this - */ - public function assertExists($path, $content = null) - { - clearstatcache(); - - $paths = Arr::wrap($path); - - foreach ($paths as $path) { - PHPUnit::assertTrue( - $this->exists($path), "Unable to find a file or directory at path [{$path}]." - ); - - if (! is_null($content)) { - $actual = $this->get($path); - - PHPUnit::assertSame( - $content, - $actual, - "File or directory [{$path}] was found, but content [{$actual}] does not match [{$content}]." - ); - } - } - - return $this; - } - - /** - * Assert that the given file or directory does not exist. - * - * @param string|array $path - * @return $this - */ - public function assertMissing($path) - { - clearstatcache(); - - $paths = Arr::wrap($path); - - foreach ($paths as $path) { - PHPUnit::assertFalse( - $this->exists($path), "Found unexpected file or directory at path [{$path}]." - ); - } - - return $this; - } - - /** - * Assert that the given directory is empty. - * - * @param string $path - * @return $this - */ - public function assertDirectoryEmpty($path) - { - PHPUnit::assertEmpty( - $this->allFiles($path), "Directory [{$path}] is not empty." - ); - - return $this; - } - - /** - * Determine if a file or directory exists. - * - * @param string $path - * @return bool - */ - public function exists($path) - { - return $this->driver->has($path); - } - - /** - * Determine if a file or directory is missing. - * - * @param string $path - * @return bool - */ - public function missing($path) - { - return ! $this->exists($path); - } - - /** - * Determine if a file exists. - * - * @param string $path - * @return bool - */ - public function fileExists($path) - { - return $this->driver->fileExists($path); - } - - /** - * Determine if a file is missing. - * - * @param string $path - * @return bool - */ - public function fileMissing($path) - { - return ! $this->fileExists($path); - } - - /** - * Determine if a directory exists. - * - * @param string $path - * @return bool - */ - public function directoryExists($path) - { - return $this->driver->directoryExists($path); - } - - /** - * Determine if a directory is missing. - * - * @param string $path - * @return bool - */ - public function directoryMissing($path) - { - return ! $this->directoryExists($path); - } - - /** - * Get the full path for the file at the given "short" path. - * - * @param string $path - * @return string - */ - public function path($path) - { - return $this->prefixer->prefixPath($path); - } - - /** - * Get the contents of a file. - * - * @param string $path - * @return string|null - */ - public function get($path) - { - try { - return $this->driver->read($path); - } catch (UnableToReadFile $e) { - throw_if($this->throwsExceptions(), $e); - } - } - - /** - * Create a streamed response for a given file. - * - * @param string $path - * @param string|null $name - * @param array $headers - * @param string|null $disposition - * @return \Symfony\Component\HttpFoundation\StreamedResponse - */ - public function response($path, $name = null, array $headers = [], $disposition = 'inline') - { - $response = new StreamedResponse; - - if (! array_key_exists('Content-Type', $headers)) { - $headers['Content-Type'] = $this->mimeType($path); - } - - if (! array_key_exists('Content-Length', $headers)) { - $headers['Content-Length'] = $this->size($path); - } - - if (! array_key_exists('Content-Disposition', $headers)) { - $filename = $name ?? basename($path); - - $disposition = $response->headers->makeDisposition( - $disposition, $filename, $this->fallbackName($filename) - ); - - $headers['Content-Disposition'] = $disposition; - } - - $response->headers->replace($headers); - - $response->setCallback(function () use ($path) { - $stream = $this->readStream($path); - fpassthru($stream); - fclose($stream); - }); - - return $response; - } - - /** - * Create a streamed download response for a given file. - * - * @param string $path - * @param string|null $name - * @return \Symfony\Component\HttpFoundation\StreamedResponse - */ - public function download($path, $name = null, array $headers = []) - { - return $this->response($path, $name, $headers, 'attachment'); - } - - /** - * Convert the string to ASCII characters that are equivalent to the given name. - * - * @param string $name - * @return string - */ - protected function fallbackName($name) - { - return str_replace('%', '', Str::ascii($name)); - } - - /** - * Write the contents of a file. - * - * @param string $path - * @param \Psr\Http\Message\StreamInterface|\Illuminate\Http\File|\Illuminate\Http\UploadedFile|string|resource $contents - * @param mixed $options - * @return string|bool - */ - public function put($path, $contents, $options = []) - { - $options = is_string($options) - ? ['visibility' => $options] - : (array) $options; - - // If the given contents is actually a file or uploaded file instance than we will - // automatically store the file using a stream. This provides a convenient path - // for the developer to store streams without managing them manually in code. - if ($contents instanceof File || - $contents instanceof UploadedFile) { - return $this->putFile($path, $contents, $options); - } - - try { - if ($contents instanceof StreamInterface) { - $this->driver->writeStream($path, $contents->detach(), $options); - - return true; - } - - is_resource($contents) - ? $this->driver->writeStream($path, $contents, $options) - : $this->driver->write($path, $contents, $options); - } catch (UnableToWriteFile|UnableToSetVisibility $e) { - throw_if($this->throwsExceptions(), $e); - - return false; - } - - return true; - } - - /** - * Store the uploaded file on the disk. - * - * @param string $path - * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file - * @param mixed $options - * @return string|false - */ - public function putFile($path, $file, $options = []) - { - $file = is_string($file) ? new File($file) : $file; - - return $this->putFileAs($path, $file, $file->hashName(), $options); - } - - /** - * Store the uploaded file on the disk with a given name. - * - * @param string $path - * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file - * @param string $name - * @param mixed $options - * @return string|false - */ - public function putFileAs($path, $file, $name, $options = []) - { - $stream = fopen(is_string($file) ? $file : $file->getRealPath(), 'r'); - - // Next, we will format the path of the file and store the file using a stream since - // they provide better performance than alternatives. Once we write the file this - // stream will get closed automatically by us so the developer doesn't have to. - $result = $this->put( - $path = trim($path.'/'.$name, '/'), $stream, $options - ); - - if (is_resource($stream)) { - fclose($stream); - } - - return $result ? $path : false; - } - - /** - * Get the visibility for the given path. - * - * @param string $path - * @return string - */ - public function getVisibility($path) - { - if ($this->driver->visibility($path) == Visibility::PUBLIC) { - return FilesystemContract::VISIBILITY_PUBLIC; - } - - return FilesystemContract::VISIBILITY_PRIVATE; - } - - /** - * Set the visibility for the given path. - * - * @param string $path - * @param string $visibility - * @return bool - */ - public function setVisibility($path, $visibility) - { - try { - $this->driver->setVisibility($path, $this->parseVisibility($visibility)); - } catch (UnableToSetVisibility $e) { - throw_if($this->throwsExceptions(), $e); - - return false; - } - - return true; - } - - /** - * Prepend to a file. - * - * @param string $path - * @param string $data - * @param string $separator - * @return bool - */ - public function prepend($path, $data, $separator = PHP_EOL) - { - if ($this->fileExists($path)) { - return $this->put($path, $data.$separator.$this->get($path)); - } - - return $this->put($path, $data); - } - - /** - * Append to a file. - * - * @param string $path - * @param string $data - * @param string $separator - * @return bool - */ - public function append($path, $data, $separator = PHP_EOL) - { - if ($this->fileExists($path)) { - return $this->put($path, $this->get($path).$separator.$data); - } - - return $this->put($path, $data); - } - - /** - * Delete the file at a given path. - * - * @param string|array $paths - * @return bool - */ - public function delete($paths) - { - $paths = is_array($paths) ? $paths : func_get_args(); - - $success = true; - - foreach ($paths as $path) { - try { - $this->driver->delete($path); - } catch (UnableToDeleteFile $e) { - throw_if($this->throwsExceptions(), $e); - - $success = false; - } - } - - return $success; - } - - /** - * Copy a file to a new location. - * - * @param string $from - * @param string $to - * @return bool - */ - public function copy($from, $to) - { - try { - $this->driver->copy($from, $to); - } catch (UnableToCopyFile $e) { - throw_if($this->throwsExceptions(), $e); - - return false; - } - - return true; - } - - /** - * Move a file to a new location. - * - * @param string $from - * @param string $to - * @return bool - */ - public function move($from, $to) - { - try { - $this->driver->move($from, $to); - } catch (UnableToMoveFile $e) { - throw_if($this->throwsExceptions(), $e); - - return false; - } - - return true; - } - - /** - * Get the file size of a given file. - * - * @param string $path - * @return int - */ - public function size($path) - { - return $this->driver->fileSize($path); - } - - /** - * Get the checksum for a file. - * - * @return string|false - * - * @throws UnableToProvideChecksum - */ - public function checksum(string $path, array $options = []) - { - try { - return $this->driver->checksum($path, $options); - } catch (UnableToProvideChecksum $e) { - throw_if($this->throwsExceptions(), $e); - - return false; - } - } - - /** - * Get the mime-type of a given file. - * - * @param string $path - * @return string|false - */ - public function mimeType($path) - { - try { - return $this->driver->mimeType($path); - } catch (UnableToRetrieveMetadata $e) { - throw_if($this->throwsExceptions(), $e); - } - - return false; - } - - /** - * Get the file's last modification time. - * - * @param string $path - * @return int - */ - public function lastModified($path) - { - return $this->driver->lastModified($path); - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - try { - return $this->driver->readStream($path); - } catch (UnableToReadFile $e) { - throw_if($this->throwsExceptions(), $e); - } - } - - /** - * {@inheritdoc} - */ - public function writeStream($path, $resource, array $options = []) - { - try { - $this->driver->writeStream($path, $resource, $options); - } catch (UnableToWriteFile|UnableToSetVisibility $e) { - throw_if($this->throwsExceptions(), $e); - - return false; - } - - return true; - } - - /** - * Get the URL for the file at the given path. - * - * @param string $path - * @return string - * - * @throws \RuntimeException - */ - public function url($path) - { - if (isset($this->config['prefix'])) { - $path = $this->concatPathToUrl($this->config['prefix'], $path); - } - - $adapter = $this->adapter; - - if (method_exists($adapter, 'getUrl')) { - return $adapter->getUrl($path); - } elseif (method_exists($this->driver, 'getUrl')) { - return $this->driver->getUrl($path); - } elseif ($adapter instanceof FtpAdapter || $adapter instanceof SftpAdapter) { - return $this->getFtpUrl($path); - } elseif ($adapter instanceof LocalAdapter) { - return $this->getLocalUrl($path); - } else { - throw new RuntimeException('This driver does not support retrieving URLs.'); - } - } - - /** - * Get the URL for the file at the given path. - * - * @param string $path - * @return string - */ - protected function getFtpUrl($path) - { - return isset($this->config['url']) - ? $this->concatPathToUrl($this->config['url'], $path) - : $path; - } - - /** - * Get the URL for the file at the given path. - * - * @param string $path - * @return string - */ - protected function getLocalUrl($path) - { - // If an explicit base URL has been set on the disk configuration then we will use - // it as the base URL instead of the default path. This allows the developer to - // have full control over the base path for this filesystem's generated URLs. - if (isset($this->config['url'])) { - return $this->concatPathToUrl($this->config['url'], $path); - } - - $path = '/storage/'.$path; - - // If the path contains "storage/public", it probably means the developer is using - // the default disk to generate the path instead of the "public" disk like they - // are really supposed to use. We will remove the public from this path here. - if (str_contains($path, '/storage/public/')) { - return Str::replaceFirst('/public/', '/', $path); - } - - return $path; - } - - /** - * Determine if temporary URLs can be generated. - * - * @return bool - */ - public function providesTemporaryUrls() - { - return method_exists($this->adapter, 'getTemporaryUrl') || isset($this->temporaryUrlCallback); - } - - /** - * Get a temporary URL for the file at the given path. - * - * @param string $path - * @param \DateTimeInterface $expiration - * @param array $options - * @return string - * - * @throws \RuntimeException - */ - public function temporaryUrl($path, $expiration, array $options = []) - { - if (method_exists($this->adapter, 'getTemporaryUrl')) { - return $this->adapter->getTemporaryUrl($path, $expiration, $options); - } - - if ($this->temporaryUrlCallback) { - return $this->temporaryUrlCallback->bindTo($this, static::class)( - $path, $expiration, $options - ); - } - - throw new RuntimeException('This driver does not support creating temporary URLs.'); - } - - /** - * Concatenate a path to a URL. - * - * @param string $url - * @param string $path - * @return string - */ - protected function concatPathToUrl($url, $path) - { - return rtrim($url, '/').'/'.ltrim($path, '/'); - } - - /** - * Replace the scheme, host and port of the given UriInterface with values from the given URL. - * - * @param \Psr\Http\Message\UriInterface $uri - * @param string $url - * @return \Psr\Http\Message\UriInterface - */ - protected function replaceBaseUrl($uri, $url) - { - $parsed = parse_url($url); - - return $uri - ->withScheme($parsed['scheme']) - ->withHost($parsed['host']) - ->withPort($parsed['port'] ?? null); - } - - /** - * Get an array of all files in a directory. - * - * @param string|null $directory - * @param bool $recursive - * @return array - */ - public function files($directory = null, $recursive = false) - { - return $this->driver->listContents($directory ?? '', $recursive) - ->filter(function (StorageAttributes $attributes) { - return $attributes->isFile(); - }) - ->sortByPath() - ->map(function (StorageAttributes $attributes) { - return $attributes->path(); - }) - ->toArray(); - } - - /** - * Get all of the files from the given directory (recursive). - * - * @param string|null $directory - * @return array - */ - public function allFiles($directory = null) - { - return $this->files($directory, true); - } - - /** - * Get all of the directories within a given directory. - * - * @param string|null $directory - * @param bool $recursive - * @return array - */ - public function directories($directory = null, $recursive = false) - { - return $this->driver->listContents($directory ?? '', $recursive) - ->filter(function (StorageAttributes $attributes) { - return $attributes->isDir(); - }) - ->map(function (StorageAttributes $attributes) { - return $attributes->path(); - }) - ->toArray(); - } - - /** - * Get all the directories within a given directory (recursive). - * - * @param string|null $directory - * @return array - */ - public function allDirectories($directory = null) - { - return $this->directories($directory, true); - } - - /** - * Create a directory. - * - * @param string $path - * @return bool - */ - public function makeDirectory($path) - { - try { - $this->driver->createDirectory($path); - } catch (UnableToCreateDirectory|UnableToSetVisibility $e) { - throw_if($this->throwsExceptions(), $e); - - return false; - } - - return true; - } - - /** - * Recursively delete a directory. - * - * @param string $directory - * @return bool - */ - public function deleteDirectory($directory) - { - try { - $this->driver->deleteDirectory($directory); - } catch (UnableToDeleteDirectory $e) { - throw_if($this->throwsExceptions(), $e); - - return false; - } - - return true; - } - - /** - * Get the Flysystem driver. - * - * @return \League\Flysystem\FilesystemOperator - */ - public function getDriver() - { - return $this->driver; - } - - /** - * Get the Flysystem adapter. - * - * @return \League\Flysystem\FilesystemAdapter - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * Get the configuration values. - * - * @return array - */ - public function getConfig() - { - return $this->config; - } - - /** - * Parse the given visibility value. - * - * @param string|null $visibility - * @return string|null - * - * @throws \InvalidArgumentException - */ - protected function parseVisibility($visibility) - { - if (is_null($visibility)) { - return; - } - - return match ($visibility) { - FilesystemContract::VISIBILITY_PUBLIC => Visibility::PUBLIC, - FilesystemContract::VISIBILITY_PRIVATE => Visibility::PRIVATE, - default => throw new InvalidArgumentException("Unknown visibility: {$visibility}."), - }; - } - - /** - * Define a custom temporary URL builder callback. - * - * @param \Closure $callback - * @return void - */ - public function buildTemporaryUrlsUsing(Closure $callback) - { - $this->temporaryUrlCallback = $callback; - } - - /** - * Determine if Flysystem exceptions should be thrown. - * - * @return bool - */ - protected function throwsExceptions(): bool - { - return (bool) ($this->config['throw'] ?? false); - } - - /** - * Pass dynamic methods call onto Flysystem. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, array $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - return $this->driver->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Filesystem/FilesystemManager.php b/framework-9.50.2/src/Illuminate/Filesystem/FilesystemManager.php deleted file mode 100644 index 0475c40..0000000 --- a/framework-9.50.2/src/Illuminate/Filesystem/FilesystemManager.php +++ /dev/null @@ -1,429 +0,0 @@ -app = $app; - } - - /** - * Get a filesystem instance. - * - * @param string|null $name - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function drive($name = null) - { - return $this->disk($name); - } - - /** - * Get a filesystem instance. - * - * @param string|null $name - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function disk($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - return $this->disks[$name] = $this->get($name); - } - - /** - * Get a default cloud filesystem instance. - * - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function cloud() - { - $name = $this->getDefaultCloudDriver(); - - return $this->disks[$name] = $this->get($name); - } - - /** - * Build an on-demand disk. - * - * @param string|array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function build($config) - { - return $this->resolve('ondemand', is_array($config) ? $config : [ - 'driver' => 'local', - 'root' => $config, - ]); - } - - /** - * Attempt to get the disk from the local cache. - * - * @param string $name - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - protected function get($name) - { - return $this->disks[$name] ?? $this->resolve($name); - } - - /** - * Resolve the given disk. - * - * @param string $name - * @param array|null $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - * - * @throws \InvalidArgumentException - */ - protected function resolve($name, $config = null) - { - $config ??= $this->getConfig($name); - - if (empty($config['driver'])) { - throw new InvalidArgumentException("Disk [{$name}] does not have a configured driver."); - } - - $name = $config['driver']; - - if (isset($this->customCreators[$name])) { - return $this->callCustomCreator($config); - } - - $driverMethod = 'create'.ucfirst($name).'Driver'; - - if (! method_exists($this, $driverMethod)) { - throw new InvalidArgumentException("Driver [{$name}] is not supported."); - } - - return $this->{$driverMethod}($config); - } - - /** - * Call a custom driver creator. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - protected function callCustomCreator(array $config) - { - return $this->customCreators[$config['driver']]($this->app, $config); - } - - /** - * Create an instance of the local driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function createLocalDriver(array $config) - { - $visibility = PortableVisibilityConverter::fromArray( - $config['permissions'] ?? [], - $config['directory_visibility'] ?? $config['visibility'] ?? Visibility::PRIVATE - ); - - $links = ($config['links'] ?? null) === 'skip' - ? LocalAdapter::SKIP_LINKS - : LocalAdapter::DISALLOW_LINKS; - - $adapter = new LocalAdapter( - $config['root'], $visibility, $config['lock'] ?? LOCK_EX, $links - ); - - return new FilesystemAdapter($this->createFlysystem($adapter, $config), $adapter, $config); - } - - /** - * Create an instance of the ftp driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function createFtpDriver(array $config) - { - if (! isset($config['root'])) { - $config['root'] = ''; - } - - $adapter = new FtpAdapter(FtpConnectionOptions::fromArray($config)); - - return new FilesystemAdapter($this->createFlysystem($adapter, $config), $adapter, $config); - } - - /** - * Create an instance of the sftp driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function createSftpDriver(array $config) - { - $provider = SftpConnectionProvider::fromArray($config); - - $root = $config['root'] ?? '/'; - - $visibility = PortableVisibilityConverter::fromArray( - $config['permissions'] ?? [] - ); - - $adapter = new SftpAdapter($provider, $root, $visibility); - - return new FilesystemAdapter($this->createFlysystem($adapter, $config), $adapter, $config); - } - - /** - * Create an instance of the Amazon S3 driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Cloud - */ - public function createS3Driver(array $config) - { - $s3Config = $this->formatS3Config($config); - - $root = (string) ($s3Config['root'] ?? ''); - - $visibility = new AwsS3PortableVisibilityConverter( - $config['visibility'] ?? Visibility::PUBLIC - ); - - $streamReads = $s3Config['stream_reads'] ?? false; - - $client = new S3Client($s3Config); - - $adapter = new S3Adapter($client, $s3Config['bucket'], $root, $visibility, null, $config['options'] ?? [], $streamReads); - - return new AwsS3V3Adapter( - $this->createFlysystem($adapter, $config), $adapter, $s3Config, $client - ); - } - - /** - * Format the given S3 configuration with the default options. - * - * @param array $config - * @return array - */ - protected function formatS3Config(array $config) - { - $config += ['version' => 'latest']; - - if (! empty($config['key']) && ! empty($config['secret'])) { - $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); - } - - return Arr::except($config, ['token']); - } - - /** - * Create a scoped driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public function createScopedDriver(array $config) - { - if (empty($config['disk'])) { - throw new InvalidArgumentException('Scoped disk is missing "disk" configuration option.'); - } elseif (empty($config['prefix'])) { - throw new InvalidArgumentException('Scoped disk is missing "prefix" configuration option.'); - } - - return $this->build(tap( - $this->getConfig($config['disk']), - fn (&$parent) => $parent['prefix'] = $config['prefix'] - )); - } - - /** - * Create a Flysystem instance with the given adapter. - * - * @param \League\Flysystem\FilesystemAdapter $adapter - * @param array $config - * @return \League\Flysystem\FilesystemOperator - */ - protected function createFlysystem(FlysystemAdapter $adapter, array $config) - { - if ($config['read-only'] ?? false === true) { - $adapter = new ReadOnlyFilesystemAdapter($adapter); - } - - if (! empty($config['prefix'])) { - $adapter = new PathPrefixedAdapter($adapter, $config['prefix']); - } - - return new Flysystem($adapter, Arr::only($config, [ - 'directory_visibility', - 'disable_asserts', - 'temporary_url', - 'url', - 'visibility', - ])); - } - - /** - * Set the given disk instance. - * - * @param string $name - * @param mixed $disk - * @return $this - */ - public function set($name, $disk) - { - $this->disks[$name] = $disk; - - return $this; - } - - /** - * Get the filesystem connection configuration. - * - * @param string $name - * @return array - */ - protected function getConfig($name) - { - return $this->app['config']["filesystems.disks.{$name}"] ?: []; - } - - /** - * Get the default driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['filesystems.default']; - } - - /** - * Get the default cloud driver name. - * - * @return string - */ - public function getDefaultCloudDriver() - { - return $this->app['config']['filesystems.cloud'] ?? 's3'; - } - - /** - * Unset the given disk instances. - * - * @param array|string $disk - * @return $this - */ - public function forgetDisk($disk) - { - foreach ((array) $disk as $diskName) { - unset($this->disks[$diskName]); - } - - return $this; - } - - /** - * Disconnect the given disk and remove from local cache. - * - * @param string|null $name - * @return void - */ - public function purge($name = null) - { - $name ??= $this->getDefaultDriver(); - - unset($this->disks[$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; - } - - /** - * Set the application instance used by the manager. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return $this - */ - public function setApplication($app) - { - $this->app = $app; - - return $this; - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->disk()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Filesystem/FilesystemServiceProvider.php b/framework-9.50.2/src/Illuminate/Filesystem/FilesystemServiceProvider.php deleted file mode 100644 index ff348a2..0000000 --- a/framework-9.50.2/src/Illuminate/Filesystem/FilesystemServiceProvider.php +++ /dev/null @@ -1,82 +0,0 @@ -registerNativeFilesystem(); - - $this->registerFlysystem(); - } - - /** - * Register the native filesystem implementation. - * - * @return void - */ - protected function registerNativeFilesystem() - { - $this->app->singleton('files', function () { - return new Filesystem; - }); - } - - /** - * Register the driver based filesystem. - * - * @return void - */ - protected function registerFlysystem() - { - $this->registerManager(); - - $this->app->singleton('filesystem.disk', function ($app) { - return $app['filesystem']->disk($this->getDefaultDriver()); - }); - - $this->app->singleton('filesystem.cloud', function ($app) { - return $app['filesystem']->disk($this->getCloudDriver()); - }); - } - - /** - * Register the filesystem manager. - * - * @return void - */ - protected function registerManager() - { - $this->app->singleton('filesystem', function ($app) { - return new FilesystemManager($app); - }); - } - - /** - * Get the default file driver. - * - * @return string - */ - protected function getDefaultDriver() - { - return $this->app['config']['filesystems.default']; - } - - /** - * Get the default cloud based file driver. - * - * @return string - */ - protected function getCloudDriver() - { - return $this->app['config']['filesystems.cloud']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Filesystem/LICENSE.md b/framework-9.50.2/src/Illuminate/Filesystem/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Filesystem/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Filesystem/LockableFile.php b/framework-9.50.2/src/Illuminate/Filesystem/LockableFile.php deleted file mode 100644 index 8b2de76..0000000 --- a/framework-9.50.2/src/Illuminate/Filesystem/LockableFile.php +++ /dev/null @@ -1,194 +0,0 @@ -path = $path; - - $this->ensureDirectoryExists($path); - $this->createResource($path, $mode); - } - - /** - * Create the file's directory if necessary. - * - * @param string $path - * @return void - */ - protected function ensureDirectoryExists($path) - { - if (! file_exists(dirname($path))) { - @mkdir(dirname($path), 0777, true); - } - } - - /** - * Create the file resource. - * - * @param string $path - * @param string $mode - * @return void - * - * @throws \Exception - */ - protected function createResource($path, $mode) - { - $this->handle = @fopen($path, $mode); - - if (! $this->handle) { - throw new Exception('Unable to create lockable file: '.$path.'. Please ensure you have permission to create files in this location.'); - } - } - - /** - * Read the file contents. - * - * @param int|null $length - * @return string - */ - public function read($length = null) - { - clearstatcache(true, $this->path); - - return fread($this->handle, $length ?? ($this->size() ?: 1)); - } - - /** - * Get the file size. - * - * @return int - */ - public function size() - { - return filesize($this->path); - } - - /** - * Write to the file. - * - * @param string $contents - * @return $this - */ - public function write($contents) - { - fwrite($this->handle, $contents); - - fflush($this->handle); - - return $this; - } - - /** - * Truncate the file. - * - * @return $this - */ - public function truncate() - { - rewind($this->handle); - - ftruncate($this->handle, 0); - - return $this; - } - - /** - * Get a shared lock on the file. - * - * @param bool $block - * @return $this - * - * @throws \Illuminate\Contracts\Filesystem\LockTimeoutException - */ - public function getSharedLock($block = false) - { - if (! flock($this->handle, LOCK_SH | ($block ? 0 : LOCK_NB))) { - throw new LockTimeoutException("Unable to acquire file lock at path [{$this->path}]."); - } - - $this->isLocked = true; - - return $this; - } - - /** - * Get an exclusive lock on the file. - * - * @param bool $block - * @return bool - * - * @throws \Illuminate\Contracts\Filesystem\LockTimeoutException - */ - public function getExclusiveLock($block = false) - { - if (! flock($this->handle, LOCK_EX | ($block ? 0 : LOCK_NB))) { - throw new LockTimeoutException("Unable to acquire file lock at path [{$this->path}]."); - } - - $this->isLocked = true; - - return $this; - } - - /** - * Release the lock on the file. - * - * @return $this - */ - public function releaseLock() - { - flock($this->handle, LOCK_UN); - - $this->isLocked = false; - - return $this; - } - - /** - * Close the file. - * - * @return bool - */ - public function close() - { - if ($this->isLocked) { - $this->releaseLock(); - } - - return fclose($this->handle); - } -} diff --git a/framework-9.50.2/src/Illuminate/Filesystem/composer.json b/framework-9.50.2/src/Illuminate/Filesystem/composer.json deleted file mode 100644 index 13d52d8..0000000 --- a/framework-9.50.2/src/Illuminate/Filesystem/composer.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "illuminate/filesystem", - "description": "The Illuminate Filesystem package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0", - "symfony/finder": "^6.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Filesystem\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "ext-ftp": "Required to use the Flysystem FTP driver.", - "illuminate/http": "Required for handling uploaded files (^7.0).", - "league/flysystem": "Required to use the Flysystem local driver (^3.0.16).", - "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.0).", - "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.0).", - "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.0).", - "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", - "symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).", - "symfony/mime": "Required to enable support for guessing extensions (^6.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/AliasLoader.php b/framework-9.50.2/src/Illuminate/Foundation/AliasLoader.php deleted file mode 100755 index 5146e44..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/AliasLoader.php +++ /dev/null @@ -1,243 +0,0 @@ -aliases = $aliases; - } - - /** - * Get or create the singleton alias loader instance. - * - * @param array $aliases - * @return \Illuminate\Foundation\AliasLoader - */ - public static function getInstance(array $aliases = []) - { - if (is_null(static::$instance)) { - return static::$instance = new static($aliases); - } - - $aliases = array_merge(static::$instance->getAliases(), $aliases); - - static::$instance->setAliases($aliases); - - return static::$instance; - } - - /** - * Load a class alias if it is registered. - * - * @param string $alias - * @return bool|null - */ - public function load($alias) - { - if (static::$facadeNamespace && str_starts_with($alias, static::$facadeNamespace)) { - $this->loadFacade($alias); - - return true; - } - - if (isset($this->aliases[$alias])) { - return class_alias($this->aliases[$alias], $alias); - } - } - - /** - * Load a real-time facade for the given alias. - * - * @param string $alias - * @return void - */ - protected function loadFacade($alias) - { - require $this->ensureFacadeExists($alias); - } - - /** - * Ensure that the given alias has an existing real-time facade class. - * - * @param string $alias - * @return string - */ - protected function ensureFacadeExists($alias) - { - if (is_file($path = storage_path('framework/cache/facade-'.sha1($alias).'.php'))) { - return $path; - } - - file_put_contents($path, $this->formatFacadeStub( - $alias, file_get_contents(__DIR__.'/stubs/facade.stub') - )); - - return $path; - } - - /** - * Format the facade stub with the proper namespace and class. - * - * @param string $alias - * @param string $stub - * @return string - */ - protected function formatFacadeStub($alias, $stub) - { - $replacements = [ - str_replace('/', '\\', dirname(str_replace('\\', '/', $alias))), - class_basename($alias), - substr($alias, strlen(static::$facadeNamespace)), - ]; - - return str_replace( - ['DummyNamespace', 'DummyClass', 'DummyTarget'], $replacements, $stub - ); - } - - /** - * Add an alias to the loader. - * - * @param string $alias - * @param string $class - * @return void - */ - public function alias($alias, $class) - { - $this->aliases[$alias] = $class; - } - - /** - * Register the loader on the auto-loader stack. - * - * @return void - */ - public function register() - { - if (! $this->registered) { - $this->prependToLoaderStack(); - - $this->registered = true; - } - } - - /** - * Prepend the load method to the auto-loader stack. - * - * @return void - */ - protected function prependToLoaderStack() - { - spl_autoload_register([$this, 'load'], true, true); - } - - /** - * Get the registered aliases. - * - * @return array - */ - public function getAliases() - { - return $this->aliases; - } - - /** - * Set the registered aliases. - * - * @param array $aliases - * @return void - */ - public function setAliases(array $aliases) - { - $this->aliases = $aliases; - } - - /** - * Indicates if the loader has been registered. - * - * @return bool - */ - public function isRegistered() - { - return $this->registered; - } - - /** - * Set the "registered" state of the loader. - * - * @param bool $value - * @return void - */ - public function setRegistered($value) - { - $this->registered = $value; - } - - /** - * Set the real-time facade namespace. - * - * @param string $namespace - * @return void - */ - public static function setFacadeNamespace($namespace) - { - static::$facadeNamespace = rtrim($namespace, '\\').'\\'; - } - - /** - * Set the value of the singleton alias loader. - * - * @param \Illuminate\Foundation\AliasLoader $loader - * @return void - */ - public static function setInstance($loader) - { - static::$instance = $loader; - } - - /** - * Clone method. - * - * @return void - */ - private function __clone() - { - // - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Application.php b/framework-9.50.2/src/Illuminate/Foundation/Application.php deleted file mode 100755 index a6f9287..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Application.php +++ /dev/null @@ -1,1427 +0,0 @@ -setBasePath($basePath); - } - - $this->registerBaseBindings(); - $this->registerBaseServiceProviders(); - $this->registerCoreContainerAliases(); - } - - /** - * Get the version number of the application. - * - * @return string - */ - public function version() - { - return static::VERSION; - } - - /** - * Register the basic bindings into the container. - * - * @return void - */ - protected function registerBaseBindings() - { - static::setInstance($this); - - $this->instance('app', $this); - - $this->instance(Container::class, $this); - $this->singleton(Mix::class); - - $this->singleton(PackageManifest::class, function () { - return new PackageManifest( - new Filesystem, $this->basePath(), $this->getCachedPackagesPath() - ); - }); - } - - /** - * Register all of the base service providers. - * - * @return void - */ - protected function registerBaseServiceProviders() - { - $this->register(new EventServiceProvider($this)); - $this->register(new LogServiceProvider($this)); - $this->register(new RoutingServiceProvider($this)); - } - - /** - * Run the given array of bootstrap classes. - * - * @param string[] $bootstrappers - * @return void - */ - public function bootstrapWith(array $bootstrappers) - { - $this->hasBeenBootstrapped = true; - - foreach ($bootstrappers as $bootstrapper) { - $this['events']->dispatch('bootstrapping: '.$bootstrapper, [$this]); - - $this->make($bootstrapper)->bootstrap($this); - - $this['events']->dispatch('bootstrapped: '.$bootstrapper, [$this]); - } - } - - /** - * Register a callback to run after loading the environment. - * - * @param \Closure $callback - * @return void - */ - public function afterLoadingEnvironment(Closure $callback) - { - $this->afterBootstrapping( - LoadEnvironmentVariables::class, $callback - ); - } - - /** - * Register a callback to run before a bootstrapper. - * - * @param string $bootstrapper - * @param \Closure $callback - * @return void - */ - public function beforeBootstrapping($bootstrapper, Closure $callback) - { - $this['events']->listen('bootstrapping: '.$bootstrapper, $callback); - } - - /** - * Register a callback to run after a bootstrapper. - * - * @param string $bootstrapper - * @param \Closure $callback - * @return void - */ - public function afterBootstrapping($bootstrapper, Closure $callback) - { - $this['events']->listen('bootstrapped: '.$bootstrapper, $callback); - } - - /** - * Determine if the application has been bootstrapped before. - * - * @return bool - */ - public function hasBeenBootstrapped() - { - return $this->hasBeenBootstrapped; - } - - /** - * Set the base path for the application. - * - * @param string $basePath - * @return $this - */ - public function setBasePath($basePath) - { - $this->basePath = rtrim($basePath, '\/'); - - $this->bindPathsInContainer(); - - return $this; - } - - /** - * Bind all of the application paths in the container. - * - * @return void - */ - protected function bindPathsInContainer() - { - $this->instance('path', $this->path()); - $this->instance('path.base', $this->basePath()); - $this->instance('path.config', $this->configPath()); - $this->instance('path.public', $this->publicPath()); - $this->instance('path.storage', $this->storagePath()); - $this->instance('path.database', $this->databasePath()); - $this->instance('path.resources', $this->resourcePath()); - $this->instance('path.bootstrap', $this->bootstrapPath()); - - $this->useLangPath(value(function () { - if (is_dir($directory = $this->resourcePath('lang'))) { - return $directory; - } - - return $this->basePath('lang'); - })); - } - - /** - * Get the path to the application "app" directory. - * - * @param string $path - * @return string - */ - public function path($path = '') - { - $appPath = $this->appPath ?: $this->basePath.DIRECTORY_SEPARATOR.'app'; - - return $appPath.($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Set the application directory. - * - * @param string $path - * @return $this - */ - public function useAppPath($path) - { - $this->appPath = $path; - - $this->instance('path', $path); - - return $this; - } - - /** - * Get the base path of the Laravel installation. - * - * @param string $path - * @return string - */ - public function basePath($path = '') - { - return $this->basePath.($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Get the path to the bootstrap directory. - * - * @param string $path - * @return string - */ - public function bootstrapPath($path = '') - { - return $this->basePath.DIRECTORY_SEPARATOR.'bootstrap'.($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Get the path to the application configuration files. - * - * @param string $path - * @return string - */ - public function configPath($path = '') - { - return $this->basePath.DIRECTORY_SEPARATOR.'config'.($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Get the path to the database directory. - * - * @param string $path - * @return string - */ - public function databasePath($path = '') - { - return ($this->databasePath ?: $this->basePath.DIRECTORY_SEPARATOR.'database').($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Set the database directory. - * - * @param string $path - * @return $this - */ - public function useDatabasePath($path) - { - $this->databasePath = $path; - - $this->instance('path.database', $path); - - return $this; - } - - /** - * Get the path to the language files. - * - * @param string $path - * @return string - */ - public function langPath($path = '') - { - return $this->langPath.($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Set the language file directory. - * - * @param string $path - * @return $this - */ - public function useLangPath($path) - { - $this->langPath = $path; - - $this->instance('path.lang', $path); - - return $this; - } - - /** - * Get the path to the public / web directory. - * - * @return string - */ - public function publicPath() - { - return $this->basePath.DIRECTORY_SEPARATOR.'public'; - } - - /** - * Get the path to the storage directory. - * - * @param string $path - * @return string - */ - public function storagePath($path = '') - { - return ($this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage') - .($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Set the storage directory. - * - * @param string $path - * @return $this - */ - public function useStoragePath($path) - { - $this->storagePath = $path; - - $this->instance('path.storage', $path); - - return $this; - } - - /** - * Get the path to the resources directory. - * - * @param string $path - * @return string - */ - public function resourcePath($path = '') - { - return $this->basePath.DIRECTORY_SEPARATOR.'resources'.($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Get the path to the views directory. - * - * This method returns the first configured path in the array of view paths. - * - * @param string $path - * @return string - */ - public function viewPath($path = '') - { - $basePath = $this['config']->get('view.paths')[0]; - - return rtrim($basePath, DIRECTORY_SEPARATOR).($path != '' ? DIRECTORY_SEPARATOR.$path : ''); - } - - /** - * Get the path to the environment file directory. - * - * @return string - */ - public function environmentPath() - { - return $this->environmentPath ?: $this->basePath; - } - - /** - * Set the directory for the environment file. - * - * @param string $path - * @return $this - */ - public function useEnvironmentPath($path) - { - $this->environmentPath = $path; - - return $this; - } - - /** - * Set the environment file to be loaded during bootstrapping. - * - * @param string $file - * @return $this - */ - public function loadEnvironmentFrom($file) - { - $this->environmentFile = $file; - - return $this; - } - - /** - * Get the environment file the application is using. - * - * @return string - */ - public function environmentFile() - { - return $this->environmentFile ?: '.env'; - } - - /** - * Get the fully qualified path to the environment file. - * - * @return string - */ - public function environmentFilePath() - { - return $this->environmentPath().DIRECTORY_SEPARATOR.$this->environmentFile(); - } - - /** - * Get or check the current application environment. - * - * @param string|array ...$environments - * @return string|bool - */ - public function environment(...$environments) - { - if (count($environments) > 0) { - $patterns = is_array($environments[0]) ? $environments[0] : $environments; - - return Str::is($patterns, $this['env']); - } - - return $this['env']; - } - - /** - * Determine if the application is in the local environment. - * - * @return bool - */ - public function isLocal() - { - return $this['env'] === 'local'; - } - - /** - * Determine if the application is in the production environment. - * - * @return bool - */ - public function isProduction() - { - return $this['env'] === 'production'; - } - - /** - * Detect the application's current environment. - * - * @param \Closure $callback - * @return string - */ - public function detectEnvironment(Closure $callback) - { - $args = $_SERVER['argv'] ?? null; - - return $this['env'] = (new EnvironmentDetector)->detect($callback, $args); - } - - /** - * Determine if the application is running in the console. - * - * @return bool - */ - public function runningInConsole() - { - if ($this->isRunningInConsole === null) { - $this->isRunningInConsole = Env::get('APP_RUNNING_IN_CONSOLE') ?? (\PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg'); - } - - return $this->isRunningInConsole; - } - - /** - * Determine if the application is running unit tests. - * - * @return bool - */ - public function runningUnitTests() - { - return $this->bound('env') && $this['env'] === 'testing'; - } - - /** - * Determine if the application is running with debug mode enabled. - * - * @return bool - */ - public function hasDebugModeEnabled() - { - return (bool) $this['config']->get('app.debug'); - } - - /** - * Register all of the configured providers. - * - * @return void - */ - public function registerConfiguredProviders() - { - $providers = Collection::make($this->make('config')->get('app.providers')) - ->partition(fn ($provider) => str_starts_with($provider, 'Illuminate\\')); - - $providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]); - - (new ProviderRepository($this, new Filesystem, $this->getCachedServicesPath())) - ->load($providers->collapse()->toArray()); - } - - /** - * Register a service provider with the application. - * - * @param \Illuminate\Support\ServiceProvider|string $provider - * @param bool $force - * @return \Illuminate\Support\ServiceProvider - */ - public function register($provider, $force = false) - { - if (($registered = $this->getProvider($provider)) && ! $force) { - return $registered; - } - - // If the given "provider" is a string, we will resolve it, passing in the - // application instance automatically for the developer. This is simply - // a more convenient way of specifying your service provider classes. - if (is_string($provider)) { - $provider = $this->resolveProvider($provider); - } - - $provider->register(); - - // If there are bindings / singletons set as properties on the provider we - // will spin through them and register them with the application, which - // serves as a convenience layer while registering a lot of bindings. - if (property_exists($provider, 'bindings')) { - foreach ($provider->bindings as $key => $value) { - $this->bind($key, $value); - } - } - - if (property_exists($provider, 'singletons')) { - foreach ($provider->singletons as $key => $value) { - $key = is_int($key) ? $value : $key; - - $this->singleton($key, $value); - } - } - - $this->markAsRegistered($provider); - - // If the application has already booted, we will call this boot method on - // the provider class so it has an opportunity to do its boot logic and - // will be ready for any usage by this developer's application logic. - if ($this->isBooted()) { - $this->bootProvider($provider); - } - - return $provider; - } - - /** - * Get the registered service provider instance if it exists. - * - * @param \Illuminate\Support\ServiceProvider|string $provider - * @return \Illuminate\Support\ServiceProvider|null - */ - public function getProvider($provider) - { - return array_values($this->getProviders($provider))[0] ?? null; - } - - /** - * Get the registered service provider instances if any exist. - * - * @param \Illuminate\Support\ServiceProvider|string $provider - * @return array - */ - public function getProviders($provider) - { - $name = is_string($provider) ? $provider : get_class($provider); - - return Arr::where($this->serviceProviders, fn ($value) => $value instanceof $name); - } - - /** - * Resolve a service provider instance from the class name. - * - * @param string $provider - * @return \Illuminate\Support\ServiceProvider - */ - public function resolveProvider($provider) - { - return new $provider($this); - } - - /** - * Mark the given provider as registered. - * - * @param \Illuminate\Support\ServiceProvider $provider - * @return void - */ - protected function markAsRegistered($provider) - { - $this->serviceProviders[] = $provider; - - $this->loadedProviders[get_class($provider)] = true; - } - - /** - * Load and boot all of the remaining deferred providers. - * - * @return void - */ - public function loadDeferredProviders() - { - // We will simply spin through each of the deferred providers and register each - // one and boot them if the application has booted. This should make each of - // the remaining services available to this application for immediate use. - foreach ($this->deferredServices as $service => $provider) { - $this->loadDeferredProvider($service); - } - - $this->deferredServices = []; - } - - /** - * Load the provider for a deferred service. - * - * @param string $service - * @return void - */ - public function loadDeferredProvider($service) - { - if (! $this->isDeferredService($service)) { - return; - } - - $provider = $this->deferredServices[$service]; - - // If the service provider has not already been loaded and registered we can - // register it with the application and remove the service from this list - // of deferred services, since it will already be loaded on subsequent. - if (! isset($this->loadedProviders[$provider])) { - $this->registerDeferredProvider($provider, $service); - } - } - - /** - * Register a deferred provider and service. - * - * @param string $provider - * @param string|null $service - * @return void - */ - public function registerDeferredProvider($provider, $service = null) - { - // Once the provider that provides the deferred service has been registered we - // will remove it from our local list of the deferred services with related - // providers so that this container does not try to resolve it out again. - if ($service) { - unset($this->deferredServices[$service]); - } - - $this->register($instance = new $provider($this)); - - if (! $this->isBooted()) { - $this->booting(function () use ($instance) { - $this->bootProvider($instance); - }); - } - } - - /** - * Resolve the given type from the container. - * - * @param string $abstract - * @param array $parameters - * @return mixed - */ - public function make($abstract, array $parameters = []) - { - $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); - - return parent::make($abstract, $parameters); - } - - /** - * Resolve the given type from the container. - * - * @param string $abstract - * @param array $parameters - * @param bool $raiseEvents - * @return mixed - */ - protected function resolve($abstract, $parameters = [], $raiseEvents = true) - { - $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); - - return parent::resolve($abstract, $parameters, $raiseEvents); - } - - /** - * Load the deferred provider if the given type is a deferred service and the instance has not been loaded. - * - * @param string $abstract - * @return void - */ - protected function loadDeferredProviderIfNeeded($abstract) - { - if ($this->isDeferredService($abstract) && ! isset($this->instances[$abstract])) { - $this->loadDeferredProvider($abstract); - } - } - - /** - * Determine if the given abstract type has been bound. - * - * @param string $abstract - * @return bool - */ - public function bound($abstract) - { - return $this->isDeferredService($abstract) || parent::bound($abstract); - } - - /** - * Determine if the application has booted. - * - * @return bool - */ - public function isBooted() - { - return $this->booted; - } - - /** - * Boot the application's service providers. - * - * @return void - */ - public function boot() - { - if ($this->isBooted()) { - return; - } - - // Once the application has booted we will also fire some "booted" callbacks - // for any listeners that need to do work after this initial booting gets - // finished. This is useful when ordering the boot-up processes we run. - $this->fireAppCallbacks($this->bootingCallbacks); - - array_walk($this->serviceProviders, function ($p) { - $this->bootProvider($p); - }); - - $this->booted = true; - - $this->fireAppCallbacks($this->bootedCallbacks); - } - - /** - * Boot the given service provider. - * - * @param \Illuminate\Support\ServiceProvider $provider - * @return void - */ - protected function bootProvider(ServiceProvider $provider) - { - $provider->callBootingCallbacks(); - - if (method_exists($provider, 'boot')) { - $this->call([$provider, 'boot']); - } - - $provider->callBootedCallbacks(); - } - - /** - * Register a new boot listener. - * - * @param callable $callback - * @return void - */ - public function booting($callback) - { - $this->bootingCallbacks[] = $callback; - } - - /** - * Register a new "booted" listener. - * - * @param callable $callback - * @return void - */ - public function booted($callback) - { - $this->bootedCallbacks[] = $callback; - - if ($this->isBooted()) { - $callback($this); - } - } - - /** - * Call the booting callbacks for the application. - * - * @param callable[] $callbacks - * @return void - */ - protected function fireAppCallbacks(array &$callbacks) - { - $index = 0; - - while ($index < count($callbacks)) { - $callbacks[$index]($this); - - $index++; - } - } - - /** - * {@inheritdoc} - * - * @return \Symfony\Component\HttpFoundation\Response - */ - public function handle(SymfonyRequest $request, int $type = self::MAIN_REQUEST, bool $catch = true): SymfonyResponse - { - return $this[HttpKernelContract::class]->handle(Request::createFromBase($request)); - } - - /** - * Determine if middleware has been disabled for the application. - * - * @return bool - */ - public function shouldSkipMiddleware() - { - return $this->bound('middleware.disable') && - $this->make('middleware.disable') === true; - } - - /** - * Get the path to the cached services.php file. - * - * @return string - */ - public function getCachedServicesPath() - { - return $this->normalizeCachePath('APP_SERVICES_CACHE', 'cache/services.php'); - } - - /** - * Get the path to the cached packages.php file. - * - * @return string - */ - public function getCachedPackagesPath() - { - return $this->normalizeCachePath('APP_PACKAGES_CACHE', 'cache/packages.php'); - } - - /** - * Determine if the application configuration is cached. - * - * @return bool - */ - public function configurationIsCached() - { - return is_file($this->getCachedConfigPath()); - } - - /** - * Get the path to the configuration cache file. - * - * @return string - */ - public function getCachedConfigPath() - { - return $this->normalizeCachePath('APP_CONFIG_CACHE', 'cache/config.php'); - } - - /** - * Determine if the application routes are cached. - * - * @return bool - */ - public function routesAreCached() - { - return $this['files']->exists($this->getCachedRoutesPath()); - } - - /** - * Get the path to the routes cache file. - * - * @return string - */ - public function getCachedRoutesPath() - { - return $this->normalizeCachePath('APP_ROUTES_CACHE', 'cache/routes-v7.php'); - } - - /** - * Determine if the application events are cached. - * - * @return bool - */ - public function eventsAreCached() - { - return $this['files']->exists($this->getCachedEventsPath()); - } - - /** - * Get the path to the events cache file. - * - * @return string - */ - public function getCachedEventsPath() - { - return $this->normalizeCachePath('APP_EVENTS_CACHE', 'cache/events.php'); - } - - /** - * Normalize a relative or absolute path to a cache file. - * - * @param string $key - * @param string $default - * @return string - */ - protected function normalizeCachePath($key, $default) - { - if (is_null($env = Env::get($key))) { - return $this->bootstrapPath($default); - } - - return Str::startsWith($env, $this->absoluteCachePathPrefixes) - ? $env - : $this->basePath($env); - } - - /** - * Add new prefix to list of absolute path prefixes. - * - * @param string $prefix - * @return $this - */ - public function addAbsoluteCachePathPrefix($prefix) - { - $this->absoluteCachePathPrefixes[] = $prefix; - - return $this; - } - - /** - * Get an instance of the maintenance mode manager implementation. - * - * @return \Illuminate\Contracts\Foundation\MaintenanceMode - */ - public function maintenanceMode() - { - return $this->make(MaintenanceModeContract::class); - } - - /** - * Determine if the application is currently down for maintenance. - * - * @return bool - */ - public function isDownForMaintenance() - { - return $this->maintenanceMode()->active(); - } - - /** - * Throw an HttpException with the given data. - * - * @param int $code - * @param string $message - * @param array $headers - * @return never - * - * @throws \Symfony\Component\HttpKernel\Exception\HttpException - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - public function abort($code, $message = '', array $headers = []) - { - if ($code == 404) { - throw new NotFoundHttpException($message); - } - - throw new HttpException($code, $message, null, $headers); - } - - /** - * Register a terminating callback with the application. - * - * @param callable|string $callback - * @return $this - */ - public function terminating($callback) - { - $this->terminatingCallbacks[] = $callback; - - return $this; - } - - /** - * Terminate the application. - * - * @return void - */ - public function terminate() - { - $index = 0; - - while ($index < count($this->terminatingCallbacks)) { - $this->call($this->terminatingCallbacks[$index]); - - $index++; - } - } - - /** - * Get the service providers that have been loaded. - * - * @return array - */ - public function getLoadedProviders() - { - return $this->loadedProviders; - } - - /** - * Determine if the given service provider is loaded. - * - * @param string $provider - * @return bool - */ - public function providerIsLoaded(string $provider) - { - return isset($this->loadedProviders[$provider]); - } - - /** - * Get the application's deferred services. - * - * @return array - */ - public function getDeferredServices() - { - return $this->deferredServices; - } - - /** - * Set the application's deferred services. - * - * @param array $services - * @return void - */ - public function setDeferredServices(array $services) - { - $this->deferredServices = $services; - } - - /** - * Add an array of services to the application's deferred services. - * - * @param array $services - * @return void - */ - public function addDeferredServices(array $services) - { - $this->deferredServices = array_merge($this->deferredServices, $services); - } - - /** - * Determine if the given service is a deferred service. - * - * @param string $service - * @return bool - */ - public function isDeferredService($service) - { - return isset($this->deferredServices[$service]); - } - - /** - * Configure the real-time facade namespace. - * - * @param string $namespace - * @return void - */ - public function provideFacades($namespace) - { - AliasLoader::setFacadeNamespace($namespace); - } - - /** - * Get the current application locale. - * - * @return string - */ - public function getLocale() - { - return $this['config']->get('app.locale'); - } - - /** - * Get the current application locale. - * - * @return string - */ - public function currentLocale() - { - return $this->getLocale(); - } - - /** - * Get the current application fallback locale. - * - * @return string - */ - public function getFallbackLocale() - { - return $this['config']->get('app.fallback_locale'); - } - - /** - * Set the current application locale. - * - * @param string $locale - * @return void - */ - public function setLocale($locale) - { - $this['config']->set('app.locale', $locale); - - $this['translator']->setLocale($locale); - - $this['events']->dispatch(new LocaleUpdated($locale)); - } - - /** - * Set the current application fallback locale. - * - * @param string $fallbackLocale - * @return void - */ - public function setFallbackLocale($fallbackLocale) - { - $this['config']->set('app.fallback_locale', $fallbackLocale); - - $this['translator']->setFallback($fallbackLocale); - } - - /** - * Determine if the application locale is the given locale. - * - * @param string $locale - * @return bool - */ - public function isLocale($locale) - { - return $this->getLocale() == $locale; - } - - /** - * Register the core class aliases in the container. - * - * @return void - */ - public function registerCoreContainerAliases() - { - foreach ([ - 'app' => [self::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class], - 'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class], - 'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class], - 'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class], - 'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class], - 'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class, \Psr\SimpleCache\CacheInterface::class], - 'cache.psr6' => [\Symfony\Component\Cache\Adapter\Psr16Adapter::class, \Symfony\Component\Cache\Adapter\AdapterInterface::class, \Psr\Cache\CacheItemPoolInterface::class], - 'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class], - 'cookie' => [\Illuminate\Cookie\CookieJar::class, \Illuminate\Contracts\Cookie\Factory::class, \Illuminate\Contracts\Cookie\QueueingFactory::class], - 'db' => [\Illuminate\Database\DatabaseManager::class, \Illuminate\Database\ConnectionResolverInterface::class], - 'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class], - 'db.schema' => [\Illuminate\Database\Schema\Builder::class], - 'encrypter' => [\Illuminate\Encryption\Encrypter::class, \Illuminate\Contracts\Encryption\Encrypter::class, \Illuminate\Contracts\Encryption\StringEncrypter::class], - 'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class], - 'files' => [\Illuminate\Filesystem\Filesystem::class], - 'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class], - 'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class], - 'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class], - 'hash' => [\Illuminate\Hashing\HashManager::class], - 'hash.driver' => [\Illuminate\Contracts\Hashing\Hasher::class], - 'translator' => [\Illuminate\Translation\Translator::class, \Illuminate\Contracts\Translation\Translator::class], - 'log' => [\Illuminate\Log\LogManager::class, \Psr\Log\LoggerInterface::class], - 'mail.manager' => [\Illuminate\Mail\MailManager::class, \Illuminate\Contracts\Mail\Factory::class], - 'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class], - 'auth.password' => [\Illuminate\Auth\Passwords\PasswordBrokerManager::class, \Illuminate\Contracts\Auth\PasswordBrokerFactory::class], - 'auth.password.broker' => [\Illuminate\Auth\Passwords\PasswordBroker::class, \Illuminate\Contracts\Auth\PasswordBroker::class], - 'queue' => [\Illuminate\Queue\QueueManager::class, \Illuminate\Contracts\Queue\Factory::class, \Illuminate\Contracts\Queue\Monitor::class], - 'queue.connection' => [\Illuminate\Contracts\Queue\Queue::class], - 'queue.failer' => [\Illuminate\Queue\Failed\FailedJobProviderInterface::class], - 'redirect' => [\Illuminate\Routing\Redirector::class], - 'redis' => [\Illuminate\Redis\RedisManager::class, \Illuminate\Contracts\Redis\Factory::class], - 'redis.connection' => [\Illuminate\Redis\Connections\Connection::class, \Illuminate\Contracts\Redis\Connection::class], - 'request' => [\Illuminate\Http\Request::class, \Symfony\Component\HttpFoundation\Request::class], - 'router' => [\Illuminate\Routing\Router::class, \Illuminate\Contracts\Routing\Registrar::class, \Illuminate\Contracts\Routing\BindingRegistrar::class], - 'session' => [\Illuminate\Session\SessionManager::class], - 'session.store' => [\Illuminate\Session\Store::class, \Illuminate\Contracts\Session\Session::class], - 'url' => [\Illuminate\Routing\UrlGenerator::class, \Illuminate\Contracts\Routing\UrlGenerator::class], - 'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class], - 'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class], - ] as $key => $aliases) { - foreach ($aliases as $alias) { - $this->alias($key, $alias); - } - } - } - - /** - * Flush the container of all bindings and resolved instances. - * - * @return void - */ - public function flush() - { - parent::flush(); - - $this->buildStack = []; - $this->loadedProviders = []; - $this->bootedCallbacks = []; - $this->bootingCallbacks = []; - $this->deferredServices = []; - $this->reboundCallbacks = []; - $this->serviceProviders = []; - $this->resolvingCallbacks = []; - $this->terminatingCallbacks = []; - $this->beforeResolvingCallbacks = []; - $this->afterResolvingCallbacks = []; - $this->globalBeforeResolvingCallbacks = []; - $this->globalResolvingCallbacks = []; - $this->globalAfterResolvingCallbacks = []; - } - - /** - * Get the application namespace. - * - * @return string - * - * @throws \RuntimeException - */ - public function getNamespace() - { - if (! is_null($this->namespace)) { - return $this->namespace; - } - - $composer = json_decode(file_get_contents($this->basePath('composer.json')), true); - - foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) { - foreach ((array) $path as $pathChoice) { - if (realpath($this->path()) === realpath($this->basePath($pathChoice))) { - return $this->namespace = $namespace; - } - } - } - - throw new RuntimeException('Unable to detect application namespace.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Auth/Access/Authorizable.php b/framework-9.50.2/src/Illuminate/Foundation/Auth/Access/Authorizable.php deleted file mode 100644 index d8cf50d..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Auth/Access/Authorizable.php +++ /dev/null @@ -1,56 +0,0 @@ -forUser($this)->check($abilities, $arguments); - } - - /** - * Determine if the entity has any of the given abilities. - * - * @param iterable|string $abilities - * @param array|mixed $arguments - * @return bool - */ - public function canAny($abilities, $arguments = []) - { - return app(Gate::class)->forUser($this)->any($abilities, $arguments); - } - - /** - * Determine if the entity does not have the given abilities. - * - * @param iterable|string $abilities - * @param array|mixed $arguments - * @return bool - */ - public function cant($abilities, $arguments = []) - { - return ! $this->can($abilities, $arguments); - } - - /** - * Determine if the entity does not have the given abilities. - * - * @param iterable|string $abilities - * @param array|mixed $arguments - * @return bool - */ - public function cannot($abilities, $arguments = []) - { - return $this->cant($abilities, $arguments); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php b/framework-9.50.2/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php deleted file mode 100644 index 19dc164..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php +++ /dev/null @@ -1,131 +0,0 @@ -parseAbilityAndArguments($ability, $arguments); - - return app(Gate::class)->authorize($ability, $arguments); - } - - /** - * Authorize a given action for a user. - * - * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user - * @param mixed $ability - * @param mixed|array $arguments - * @return \Illuminate\Auth\Access\Response - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - public function authorizeForUser($user, $ability, $arguments = []) - { - [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); - - return app(Gate::class)->forUser($user)->authorize($ability, $arguments); - } - - /** - * Guesses the ability's name if it wasn't provided. - * - * @param mixed $ability - * @param mixed|array $arguments - * @return array - */ - protected function parseAbilityAndArguments($ability, $arguments) - { - if (is_string($ability) && ! str_contains($ability, '\\')) { - return [$ability, $arguments]; - } - - $method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function']; - - return [$this->normalizeGuessedAbilityName($method), $ability]; - } - - /** - * Normalize the ability name that has been guessed from the method name. - * - * @param string $ability - * @return string - */ - protected function normalizeGuessedAbilityName($ability) - { - $map = $this->resourceAbilityMap(); - - return $map[$ability] ?? $ability; - } - - /** - * Authorize a resource action based on the incoming request. - * - * @param string|array $model - * @param string|array|null $parameter - * @param array $options - * @param \Illuminate\Http\Request|null $request - * @return void - */ - public function authorizeResource($model, $parameter = null, array $options = [], $request = null) - { - $model = is_array($model) ? implode(',', $model) : $model; - - $parameter = is_array($parameter) ? implode(',', $parameter) : $parameter; - - $parameter = $parameter ?: Str::snake(class_basename($model)); - - $middleware = []; - - foreach ($this->resourceAbilityMap() as $method => $ability) { - $modelName = in_array($method, $this->resourceMethodsWithoutModels()) ? $model : $parameter; - - $middleware["can:{$ability},{$modelName}"][] = $method; - } - - foreach ($middleware as $middlewareName => $methods) { - $this->middleware($middlewareName, $options)->only($methods); - } - } - - /** - * Get the map of resource methods to ability names. - * - * @return array - */ - protected function resourceAbilityMap() - { - return [ - 'index' => 'viewAny', - 'show' => 'view', - 'create' => 'create', - 'store' => 'create', - 'edit' => 'update', - 'update' => 'update', - 'destroy' => 'delete', - ]; - } - - /** - * Get the list of resource methods which do not have model parameters. - * - * @return array - */ - protected function resourceMethodsWithoutModels() - { - return ['index', 'create', 'store']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Auth/EmailVerificationRequest.php b/framework-9.50.2/src/Illuminate/Foundation/Auth/EmailVerificationRequest.php deleted file mode 100644 index 9cbe9b5..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Auth/EmailVerificationRequest.php +++ /dev/null @@ -1,64 +0,0 @@ -user()->getKey(), (string) $this->route('id'))) { - return false; - } - - if (! hash_equals(sha1($this->user()->getEmailForVerification()), (string) $this->route('hash'))) { - return false; - } - - return true; - } - - /** - * Get the validation rules that apply to the request. - * - * @return array - */ - public function rules() - { - return [ - // - ]; - } - - /** - * Fulfill the email verification request. - * - * @return void - */ - public function fulfill() - { - if (! $this->user()->hasVerifiedEmail()) { - $this->user()->markEmailAsVerified(); - - event(new Verified($this->user())); - } - } - - /** - * Configure the validator instance. - * - * @param \Illuminate\Validation\Validator $validator - * @return void - */ - public function withValidator($validator) - { - return $validator; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Auth/User.php b/framework-9.50.2/src/Illuminate/Foundation/Auth/User.php deleted file mode 100644 index be1dff5..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Auth/User.php +++ /dev/null @@ -1,20 +0,0 @@ -boot(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php b/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php deleted file mode 100644 index a67649b..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php +++ /dev/null @@ -1,311 +0,0 @@ -forwardsTo('handleError')); - - set_exception_handler($this->forwardsTo('handleException')); - - register_shutdown_function($this->forwardsTo('handleShutdown')); - - if (! $app->environment('testing')) { - ini_set('display_errors', 'Off'); - } - } - - /** - * Report PHP deprecations, or convert PHP errors to ErrorException instances. - * - * @param int $level - * @param string $message - * @param string $file - * @param int $line - * @param array $context - * @return void - * - * @throws \ErrorException - */ - public function handleError($level, $message, $file = '', $line = 0, $context = []) - { - if ($this->isDeprecation($level)) { - $this->handleDeprecationError($message, $file, $line, $level); - } elseif (error_reporting() & $level) { - throw new ErrorException($message, 0, $level, $file, $line); - } - } - - /** - * Reports a deprecation to the "deprecations" logger. - * - * @param string $message - * @param string $file - * @param int $line - * @return void - * - * @deprecated Use handleDeprecationError instead. - */ - public function handleDeprecation($message, $file, $line) - { - $this->handleDeprecationError($message, $file, $line); - } - - /** - * Reports a deprecation to the "deprecations" logger. - * - * @param string $message - * @param string $file - * @param int $line - * @param int $level - * @return void - */ - public function handleDeprecationError($message, $file, $line, $level = E_DEPRECATED) - { - if ($this->shouldIgnoreDeprecationErrors()) { - return; - } - - try { - $logger = static::$app->make(LogManager::class); - } catch (Exception $e) { - return; - } - - $this->ensureDeprecationLoggerIsConfigured(); - - $options = static::$app['config']->get('logging.deprecations') ?? []; - - with($logger->channel('deprecations'), function ($log) use ($message, $file, $line, $level, $options) { - if ($options['trace'] ?? false) { - $log->warning((string) new ErrorException($message, 0, $level, $file, $line)); - } else { - $log->warning(sprintf('%s in %s on line %s', - $message, $file, $line - )); - } - }); - } - - /** - * Determine if deprecation errors should be ignored. - * - * @return bool - */ - protected function shouldIgnoreDeprecationErrors() - { - return ! class_exists(LogManager::class) - || ! static::$app->hasBeenBootstrapped() - || static::$app->runningUnitTests(); - } - - /** - * Ensure the "deprecations" logger is configured. - * - * @return void - */ - protected function ensureDeprecationLoggerIsConfigured() - { - with(static::$app['config'], function ($config) { - if ($config->get('logging.channels.deprecations')) { - return; - } - - $this->ensureNullLogDriverIsConfigured(); - - if (is_array($options = $config->get('logging.deprecations'))) { - $driver = $options['channel'] ?? 'null'; - } else { - $driver = $options ?? 'null'; - } - - $config->set('logging.channels.deprecations', $config->get("logging.channels.{$driver}")); - }); - } - - /** - * Ensure the "null" log driver is configured. - * - * @return void - */ - protected function ensureNullLogDriverIsConfigured() - { - with(static::$app['config'], function ($config) { - if ($config->get('logging.channels.null')) { - return; - } - - $config->set('logging.channels.null', [ - 'driver' => 'monolog', - 'handler' => NullHandler::class, - ]); - }); - } - - /** - * Handle an uncaught exception from the application. - * - * Note: Most exceptions can be handled via the try / catch block in - * the HTTP and Console kernels. But, fatal error exceptions must - * be handled differently since they are not normal exceptions. - * - * @param \Throwable $e - * @return void - */ - public function handleException(Throwable $e) - { - self::$reservedMemory = null; - - try { - $this->getExceptionHandler()->report($e); - } catch (Exception $e) { - // - } - - if (static::$app->runningInConsole()) { - $this->renderForConsole($e); - } else { - $this->renderHttpResponse($e); - } - } - - /** - * Render an exception to the console. - * - * @param \Throwable $e - * @return void - */ - protected function renderForConsole(Throwable $e) - { - $this->getExceptionHandler()->renderForConsole(new ConsoleOutput, $e); - } - - /** - * Render an exception as an HTTP response and send it. - * - * @param \Throwable $e - * @return void - */ - protected function renderHttpResponse(Throwable $e) - { - $this->getExceptionHandler()->render(static::$app['request'], $e)->send(); - } - - /** - * Handle the PHP shutdown event. - * - * @return void - */ - public function handleShutdown() - { - self::$reservedMemory = null; - - if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) { - $this->handleException($this->fatalErrorFromPhpError($error, 0)); - } - } - - /** - * Create a new fatal error instance from an error array. - * - * @param array $error - * @param int|null $traceOffset - * @return \Symfony\Component\ErrorHandler\Error\FatalError - */ - protected function fatalErrorFromPhpError(array $error, $traceOffset = null) - { - return new FatalError($error['message'], 0, $error, $traceOffset); - } - - /** - * Forward a method call to the given method if an application instance exists. - * - * @return callable - */ - protected function forwardsTo($method) - { - return fn (...$arguments) => static::$app - ? $this->{$method}(...$arguments) - : false; - } - - /** - * Determine if the error level is a deprecation. - * - * @param int $level - * @return bool - */ - protected function isDeprecation($level) - { - return in_array($level, [E_DEPRECATED, E_USER_DEPRECATED]); - } - - /** - * Determine if the error type is fatal. - * - * @param int $type - * @return bool - */ - protected function isFatal($type) - { - return in_array($type, [E_COMPILE_ERROR, E_CORE_ERROR, E_ERROR, E_PARSE]); - } - - /** - * Get an instance of the exception handler. - * - * @return \Illuminate\Contracts\Debug\ExceptionHandler - */ - protected function getExceptionHandler() - { - return static::$app->make(ExceptionHandler::class); - } - - /** - * Clear the local application instance from memory. - * - * @return void - */ - public static function forgetApp() - { - static::$app = null; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php deleted file mode 100644 index ae3f738..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php +++ /dev/null @@ -1,114 +0,0 @@ -getCachedConfigPath())) { - $items = require $cached; - - $loadedFromCache = true; - } - - // Next we will spin through all of the configuration files in the configuration - // directory and load each one into the repository. This will make all of the - // options available to the developer for use in various parts of this app. - $app->instance('config', $config = new Repository($items)); - - if (! isset($loadedFromCache)) { - $this->loadConfigurationFiles($app, $config); - } - - // Finally, we will set the application's environment based on the configuration - // values that were loaded. We will pass a callback which will be used to get - // the environment in a web context where an "--env" switch is not present. - $app->detectEnvironment(fn () => $config->get('app.env', 'production')); - - date_default_timezone_set($config->get('app.timezone', 'UTC')); - - mb_internal_encoding('UTF-8'); - } - - /** - * Load the configuration items from all of the files. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param \Illuminate\Contracts\Config\Repository $repository - * @return void - * - * @throws \Exception - */ - protected function loadConfigurationFiles(Application $app, RepositoryContract $repository) - { - $files = $this->getConfigurationFiles($app); - - if (! isset($files['app'])) { - throw new Exception('Unable to load the "app" configuration file.'); - } - - foreach ($files as $key => $path) { - $repository->set($key, require $path); - } - } - - /** - * Get all of the configuration files for the application. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return array - */ - protected function getConfigurationFiles(Application $app) - { - $files = []; - - $configPath = realpath($app->configPath()); - - foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) { - $directory = $this->getNestedDirectory($file, $configPath); - - $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath(); - } - - ksort($files, SORT_NATURAL); - - return $files; - } - - /** - * Get the configuration file nesting path. - * - * @param \SplFileInfo $file - * @param string $configPath - * @return string - */ - protected function getNestedDirectory(SplFileInfo $file, $configPath) - { - $directory = $file->getPath(); - - if ($nested = trim(str_replace($configPath, '', $directory), DIRECTORY_SEPARATOR)) { - $nested = str_replace(DIRECTORY_SEPARATOR, '.', $nested).'.'; - } - - return $nested; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php deleted file mode 100644 index 3f0be6c..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php +++ /dev/null @@ -1,110 +0,0 @@ -configurationIsCached()) { - return; - } - - $this->checkForSpecificEnvironmentFile($app); - - try { - $this->createDotenv($app)->safeLoad(); - } catch (InvalidFileException $e) { - $this->writeErrorAndDie($e); - } - } - - /** - * Detect if a custom environment file matching the APP_ENV exists. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return void - */ - protected function checkForSpecificEnvironmentFile($app) - { - if ($app->runningInConsole() && - ($input = new ArgvInput)->hasParameterOption('--env') && - $this->setEnvironmentFilePath($app, $app->environmentFile().'.'.$input->getParameterOption('--env'))) { - return; - } - - $environment = Env::get('APP_ENV'); - - if (! $environment) { - return; - } - - $this->setEnvironmentFilePath( - $app, $app->environmentFile().'.'.$environment - ); - } - - /** - * Load a custom environment file. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @param string $file - * @return bool - */ - protected function setEnvironmentFilePath($app, $file) - { - if (is_file($app->environmentPath().'/'.$file)) { - $app->loadEnvironmentFrom($file); - - return true; - } - - return false; - } - - /** - * Create a Dotenv instance. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return \Dotenv\Dotenv - */ - protected function createDotenv($app) - { - return Dotenv::create( - Env::getRepository(), - $app->environmentPath(), - $app->environmentFile() - ); - } - - /** - * Write the error information to the screen and exit. - * - * @param \Dotenv\Exception\InvalidFileException $e - * @return void - */ - protected function writeErrorAndDie(InvalidFileException $e) - { - $output = (new ConsoleOutput)->getErrorOutput(); - - $output->writeln('The environment file is invalid!'); - $output->writeln($e->getMessage()); - - http_response_code(500); - - exit(1); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php b/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php deleted file mode 100644 index 2a4c6b4..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php +++ /dev/null @@ -1,29 +0,0 @@ -make('config')->get('app.aliases', []), - $app->make(PackageManifest::class)->aliases() - ))->register(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php b/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php deleted file mode 100644 index f18375c..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php +++ /dev/null @@ -1,19 +0,0 @@ -registerConfiguredProviders(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php b/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php deleted file mode 100644 index 613fa85..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php +++ /dev/null @@ -1,35 +0,0 @@ -make('config')->get('app.url', 'http://localhost'); - - $components = parse_url($uri); - - $server = $_SERVER; - - if (isset($components['path'])) { - $server = array_merge($server, [ - 'SCRIPT_FILENAME' => $components['path'], - 'SCRIPT_NAME' => $components['path'], - ]); - } - - $app->instance('request', Request::create( - $uri, 'GET', [], [], [], $server - )); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bus/Dispatchable.php b/framework-9.50.2/src/Illuminate/Foundation/Bus/Dispatchable.php deleted file mode 100644 index 83f19ee..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bus/Dispatchable.php +++ /dev/null @@ -1,112 +0,0 @@ -dispatchSync(new static(...$arguments)); - } - - /** - * Dispatch a command to its appropriate handler in the current process. - * - * @return mixed - * - * @deprecated Will be removed in a future Laravel version. - */ - public static function dispatchNow(...$arguments) - { - return app(Dispatcher::class)->dispatchNow(new static(...$arguments)); - } - - /** - * Dispatch a command to its appropriate handler after the current process. - * - * @param mixed ...$arguments - * @return mixed - */ - public static function dispatchAfterResponse(...$arguments) - { - return app(Dispatcher::class)->dispatchAfterResponse(new static(...$arguments)); - } - - /** - * Set the jobs that should run if this job is successful. - * - * @param array $chain - * @return \Illuminate\Foundation\Bus\PendingChain - */ - public static function withChain($chain) - { - return new PendingChain(static::class, $chain); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bus/DispatchesJobs.php b/framework-9.50.2/src/Illuminate/Foundation/Bus/DispatchesJobs.php deleted file mode 100644 index d521158..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bus/DispatchesJobs.php +++ /dev/null @@ -1,45 +0,0 @@ -dispatch($job); - } - - /** - * Dispatch a job to its appropriate handler in the current process. - * - * @param mixed $job - * @return mixed - * - * @deprecated Will be removed in a future Laravel version. - */ - public function dispatchNow($job) - { - return app(Dispatcher::class)->dispatchNow($job); - } - - /** - * Dispatch a job to its appropriate handler in the current process. - * - * Queueable jobs will be dispatched to the "sync" queue. - * - * @param mixed $job - * @return mixed - */ - public function dispatchSync($job) - { - return app(Dispatcher::class)->dispatchSync($job); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingChain.php b/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingChain.php deleted file mode 100644 index b56b773..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingChain.php +++ /dev/null @@ -1,165 +0,0 @@ -job = $job; - $this->chain = $chain; - } - - /** - * Set the desired connection for the job. - * - * @param string|null $connection - * @return $this - */ - public function onConnection($connection) - { - $this->connection = $connection; - - return $this; - } - - /** - * Set the desired queue for the job. - * - * @param string|null $queue - * @return $this - */ - public function onQueue($queue) - { - $this->queue = $queue; - - return $this; - } - - /** - * Set the desired delay in seconds for the chain. - * - * @param \DateTimeInterface|\DateInterval|int|null $delay - * @return $this - */ - public function delay($delay) - { - $this->delay = $delay; - - return $this; - } - - /** - * Add a callback to be executed on job failure. - * - * @param callable $callback - * @return $this - */ - public function catch($callback) - { - $this->catchCallbacks[] = $callback instanceof Closure - ? new SerializableClosure($callback) - : $callback; - - return $this; - } - - /** - * Get the "catch" callbacks that have been registered. - * - * @return array - */ - public function catchCallbacks() - { - return $this->catchCallbacks ?? []; - } - - /** - * Dispatch the job with the given arguments. - * - * @return \Illuminate\Foundation\Bus\PendingDispatch - */ - public function dispatch() - { - if (is_string($this->job)) { - $firstJob = new $this->job(...func_get_args()); - } elseif ($this->job instanceof Closure) { - $firstJob = CallQueuedClosure::create($this->job); - } else { - $firstJob = $this->job; - } - - if ($this->connection) { - $firstJob->chainConnection = $this->connection; - $firstJob->connection = $firstJob->connection ?: $this->connection; - } - - if ($this->queue) { - $firstJob->chainQueue = $this->queue; - $firstJob->queue = $firstJob->queue ?: $this->queue; - } - - if ($this->delay) { - $firstJob->delay = ! is_null($firstJob->delay) ? $firstJob->delay : $this->delay; - } - - $firstJob->chain($this->chain); - $firstJob->chainCatchCallbacks = $this->catchCallbacks(); - - return app(Dispatcher::class)->dispatch($firstJob); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingClosureDispatch.php b/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingClosureDispatch.php deleted file mode 100644 index 84cc14a..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingClosureDispatch.php +++ /dev/null @@ -1,21 +0,0 @@ -job->onFailure($callback); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingDispatch.php b/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingDispatch.php deleted file mode 100644 index 1e514e5..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Bus/PendingDispatch.php +++ /dev/null @@ -1,196 +0,0 @@ -job = $job; - } - - /** - * Set the desired connection for the job. - * - * @param string|null $connection - * @return $this - */ - public function onConnection($connection) - { - $this->job->onConnection($connection); - - return $this; - } - - /** - * Set the desired queue for the job. - * - * @param string|null $queue - * @return $this - */ - public function onQueue($queue) - { - $this->job->onQueue($queue); - - return $this; - } - - /** - * Set the desired connection for the chain. - * - * @param string|null $connection - * @return $this - */ - public function allOnConnection($connection) - { - $this->job->allOnConnection($connection); - - return $this; - } - - /** - * Set the desired queue for the chain. - * - * @param string|null $queue - * @return $this - */ - public function allOnQueue($queue) - { - $this->job->allOnQueue($queue); - - return $this; - } - - /** - * Set the desired delay in seconds for the job. - * - * @param \DateTimeInterface|\DateInterval|int|null $delay - * @return $this - */ - public function delay($delay) - { - $this->job->delay($delay); - - return $this; - } - - /** - * Indicate that the job should be dispatched after all database transactions have committed. - * - * @return $this - */ - public function afterCommit() - { - $this->job->afterCommit(); - - return $this; - } - - /** - * Indicate that the job should not wait until database transactions have been committed before dispatching. - * - * @return $this - */ - public function beforeCommit() - { - $this->job->beforeCommit(); - - return $this; - } - - /** - * Set the jobs that should run if this job is successful. - * - * @param array $chain - * @return $this - */ - public function chain($chain) - { - $this->job->chain($chain); - - return $this; - } - - /** - * Indicate that the job should be dispatched after the response is sent to the browser. - * - * @return $this - */ - public function afterResponse() - { - $this->afterResponse = true; - - return $this; - } - - /** - * Determine if the job should be dispatched. - * - * @return bool - */ - protected function shouldDispatch() - { - if (! $this->job instanceof ShouldBeUnique) { - return true; - } - - return (new UniqueLock(Container::getInstance()->make(Cache::class))) - ->acquire($this->job); - } - - /** - * Dynamically proxy methods to the underlying job. - * - * @param string $method - * @param array $parameters - * @return $this - */ - public function __call($method, $parameters) - { - $this->job->{$method}(...$parameters); - - return $this; - } - - /** - * Handle the object's destruction. - * - * @return void - */ - public function __destruct() - { - if (! $this->shouldDispatch()) { - return; - } elseif ($this->afterResponse) { - app(Dispatcher::class)->dispatchAfterResponse($this->job); - } else { - app(Dispatcher::class)->dispatch($this->job); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/CacheBasedMaintenanceMode.php b/framework-9.50.2/src/Illuminate/Foundation/CacheBasedMaintenanceMode.php deleted file mode 100644 index 01ff30d..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/CacheBasedMaintenanceMode.php +++ /dev/null @@ -1,97 +0,0 @@ -cache = $cache; - $this->store = $store; - $this->key = $key; - } - - /** - * Take the application down for maintenance. - * - * @param array $payload - * @return void - */ - public function activate(array $payload): void - { - $this->getStore()->put($this->key, $payload); - } - - /** - * Take the application out of maintenance. - * - * @return void - */ - public function deactivate(): void - { - $this->getStore()->forget($this->key); - } - - /** - * Determine if the application is currently down for maintenance. - * - * @return bool - */ - public function active(): bool - { - return $this->getStore()->has($this->key); - } - - /** - * Get the data array which was provided when the application was placed into maintenance. - * - * @return array - */ - public function data(): array - { - return $this->getStore()->get($this->key); - } - - /** - * Get the cache store to use. - * - * @return \Illuminate\Contracts\Cache\Repository - */ - protected function getStore(): Repository - { - return $this->cache->store($this->store); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/ComposerScripts.php b/framework-9.50.2/src/Illuminate/Foundation/ComposerScripts.php deleted file mode 100644 index 8cf5684..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/ComposerScripts.php +++ /dev/null @@ -1,69 +0,0 @@ -getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; - - static::clearCompiled(); - } - - /** - * Handle the post-update Composer event. - * - * @param \Composer\Script\Event $event - * @return void - */ - public static function postUpdate(Event $event) - { - require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; - - static::clearCompiled(); - } - - /** - * Handle the post-autoload-dump Composer event. - * - * @param \Composer\Script\Event $event - * @return void - */ - public static function postAutoloadDump(Event $event) - { - require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; - - static::clearCompiled(); - } - - /** - * Clear the cached Laravel bootstrapping files. - * - * @return void - */ - protected static function clearCompiled() - { - $laravel = new Application(getcwd()); - - if (is_file($configPath = $laravel->getCachedConfigPath())) { - @unlink($configPath); - } - - if (is_file($servicesPath = $laravel->getCachedServicesPath())) { - @unlink($servicesPath); - } - - if (is_file($packagesPath = $laravel->getCachedPackagesPath())) { - @unlink($packagesPath); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php b/framework-9.50.2/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php deleted file mode 100644 index 7e0dfff..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php +++ /dev/null @@ -1,197 +0,0 @@ - - */ - protected $editorHrefs = [ - 'atom' => 'atom://core/open/file?filename={file}&line={line}', - 'emacs' => 'emacs://open?url=file://{file}&line={line}', - 'idea' => 'idea://open?file={file}&line={line}', - 'macvim' => 'mvim://open/?url=file://{file}&line={line}', - 'netbeans' => 'netbeans://open/?f={file}:{line}', - 'nova' => 'nova://core/open/file?filename={file}&line={line}', - 'phpstorm' => 'phpstorm://open?file={file}&line={line}', - 'sublime' => 'subl://open?url=file://{file}&line={line}', - 'textmate' => 'txmt://open?url=file://{file}&line={line}', - 'vscode' => 'vscode://file/{file}:{line}', - 'vscode-insiders' => 'vscode-insiders://file/{file}:{line}', - 'vscode-insiders-remote' => 'vscode-insiders://vscode-remote/{file}:{line}', - 'vscode-remote' => 'vscode://vscode-remote/{file}:{line}', - 'vscodium' => 'vscodium://file/{file}:{line}', - 'xdebug' => 'xdebug://{file}@{line}', - ]; - - /** - * Files that require special trace handling and their levels. - * - * @var array - */ - protected static $adjustableTraces = [ - 'symfony/var-dumper/Resources/functions/dump.php' => 1, - 'Illuminate/Collections/Traits/EnumeratesValues.php' => 4, - ]; - - /** - * The source resolver. - * - * @var (callable(): (array{0: string, 1: string, 2: int|null}|null))|null|false - */ - protected static $dumpSourceResolver; - - /** - * Resolve the source of the dump call. - * - * @return array{0: string, 1: string, 2: int|null}|null - */ - public function resolveDumpSource() - { - if (static::$dumpSourceResolver === false) { - return null; - } - - if (static::$dumpSourceResolver) { - return call_user_func(static::$dumpSourceResolver); - } - - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 20); - - $sourceKey = null; - - foreach ($trace as $traceKey => $traceFile) { - if (! isset($traceFile['file'])) { - continue; - } - - foreach (self::$adjustableTraces as $name => $key) { - if (str_ends_with( - $traceFile['file'], - str_replace('/', DIRECTORY_SEPARATOR, $name) - )) { - $sourceKey = $traceKey + $key; - break; - } - } - - if (! is_null($sourceKey)) { - break; - } - } - - if (is_null($sourceKey)) { - return; - } - - $file = $trace[$sourceKey]['file'] ?? null; - $line = $trace[$sourceKey]['line'] ?? null; - - if (is_null($file) || is_null($line)) { - return; - } - - $relativeFile = $file; - - if ($this->isCompiledViewFile($file)) { - $file = $this->getOriginalFileForCompiledView($file); - $line = null; - } - - if (str_starts_with($file, $this->basePath)) { - $relativeFile = substr($file, strlen($this->basePath) + 1); - } - - return [$file, $relativeFile, $line]; - } - - /** - * Determine if the given file is a view compiled. - * - * @param string $file - * @return bool - */ - protected function isCompiledViewFile($file) - { - return str_starts_with($file, $this->compiledViewPath); - } - - /** - * Get the original view compiled file by the given compiled file. - * - * @param string $file - * @return string - */ - protected function getOriginalFileForCompiledView($file) - { - preg_match('/\/\*\*PATH\s(.*)\sENDPATH/', file_get_contents($file), $matches); - - if (isset($matches[1])) { - $file = $matches[1]; - } - - return $file; - } - - /** - * Resolve the source href, if possible. - * - * @param string $file - * @param int|null $line - * @return string|null - */ - protected function resolveSourceHref($file, $line) - { - try { - $editor = config('app.editor'); - } catch (Throwable $e) { - // .. - } - - if (! isset($editor)) { - return; - } - - $href = is_array($editor) && isset($editor['href']) - ? $editor['href'] - : ($this->editorHrefs[$editor['name'] ?? $editor] ?? sprintf('%s://open?file={file}&line={line}', $editor['name'] ?? $editor)); - - if ($basePath = $editor['base_path'] ?? false) { - $file = str_replace($this->basePath, $basePath, $file); - } - - $href = str_replace( - ['{file}', '{line}'], - [$file, is_null($line) ? 1 : $line], - $href, - ); - - return $href; - } - - /** - * Set the resolver that resolves the source of the dump call. - * - * @param (callable(): (array{0: string, 1: string, 2: int|null}|null))|null $callable - * @return void - */ - public static function resolveDumpSourceUsing($callable) - { - static::$dumpSourceResolver = $callable; - } - - /** - * Don't include the location / file of the dump in dumps. - * - * @return void - */ - public static function dontIncludeSource() - { - static::$dumpSourceResolver = false; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/AboutCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/AboutCommand.php deleted file mode 100644 index c6a38ce..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/AboutCommand.php +++ /dev/null @@ -1,266 +0,0 @@ -composer = $composer; - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - $this->gatherApplicationInformation(); - - collect(static::$data) - ->map(fn ($items) => collect($items) - ->map(function ($value) { - if (is_array($value)) { - return [$value]; - } - - if (is_string($value)) { - $value = $this->laravel->make($value); - } - - return collect($this->laravel->call($value)) - ->map(fn ($value, $key) => [$key, $value]) - ->values() - ->all(); - })->flatten(1) - ) - ->sortBy(function ($data, $key) { - $index = array_search($key, ['Environment', 'Cache', 'Drivers']); - - return $index === false ? 99 : $index; - }) - ->filter(function ($data, $key) { - return $this->option('only') ? in_array(Str::of($key)->lower()->snake(), $this->sections()) : true; - }) - ->pipe(fn ($data) => $this->display($data)); - - $this->newLine(); - - return 0; - } - - /** - * Display the application information. - * - * @param \Illuminate\Support\Collection $data - * @return void - */ - protected function display($data) - { - $this->option('json') ? $this->displayJson($data) : $this->displayDetail($data); - } - - /** - * Display the application information as a detail view. - * - * @param \Illuminate\Support\Collection $data - * @return void - */ - protected function displayDetail($data) - { - $data->each(function ($data, $section) { - $this->newLine(); - - $this->components->twoColumnDetail(' '.$section.''); - - $data->pipe(fn ($data) => $section !== 'Environment' ? $data->sort() : $data)->each(function ($detail) { - [$label, $value] = $detail; - - $this->components->twoColumnDetail($label, value($value)); - }); - }); - } - - /** - * Display the application information as JSON. - * - * @param \Illuminate\Support\Collection $data - * @return void - */ - protected function displayJson($data) - { - $output = $data->flatMap(function ($data, $section) { - return [(string) Str::of($section)->snake() => $data->mapWithKeys(fn ($item, $key) => [(string) Str::of($item[0])->lower()->snake() => value($item[1])])]; - }); - - $this->output->writeln(strip_tags(json_encode($output))); - } - - /** - * Gather information about the application. - * - * @return void - */ - protected function gatherApplicationInformation() - { - static::addToSection('Environment', fn () => [ - 'Application Name' => config('app.name'), - 'Laravel Version' => $this->laravel->version(), - 'PHP Version' => phpversion(), - 'Composer Version' => $this->composer->getVersion() ?? '-', - 'Environment' => $this->laravel->environment(), - 'Debug Mode' => config('app.debug') ? 'ENABLED' : 'OFF', - 'URL' => Str::of(config('app.url'))->replace(['http://', 'https://'], ''), - 'Maintenance Mode' => $this->laravel->isDownForMaintenance() ? 'ENABLED' : 'OFF', - ]); - - static::addToSection('Cache', fn () => [ - 'Config' => $this->laravel->configurationIsCached() ? 'CACHED' : 'NOT CACHED', - 'Events' => $this->laravel->eventsAreCached() ? 'CACHED' : 'NOT CACHED', - 'Routes' => $this->laravel->routesAreCached() ? 'CACHED' : 'NOT CACHED', - 'Views' => $this->hasPhpFiles($this->laravel->storagePath('framework/views')) ? 'CACHED' : 'NOT CACHED', - ]); - - $logChannel = config('logging.default'); - - if (config('logging.channels.'.$logChannel.'.driver') === 'stack') { - $secondary = collect(config('logging.channels.'.$logChannel.'.channels')) - ->implode(', '); - - $logs = ''.$logChannel.' / '.$secondary; - } else { - $logs = $logChannel; - } - - static::addToSection('Drivers', fn () => array_filter([ - 'Broadcasting' => config('broadcasting.default'), - 'Cache' => config('cache.default'), - 'Database' => config('database.default'), - 'Logs' => $logs, - 'Mail' => config('mail.default'), - 'Octane' => config('octane.server'), - 'Queue' => config('queue.default'), - 'Scout' => config('scout.driver'), - 'Session' => config('session.driver'), - ])); - - collect(static::$customDataResolvers)->each->__invoke(); - } - - /** - * Determine whether the given directory has PHP files. - * - * @param string $path - * @return bool - */ - protected function hasPhpFiles(string $path): bool - { - return count(glob($path.'/*.php')) > 0; - } - - /** - * Add additional data to the output of the "about" command. - * - * @param string $section - * @param callable|string|array $data - * @param string|null $value - * @return void - */ - public static function add(string $section, $data, string $value = null) - { - static::$customDataResolvers[] = fn () => static::addToSection($section, $data, $value); - } - - /** - * Add additional data to the output of the "about" command. - * - * @param string $section - * @param callable|string|array $data - * @param string|null $value - * @return void - */ - protected static function addToSection(string $section, $data, string $value = null) - { - if (is_array($data)) { - foreach ($data as $key => $value) { - self::$data[$section][] = [$key, $value]; - } - } elseif (is_callable($data) || ($value === null && class_exists($data))) { - self::$data[$section][] = $data; - } else { - self::$data[$section][] = [$data, $value]; - } - } - - /** - * Get the sections provided to the command. - * - * @return array - */ - protected function sections() - { - return array_filter(explode(',', $this->option('only') ?? '')); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/CastMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/CastMakeCommand.php deleted file mode 100644 index 2704360..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/CastMakeCommand.php +++ /dev/null @@ -1,92 +0,0 @@ -option('inbound') - ? $this->resolveStubPath('/stubs/cast.inbound.stub') - : $this->resolveStubPath('/stubs/cast.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Casts'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the cast already exists'], - ['inbound', null, InputOption::VALUE_NONE, 'Generate an inbound cast class'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ChannelMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ChannelMakeCommand.php deleted file mode 100644 index 1bc26e8..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ChannelMakeCommand.php +++ /dev/null @@ -1,91 +0,0 @@ -userProviderModel()), - parent::buildClass($name) - ); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return __DIR__.'/stubs/channel.stub'; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Broadcasting'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the channel already exists'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ClearCompiledCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ClearCompiledCommand.php deleted file mode 100644 index 20375de..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ClearCompiledCommand.php +++ /dev/null @@ -1,53 +0,0 @@ -laravel->getCachedServicesPath())) { - @unlink($servicesPath); - } - - if (is_file($packagesPath = $this->laravel->getCachedPackagesPath())) { - @unlink($packagesPath); - } - - $this->components->info('Compiled services and packages files removed successfully.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/CliDumper.php b/framework-9.50.2/src/Illuminate/Foundation/Console/CliDumper.php deleted file mode 100644 index beed2f2..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/CliDumper.php +++ /dev/null @@ -1,134 +0,0 @@ -basePath = $basePath; - $this->output = $output; - $this->compiledViewPath = $compiledViewPath; - } - - /** - * Create a new CLI dumper instance and register it as the default dumper. - * - * @param string $basePath - * @param string $compiledViewPath - * @return void - */ - public static function register($basePath, $compiledViewPath) - { - $cloner = tap(new VarCloner())->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO); - - $dumper = new static(new ConsoleOutput(), $basePath, $compiledViewPath); - - VarDumper::setHandler(fn ($value) => $dumper->dumpWithSource($cloner->cloneVar($value))); - } - - /** - * Dump a variable with its source file / line. - * - * @param \Symfony\Component\VarDumper\Cloner\Data $data - * @return void - */ - public function dumpWithSource(Data $data) - { - if ($this->dumping) { - $this->dump($data); - - return; - } - - $this->dumping = true; - - $output = (string) $this->dump($data, true); - $lines = explode("\n", $output); - - $lines[0] .= $this->getDumpSourceContent(); - - $this->output->write(implode("\n", $lines)); - - $this->dumping = false; - } - - /** - * Get the dump's source console content. - * - * @return string - */ - protected function getDumpSourceContent() - { - if (is_null($dumpSource = $this->resolveDumpSource())) { - return ''; - } - - [$file, $relativeFile, $line] = $dumpSource; - - $href = $this->resolveSourceHref($file, $line); - - return sprintf( - ' // %s%s', - is_null($href) ? '' : ";href=$href", - $relativeFile, - is_null($line) ? '' : ":$line" - ); - } - - /** - * {@inheritDoc} - */ - protected function supportsColors(): bool - { - return $this->output->isDecorated(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ClosureCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ClosureCommand.php deleted file mode 100644 index 4cd54e8..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ClosureCommand.php +++ /dev/null @@ -1,82 +0,0 @@ -callback = $callback; - $this->signature = $signature; - - parent::__construct(); - } - - /** - * Execute the console command. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $inputs = array_merge($input->getArguments(), $input->getOptions()); - - $parameters = []; - - foreach ((new ReflectionFunction($this->callback))->getParameters() as $parameter) { - if (isset($inputs[$parameter->getName()])) { - $parameters[$parameter->getName()] = $inputs[$parameter->getName()]; - } - } - - return (int) $this->laravel->call( - $this->callback->bindTo($this, $this), $parameters - ); - } - - /** - * Set the description for the command. - * - * @param string $description - * @return $this - */ - public function purpose($description) - { - return $this->describe($description); - } - - /** - * Set the description for the command. - * - * @param string $description - * @return $this - */ - public function describe($description) - { - $this->setDescription($description); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ComponentMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ComponentMakeCommand.php deleted file mode 100644 index e11838c..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ComponentMakeCommand.php +++ /dev/null @@ -1,190 +0,0 @@ -option('view')) { - $this->writeView(function () { - $this->components->info($this->type.' created successfully.'); - }); - - return; - } - - if (parent::handle() === false && ! $this->option('force')) { - return false; - } - - if (! $this->option('inline')) { - $this->writeView(); - } - } - - /** - * Write the view for the component. - * - * @param callable|null $onSuccess - * @return void - */ - protected function writeView($onSuccess = null) - { - $path = $this->viewPath( - str_replace('.', '/', 'components.'.$this->getView()).'.blade.php' - ); - - if (! $this->files->isDirectory(dirname($path))) { - $this->files->makeDirectory(dirname($path), 0777, true, true); - } - - if ($this->files->exists($path) && ! $this->option('force')) { - $this->components->error('View already exists.'); - - return; - } - - file_put_contents( - $path, - '
- -
' - ); - - if ($onSuccess) { - $onSuccess(); - } - } - - /** - * Build the class with the given name. - * - * @param string $name - * @return string - */ - protected function buildClass($name) - { - if ($this->option('inline')) { - return str_replace( - ['DummyView', '{{ view }}'], - "<<<'blade'\n
\n \n
\nblade", - parent::buildClass($name) - ); - } - - return str_replace( - ['DummyView', '{{ view }}'], - 'view(\'components.'.$this->getView().'\')', - parent::buildClass($name) - ); - } - - /** - * Get the view name relative to the components directory. - * - * @return string view - */ - protected function getView() - { - $name = str_replace('\\', '/', $this->argument('name')); - - return collect(explode('/', $name)) - ->map(function ($part) { - return Str::kebab($part); - }) - ->implode('.'); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return $this->resolveStubPath('/stubs/view-component.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\View\Components'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the component already exists'], - ['inline', null, InputOption::VALUE_NONE, 'Create a component that renders an inline view'], - ['view', null, InputOption::VALUE_NONE, 'Create an anonymous component with only a view'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ConfigCacheCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ConfigCacheCommand.php deleted file mode 100644 index 18eec46..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ConfigCacheCommand.php +++ /dev/null @@ -1,105 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - * - * @throws \LogicException - */ - public function handle() - { - $this->callSilent('config:clear'); - - $config = $this->getFreshConfiguration(); - - $configPath = $this->laravel->getCachedConfigPath(); - - $this->files->put( - $configPath, 'files->delete($configPath); - - throw new LogicException('Your configuration files are not serializable.', 0, $e); - } - - $this->components->info('Configuration cached successfully.'); - } - - /** - * Boot a fresh copy of the application configuration. - * - * @return array - */ - protected function getFreshConfiguration() - { - $app = require $this->laravel->bootstrapPath().'/app.php'; - - $app->useStoragePath($this->laravel->storagePath()); - - $app->make(ConsoleKernelContract::class)->bootstrap(); - - return $app['config']->all(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ConfigClearCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ConfigClearCommand.php deleted file mode 100644 index 3e07e9b..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ConfigClearCommand.php +++ /dev/null @@ -1,68 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->files->delete($this->laravel->getCachedConfigPath()); - - $this->components->info('Configuration cache cleared successfully.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php deleted file mode 100644 index 18f6dd1..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php +++ /dev/null @@ -1,111 +0,0 @@ -option('command'), $stub); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - $relativePath = '/stubs/console.stub'; - - return file_exists($customPath = $this->laravel->basePath(trim($relativePath, '/'))) - ? $customPath - : __DIR__.$relativePath; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Console\Commands'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['name', InputArgument::REQUIRED, 'The name of the command'], - ]; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the console command already exists'], - ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned', 'command:name'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/DocsCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/DocsCommand.php deleted file mode 100644 index 95afeb0..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/DocsCommand.php +++ /dev/null @@ -1,536 +0,0 @@ -php artisan docs -- search query here'; - - /** - * The HTTP client instance. - * - * @var \Illuminate\Http\Client\Factory - */ - protected $http; - - /** - * The cache repository implementation. - * - * @var \Illuminate\Contracts\Cache\Repository - */ - protected $cache; - - /** - * The custom URL opener. - * - * @var callable|null - */ - protected $urlOpener; - - /** - * The custom documentation version to open. - * - * @var string|null - */ - protected $version; - - /** - * The operating system family. - * - * @var string - */ - protected $systemOsFamily = PHP_OS_FAMILY; - - /** - * Configure the current command. - * - * @return void - */ - protected function configure() - { - parent::configure(); - - if ($this->isSearching()) { - $this->ignoreValidationErrors(); - } - } - - /** - * Execute the console command. - * - * @param \Illuminate\Http\Client\Factory $http - * @param \Illuminate\Contracts\Cache\Repository $cache - * @return int - */ - public function handle(Http $http, Cache $cache) - { - $this->http = $http; - $this->cache = $cache; - - try { - $this->openUrl(); - } catch (ProcessFailedException $e) { - if ($e->getProcess()->getExitCodeText() === 'Interrupt') { - return $e->getProcess()->getExitCode(); - } - - throw $e; - } - - $this->refreshDocs(); - - return Command::SUCCESS; - } - - /** - * Open the documentation URL. - * - * @return void - */ - protected function openUrl() - { - with($this->url(), function ($url) { - $this->components->info("Opening the docs to: {$url}"); - - $this->open($url); - }); - } - - /** - * The URL to the documentation page. - * - * @return string - */ - protected function url() - { - if ($this->isSearching()) { - return "https://laravel.com/docs/{$this->version()}?".Arr::query([ - 'q' => $this->searchQuery(), - ]); - } - - return with($this->page(), function ($page) { - return trim("https://laravel.com/docs/{$this->version()}/{$page}#{$this->section($page)}", '#/'); - }); - } - - /** - * The page the user is opening. - * - * @return string - */ - protected function page() - { - return with($this->resolvePage(), function ($page) { - if ($page === null) { - $this->components->warn('Unable to determine the page you are trying to visit.'); - - return '/'; - } - - return $page; - }); - } - - /** - * Determine the page to open. - * - * @return string|null - */ - protected function resolvePage() - { - if ($this->option('no-interaction') && $this->didNotRequestPage()) { - return '/'; - } - - return $this->didNotRequestPage() - ? $this->askForPage() - : $this->guessPage(); - } - - /** - * Determine if the user requested a specific page when calling the command. - * - * @return bool - */ - protected function didNotRequestPage() - { - return $this->argument('page') === null; - } - - /** - * Ask the user which page they would like to open. - * - * @return string|null - */ - protected function askForPage() - { - return $this->askForPageViaCustomStrategy() ?? $this->askForPageViaAutocomplete(); - } - - /** - * Ask the user which page they would like to open via a custom strategy. - * - * @return string|null - */ - protected function askForPageViaCustomStrategy() - { - try { - $strategy = require Env::get('ARTISAN_DOCS_ASK_STRATEGY'); - } catch (Throwable $e) { - return null; - } - - if (! is_callable($strategy)) { - return null; - } - - return $strategy($this) ?? '/'; - } - - /** - * Ask the user which page they would like to open using autocomplete. - * - * @return string|null - */ - protected function askForPageViaAutocomplete() - { - $choice = $this->components->choice( - 'Which page would you like to open?', - $this->pages()->mapWithKeys(fn ($option) => [ - Str::lower($option['title']) => $option['title'], - ])->all(), - 'installation', - 3 - ); - - return $this->pages()->filter( - fn ($page) => $page['title'] === $choice || Str::lower($page['title']) === $choice - )->keys()->first() ?: null; - } - - /** - * Guess the page the user is attempting to open. - * - * @return string|null - */ - protected function guessPage() - { - return $this->pages() - ->filter(fn ($page) => str_starts_with( - Str::slug($page['title'], ' '), - Str::slug($this->argument('page'), ' ') - ))->keys()->first() ?? $this->pages()->map(fn ($page) => similar_text( - Str::slug($page['title'], ' '), - Str::slug($this->argument('page'), ' '), - )) - ->filter(fn ($score) => $score >= min(3, Str::length($this->argument('page')))) - ->sortDesc() - ->keys() - ->sortByDesc(fn ($slug) => Str::contains( - Str::slug($this->pages()[$slug]['title'], ' '), - Str::slug($this->argument('page'), ' ') - ) ? 1 : 0) - ->first(); - } - - /** - * The section the user specifically asked to open. - * - * @param string $page - * @return string|null - */ - protected function section($page) - { - return $this->didNotRequestSection() - ? null - : $this->guessSection($page); - } - - /** - * Determine if the user requested a specific section when calling the command. - * - * @return bool - */ - protected function didNotRequestSection() - { - return $this->argument('section') === null; - } - - /** - * Guess the section the user is attempting to open. - * - * @param string $page - * @return string|null - */ - protected function guessSection($page) - { - return $this->sectionsFor($page) - ->filter(fn ($section) => str_starts_with( - Str::slug($section['title'], ' '), - Str::slug($this->argument('section'), ' ') - ))->keys()->first() ?? $this->sectionsFor($page)->map(fn ($section) => similar_text( - Str::slug($section['title'], ' '), - Str::slug($this->argument('section'), ' '), - )) - ->filter(fn ($score) => $score >= min(3, Str::length($this->argument('section')))) - ->sortDesc() - ->keys() - ->sortByDesc(fn ($slug) => Str::contains( - Str::slug($this->sectionsFor($page)[$slug]['title'], ' '), - Str::slug($this->argument('section'), ' ') - ) ? 1 : 0) - ->first(); - } - - /** - * Open the URL in the user's browser. - * - * @param string $url - * @return void - */ - protected function open($url) - { - ($this->urlOpener ?? function ($url) { - if (Env::get('ARTISAN_DOCS_OPEN_STRATEGY')) { - $this->openViaCustomStrategy($url); - } elseif (in_array($this->systemOsFamily, ['Darwin', 'Windows', 'Linux'])) { - $this->openViaBuiltInStrategy($url); - } else { - $this->components->warn('Unable to open the URL on your system. You will need to open it yourself or create a custom opener for your system.'); - } - })($url); - } - - /** - * Open the URL via a custom strategy. - * - * @param string $url - * @return void - */ - protected function openViaCustomStrategy($url) - { - try { - $command = require Env::get('ARTISAN_DOCS_OPEN_STRATEGY'); - } catch (Throwable $e) { - $command = null; - } - - if (! is_callable($command)) { - $this->components->warn('Unable to open the URL with your custom strategy. You will need to open it yourself.'); - - return; - } - - $command($url); - } - - /** - * Open the URL via the built in strategy. - * - * @param string $url - * @return void - */ - protected function openViaBuiltInStrategy($url) - { - if ($this->systemOsFamily === 'Windows') { - $process = tap(Process::fromShellCommandline(escapeshellcmd("start {$url}")))->run(); - - if (! $process->isSuccessful()) { - throw new ProcessFailedException($process); - } - - return; - } - - $binary = Collection::make(match ($this->systemOsFamily) { - 'Darwin' => ['open'], - 'Linux' => ['xdg-open', 'wslview'], - })->first(fn ($binary) => (new ExecutableFinder)->find($binary) !== null); - - if ($binary === null) { - $this->components->warn('Unable to open the URL on your system. You will need to open it yourself or create a custom opener for your system.'); - - return; - } - - $process = tap(Process::fromShellCommandline(escapeshellcmd("{$binary} {$url}")))->run(); - - if (! $process->isSuccessful()) { - throw new ProcessFailedException($process); - } - } - - /** - * The available sections for the page. - * - * @param string $page - * @return \Illuminate\Support\Collection - */ - public function sectionsFor($page) - { - return new Collection($this->pages()[$page]['sections']); - } - - /** - * The pages available to open. - * - * @return \Illuminate\Support\Collection - */ - public function pages() - { - return new Collection($this->docs()['pages']); - } - - /** - * Get the documentation index as a collection. - * - * @return \Illuminate\Support\Collection - */ - public function docs() - { - return $this->cache->remember( - "artisan.docs.{{$this->version()}}.index", - CarbonInterval::months(2), - fn () => $this->fetchDocs()->throw()->collect() - ); - } - - /** - * Refresh the cached copy of the documentation index. - * - * @return void - */ - protected function refreshDocs() - { - with($this->fetchDocs(), function ($response) { - if ($response->successful()) { - $this->cache->put("artisan.docs.{{$this->version()}}.index", $response->collect(), CarbonInterval::months(2)); - } - }); - } - - /** - * Fetch the documentation index from the Laravel website. - * - * @return \Illuminate\Http\Client\Response - */ - protected function fetchDocs() - { - return $this->http->get("https://laravel.com/docs/{$this->version()}/index.json"); - } - - /** - * Determine the version of the docs to open. - * - * @return string - */ - protected function version() - { - return Str::before(($this->version ?? $this->laravel->version()), '.').'.x'; - } - - /** - * The search query the user provided. - * - * @return string - */ - protected function searchQuery() - { - return Collection::make($_SERVER['argv'])->skip(3)->implode(' '); - } - - /** - * Determine if the command is intended to perform a search. - * - * @return bool - */ - protected function isSearching() - { - return ($_SERVER['argv'][2] ?? null) === '--'; - } - - /** - * Set the documentation version. - * - * @param string $version - * @return $this - */ - public function setVersion($version) - { - $this->version = $version; - - return $this; - } - - /** - * Set a custom URL opener. - * - * @param callable|null $opener - * @return $this - */ - public function setUrlOpener($opener) - { - $this->urlOpener = $opener; - - return $this; - } - - /** - * Set the system operating system family. - * - * @param string $family - * @return $this - */ - public function setSystemOsFamily($family) - { - $this->systemOsFamily = $family; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/DownCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/DownCommand.php deleted file mode 100644 index 42aa6b6..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/DownCommand.php +++ /dev/null @@ -1,151 +0,0 @@ -laravel->maintenanceMode()->active()) { - $this->components->info('Application is already down.'); - - return 0; - } - - $this->laravel->maintenanceMode()->activate($this->getDownFilePayload()); - - file_put_contents( - storage_path('framework/maintenance.php'), - file_get_contents(__DIR__.'/stubs/maintenance-mode.stub') - ); - - $this->laravel->get('events')->dispatch(new MaintenanceModeEnabled()); - - $this->components->info('Application is now in maintenance mode.'); - } catch (Exception $e) { - $this->components->error(sprintf( - 'Failed to enter maintenance mode: %s.', - $e->getMessage(), - )); - - return 1; - } - } - - /** - * Get the payload to be placed in the "down" file. - * - * @return array - */ - protected function getDownFilePayload() - { - return [ - 'except' => $this->excludedPaths(), - 'redirect' => $this->redirectPath(), - 'retry' => $this->getRetryTime(), - 'refresh' => $this->option('refresh'), - 'secret' => $this->option('secret'), - 'status' => (int) $this->option('status', 503), - 'template' => $this->option('render') ? $this->prerenderView() : null, - ]; - } - - /** - * Get the paths that should be excluded from maintenance mode. - * - * @return array - */ - protected function excludedPaths() - { - try { - return $this->laravel->make(PreventRequestsDuringMaintenance::class)->getExcludedPaths(); - } catch (Throwable $e) { - return []; - } - } - - /** - * Get the path that users should be redirected to. - * - * @return string - */ - protected function redirectPath() - { - if ($this->option('redirect') && $this->option('redirect') !== '/') { - return '/'.trim($this->option('redirect'), '/'); - } - - return $this->option('redirect'); - } - - /** - * Prerender the specified view so that it can be rendered even before loading Composer. - * - * @return string - */ - protected function prerenderView() - { - (new RegisterErrorViewPaths)(); - - return view($this->option('render'), [ - 'retryAfter' => $this->option('retry'), - ])->render(); - } - - /** - * Get the number of seconds the client should wait before retrying their request. - * - * @return int|null - */ - protected function getRetryTime() - { - $retry = $this->option('retry'); - - return is_numeric($retry) && $retry > 0 ? (int) $retry : null; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentCommand.php deleted file mode 100644 index ba74ed9..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentCommand.php +++ /dev/null @@ -1,48 +0,0 @@ -components->info(sprintf( - 'The application environment is [%s].', - $this->laravel['env'], - )); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentDecryptCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentDecryptCommand.php deleted file mode 100644 index 1e11e11..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentDecryptCommand.php +++ /dev/null @@ -1,159 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $key = $this->option('key') ?: Env::get('LARAVEL_ENV_ENCRYPTION_KEY'); - - if (! $key) { - $this->components->error('A decryption key is required.'); - - return Command::FAILURE; - } - - $cipher = $this->option('cipher') ?: 'AES-256-CBC'; - - $key = $this->parseKey($key); - - $encryptedFile = ($this->option('env') - ? base_path('.env').'.'.$this->option('env') - : $this->laravel->environmentFilePath()).'.encrypted'; - - $outputFile = $this->outputFilePath(); - - if (Str::endsWith($outputFile, '.encrypted')) { - $this->components->error('Invalid filename.'); - - return Command::FAILURE; - } - - if (! $this->files->exists($encryptedFile)) { - $this->components->error('Encrypted environment file not found.'); - - return Command::FAILURE; - } - - if ($this->files->exists($outputFile) && ! $this->option('force')) { - $this->components->error('Environment file already exists.'); - - return Command::FAILURE; - } - - try { - $encrypter = new Encrypter($key, $cipher); - - $this->files->put( - $outputFile, - $encrypter->decrypt($this->files->get($encryptedFile)) - ); - } catch (Exception $e) { - $this->components->error($e->getMessage()); - - return Command::FAILURE; - } - - $this->components->info('Environment successfully decrypted.'); - - $this->components->twoColumnDetail('Decrypted file', $outputFile); - - $this->newLine(); - } - - /** - * Parse the encryption key. - * - * @param string $key - * @return string - */ - protected function parseKey(string $key) - { - if (Str::startsWith($key, $prefix = 'base64:')) { - $key = base64_decode(Str::after($key, $prefix)); - } - - return $key; - } - - /** - * Get the output file path that should be used for the command. - * - * @return string - */ - protected function outputFilePath() - { - $path = Str::finish($this->option('path') ?: base_path(), DIRECTORY_SEPARATOR); - - $outputFile = $this->option('filename') ?: ('.env'.($this->option('env') ? '.'.$this->option('env') : '')); - $outputFile = ltrim($outputFile, DIRECTORY_SEPARATOR); - - return $path.$outputFile; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentEncryptCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentEncryptCommand.php deleted file mode 100644 index ef90826..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/EnvironmentEncryptCommand.php +++ /dev/null @@ -1,135 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $cipher = $this->option('cipher') ?: 'AES-256-CBC'; - - $key = $this->option('key'); - - $keyPassed = $key !== null; - - $environmentFile = $this->option('env') - ? base_path('.env').'.'.$this->option('env') - : $this->laravel->environmentFilePath(); - - $encryptedFile = $environmentFile.'.encrypted'; - - if (! $keyPassed) { - $key = Encrypter::generateKey($cipher); - } - - if (! $this->files->exists($environmentFile)) { - $this->components->error('Environment file not found.'); - - return Command::FAILURE; - } - - if ($this->files->exists($encryptedFile) && ! $this->option('force')) { - $this->components->error('Encrypted environment file already exists.'); - - return Command::FAILURE; - } - - try { - $encrypter = new Encrypter($this->parseKey($key), $cipher); - - $this->files->put( - $encryptedFile, - $encrypter->encrypt($this->files->get($environmentFile)) - ); - } catch (Exception $e) { - $this->components->error($e->getMessage()); - - return Command::FAILURE; - } - - $this->components->info('Environment successfully encrypted.'); - - $this->components->twoColumnDetail('Key', ($keyPassed ? $key : 'base64:'.base64_encode($key))); - $this->components->twoColumnDetail('Cipher', $cipher); - $this->components->twoColumnDetail('Encrypted file', $encryptedFile); - - $this->newLine(); - } - - /** - * Parse the encryption key. - * - * @param string $key - * @return string - */ - protected function parseKey(string $key) - { - if (Str::startsWith($key, $prefix = 'base64:')) { - $key = base64_decode(Str::after($key, $prefix)); - } - - return $key; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/EventCacheCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/EventCacheCommand.php deleted file mode 100644 index df42fbf..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/EventCacheCommand.php +++ /dev/null @@ -1,71 +0,0 @@ -callSilent('event:clear'); - - file_put_contents( - $this->laravel->getCachedEventsPath(), - 'getEvents(), true).';' - ); - - $this->components->info('Events cached successfully.'); - } - - /** - * Get all of the events and listeners configured for the application. - * - * @return array - */ - protected function getEvents() - { - $events = []; - - foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) { - $providerEvents = array_merge_recursive($provider->shouldDiscoverEvents() ? $provider->discoverEvents() : [], $provider->listens()); - - $events[get_class($provider)] = $providerEvents; - } - - return $events; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/EventClearCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/EventClearCommand.php deleted file mode 100644 index a5c8ed1..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/EventClearCommand.php +++ /dev/null @@ -1,70 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - * - * @throws \RuntimeException - */ - public function handle() - { - $this->files->delete($this->laravel->getCachedEventsPath()); - - $this->components->info('Cached events cleared successfully.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/EventGenerateCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/EventGenerateCommand.php deleted file mode 100644 index b27e9db..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/EventGenerateCommand.php +++ /dev/null @@ -1,90 +0,0 @@ -laravel->getProviders(EventServiceProvider::class); - - foreach ($providers as $provider) { - foreach ($provider->listens() as $event => $listeners) { - $this->makeEventAndListeners($event, $listeners); - } - } - - $this->components->info('Events and listeners generated successfully.'); - } - - /** - * Make the event and listeners for the given event. - * - * @param string $event - * @param array $listeners - * @return void - */ - protected function makeEventAndListeners($event, $listeners) - { - if (! str_contains($event, '\\')) { - return; - } - - $this->callSilent('make:event', ['name' => $event]); - - $this->makeListeners($event, $listeners); - } - - /** - * Make the listeners for the given event. - * - * @param string $event - * @param array $listeners - * @return void - */ - protected function makeListeners($event, $listeners) - { - foreach ($listeners as $listener) { - $listener = preg_replace('/@.+$/', '', $listener); - - $this->callSilent('make:listener', array_filter( - ['name' => $listener, '--event' => $event] - )); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/EventListCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/EventListCommand.php deleted file mode 100644 index 1e0e11b..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/EventListCommand.php +++ /dev/null @@ -1,232 +0,0 @@ -getEvents()->sortKeys(); - - if ($events->isEmpty()) { - $this->components->info("Your application doesn't have any events matching the given criteria."); - - return; - } - - $this->newLine(); - - $events->each(function ($listeners, $event) { - $this->components->twoColumnDetail($this->appendEventInterfaces($event)); - $this->components->bulletList($listeners); - }); - - $this->newLine(); - } - - /** - * Get all of the events and listeners configured for the application. - * - * @return \Illuminate\Support\Collection - */ - protected function getEvents() - { - $events = collect($this->getListenersOnDispatcher()); - - if ($this->filteringByEvent()) { - $events = $this->filterEvents($events); - } - - return $events; - } - - /** - * Get the event / listeners from the dispatcher object. - * - * @return array - */ - protected function getListenersOnDispatcher() - { - $events = []; - - foreach ($this->getRawListeners() as $event => $rawListeners) { - foreach ($rawListeners as $rawListener) { - if (is_string($rawListener)) { - $events[$event][] = $this->appendListenerInterfaces($rawListener); - } elseif ($rawListener instanceof Closure) { - $events[$event][] = $this->stringifyClosure($rawListener); - } elseif (is_array($rawListener) && count($rawListener) === 2) { - if (is_object($rawListener[0])) { - $rawListener[0] = get_class($rawListener[0]); - } - - $events[$event][] = $this->appendListenerInterfaces(implode('@', $rawListener)); - } - } - } - - return $events; - } - - /** - * Add the event implemented interfaces to the output. - * - * @param string $event - * @return string - */ - protected function appendEventInterfaces($event) - { - if (! class_exists($event)) { - return $event; - } - - $interfaces = class_implements($event); - - if (in_array(ShouldBroadcast::class, $interfaces)) { - $event .= ' (ShouldBroadcast)'; - } - - return $event; - } - - /** - * Add the listener implemented interfaces to the output. - * - * @param string $listener - * @return string - */ - protected function appendListenerInterfaces($listener) - { - $listener = explode('@', $listener); - - $interfaces = class_implements($listener[0]); - - $listener = implode('@', $listener); - - if (in_array(ShouldQueue::class, $interfaces)) { - $listener .= ' (ShouldQueue)'; - } - - return $listener; - } - - /** - * Get a displayable string representation of a Closure listener. - * - * @param \Closure $rawListener - * @return string - */ - protected function stringifyClosure(Closure $rawListener) - { - $reflection = new ReflectionFunction($rawListener); - - $path = str_replace([base_path(), DIRECTORY_SEPARATOR], ['', '/'], $reflection->getFileName() ?: ''); - - return 'Closure at: '.$path.':'.$reflection->getStartLine(); - } - - /** - * Filter the given events using the provided event name filter. - * - * @param \Illuminate\Support\Collection $events - * @return \Illuminate\Support\Collection - */ - protected function filterEvents($events) - { - if (! $eventName = $this->option('event')) { - return $events; - } - - return $events->filter( - fn ($listeners, $event) => str_contains($event, $eventName) - ); - } - - /** - * Determine whether the user is filtering by an event name. - * - * @return bool - */ - protected function filteringByEvent() - { - return ! empty($this->option('event')); - } - - /** - * Gets the raw version of event listeners from the event dispatcher. - * - * @return array - */ - protected function getRawListeners() - { - return $this->getEventsDispatcher()->getRawListeners(); - } - - /** - * Get the event dispatcher. - * - * @return Illuminate\Events\Dispatcher - */ - public function getEventsDispatcher() - { - return is_null(self::$eventsResolver) - ? $this->getLaravel()->make('events') - : call_user_func(self::$eventsResolver); - } - - /** - * Set a callback that should be used when resolving the events dispatcher. - * - * @param \Closure|null $resolver - * @return void - */ - public static function resolveEventsUsing($resolver) - { - static::$eventsResolver = $resolver; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/EventMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/EventMakeCommand.php deleted file mode 100644 index 94f96b5..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/EventMakeCommand.php +++ /dev/null @@ -1,101 +0,0 @@ -files->exists($this->getPath($this->qualifyClass($rawName))); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return $this->resolveStubPath('/stubs/event.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Events'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the event already exists'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ExceptionMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ExceptionMakeCommand.php deleted file mode 100644 index 54b24d6..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ExceptionMakeCommand.php +++ /dev/null @@ -1,97 +0,0 @@ -option('render')) { - return $this->option('report') - ? __DIR__.'/stubs/exception-render-report.stub' - : __DIR__.'/stubs/exception-render.stub'; - } - - return $this->option('report') - ? __DIR__.'/stubs/exception-report.stub' - : __DIR__.'/stubs/exception.stub'; - } - - /** - * Determine if the class already exists. - * - * @param string $rawName - * @return bool - */ - protected function alreadyExists($rawName) - { - return class_exists($this->rootNamespace().'Exceptions\\'.$rawName); - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Exceptions'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the exception already exists'], - ['render', null, InputOption::VALUE_NONE, 'Create the exception with an empty render method'], - ['report', null, InputOption::VALUE_NONE, 'Create the exception with an empty report method'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/JobMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/JobMakeCommand.php deleted file mode 100644 index 901fff2..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/JobMakeCommand.php +++ /dev/null @@ -1,95 +0,0 @@ -option('sync') - ? $this->resolveStubPath('/stubs/job.stub') - : $this->resolveStubPath('/stubs/job.queued.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Jobs'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the job already exists'], - ['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/Kernel.php b/framework-9.50.2/src/Illuminate/Foundation/Console/Kernel.php deleted file mode 100644 index e9c1261..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/Kernel.php +++ /dev/null @@ -1,468 +0,0 @@ -app = $app; - $this->events = $events; - - $this->app->booted(function () { - $this->defineConsoleSchedule(); - }); - } - - /** - * Define the application's command schedule. - * - * @return void - */ - protected function defineConsoleSchedule() - { - $this->app->singleton(Schedule::class, function ($app) { - return tap(new Schedule($this->scheduleTimezone()), function ($schedule) { - $this->schedule($schedule->useCache($this->scheduleCache())); - }); - }); - } - - /** - * Get the name of the cache store that should manage scheduling mutexes. - * - * @return string - */ - protected function scheduleCache() - { - return $this->app['config']->get('cache.schedule_store', Env::get('SCHEDULE_CACHE_DRIVER')); - } - - /** - * Run the console application. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface|null $output - * @return int - */ - public function handle($input, $output = null) - { - $this->commandStartedAt = Carbon::now(); - - try { - if (in_array($input->getFirstArgument(), ['env:encrypt', 'env:decrypt'], true)) { - $this->bootstrapWithoutBootingProviders(); - } - - $this->bootstrap(); - - return $this->getArtisan()->run($input, $output); - } catch (Throwable $e) { - $this->reportException($e); - - $this->renderException($output, $e); - - return 1; - } - } - - /** - * Terminate the application. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param int $status - * @return void - */ - public function terminate($input, $status) - { - $this->app->terminate(); - - foreach ($this->commandLifecycleDurationHandlers as ['threshold' => $threshold, 'handler' => $handler]) { - $end ??= Carbon::now(); - - if ($this->commandStartedAt->diffInMilliseconds($end) > $threshold) { - $handler($this->commandStartedAt, $input, $status); - } - } - - $this->commandStartedAt = null; - } - - /** - * Register a callback to be invoked when the command lifecycle duration exceeds a given amount of time. - * - * @param \DateTimeInterface|\Carbon\CarbonInterval|float|int $threshold - * @param callable $handler - * @return void - */ - public function whenCommandLifecycleIsLongerThan($threshold, $handler) - { - $threshold = $threshold instanceof DateTimeInterface - ? $this->secondsUntil($threshold) * 1000 - : $threshold; - - $threshold = $threshold instanceof CarbonInterval - ? $threshold->totalMilliseconds - : $threshold; - - $this->commandLifecycleDurationHandlers[] = [ - 'threshold' => $threshold, - 'handler' => $handler, - ]; - } - - /** - * When the command being handled started. - * - * @return \Illuminate\Support\Carbon|null - */ - public function commandStartedAt() - { - return $this->commandStartedAt; - } - - /** - * Define the application's command schedule. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule - * @return void - */ - protected function schedule(Schedule $schedule) - { - // - } - - /** - * Get the timezone that should be used by default for scheduled events. - * - * @return \DateTimeZone|string|null - */ - protected function scheduleTimezone() - { - $config = $this->app['config']; - - return $config->get('app.schedule_timezone', $config->get('app.timezone')); - } - - /** - * Register the commands for the application. - * - * @return void - */ - protected function commands() - { - // - } - - /** - * Register a Closure based command with the application. - * - * @param string $signature - * @param \Closure $callback - * @return \Illuminate\Foundation\Console\ClosureCommand - */ - public function command($signature, Closure $callback) - { - $command = new ClosureCommand($signature, $callback); - - Artisan::starting(function ($artisan) use ($command) { - $artisan->add($command); - }); - - return $command; - } - - /** - * Register all of the commands in the given directory. - * - * @param array|string $paths - * @return void - */ - protected function load($paths) - { - $paths = array_unique(Arr::wrap($paths)); - - $paths = array_filter($paths, function ($path) { - return is_dir($path); - }); - - if (empty($paths)) { - return; - } - - $namespace = $this->app->getNamespace(); - - foreach ((new Finder)->in($paths)->files() as $command) { - $command = $namespace.str_replace( - ['/', '.php'], - ['\\', ''], - Str::after($command->getRealPath(), realpath(app_path()).DIRECTORY_SEPARATOR) - ); - - if (is_subclass_of($command, Command::class) && - ! (new ReflectionClass($command))->isAbstract()) { - Artisan::starting(function ($artisan) use ($command) { - $artisan->resolve($command); - }); - } - } - } - - /** - * Register the given command with the console application. - * - * @param \Symfony\Component\Console\Command\Command $command - * @return void - */ - public function registerCommand($command) - { - $this->getArtisan()->add($command); - } - - /** - * Run an Artisan console command by name. - * - * @param string $command - * @param array $parameters - * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer - * @return int - * - * @throws \Symfony\Component\Console\Exception\CommandNotFoundException - */ - public function call($command, array $parameters = [], $outputBuffer = null) - { - if (in_array($command, ['env:encrypt', 'env:decrypt'], true)) { - $this->bootstrapWithoutBootingProviders(); - } - - $this->bootstrap(); - - return $this->getArtisan()->call($command, $parameters, $outputBuffer); - } - - /** - * Queue the given console command. - * - * @param string $command - * @param array $parameters - * @return \Illuminate\Foundation\Bus\PendingDispatch - */ - public function queue($command, array $parameters = []) - { - return QueuedCommand::dispatch(func_get_args()); - } - - /** - * Get all of the commands registered with the console. - * - * @return array - */ - public function all() - { - $this->bootstrap(); - - return $this->getArtisan()->all(); - } - - /** - * Get the output for the last run command. - * - * @return string - */ - public function output() - { - $this->bootstrap(); - - return $this->getArtisan()->output(); - } - - /** - * Bootstrap the application for artisan commands. - * - * @return void - */ - public function bootstrap() - { - if (! $this->app->hasBeenBootstrapped()) { - $this->app->bootstrapWith($this->bootstrappers()); - } - - $this->app->loadDeferredProviders(); - - if (! $this->commandsLoaded) { - $this->commands(); - - $this->commandsLoaded = true; - } - } - - /** - * Bootstrap the application without booting service providers. - * - * @return void - */ - public function bootstrapWithoutBootingProviders() - { - $this->app->bootstrapWith( - collect($this->bootstrappers())->reject(function ($bootstrapper) { - return $bootstrapper === \Illuminate\Foundation\Bootstrap\BootProviders::class; - })->all() - ); - } - - /** - * Get the Artisan application instance. - * - * @return \Illuminate\Console\Application - */ - protected function getArtisan() - { - if (is_null($this->artisan)) { - $this->artisan = (new Artisan($this->app, $this->events, $this->app->version())) - ->resolveCommands($this->commands) - ->setContainerCommandLoader(); - } - - return $this->artisan; - } - - /** - * Set the Artisan application instance. - * - * @param \Illuminate\Console\Application $artisan - * @return void - */ - public function setArtisan($artisan) - { - $this->artisan = $artisan; - } - - /** - * Get the bootstrap classes for the application. - * - * @return array - */ - protected function bootstrappers() - { - return $this->bootstrappers; - } - - /** - * Report the exception to the exception handler. - * - * @param \Throwable $e - * @return void - */ - protected function reportException(Throwable $e) - { - $this->app[ExceptionHandler::class]->report($e); - } - - /** - * Render the given exception. - * - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @param \Throwable $e - * @return void - */ - protected function renderException($output, Throwable $e) - { - $this->app[ExceptionHandler::class]->renderForConsole($output, $e); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/KeyGenerateCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/KeyGenerateCommand.php deleted file mode 100644 index f047bc3..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/KeyGenerateCommand.php +++ /dev/null @@ -1,136 +0,0 @@ -generateRandomKey(); - - if ($this->option('show')) { - return $this->line(''.$key.''); - } - - // Next, we will replace the application key in the environment file so it is - // automatically setup for this developer. This key gets generated using a - // secure random byte generator and is later base64 encoded for storage. - if (! $this->setKeyInEnvironmentFile($key)) { - return; - } - - $this->laravel['config']['app.key'] = $key; - - $this->components->info('Application key set successfully.'); - } - - /** - * Generate a random key for the application. - * - * @return string - */ - protected function generateRandomKey() - { - return 'base64:'.base64_encode( - Encrypter::generateKey($this->laravel['config']['app.cipher']) - ); - } - - /** - * Set the application key in the environment file. - * - * @param string $key - * @return bool - */ - protected function setKeyInEnvironmentFile($key) - { - $currentKey = $this->laravel['config']['app.key']; - - if (strlen($currentKey) !== 0 && (! $this->confirmToProceed())) { - return false; - } - - if (! $this->writeNewEnvironmentFileWith($key)) { - return false; - } - - return true; - } - - /** - * Write a new environment file with the given key. - * - * @param string $key - * @return bool - */ - protected function writeNewEnvironmentFileWith($key) - { - $replaced = preg_replace( - $this->keyReplacementPattern(), - 'APP_KEY='.$key, - $input = file_get_contents($this->laravel->environmentFilePath()) - ); - - if ($replaced === $input || $replaced === null) { - $this->error('Unable to set application key. No APP_KEY variable was found in the .env file.'); - - return false; - } - - file_put_contents($this->laravel->environmentFilePath(), $replaced); - - return true; - } - - /** - * Get a regex pattern that will match env APP_KEY with any random key. - * - * @return string - */ - protected function keyReplacementPattern() - { - $escaped = preg_quote('='.$this->laravel['config']['app.key'], '/'); - - return "/^APP_KEY{$escaped}/m"; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ListenerMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ListenerMakeCommand.php deleted file mode 100644 index 94d0b66..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ListenerMakeCommand.php +++ /dev/null @@ -1,154 +0,0 @@ -option('event'); - - if (! Str::startsWith($event, [ - $this->laravel->getNamespace(), - 'Illuminate', - '\\', - ])) { - $event = $this->laravel->getNamespace().'Events\\'.str_replace('/', '\\', $event); - } - - $stub = str_replace( - ['DummyEvent', '{{ event }}'], class_basename($event), parent::buildClass($name) - ); - - return str_replace( - ['DummyFullEvent', '{{ eventNamespace }}'], trim($event, '\\'), $stub - ); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - if ($this->option('queued')) { - return $this->option('event') - ? __DIR__.'/stubs/listener-queued.stub' - : __DIR__.'/stubs/listener-queued-duck.stub'; - } - - return $this->option('event') - ? __DIR__.'/stubs/listener.stub' - : __DIR__.'/stubs/listener-duck.stub'; - } - - /** - * Determine if the class already exists. - * - * @param string $rawName - * @return bool - */ - protected function alreadyExists($rawName) - { - return class_exists($rawName); - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Listeners'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['event', 'e', InputOption::VALUE_OPTIONAL, 'The event class being listened for'], - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the listener already exists'], - ['queued', null, InputOption::VALUE_NONE, 'Indicates the event listener should be queued'], - ]; - } - - /** - * Interact further with the user if they were prompted for missing arguments. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return void - */ - protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) - { - if ($this->didReceiveOptions($input)) { - return; - } - - $event = $this->components->askWithCompletion( - 'What event should be listened for?', - $this->possibleEvents(), - 'none' - ); - - if ($event && $event !== 'none') { - $input->setOption('event', $event); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/MailMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/MailMakeCommand.php deleted file mode 100644 index e998da5..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/MailMakeCommand.php +++ /dev/null @@ -1,172 +0,0 @@ -option('force')) { - return; - } - - if ($this->option('markdown') !== false) { - $this->writeMarkdownTemplate(); - } - } - - /** - * Write the Markdown template for the mailable. - * - * @return void - */ - protected function writeMarkdownTemplate() - { - $path = $this->viewPath( - str_replace('.', '/', $this->getView()).'.blade.php' - ); - - if (! $this->files->isDirectory(dirname($path))) { - $this->files->makeDirectory(dirname($path), 0755, true); - } - - $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub')); - } - - /** - * Build the class with the given name. - * - * @param string $name - * @return string - */ - protected function buildClass($name) - { - $class = str_replace( - '{{ subject }}', - Str::headline(str_replace($this->getNamespace($name).'\\', '', $name)), - parent::buildClass($name) - ); - - if ($this->option('markdown') !== false) { - $class = str_replace(['DummyView', '{{ view }}'], $this->getView(), $class); - } - - return $class; - } - - /** - * Get the view name. - * - * @return string - */ - protected function getView() - { - $view = $this->option('markdown'); - - if (! $view) { - $name = str_replace('\\', '/', $this->argument('name')); - - $view = 'mail.'.collect(explode('/', $name)) - ->map(fn ($part) => Str::kebab($part)) - ->implode('.'); - } - - return $view; - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return $this->resolveStubPath( - $this->option('markdown') !== false - ? '/stubs/markdown-mail.stub' - : '/stubs/mail.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Mail'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the mailable already exists'], - ['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the mailable', false], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ModelMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ModelMakeCommand.php deleted file mode 100644 index 3bec9f7..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ModelMakeCommand.php +++ /dev/null @@ -1,270 +0,0 @@ -option('force')) { - return false; - } - - if ($this->option('all')) { - $this->input->setOption('factory', true); - $this->input->setOption('seed', true); - $this->input->setOption('migration', true); - $this->input->setOption('controller', true); - $this->input->setOption('policy', true); - $this->input->setOption('resource', true); - } - - if ($this->option('factory')) { - $this->createFactory(); - } - - if ($this->option('migration')) { - $this->createMigration(); - } - - if ($this->option('seed')) { - $this->createSeeder(); - } - - if ($this->option('controller') || $this->option('resource') || $this->option('api')) { - $this->createController(); - } - - if ($this->option('policy')) { - $this->createPolicy(); - } - } - - /** - * Create a model factory for the model. - * - * @return void - */ - protected function createFactory() - { - $factory = Str::studly($this->argument('name')); - - $this->call('make:factory', [ - 'name' => "{$factory}Factory", - '--model' => $this->qualifyClass($this->getNameInput()), - ]); - } - - /** - * Create a migration file for the model. - * - * @return void - */ - protected function createMigration() - { - $table = Str::snake(Str::pluralStudly(class_basename($this->argument('name')))); - - if ($this->option('pivot')) { - $table = Str::singular($table); - } - - $this->call('make:migration', [ - 'name' => "create_{$table}_table", - '--create' => $table, - '--fullpath' => true, - ]); - } - - /** - * Create a seeder file for the model. - * - * @return void - */ - protected function createSeeder() - { - $seeder = Str::studly(class_basename($this->argument('name'))); - - $this->call('make:seeder', [ - 'name' => "{$seeder}Seeder", - ]); - } - - /** - * Create a controller for the model. - * - * @return void - */ - protected function createController() - { - $controller = Str::studly(class_basename($this->argument('name'))); - - $modelName = $this->qualifyClass($this->getNameInput()); - - $this->call('make:controller', array_filter([ - 'name' => "{$controller}Controller", - '--model' => $this->option('resource') || $this->option('api') ? $modelName : null, - '--api' => $this->option('api'), - '--requests' => $this->option('requests') || $this->option('all'), - ])); - } - - /** - * Create a policy file for the model. - * - * @return void - */ - protected function createPolicy() - { - $policy = Str::studly(class_basename($this->argument('name'))); - - $this->call('make:policy', [ - 'name' => "{$policy}Policy", - '--model' => $this->qualifyClass($this->getNameInput()), - ]); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - if ($this->option('pivot')) { - return $this->resolveStubPath('/stubs/model.pivot.stub'); - } - - if ($this->option('morph-pivot')) { - return $this->resolveStubPath('/stubs/model.morph-pivot.stub'); - } - - return $this->resolveStubPath('/stubs/model.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return is_dir(app_path('Models')) ? $rootNamespace.'\\Models' : $rootNamespace; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model'], - ['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'], - ['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'], - ['force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists'], - ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model'], - ['morph-pivot', null, InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom polymorphic intermediate table model'], - ['policy', null, InputOption::VALUE_NONE, 'Create a new policy for the model'], - ['seed', 's', InputOption::VALUE_NONE, 'Create a new seeder for the model'], - ['pivot', 'p', InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom intermediate table model'], - ['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'], - ['api', null, InputOption::VALUE_NONE, 'Indicates if the generated controller should be an API resource controller'], - ['requests', 'R', InputOption::VALUE_NONE, 'Create new form request classes and use them in the resource controller'], - ]; - } - - /** - * Interact further with the user if they were prompted for missing arguments. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return void - */ - protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) - { - if ($this->didReceiveOptions($input)) { - return; - } - - collect($this->components->choice('Would you like any of the following?', [ - 'none', - 'all', - 'factory', - 'form requests', - 'migration', - 'policy', - 'resource controller', - 'seed', - ], default: 0, multiple: true)) - ->reject('none') - ->map(fn ($option) => match ($option) { - 'resource controller' => 'resource', - 'form requests' => 'requests', - default => $option, - }) - ->each(fn ($option) => $input->setOption($option, true)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/NotificationMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/NotificationMakeCommand.php deleted file mode 100644 index 4bcf5c8..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/NotificationMakeCommand.php +++ /dev/null @@ -1,146 +0,0 @@ -option('force')) { - return; - } - - if ($this->option('markdown')) { - $this->writeMarkdownTemplate(); - } - } - - /** - * Write the Markdown template for the mailable. - * - * @return void - */ - protected function writeMarkdownTemplate() - { - $path = $this->viewPath( - str_replace('.', '/', $this->option('markdown')).'.blade.php' - ); - - if (! $this->files->isDirectory(dirname($path))) { - $this->files->makeDirectory(dirname($path), 0755, true); - } - - $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub')); - } - - /** - * Build the class with the given name. - * - * @param string $name - * @return string - */ - protected function buildClass($name) - { - $class = parent::buildClass($name); - - if ($this->option('markdown')) { - $class = str_replace(['DummyView', '{{ view }}'], $this->option('markdown'), $class); - } - - return $class; - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return $this->option('markdown') - ? $this->resolveStubPath('/stubs/markdown-notification.stub') - : $this->resolveStubPath('/stubs/notification.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Notifications'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the notification already exists'], - ['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the notification'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ObserverMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ObserverMakeCommand.php deleted file mode 100644 index 6d53265..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ObserverMakeCommand.php +++ /dev/null @@ -1,179 +0,0 @@ -option('model'); - - return $model ? $this->replaceModel($stub, $model) : $stub; - } - - /** - * Replace the model for the given stub. - * - * @param string $stub - * @param string $model - * @return string - */ - protected function replaceModel($stub, $model) - { - $modelClass = $this->parseModel($model); - - $replace = [ - 'DummyFullModelClass' => $modelClass, - '{{ namespacedModel }}' => $modelClass, - '{{namespacedModel}}' => $modelClass, - 'DummyModelClass' => class_basename($modelClass), - '{{ model }}' => class_basename($modelClass), - '{{model}}' => class_basename($modelClass), - 'DummyModelVariable' => lcfirst(class_basename($modelClass)), - '{{ modelVariable }}' => lcfirst(class_basename($modelClass)), - '{{modelVariable}}' => lcfirst(class_basename($modelClass)), - ]; - - return str_replace( - array_keys($replace), array_values($replace), $stub - ); - } - - /** - * Get the fully-qualified model class name. - * - * @param string $model - * @return string - * - * @throws \InvalidArgumentException - */ - protected function parseModel($model) - { - if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) { - throw new InvalidArgumentException('Model name contains invalid characters.'); - } - - return $this->qualifyModel($model); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return $this->option('model') - ? $this->resolveStubPath('/stubs/observer.stub') - : $this->resolveStubPath('/stubs/observer.plain.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Observers'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the observer already exists'], - ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the observer applies to'], - ]; - } - - /** - * Interact further with the user if they were prompted for missing arguments. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return void - */ - protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) - { - if ($this->didReceiveOptions($input)) { - return; - } - - $model = $this->components->askWithCompletion( - 'What model should this observer apply to?', - $this->possibleModels(), - 'none' - ); - - if ($model && $model !== 'none') { - $input->setOption('model', $model); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/OptimizeClearCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/OptimizeClearCommand.php deleted file mode 100644 index d3b039e..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/OptimizeClearCommand.php +++ /dev/null @@ -1,56 +0,0 @@ -components->info('Clearing cached bootstrap files.'); - - collect([ - 'events' => fn () => $this->callSilent('event:clear') == 0, - 'views' => fn () => $this->callSilent('view:clear') == 0, - 'cache' => fn () => $this->callSilent('cache:clear') == 0, - 'route' => fn () => $this->callSilent('route:clear') == 0, - 'config' => fn () => $this->callSilent('config:clear') == 0, - 'compiled' => fn () => $this->callSilent('clear-compiled') == 0, - ])->each(fn ($task, $description) => $this->components->task($description, $task)); - - $this->newLine(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/OptimizeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/OptimizeCommand.php deleted file mode 100644 index b487928..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/OptimizeCommand.php +++ /dev/null @@ -1,52 +0,0 @@ -components->info('Caching the framework bootstrap files'); - - collect([ - 'config' => fn () => $this->callSilent('config:cache') == 0, - 'routes' => fn () => $this->callSilent('route:cache') == 0, - ])->each(fn ($task, $description) => $this->components->task($description, $task)); - - $this->newLine(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php deleted file mode 100644 index d9b928f..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php +++ /dev/null @@ -1,54 +0,0 @@ -components->info('Discovering packages'); - - $manifest->build(); - - collect($manifest->manifest) - ->keys() - ->each(fn ($description) => $this->components->task($description)) - ->whenNotEmpty(fn () => $this->newLine()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/PolicyMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/PolicyMakeCommand.php deleted file mode 100644 index 92bb68f..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/PolicyMakeCommand.php +++ /dev/null @@ -1,238 +0,0 @@ -replaceUserNamespace( - parent::buildClass($name) - ); - - $model = $this->option('model'); - - return $model ? $this->replaceModel($stub, $model) : $stub; - } - - /** - * Replace the User model namespace. - * - * @param string $stub - * @return string - */ - protected function replaceUserNamespace($stub) - { - $model = $this->userProviderModel(); - - if (! $model) { - return $stub; - } - - return str_replace( - $this->rootNamespace().'User', - $model, - $stub - ); - } - - /** - * Get the model for the guard's user provider. - * - * @return string|null - * - * @throws \LogicException - */ - protected function userProviderModel() - { - $config = $this->laravel['config']; - - $guard = $this->option('guard') ?: $config->get('auth.defaults.guard'); - - if (is_null($guardProvider = $config->get('auth.guards.'.$guard.'.provider'))) { - throw new LogicException('The ['.$guard.'] guard is not defined in your "auth" configuration file.'); - } - - if (! $config->get('auth.providers.'.$guardProvider.'.model')) { - return 'App\\Models\\User'; - } - - return $config->get( - 'auth.providers.'.$guardProvider.'.model' - ); - } - - /** - * Replace the model for the given stub. - * - * @param string $stub - * @param string $model - * @return string - */ - protected function replaceModel($stub, $model) - { - $model = str_replace('/', '\\', $model); - - if (str_starts_with($model, '\\')) { - $namespacedModel = trim($model, '\\'); - } else { - $namespacedModel = $this->qualifyModel($model); - } - - $model = class_basename(trim($model, '\\')); - - $dummyUser = class_basename($this->userProviderModel()); - - $dummyModel = Str::camel($model) === 'user' ? 'model' : $model; - - $replace = [ - 'NamespacedDummyModel' => $namespacedModel, - '{{ namespacedModel }}' => $namespacedModel, - '{{namespacedModel}}' => $namespacedModel, - 'DummyModel' => $model, - '{{ model }}' => $model, - '{{model}}' => $model, - 'dummyModel' => Str::camel($dummyModel), - '{{ modelVariable }}' => Str::camel($dummyModel), - '{{modelVariable}}' => Str::camel($dummyModel), - 'DummyUser' => $dummyUser, - '{{ user }}' => $dummyUser, - '{{user}}' => $dummyUser, - '$user' => '$'.Str::camel($dummyUser), - ]; - - $stub = str_replace( - array_keys($replace), array_values($replace), $stub - ); - - return preg_replace( - vsprintf('/use %s;[\r\n]+use %s;/', [ - preg_quote($namespacedModel, '/'), - preg_quote($namespacedModel, '/'), - ]), - "use {$namespacedModel};", - $stub - ); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return $this->option('model') - ? $this->resolveStubPath('/stubs/policy.stub') - : $this->resolveStubPath('/stubs/policy.plain.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Policies'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the policy already exists'], - ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the policy applies to'], - ['guard', 'g', InputOption::VALUE_OPTIONAL, 'The guard that the policy relies on'], - ]; - } - - /** - * Interact further with the user if they were prompted for missing arguments. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return void - */ - protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) - { - if ($this->didReceiveOptions($input)) { - return; - } - - $model = $this->components->askWithCompletion( - 'What model should this policy apply to?', - $this->possibleModels(), - 'none' - ); - - if ($model && $model !== 'none') { - $input->setOption('model', $model); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ProviderMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ProviderMakeCommand.php deleted file mode 100644 index a3b99d9..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ProviderMakeCommand.php +++ /dev/null @@ -1,89 +0,0 @@ -resolveStubPath('/stubs/provider.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Providers'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the provider already exists'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/QueuedCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/QueuedCommand.php deleted file mode 100644 index fb3d027..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/QueuedCommand.php +++ /dev/null @@ -1,42 +0,0 @@ -data = $data; - } - - /** - * Handle the job. - * - * @param \Illuminate\Contracts\Console\Kernel $kernel - * @return void - */ - public function handle(KernelContract $kernel) - { - $kernel->call(...array_values($this->data)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/RequestMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/RequestMakeCommand.php deleted file mode 100644 index f181ff0..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/RequestMakeCommand.php +++ /dev/null @@ -1,89 +0,0 @@ -resolveStubPath('/stubs/request.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Http\Requests'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the request already exists'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ResourceMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ResourceMakeCommand.php deleted file mode 100644 index 9fe4fdd..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ResourceMakeCommand.php +++ /dev/null @@ -1,117 +0,0 @@ -collection()) { - $this->type = 'Resource collection'; - } - - parent::handle(); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - return $this->collection() - ? $this->resolveStubPath('/stubs/resource-collection.stub') - : $this->resolveStubPath('/stubs/resource.stub'); - } - - /** - * Determine if the command is generating a resource collection. - * - * @return bool - */ - protected function collection() - { - return $this->option('collection') || - str_ends_with($this->argument('name'), 'Collection'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Http\Resources'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the resource already exists'], - ['collection', 'c', InputOption::VALUE_NONE, 'Create a resource collection'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/RouteCacheCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/RouteCacheCommand.php deleted file mode 100644 index 00f4050..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/RouteCacheCommand.php +++ /dev/null @@ -1,122 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->callSilent('route:clear'); - - $routes = $this->getFreshApplicationRoutes(); - - if (count($routes) === 0) { - return $this->components->error("Your application doesn't have any routes."); - } - - foreach ($routes as $route) { - $route->prepareForSerialization(); - } - - $this->files->put( - $this->laravel->getCachedRoutesPath(), $this->buildRouteCacheFile($routes) - ); - - $this->components->info('Routes cached successfully.'); - } - - /** - * Boot a fresh copy of the application and get the routes. - * - * @return \Illuminate\Routing\RouteCollection - */ - protected function getFreshApplicationRoutes() - { - return tap($this->getFreshApplication()['router']->getRoutes(), function ($routes) { - $routes->refreshNameLookups(); - $routes->refreshActionLookups(); - }); - } - - /** - * Get a fresh application instance. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - protected function getFreshApplication() - { - return tap(require $this->laravel->bootstrapPath().'/app.php', function ($app) { - $app->make(ConsoleKernelContract::class)->bootstrap(); - }); - } - - /** - * Build the route cache file. - * - * @param \Illuminate\Routing\RouteCollection $routes - * @return string - */ - protected function buildRouteCacheFile(RouteCollection $routes) - { - $stub = $this->files->get(__DIR__.'/stubs/routes.stub'); - - return str_replace('{{routes}}', var_export($routes->compile(), true), $stub); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/RouteClearCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/RouteClearCommand.php deleted file mode 100644 index da45e6d..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/RouteClearCommand.php +++ /dev/null @@ -1,68 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->files->delete($this->laravel->getCachedRoutesPath()); - - $this->components->info('Route cache cleared successfully.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/RouteListCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/RouteListCommand.php deleted file mode 100644 index caa8165..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/RouteListCommand.php +++ /dev/null @@ -1,508 +0,0 @@ - 'red', - 'GET' => 'blue', - 'HEAD' => '#6C7280', - 'OPTIONS' => '#6C7280', - 'POST' => 'yellow', - 'PUT' => 'yellow', - 'PATCH' => 'yellow', - 'DELETE' => 'red', - ]; - - /** - * Create a new route command instance. - * - * @param \Illuminate\Routing\Router $router - * @return void - */ - public function __construct(Router $router) - { - parent::__construct(); - - $this->router = $router; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->router->flushMiddlewareGroups(); - - if (! $this->router->getRoutes()->count()) { - return $this->components->error("Your application doesn't have any routes."); - } - - if (empty($routes = $this->getRoutes())) { - return $this->components->error("Your application doesn't have any routes matching the given criteria."); - } - - $this->displayRoutes($routes); - } - - /** - * Compile the routes into a displayable format. - * - * @return array - */ - protected function getRoutes() - { - $routes = collect($this->router->getRoutes())->map(function ($route) { - return $this->getRouteInformation($route); - })->filter()->all(); - - if (($sort = $this->option('sort')) !== null) { - $routes = $this->sortRoutes($sort, $routes); - } else { - $routes = $this->sortRoutes('uri', $routes); - } - - if ($this->option('reverse')) { - $routes = array_reverse($routes); - } - - return $this->pluckColumns($routes); - } - - /** - * Get the route information for a given route. - * - * @param \Illuminate\Routing\Route $route - * @return array - */ - protected function getRouteInformation(Route $route) - { - return $this->filterRoute([ - 'domain' => $route->domain(), - 'method' => implode('|', $route->methods()), - 'uri' => $route->uri(), - 'name' => $route->getName(), - 'action' => ltrim($route->getActionName(), '\\'), - 'middleware' => $this->getMiddleware($route), - 'vendor' => $this->isVendorRoute($route), - ]); - } - - /** - * Sort the routes by a given element. - * - * @param string $sort - * @param array $routes - * @return array - */ - protected function sortRoutes($sort, array $routes) - { - return Arr::sort($routes, function ($route) use ($sort) { - return $route[$sort]; - }); - } - - /** - * Remove unnecessary columns from the routes. - * - * @param array $routes - * @return array - */ - protected function pluckColumns(array $routes) - { - return array_map(function ($route) { - return Arr::only($route, $this->getColumns()); - }, $routes); - } - - /** - * Display the route information on the console. - * - * @param array $routes - * @return void - */ - protected function displayRoutes(array $routes) - { - $routes = collect($routes); - - $this->output->writeln( - $this->option('json') ? $this->asJson($routes) : $this->forCli($routes) - ); - } - - /** - * Get the middleware for the route. - * - * @param \Illuminate\Routing\Route $route - * @return string - */ - protected function getMiddleware($route) - { - return collect($this->router->gatherRouteMiddleware($route))->map(function ($middleware) { - return $middleware instanceof Closure ? 'Closure' : $middleware; - })->implode("\n"); - } - - /** - * Determine if the route has been defined outside of the application. - * - * @param \Illuminate\Routing\Route $route - * @return bool - */ - protected function isVendorRoute(Route $route) - { - if ($route->action['uses'] instanceof Closure) { - $path = (new ReflectionFunction($route->action['uses'])) - ->getFileName(); - } elseif (is_string($route->action['uses']) && - str_contains($route->action['uses'], 'SerializableClosure')) { - return false; - } elseif (is_string($route->action['uses'])) { - if ($this->isFrameworkController($route)) { - return false; - } - - $path = (new ReflectionClass($route->getControllerClass())) - ->getFileName(); - } else { - return false; - } - - return str_starts_with($path, base_path('vendor')); - } - - /** - * Determine if the route uses a framework controller. - * - * @param \Illuminate\Routing\Route $route - * @return bool - */ - protected function isFrameworkController(Route $route) - { - return in_array($route->getControllerClass(), [ - '\Illuminate\Routing\RedirectController', - '\Illuminate\Routing\ViewController', - ], true); - } - - /** - * Filter the route by URI and / or name. - * - * @param array $route - * @return array|null - */ - protected function filterRoute(array $route) - { - if (($this->option('name') && ! Str::contains((string) $route['name'], $this->option('name'))) || - ($this->option('path') && ! Str::contains($route['uri'], $this->option('path'))) || - ($this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) || - ($this->option('domain') && ! Str::contains((string) $route['domain'], $this->option('domain'))) || - ($this->option('except-vendor') && $route['vendor']) || - ($this->option('only-vendor') && ! $route['vendor'])) { - return; - } - - if ($this->option('except-path')) { - foreach (explode(',', $this->option('except-path')) as $path) { - if (str_contains($route['uri'], $path)) { - return; - } - } - } - - return $route; - } - - /** - * Get the table headers for the visible columns. - * - * @return array - */ - protected function getHeaders() - { - return Arr::only($this->headers, array_keys($this->getColumns())); - } - - /** - * Get the column names to show (lowercase table headers). - * - * @return array - */ - protected function getColumns() - { - return array_map('strtolower', $this->headers); - } - - /** - * Parse the column list. - * - * @param array $columns - * @return array - */ - protected function parseColumns(array $columns) - { - $results = []; - - foreach ($columns as $column) { - if (str_contains($column, ',')) { - $results = array_merge($results, explode(',', $column)); - } else { - $results[] = $column; - } - } - - return array_map('strtolower', $results); - } - - /** - * Convert the given routes to JSON. - * - * @param \Illuminate\Support\Collection $routes - * @return string - */ - protected function asJson($routes) - { - return $routes - ->map(function ($route) { - $route['middleware'] = empty($route['middleware']) ? [] : explode("\n", $route['middleware']); - - return $route; - }) - ->values() - ->toJson(); - } - - /** - * Convert the given routes to regular CLI output. - * - * @param \Illuminate\Support\Collection $routes - * @return array - */ - protected function forCli($routes) - { - $routes = $routes->map( - fn ($route) => array_merge($route, [ - 'action' => $this->formatActionForCli($route), - 'method' => $route['method'] == 'GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS' ? 'ANY' : $route['method'], - 'uri' => $route['domain'] ? ($route['domain'].'/'.ltrim($route['uri'], '/')) : $route['uri'], - ]), - ); - - $maxMethod = mb_strlen($routes->max('method')); - - $terminalWidth = $this->getTerminalWidth(); - - $routeCount = $this->determineRouteCountOutput($routes, $terminalWidth); - - return $routes->map(function ($route) use ($maxMethod, $terminalWidth) { - [ - 'action' => $action, - 'domain' => $domain, - 'method' => $method, - 'middleware' => $middleware, - 'uri' => $uri, - ] = $route; - - $middleware = Str::of($middleware)->explode("\n")->filter()->whenNotEmpty( - fn ($collection) => $collection->map( - fn ($middleware) => sprintf(' %s⇂ %s', str_repeat(' ', $maxMethod), $middleware) - ) - )->implode("\n"); - - $spaces = str_repeat(' ', max($maxMethod + 6 - mb_strlen($method), 0)); - - $dots = str_repeat('.', max( - $terminalWidth - mb_strlen($method.$spaces.$uri.$action) - 6 - ($action ? 1 : 0), 0 - )); - - $dots = empty($dots) ? $dots : " $dots"; - - if ($action && ! $this->output->isVerbose() && mb_strlen($method.$spaces.$uri.$action.$dots) > ($terminalWidth - 6)) { - $action = substr($action, 0, $terminalWidth - 7 - mb_strlen($method.$spaces.$uri.$dots)).'…'; - } - - $method = Str::of($method)->explode('|')->map( - fn ($method) => sprintf('%s', $this->verbColors[$method] ?? 'default', $method), - )->implode('|'); - - return [sprintf( - ' %s %s%s%s %s', - $method, - $spaces, - preg_replace('#({[^}]+})#', '$1', $uri), - $dots, - str_replace(' ', ' › ', $action ?? ''), - ), $this->output->isVerbose() && ! empty($middleware) ? "$middleware" : null]; - }) - ->flatten() - ->filter() - ->prepend('') - ->push('')->push($routeCount)->push('') - ->toArray(); - } - - /** - * Get the formatted action for display on the CLI. - * - * @param array $route - * @return string - */ - protected function formatActionForCli($route) - { - ['action' => $action, 'name' => $name] = $route; - - if ($action === 'Closure' || $action === ViewController::class) { - return $name; - } - - $name = $name ? "$name " : null; - - $rootControllerNamespace = $this->laravel[UrlGenerator::class]->getRootControllerNamespace() - ?? ($this->laravel->getNamespace().'Http\\Controllers'); - - if (str_starts_with($action, $rootControllerNamespace)) { - return $name.substr($action, mb_strlen($rootControllerNamespace) + 1); - } - - $actionClass = explode('@', $action)[0]; - - if (class_exists($actionClass) && str_starts_with((new ReflectionClass($actionClass))->getFilename(), base_path('vendor'))) { - $actionCollection = collect(explode('\\', $action)); - - return $name.$actionCollection->take(2)->implode('\\').' '.$actionCollection->last(); - } - - return $name.$action; - } - - /** - * Determine and return the output for displaying the number of routes in the CLI output. - * - * @param \Illuminate\Support\Collection $routes - * @param int $terminalWidth - * @return string - */ - protected function determineRouteCountOutput($routes, $terminalWidth) - { - $routeCountText = 'Showing ['.$routes->count().'] routes'; - - $offset = $terminalWidth - mb_strlen($routeCountText) - 2; - - $spaces = str_repeat(' ', $offset); - - return $spaces.'Showing ['.$routes->count().'] routes'; - } - - /** - * Get the terminal width. - * - * @return int - */ - public static function getTerminalWidth() - { - return is_null(static::$terminalWidthResolver) - ? (new Terminal)->getWidth() - : call_user_func(static::$terminalWidthResolver); - } - - /** - * Set a callback that should be used when resolving the terminal width. - * - * @param \Closure|null $resolver - * @return void - */ - public static function resolveTerminalWidthUsing($resolver) - { - static::$terminalWidthResolver = $resolver; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['json', null, InputOption::VALUE_NONE, 'Output the route list as JSON'], - ['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'], - ['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'], - ['domain', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by domain'], - ['path', null, InputOption::VALUE_OPTIONAL, 'Only show routes matching the given path pattern'], - ['except-path', null, InputOption::VALUE_OPTIONAL, 'Do not display the routes matching the given path pattern'], - ['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'], - ['sort', null, InputOption::VALUE_OPTIONAL, 'The column (domain, method, uri, name, action, middleware) to sort by', 'uri'], - ['except-vendor', null, InputOption::VALUE_NONE, 'Do not display routes defined by vendor packages'], - ['only-vendor', null, InputOption::VALUE_NONE, 'Only display routes defined by vendor packages'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/RuleMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/RuleMakeCommand.php deleted file mode 100644 index 5cefd1f..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/RuleMakeCommand.php +++ /dev/null @@ -1,107 +0,0 @@ -option('implicit') ? 'ImplicitRule' : 'Rule', - parent::buildClass($name) - ); - } - - /** - * Get the stub file for the generator. - * - * @return string - */ - protected function getStub() - { - $stub = '/stubs/rule.stub'; - - if ($this->option('invokable')) { - $stub = '/stubs/rule.invokable.stub'; - } - - if ($this->option('implicit') && $this->option('invokable')) { - $stub = str_replace('.stub', '.implicit.stub', $stub); - } - - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Rules'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the rule already exists'], - ['implicit', 'i', InputOption::VALUE_NONE, 'Generate an implicit rule'], - ['invokable', null, InputOption::VALUE_NONE, 'Generate a single method, invokable rule class'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ScopeMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ScopeMakeCommand.php deleted file mode 100644 index d36742c..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ScopeMakeCommand.php +++ /dev/null @@ -1,89 +0,0 @@ -resolveStubPath('/stubs/scope.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return is_dir(app_path('Models')) ? $rootNamespace.'\\Models\\Scopes' : $rootNamespace.'\Scopes'; - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the scope already exists'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ServeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ServeCommand.php deleted file mode 100644 index 67321fd..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ServeCommand.php +++ /dev/null @@ -1,339 +0,0 @@ - - */ - protected $requestsPool; - - /** - * Indicates if the "Server running on..." output message has been displayed. - * - * @var bool - */ - protected $serverRunningHasBeenDisplayed = false; - - /** - * The environment variables that should be passed from host machine to the PHP server process. - * - * @var string[] - */ - public static $passthroughVariables = [ - 'APP_ENV', - 'LARAVEL_SAIL', - 'PATH', - 'PHP_CLI_SERVER_WORKERS', - 'PHP_IDE_CONFIG', - 'SYSTEMROOT', - 'XDEBUG_CONFIG', - 'XDEBUG_MODE', - 'XDEBUG_SESSION', - ]; - - /** - * Execute the console command. - * - * @return int - * - * @throws \Exception - */ - public function handle() - { - $environmentFile = $this->option('env') - ? base_path('.env').'.'.$this->option('env') - : base_path('.env'); - - $hasEnvironment = file_exists($environmentFile); - - $environmentLastModified = $hasEnvironment - ? filemtime($environmentFile) - : now()->addDays(30)->getTimestamp(); - - $process = $this->startProcess($hasEnvironment); - - while ($process->isRunning()) { - if ($hasEnvironment) { - clearstatcache(false, $environmentFile); - } - - if (! $this->option('no-reload') && - $hasEnvironment && - filemtime($environmentFile) > $environmentLastModified) { - $environmentLastModified = filemtime($environmentFile); - - $this->newLine(); - - $this->components->info('Environment modified. Restarting server...'); - - $process->stop(5); - - $this->serverRunningHasBeenDisplayed = false; - - $process = $this->startProcess($hasEnvironment); - } - - usleep(500 * 1000); - } - - $status = $process->getExitCode(); - - if ($status && $this->canTryAnotherPort()) { - $this->portOffset += 1; - - return $this->handle(); - } - - return $status; - } - - /** - * Start a new server process. - * - * @param bool $hasEnvironment - * @return \Symfony\Component\Process\Process - */ - protected function startProcess($hasEnvironment) - { - $process = new Process($this->serverCommand(), public_path(), collect($_ENV)->mapWithKeys(function ($value, $key) use ($hasEnvironment) { - if ($this->option('no-reload') || ! $hasEnvironment) { - return [$key => $value]; - } - - return in_array($key, static::$passthroughVariables) ? [$key => $value] : [$key => false]; - })->all()); - - $process->start($this->handleProcessOutput()); - - return $process; - } - - /** - * Get the full server command. - * - * @return array - */ - protected function serverCommand() - { - $server = file_exists(base_path('server.php')) - ? base_path('server.php') - : __DIR__.'/../resources/server.php'; - - return [ - (new PhpExecutableFinder)->find(false), - '-S', - $this->host().':'.$this->port(), - $server, - ]; - } - - /** - * Get the host for the command. - * - * @return string - */ - protected function host() - { - [$host] = $this->getHostAndPort(); - - return $host; - } - - /** - * Get the port for the command. - * - * @return string - */ - protected function port() - { - $port = $this->input->getOption('port'); - - if (is_null($port)) { - [, $port] = $this->getHostAndPort(); - } - - $port = $port ?: 8000; - - return $port + $this->portOffset; - } - - /** - * Get the host and port from the host option string. - * - * @return array - */ - protected function getHostAndPort() - { - $hostParts = explode(':', $this->input->getOption('host')); - - return [ - $hostParts[0], - $hostParts[1] ?? null, - ]; - } - - /** - * Check if the command has reached its maximum number of port tries. - * - * @return bool - */ - protected function canTryAnotherPort() - { - return is_null($this->input->getOption('port')) && - ($this->input->getOption('tries') > $this->portOffset); - } - - /** - * Returns a "callable" to handle the process output. - * - * @return callable(string, string): void - */ - protected function handleProcessOutput() - { - return fn ($type, $buffer) => str($buffer)->explode("\n")->each(function ($line) { - if (str($line)->contains('Development Server (http')) { - if ($this->serverRunningHasBeenDisplayed) { - return; - } - - $this->components->info("Server running on [http://{$this->host()}:{$this->port()}]."); - $this->comment(' Press Ctrl+C to stop the server'); - - $this->newLine(); - - $this->serverRunningHasBeenDisplayed = true; - } elseif (str($line)->contains(' Accepted')) { - $requestPort = $this->getRequestPortFromLine($line); - - $this->requestsPool[$requestPort] = [ - $this->getDateFromLine($line), - false, - ]; - } elseif (str($line)->contains([' [200]: GET '])) { - $requestPort = $this->getRequestPortFromLine($line); - - $this->requestsPool[$requestPort][1] = trim(explode('[200]: GET', $line)[1]); - } elseif (str($line)->contains(' Closing')) { - $requestPort = $this->getRequestPortFromLine($line); - $request = $this->requestsPool[$requestPort]; - - [$startDate, $file] = $request; - - $formattedStartedAt = $startDate->format('Y-m-d H:i:s'); - - unset($this->requestsPool[$requestPort]); - - [$date, $time] = explode(' ', $formattedStartedAt); - - $this->output->write(" $date $time"); - - $runTime = $this->getDateFromLine($line)->diffInSeconds($startDate); - - if ($file) { - $this->output->write($file = " $file"); - } - - $dots = max(terminal()->width() - mb_strlen($formattedStartedAt) - mb_strlen($file) - mb_strlen($runTime) - 9, 0); - - $this->output->write(' '.str_repeat('.', $dots)); - $this->output->writeln(" ~ {$runTime}s"); - } elseif (str($line)->contains(['Closed without sending a request'])) { - // ... - } elseif (! empty($line)) { - $warning = explode('] ', $line); - $this->components->warn(count($warning) > 1 ? $warning[1] : $warning[0]); - } - }); - } - - /** - * Get the date from the given PHP server output. - * - * @param string $line - * @return \Illuminate\Support\Carbon - */ - protected function getDateFromLine($line) - { - $regex = env('PHP_CLI_SERVER_WORKERS', 1) > 1 - ? '/^\[\d+]\s\[([a-zA-Z0-9: ]+)\]/' - : '/^\[([^\]]+)\]/'; - - preg_match($regex, $line, $matches); - - return Carbon::createFromFormat('D M d H:i:s Y', $matches[1]); - } - - /** - * Get the request port from the given PHP server output. - * - * @param string $line - * @return int - */ - protected function getRequestPortFromLine($line) - { - preg_match('/:(\d+)\s(?:(?:\w+$)|(?:\[.*))/', $line, $matches); - - return (int) $matches[1]; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', Env::get('SERVER_HOST', '127.0.0.1')], - ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', Env::get('SERVER_PORT')], - ['tries', null, InputOption::VALUE_OPTIONAL, 'The max number of ports to attempt to serve from', 10], - ['no-reload', null, InputOption::VALUE_NONE, 'Do not reload the development server on .env file changes'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ShowModelCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ShowModelCommand.php deleted file mode 100644 index 5b15aaf..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ShowModelCommand.php +++ /dev/null @@ -1,547 +0,0 @@ -ensureDependenciesExist()) { - return 1; - } - - $class = $this->qualifyModel($this->argument('model')); - - try { - $model = $this->laravel->make($class); - - $class = get_class($model); - } catch (BindingResolutionException $e) { - return $this->components->error($e->getMessage()); - } - - if ($this->option('database')) { - $model->setConnection($this->option('database')); - } - - $this->display( - $class, - $model->getConnection()->getName(), - $model->getConnection()->getTablePrefix().$model->getTable(), - $this->getPolicy($model), - $this->getAttributes($model), - $this->getRelations($model), - $this->getObservers($model), - ); - } - - /** - * Get the first policy associated with this model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return Illuminate\Support\Collection - */ - protected function getPolicy($model) - { - return collect(Gate::policies()) - ->filter(fn ($policy, $modelClass) => $modelClass === get_class($model)) - ->values() - ->first(); - } - - /** - * Get the column attributes for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Support\Collection - */ - protected function getAttributes($model) - { - $schema = $model->getConnection()->getDoctrineSchemaManager(); - $this->registerTypeMappings($schema->getDatabasePlatform()); - $table = $model->getConnection()->getTablePrefix().$model->getTable(); - $columns = $schema->listTableColumns($table); - $indexes = $schema->listTableIndexes($table); - - return collect($columns) - ->values() - ->map(fn (Column $column) => [ - 'name' => $column->getName(), - 'type' => $this->getColumnType($column), - 'increments' => $column->getAutoincrement(), - 'nullable' => ! $column->getNotnull(), - 'default' => $this->getColumnDefault($column, $model), - 'unique' => $this->columnIsUnique($column->getName(), $indexes), - 'fillable' => $model->isFillable($column->getName()), - 'hidden' => $this->attributeIsHidden($column->getName(), $model), - 'appended' => null, - 'cast' => $this->getCastType($column->getName(), $model), - ]) - ->merge($this->getVirtualAttributes($model, $columns)); - } - - /** - * Get the virtual (non-column) attributes for the given model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param \Doctrine\DBAL\Schema\Column[] $columns - * @return \Illuminate\Support\Collection - */ - protected function getVirtualAttributes($model, $columns) - { - $class = new ReflectionClass($model); - - return collect($class->getMethods()) - ->reject( - fn (ReflectionMethod $method) => $method->isStatic() - || $method->isAbstract() - || $method->getDeclaringClass()->getName() !== get_class($model) - ) - ->mapWithKeys(function (ReflectionMethod $method) use ($model) { - if (preg_match('/^get(.+)Attribute$/', $method->getName(), $matches) === 1) { - return [Str::snake($matches[1]) => 'accessor']; - } elseif ($model->hasAttributeMutator($method->getName())) { - return [Str::snake($method->getName()) => 'attribute']; - } else { - return []; - } - }) - ->reject(fn ($cast, $name) => collect($columns)->has($name)) - ->map(fn ($cast, $name) => [ - 'name' => $name, - 'type' => null, - 'increments' => false, - 'nullable' => null, - 'default' => null, - 'unique' => null, - 'fillable' => $model->isFillable($name), - 'hidden' => $this->attributeIsHidden($name, $model), - 'appended' => $model->hasAppended($name), - 'cast' => $cast, - ]) - ->values(); - } - - /** - * Get the relations from the given model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Support\Collection - */ - protected function getRelations($model) - { - return collect(get_class_methods($model)) - ->map(fn ($method) => new ReflectionMethod($model, $method)) - ->reject( - fn (ReflectionMethod $method) => $method->isStatic() - || $method->isAbstract() - || $method->getDeclaringClass()->getName() !== get_class($model) - ) - ->filter(function (ReflectionMethod $method) { - $file = new SplFileObject($method->getFileName()); - $file->seek($method->getStartLine() - 1); - $code = ''; - while ($file->key() < $method->getEndLine()) { - $code .= trim($file->current()); - $file->next(); - } - - return collect($this->relationMethods) - ->contains(fn ($relationMethod) => str_contains($code, '$this->'.$relationMethod.'(')); - }) - ->map(function (ReflectionMethod $method) use ($model) { - $relation = $method->invoke($model); - - if (! $relation instanceof Relation) { - return null; - } - - return [ - 'name' => $method->getName(), - 'type' => Str::afterLast(get_class($relation), '\\'), - 'related' => get_class($relation->getRelated()), - ]; - }) - ->filter() - ->values(); - } - - /** - * Get the Observers watching this model. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return Illuminate\Support\Collection - */ - protected function getObservers($model) - { - $listeners = $this->getLaravel()->make('events')->getRawListeners(); - - // Get the Eloquent observers for this model... - $listeners = array_filter($listeners, function ($v, $key) use ($model) { - return Str::startsWith($key, 'eloquent.') && Str::endsWith($key, $model::class); - }, ARRAY_FILTER_USE_BOTH); - - // Format listeners Eloquent verb => Observer methods... - $extractVerb = function ($key) { - preg_match('/eloquent.([a-zA-Z]+)\: /', $key, $matches); - - return $matches[1] ?? '?'; - }; - - $formatted = []; - - foreach ($listeners as $key => $observerMethods) { - $formatted[] = [ - 'event' => $extractVerb($key), - 'observer' => array_map(fn ($obs) => is_string($obs) ? $obs : 'Closure', $observerMethods), - ]; - } - - return collect($formatted); - } - - /** - * Render the model information. - * - * @param string $class - * @param string $database - * @param string $table - * @param string $policy - * @param \Illuminate\Support\Collection $attributes - * @param \Illuminate\Support\Collection $relations - * @param \Illuminate\Support\Collection $observers - * @return void - */ - protected function display($class, $database, $table, $policy, $attributes, $relations, $observers) - { - $this->option('json') - ? $this->displayJson($class, $database, $table, $policy, $attributes, $relations, $observers) - : $this->displayCli($class, $database, $table, $policy, $attributes, $relations, $observers); - } - - /** - * Render the model information as JSON. - * - * @param string $class - * @param string $database - * @param string $table - * @param string $policy - * @param \Illuminate\Support\Collection $attributes - * @param \Illuminate\Support\Collection $relations - * @param \Illuminate\Support\Collection $observers - * @return void - */ - protected function displayJson($class, $database, $table, $policy, $attributes, $relations, $observers) - { - $this->output->writeln( - collect([ - 'class' => $class, - 'database' => $database, - 'table' => $table, - 'policy' => $policy, - 'attributes' => $attributes, - 'relations' => $relations, - 'observers' => $observers, - ])->toJson() - ); - } - - /** - * Render the model information for the CLI. - * - * @param string $class - * @param string $database - * @param string $table - * @param string $policy - * @param \Illuminate\Support\Collection $attributes - * @param \Illuminate\Support\Collection $relations - * @param \Illuminate\Support\Collection $observers - * @return void - */ - protected function displayCli($class, $database, $table, $policy, $attributes, $relations, $observers) - { - $this->newLine(); - - $this->components->twoColumnDetail(''.$class.''); - $this->components->twoColumnDetail('Database', $database); - $this->components->twoColumnDetail('Table', $table); - - if ($policy) { - $this->components->twoColumnDetail('Policy', $policy); - } - - $this->newLine(); - - $this->components->twoColumnDetail( - 'Attributes', - 'type / cast', - ); - - foreach ($attributes as $attribute) { - $first = trim(sprintf( - '%s %s', - $attribute['name'], - collect(['increments', 'unique', 'nullable', 'fillable', 'hidden', 'appended']) - ->filter(fn ($property) => $attribute[$property]) - ->map(fn ($property) => sprintf('%s', $property)) - ->implode(', ') - )); - - $second = collect([ - $attribute['type'], - $attribute['cast'] ? ''.$attribute['cast'].'' : null, - ])->filter()->implode(' / '); - - $this->components->twoColumnDetail($first, $second); - - if ($attribute['default'] !== null) { - $this->components->bulletList( - [sprintf('default: %s', $attribute['default'])], - OutputInterface::VERBOSITY_VERBOSE - ); - } - } - - $this->newLine(); - - $this->components->twoColumnDetail('Relations'); - - foreach ($relations as $relation) { - $this->components->twoColumnDetail( - sprintf('%s %s', $relation['name'], $relation['type']), - $relation['related'] - ); - } - - $this->newLine(); - - $this->components->twoColumnDetail('Observers'); - - if ($observers->count()) { - foreach ($observers as $observer) { - $this->components->twoColumnDetail( - sprintf('%s', $observer['event']), - implode(', ', $observer['observer']) - ); - } - } - - $this->newLine(); - } - - /** - * Get the cast type for the given column. - * - * @param string $column - * @param \Illuminate\Database\Eloquent\Model $model - * @return string|null - */ - protected function getCastType($column, $model) - { - if ($model->hasGetMutator($column) || $model->hasSetMutator($column)) { - return 'accessor'; - } - - if ($model->hasAttributeMutator($column)) { - return 'attribute'; - } - - return $this->getCastsWithDates($model)->get($column) ?? null; - } - - /** - * Get the model casts, including any date casts. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Support\Collection - */ - protected function getCastsWithDates($model) - { - return collect($model->getDates()) - ->filter() - ->flip() - ->map(fn () => 'datetime') - ->merge($model->getCasts()); - } - - /** - * Get the type of the given column. - * - * @param \Doctrine\DBAL\Schema\Column $column - * @return string - */ - protected function getColumnType($column) - { - $name = $column->getType()->getName(); - - $unsigned = $column->getUnsigned() ? ' unsigned' : ''; - - $details = match (get_class($column->getType())) { - DecimalType::class => $column->getPrecision().','.$column->getScale(), - default => $column->getLength(), - }; - - if ($details) { - return sprintf('%s(%s)%s', $name, $details, $unsigned); - } - - return sprintf('%s%s', $name, $unsigned); - } - - /** - * Get the default value for the given column. - * - * @param \Doctrine\DBAL\Schema\Column $column - * @param \Illuminate\Database\Eloquent\Model $model - * @return mixed|null - */ - protected function getColumnDefault($column, $model) - { - $attributeDefault = $model->getAttributes()[$column->getName()] ?? null; - - return match (true) { - $attributeDefault instanceof BackedEnum => $attributeDefault->value, - $attributeDefault instanceof UnitEnum => $attributeDefault->name, - default => $attributeDefault ?? $column->getDefault(), - }; - } - - /** - * Determine if the given attribute is hidden. - * - * @param string $attribute - * @param \Illuminate\Database\Eloquent\Model $model - * @return bool - */ - protected function attributeIsHidden($attribute, $model) - { - if (count($model->getHidden()) > 0) { - return in_array($attribute, $model->getHidden()); - } - - if (count($model->getVisible()) > 0) { - return ! in_array($attribute, $model->getVisible()); - } - - return false; - } - - /** - * Determine if the given attribute is unique. - * - * @param string $column - * @param \Doctrine\DBAL\Schema\Index[] $indexes - * @return bool - */ - protected function columnIsUnique($column, $indexes) - { - return collect($indexes) - ->filter(fn (Index $index) => count($index->getColumns()) === 1 && $index->getColumns()[0] === $column) - ->contains(fn (Index $index) => $index->isUnique()); - } - - /** - * Qualify the given model class base name. - * - * @param string $model - * @return string - * - * @see \Illuminate\Console\GeneratorCommand - */ - protected function qualifyModel(string $model) - { - if (str_contains($model, '\\') && class_exists($model)) { - return $model; - } - - $model = ltrim($model, '\\/'); - - $model = str_replace('/', '\\', $model); - - $rootNamespace = $this->laravel->getNamespace(); - - if (Str::startsWith($model, $rootNamespace)) { - return $model; - } - - return is_dir(app_path('Models')) - ? $rootNamespace.'Models\\'.$model - : $rootNamespace.$model; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/StorageLinkCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/StorageLinkCommand.php deleted file mode 100644 index 1042755..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/StorageLinkCommand.php +++ /dev/null @@ -1,89 +0,0 @@ -option('relative'); - - foreach ($this->links() as $link => $target) { - if (file_exists($link) && ! $this->isRemovableSymlink($link, $this->option('force'))) { - $this->components->error("The [$link] link already exists."); - continue; - } - - if (is_link($link)) { - $this->laravel->make('files')->delete($link); - } - - if ($relative) { - $this->laravel->make('files')->relativeLink($target, $link); - } else { - $this->laravel->make('files')->link($target, $link); - } - - $this->components->info("The [$link] link has been connected to [$target]."); - } - } - - /** - * Get the symbolic links that are configured for the application. - * - * @return array - */ - protected function links() - { - return $this->laravel['config']['filesystems.links'] ?? - [public_path('storage') => storage_path('app/public')]; - } - - /** - * Determine if the provided path is a symlink that can be removed. - * - * @param string $link - * @param bool $force - * @return bool - */ - protected function isRemovableSymlink(string $link, bool $force): bool - { - return is_link($link) && $force; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/StubPublishCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/StubPublishCommand.php deleted file mode 100644 index 58bf204..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/StubPublishCommand.php +++ /dev/null @@ -1,110 +0,0 @@ -laravel->basePath('stubs'))) { - (new Filesystem)->makeDirectory($stubsPath); - } - - $stubs = [ - __DIR__.'/stubs/cast.inbound.stub' => 'cast.inbound.stub', - __DIR__.'/stubs/cast.stub' => 'cast.stub', - __DIR__.'/stubs/console.stub' => 'console.stub', - __DIR__.'/stubs/event.stub' => 'event.stub', - __DIR__.'/stubs/job.queued.stub' => 'job.queued.stub', - __DIR__.'/stubs/job.stub' => 'job.stub', - __DIR__.'/stubs/mail.stub' => 'mail.stub', - __DIR__.'/stubs/markdown-mail.stub' => 'markdown-mail.stub', - __DIR__.'/stubs/markdown-notification.stub' => 'markdown-notification.stub', - __DIR__.'/stubs/model.pivot.stub' => 'model.pivot.stub', - __DIR__.'/stubs/model.stub' => 'model.stub', - __DIR__.'/stubs/notification.stub' => 'notification.stub', - __DIR__.'/stubs/observer.plain.stub' => 'observer.plain.stub', - __DIR__.'/stubs/observer.stub' => 'observer.stub', - __DIR__.'/stubs/policy.plain.stub' => 'policy.plain.stub', - __DIR__.'/stubs/policy.stub' => 'policy.stub', - __DIR__.'/stubs/provider.stub' => 'provider.stub', - __DIR__.'/stubs/request.stub' => 'request.stub', - __DIR__.'/stubs/resource.stub' => 'resource.stub', - __DIR__.'/stubs/resource-collection.stub' => 'resource-collection.stub', - __DIR__.'/stubs/rule.stub' => 'rule.stub', - __DIR__.'/stubs/scope.stub' => 'scope.stub', - __DIR__.'/stubs/test.stub' => 'test.stub', - __DIR__.'/stubs/test.unit.stub' => 'test.unit.stub', - __DIR__.'/stubs/view-component.stub' => 'view-component.stub', - realpath(__DIR__.'/../../Database/Console/Factories/stubs/factory.stub') => 'factory.stub', - realpath(__DIR__.'/../../Database/Console/Seeds/stubs/seeder.stub') => 'seeder.stub', - realpath(__DIR__.'/../../Database/Migrations/stubs/migration.create.stub') => 'migration.create.stub', - realpath(__DIR__.'/../../Database/Migrations/stubs/migration.stub') => 'migration.stub', - realpath(__DIR__.'/../../Database/Migrations/stubs/migration.update.stub') => 'migration.update.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.api.stub') => 'controller.api.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.invokable.stub') => 'controller.invokable.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.model.api.stub') => 'controller.model.api.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.model.stub') => 'controller.model.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.nested.api.stub') => 'controller.nested.api.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.nested.singleton.api.stub') => 'controller.nested.singleton.api.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.nested.singleton.stub') => 'controller.nested.singleton.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.nested.stub') => 'controller.nested.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.plain.stub') => 'controller.plain.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.singleton.api.stub') => 'controller.singleton.api.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.singleton.stub') => 'controller.singleton.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/controller.stub') => 'controller.stub', - realpath(__DIR__.'/../../Routing/Console/stubs/middleware.stub') => 'middleware.stub', - ]; - - $this->laravel['events']->dispatch($event = new PublishingStubs($stubs)); - - foreach ($event->stubs as $from => $to) { - $to = $stubsPath.DIRECTORY_SEPARATOR.ltrim($to, DIRECTORY_SEPARATOR); - - if ((! $this->option('existing') && (! file_exists($to) || $this->option('force'))) - || ($this->option('existing') && file_exists($to))) { - file_put_contents($to, file_get_contents($from)); - } - } - - $this->components->info('Stubs published successfully.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/TestMakeCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/TestMakeCommand.php deleted file mode 100644 index 5ddccb3..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/TestMakeCommand.php +++ /dev/null @@ -1,153 +0,0 @@ -option('unit') ? '.unit.stub' : '.stub'; - - return $this->option('pest') - ? $this->resolveStubPath('/stubs/pest'.$suffix) - : $this->resolveStubPath('/stubs/test'.$suffix); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the destination class path. - * - * @param string $name - * @return string - */ - protected function getPath($name) - { - $name = Str::replaceFirst($this->rootNamespace(), '', $name); - - return base_path('tests').str_replace('\\', '/', $name).'.php'; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - if ($this->option('unit')) { - return $rootNamespace.'\Unit'; - } else { - return $rootNamespace.'\Feature'; - } - } - - /** - * Get the root namespace for the class. - * - * @return string - */ - protected function rootNamespace() - { - return 'Tests'; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the test already exists'], - ['unit', 'u', InputOption::VALUE_NONE, 'Create a unit test'], - ['pest', 'p', InputOption::VALUE_NONE, 'Create a Pest test'], - ]; - } - - /** - * Interact further with the user if they were prompted for missing arguments. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return void - */ - protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) - { - if ($this->didReceiveOptions($input)) { - return; - } - - $type = $this->components->choice('Which type of test would you like', [ - 'feature', - 'unit', - 'pest feature', - 'pest unit', - ], default: 0); - - match ($type) { - 'feature' => null, - 'unit' => $input->setOption('unit', true), - 'pest feature' => $input->setOption('pest', true), - 'pest unit' => tap($input)->setOption('pest', true)->setOption('unit', true), - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/UpCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/UpCommand.php deleted file mode 100644 index 000d3c6..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/UpCommand.php +++ /dev/null @@ -1,72 +0,0 @@ -laravel->maintenanceMode()->active()) { - $this->components->info('Application is already up.'); - - return 0; - } - - $this->laravel->maintenanceMode()->deactivate(); - - if (is_file(storage_path('framework/maintenance.php'))) { - unlink(storage_path('framework/maintenance.php')); - } - - $this->laravel->get('events')->dispatch(new MaintenanceModeDisabled()); - - $this->components->info('Application is now live.'); - } catch (Exception $e) { - $this->components->error(sprintf( - 'Failed to disable maintenance mode: %s.', - $e->getMessage(), - )); - - return 1; - } - - return 0; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/VendorPublishCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/VendorPublishCommand.php deleted file mode 100644 index ad41fa7..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/VendorPublishCommand.php +++ /dev/null @@ -1,339 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->determineWhatShouldBePublished(); - - foreach ($this->tags ?: [null] as $tag) { - $this->publishTag($tag); - } - } - - /** - * Determine the provider or tag(s) to publish. - * - * @return void - */ - protected function determineWhatShouldBePublished() - { - if ($this->option('all')) { - return; - } - - [$this->provider, $this->tags] = [ - $this->option('provider'), (array) $this->option('tag'), - ]; - - if (! $this->provider && ! $this->tags) { - $this->promptForProviderOrTag(); - } - } - - /** - * Prompt for which provider or tag to publish. - * - * @return void - */ - protected function promptForProviderOrTag() - { - $choice = $this->components->choice( - "Which provider or tag's files would you like to publish?", - $choices = $this->publishableChoices() - ); - - if ($choice == $choices[0] || is_null($choice)) { - return; - } - - $this->parseChoice($choice); - } - - /** - * The choices available via the prompt. - * - * @return array - */ - protected function publishableChoices() - { - return array_merge( - ['Publish files from all providers and tags listed below'], - preg_filter('/^/', 'Provider: ', Arr::sort(ServiceProvider::publishableProviders())), - preg_filter('/^/', 'Tag: ', Arr::sort(ServiceProvider::publishableGroups())) - ); - } - - /** - * Parse the answer that was given via the prompt. - * - * @param string $choice - * @return void - */ - protected function parseChoice($choice) - { - [$type, $value] = explode(': ', strip_tags($choice)); - - if ($type === 'Provider') { - $this->provider = $value; - } elseif ($type === 'Tag') { - $this->tags = [$value]; - } - } - - /** - * Publishes the assets for a tag. - * - * @param string $tag - * @return mixed - */ - protected function publishTag($tag) - { - $published = false; - - $pathsToPublish = $this->pathsToPublish($tag); - - if ($publishing = count($pathsToPublish) > 0) { - $this->components->info(sprintf( - 'Publishing %sassets', - $tag ? "[$tag] " : '', - )); - } - - foreach ($pathsToPublish as $from => $to) { - $this->publishItem($from, $to); - } - - if ($publishing === false) { - $this->components->info('No publishable resources for tag ['.$tag.'].'); - } else { - $this->laravel['events']->dispatch(new VendorTagPublished($tag, $pathsToPublish)); - - $this->newLine(); - } - } - - /** - * Get all of the paths to publish. - * - * @param string $tag - * @return array - */ - protected function pathsToPublish($tag) - { - return ServiceProvider::pathsToPublish( - $this->provider, $tag - ); - } - - /** - * Publish the given item from and to the given location. - * - * @param string $from - * @param string $to - * @return void - */ - protected function publishItem($from, $to) - { - if ($this->files->isFile($from)) { - return $this->publishFile($from, $to); - } elseif ($this->files->isDirectory($from)) { - return $this->publishDirectory($from, $to); - } - - $this->components->error("Can't locate path: <{$from}>"); - } - - /** - * Publish the file to the given path. - * - * @param string $from - * @param string $to - * @return void - */ - protected function publishFile($from, $to) - { - if ((! $this->option('existing') && (! $this->files->exists($to) || $this->option('force'))) - || ($this->option('existing') && $this->files->exists($to))) { - $this->createParentDirectory(dirname($to)); - - $this->files->copy($from, $to); - - $this->status($from, $to, 'file'); - } else { - if ($this->option('existing')) { - $this->components->twoColumnDetail(sprintf( - 'File [%s] does not exist', - str_replace(base_path().'/', '', $to), - ), 'SKIPPED'); - } else { - $this->components->twoColumnDetail(sprintf( - 'File [%s] already exists', - str_replace(base_path().'/', '', realpath($to)), - ), 'SKIPPED'); - } - } - } - - /** - * Publish the directory to the given directory. - * - * @param string $from - * @param string $to - * @return void - */ - protected function publishDirectory($from, $to) - { - $visibility = PortableVisibilityConverter::fromArray([], Visibility::PUBLIC); - - $this->moveManagedFiles(new MountManager([ - 'from' => new Flysystem(new LocalAdapter($from)), - 'to' => new Flysystem(new LocalAdapter($to, $visibility)), - ])); - - $this->status($from, $to, 'directory'); - } - - /** - * Move all the files in the given MountManager. - * - * @param \League\Flysystem\MountManager $manager - * @return void - */ - protected function moveManagedFiles($manager) - { - foreach ($manager->listContents('from://', true) as $file) { - $path = Str::after($file['path'], 'from://'); - - if ( - $file['type'] === 'file' - && ( - (! $this->option('existing') && (! $manager->fileExists('to://'.$path) || $this->option('force'))) - || ($this->option('existing') && $manager->fileExists('to://'.$path)) - ) - ) { - $manager->write('to://'.$path, $manager->read($file['path'])); - } - } - } - - /** - * Create the directory to house the published files if needed. - * - * @param string $directory - * @return void - */ - protected function createParentDirectory($directory) - { - if (! $this->files->isDirectory($directory)) { - $this->files->makeDirectory($directory, 0755, true); - } - } - - /** - * Write a status message to the console. - * - * @param string $from - * @param string $to - * @param string $type - * @return void - */ - protected function status($from, $to, $type) - { - $from = str_replace(base_path().'/', '', realpath($from)); - - $to = str_replace(base_path().'/', '', realpath($to)); - - $this->components->task(sprintf( - 'Copying %s [%s] to [%s]', - $type, - $from, - $to, - )); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ViewCacheCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ViewCacheCommand.php deleted file mode 100644 index 03f8d75..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ViewCacheCommand.php +++ /dev/null @@ -1,113 +0,0 @@ -callSilent('view:clear'); - - $this->paths()->each(function ($path) { - $prefix = $this->output->isVeryVerbose() ? 'DIR ' : ''; - - $this->components->task($prefix.$path, null, OutputInterface::VERBOSITY_VERBOSE); - - $this->compileViews($this->bladeFilesIn([$path])); - }); - - $this->newLine(); - - $this->components->info('Blade templates cached successfully.'); - } - - /** - * Compile the given view files. - * - * @param \Illuminate\Support\Collection $views - * @return void - */ - protected function compileViews(Collection $views) - { - $compiler = $this->laravel['view']->getEngineResolver()->resolve('blade')->getCompiler(); - - $views->map(function (SplFileInfo $file) use ($compiler) { - $this->components->task(' '.$file->getRelativePathname(), null, OutputInterface::VERBOSITY_VERY_VERBOSE); - - $compiler->compile($file->getRealPath()); - }); - - if ($this->output->isVeryVerbose()) { - $this->newLine(); - } - } - - /** - * Get the Blade files in the given path. - * - * @param array $paths - * @return \Illuminate\Support\Collection - */ - protected function bladeFilesIn(array $paths) - { - return collect( - Finder::create() - ->in($paths) - ->exclude('vendor') - ->name('*.blade.php') - ->files() - ); - } - - /** - * Get all of the possible view paths. - * - * @return \Illuminate\Support\Collection - */ - protected function paths() - { - $finder = $this->laravel['view']->getFinder(); - - return collect($finder->getPaths())->merge( - collect($finder->getHints())->flatten() - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/ViewClearCommand.php b/framework-9.50.2/src/Illuminate/Foundation/Console/ViewClearCommand.php deleted file mode 100644 index 2480f96..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/ViewClearCommand.php +++ /dev/null @@ -1,83 +0,0 @@ -files = $files; - } - - /** - * Execute the console command. - * - * @return void - * - * @throws \RuntimeException - */ - public function handle() - { - $path = $this->laravel['config']['view.compiled']; - - if (! $path) { - throw new RuntimeException('View path not found.'); - } - - $this->laravel['view.engine.resolver'] - ->resolve('blade') - ->forgetCompiledOrNotExpired(); - - foreach ($this->files->glob("{$path}/*") as $view) { - $this->files->delete($view); - } - - $this->components->info('Compiled views cleared successfully.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/cast.inbound.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/cast.inbound.stub deleted file mode 100644 index c456e3c..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/cast.inbound.stub +++ /dev/null @@ -1,22 +0,0 @@ -= time()) { - return; - } -} - -// Redirect to the proper path if necessary... -if (isset($data['redirect']) && $_SERVER['REQUEST_URI'] !== $data['redirect']) { - http_response_code(302); - header('Location: '.$data['redirect']); - - exit; -} - -// Output the prerendered template... -http_response_code($data['status'] ?? 503); - -if (isset($data['retry'])) { - header('Retry-After: '.$data['retry']); -} - -if (isset($data['refresh'])) { - header('Refresh: '.$data['refresh']); -} - -echo $data['template']; - -exit; diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub deleted file mode 100644 index 76b6ccc..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub +++ /dev/null @@ -1,59 +0,0 @@ -markdown('{{ view }}'); - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * @return array - */ - public function toArray($notifiable) - { - return [ - // - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown.stub deleted file mode 100644 index de9a155..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/markdown.stub +++ /dev/null @@ -1,12 +0,0 @@ - -# Introduction - -The body of your message. - - -Button Text - - -Thanks,
-{{ config('app.name') }} -
diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/model.morph-pivot.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/model.morph-pivot.stub deleted file mode 100644 index eb3f1f5..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/model.morph-pivot.stub +++ /dev/null @@ -1,10 +0,0 @@ -line('The introduction to the notification.') - ->action('Notification Action', url('/')) - ->line('Thank you for using our application!'); - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * @return array - */ - public function toArray($notifiable) - { - return [ - // - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/observer.plain.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/observer.plain.stub deleted file mode 100644 index e2506b7..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/observer.plain.stub +++ /dev/null @@ -1,8 +0,0 @@ -get('/'); - - $response->assertStatus(200); -}); diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/pest.unit.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/pest.unit.stub deleted file mode 100644 index 61cd84c..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/pest.unit.stub +++ /dev/null @@ -1,5 +0,0 @@ -toBeTrue(); -}); diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/policy.plain.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/policy.plain.stub deleted file mode 100644 index b014d85..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/policy.plain.stub +++ /dev/null @@ -1,21 +0,0 @@ - - */ - public function rules() - { - return [ - // - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/resource-collection.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/resource-collection.stub deleted file mode 100644 index ddec961..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/resource-collection.stub +++ /dev/null @@ -1,19 +0,0 @@ -setCompiledRoutes( - {{routes}} -); diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/rule.invokable.implicit.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/rule.invokable.implicit.stub deleted file mode 100644 index 077cae5..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/rule.invokable.implicit.stub +++ /dev/null @@ -1,28 +0,0 @@ -get('/'); - - $response->assertStatus(200); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/test.unit.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/test.unit.stub deleted file mode 100644 index b6816aa..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/test.unit.stub +++ /dev/null @@ -1,18 +0,0 @@ -assertTrue(true); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/view-component.stub b/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/view-component.stub deleted file mode 100644 index eab8fd3..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Console/stubs/view-component.stub +++ /dev/null @@ -1,28 +0,0 @@ -detectConsoleEnvironment($callback, $consoleArgs); - } - - return $this->detectWebEnvironment($callback); - } - - /** - * Set the application environment for a web request. - * - * @param \Closure $callback - * @return string - */ - protected function detectWebEnvironment(Closure $callback) - { - return $callback(); - } - - /** - * Set the application environment from command-line arguments. - * - * @param \Closure $callback - * @param array $args - * @return string - */ - protected function detectConsoleEnvironment(Closure $callback, array $args) - { - // First we will check if an environment argument was passed via console arguments - // and if it was that automatically overrides as the environment. Otherwise, we - // will check the environment as a "web" request like a typical HTTP request. - if (! is_null($value = $this->getEnvironmentArgument($args))) { - return $value; - } - - return $this->detectWebEnvironment($callback); - } - - /** - * Get the environment argument from the console. - * - * @param array $args - * @return string|null - */ - protected function getEnvironmentArgument(array $args) - { - foreach ($args as $i => $value) { - if ($value === '--env') { - return $args[$i + 1] ?? null; - } - - if (str_starts_with($value, '--env')) { - return head(array_slice(explode('=', $value), 1)); - } - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Events/DiscoverEvents.php b/framework-9.50.2/src/Illuminate/Foundation/Events/DiscoverEvents.php deleted file mode 100644 index fae4206..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Events/DiscoverEvents.php +++ /dev/null @@ -1,98 +0,0 @@ -files()->in($listenerPath), $basePath - )); - - $discoveredEvents = []; - - foreach ($listeners as $listener => $events) { - foreach ($events as $event) { - if (! isset($discoveredEvents[$event])) { - $discoveredEvents[$event] = []; - } - - $discoveredEvents[$event][] = $listener; - } - } - - return $discoveredEvents; - } - - /** - * Get all of the listeners and their corresponding events. - * - * @param iterable $listeners - * @param string $basePath - * @return array - */ - protected static function getListenerEvents($listeners, $basePath) - { - $listenerEvents = []; - - foreach ($listeners as $listener) { - try { - $listener = new ReflectionClass( - static::classFromFile($listener, $basePath) - ); - } catch (ReflectionException $e) { - continue; - } - - if (! $listener->isInstantiable()) { - continue; - } - - foreach ($listener->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { - if ((! Str::is('handle*', $method->name) && ! Str::is('__invoke', $method->name)) || - ! isset($method->getParameters()[0])) { - continue; - } - - $listenerEvents[$listener->name.'@'.$method->name] = - Reflector::getParameterClassNames($method->getParameters()[0]); - } - } - - return array_filter($listenerEvents); - } - - /** - * Extract the class name from the given file path. - * - * @param \SplFileInfo $file - * @param string $basePath - * @return string - */ - protected static function classFromFile(SplFileInfo $file, $basePath) - { - $class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR); - - return str_replace( - [DIRECTORY_SEPARATOR, ucfirst(basename(app()->path())).'\\'], - ['\\', app()->getNamespace()], - ucfirst(Str::replaceLast('.php', '', $class)) - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Events/Dispatchable.php b/framework-9.50.2/src/Illuminate/Foundation/Events/Dispatchable.php deleted file mode 100644 index ff63315..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Events/Dispatchable.php +++ /dev/null @@ -1,54 +0,0 @@ -locale = $locale; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Events/MaintenanceModeDisabled.php b/framework-9.50.2/src/Illuminate/Foundation/Events/MaintenanceModeDisabled.php deleted file mode 100644 index f8edf47..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Events/MaintenanceModeDisabled.php +++ /dev/null @@ -1,8 +0,0 @@ -stubs = $stubs; - } - - /** - * Add a new stub to be published. - * - * @param string $path - * @param string $name - * @return $this - */ - public function add(string $path, string $name) - { - $this->stubs[$path] = $name; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Events/VendorTagPublished.php b/framework-9.50.2/src/Illuminate/Foundation/Events/VendorTagPublished.php deleted file mode 100644 index 084c129..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Events/VendorTagPublished.php +++ /dev/null @@ -1,33 +0,0 @@ -tag = $tag; - $this->paths = $paths; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Handler.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Handler.php deleted file mode 100644 index 40a4dc4..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Handler.php +++ /dev/null @@ -1,767 +0,0 @@ -> - */ - protected $dontReport = []; - - /** - * The callbacks that should be used during reporting. - * - * @var \Illuminate\Foundation\Exceptions\ReportableHandler[] - */ - protected $reportCallbacks = []; - - /** - * A map of exceptions with their corresponding custom log levels. - * - * @var array, \Psr\Log\LogLevel::*> - */ - protected $levels = []; - - /** - * The callbacks that should be used during rendering. - * - * @var \Closure[] - */ - protected $renderCallbacks = []; - - /** - * The registered exception mappings. - * - * @var array - */ - protected $exceptionMap = []; - - /** - * A list of the internal exception types that should not be reported. - * - * @var array> - */ - protected $internalDontReport = [ - AuthenticationException::class, - AuthorizationException::class, - BackedEnumCaseNotFoundException::class, - HttpException::class, - HttpResponseException::class, - ModelNotFoundException::class, - MultipleRecordsFoundException::class, - RecordsNotFoundException::class, - SuspiciousOperationException::class, - TokenMismatchException::class, - ValidationException::class, - ]; - - /** - * A list of the inputs that are never flashed for validation exceptions. - * - * @var array - */ - protected $dontFlash = [ - 'current_password', - 'password', - 'password_confirmation', - ]; - - /** - * Create a new exception handler instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function __construct(Container $container) - { - $this->container = $container; - - $this->register(); - } - - /** - * Register the exception handling callbacks for the application. - * - * @return void - */ - public function register() - { - // - } - - /** - * Register a reportable callback. - * - * @param callable $reportUsing - * @return \Illuminate\Foundation\Exceptions\ReportableHandler - */ - public function reportable(callable $reportUsing) - { - if (! $reportUsing instanceof Closure) { - $reportUsing = Closure::fromCallable($reportUsing); - } - - return tap(new ReportableHandler($reportUsing), function ($callback) { - $this->reportCallbacks[] = $callback; - }); - } - - /** - * Register a renderable callback. - * - * @param callable $renderUsing - * @return $this - */ - public function renderable(callable $renderUsing) - { - if (! $renderUsing instanceof Closure) { - $renderUsing = Closure::fromCallable($renderUsing); - } - - $this->renderCallbacks[] = $renderUsing; - - return $this; - } - - /** - * Register a new exception mapping. - * - * @param \Closure|string $from - * @param \Closure|string|null $to - * @return $this - * - * @throws \InvalidArgumentException - */ - public function map($from, $to = null) - { - if (is_string($to)) { - $to = fn ($exception) => new $to('', 0, $exception); - } - - if (is_callable($from) && is_null($to)) { - $from = $this->firstClosureParameterType($to = $from); - } - - if (! is_string($from) || ! $to instanceof Closure) { - throw new InvalidArgumentException('Invalid exception mapping.'); - } - - $this->exceptionMap[$from] = $to; - - return $this; - } - - /** - * Indicate that the given exception type should not be reported. - * - * @param string $class - * @return $this - */ - public function ignore(string $class) - { - $this->dontReport[] = $class; - - return $this; - } - - /** - * Set the log level for the given exception type. - * - * @param class-string<\Throwable> $type - * @param \Psr\Log\LogLevel::* $level - * @return $this - */ - public function level($type, $level) - { - $this->levels[$type] = $level; - - return $this; - } - - /** - * Report or log an exception. - * - * @param \Throwable $e - * @return void - * - * @throws \Throwable - */ - public function report(Throwable $e) - { - $e = $this->mapException($e); - - if ($this->shouldntReport($e)) { - return; - } - - if (Reflector::isCallable($reportCallable = [$e, 'report']) && - $this->container->call($reportCallable) !== false) { - return; - } - - foreach ($this->reportCallbacks as $reportCallback) { - if ($reportCallback->handles($e) && $reportCallback($e) === false) { - return; - } - } - - try { - $logger = $this->container->make(LoggerInterface::class); - } catch (Exception $ex) { - throw $e; - } - - $level = Arr::first( - $this->levels, fn ($level, $type) => $e instanceof $type, LogLevel::ERROR - ); - - $context = $this->buildExceptionContext($e); - - method_exists($logger, $level) - ? $logger->{$level}($e->getMessage(), $context) - : $logger->log($level, $e->getMessage(), $context); - } - - /** - * Determine if the exception should be reported. - * - * @param \Throwable $e - * @return bool - */ - public function shouldReport(Throwable $e) - { - return ! $this->shouldntReport($e); - } - - /** - * Determine if the exception is in the "do not report" list. - * - * @param \Throwable $e - * @return bool - */ - protected function shouldntReport(Throwable $e) - { - $dontReport = array_merge($this->dontReport, $this->internalDontReport); - - return ! is_null(Arr::first($dontReport, fn ($type) => $e instanceof $type)); - } - - /** - * Create the context array for logging the given exception. - * - * @param \Throwable $e - * @return array - */ - protected function buildExceptionContext(Throwable $e) - { - return array_merge( - $this->exceptionContext($e), - $this->context(), - ['exception' => $e] - ); - } - - /** - * Get the default exception context variables for logging. - * - * @param \Throwable $e - * @return array - */ - protected function exceptionContext(Throwable $e) - { - if (method_exists($e, 'context')) { - return $e->context(); - } - - return []; - } - - /** - * Get the default context variables for logging. - * - * @return array - */ - protected function context() - { - try { - return array_filter([ - 'userId' => Auth::id(), - ]); - } catch (Throwable $e) { - return []; - } - } - - /** - * Render an exception into an HTTP response. - * - * @param \Illuminate\Http\Request $request - * @param \Throwable $e - * @return \Symfony\Component\HttpFoundation\Response - * - * @throws \Throwable - */ - public function render($request, Throwable $e) - { - if (method_exists($e, 'render') && $response = $e->render($request)) { - return Router::toResponse($request, $response); - } - - if ($e instanceof Responsable) { - return $e->toResponse($request); - } - - $e = $this->prepareException($this->mapException($e)); - - if ($response = $this->renderViaCallbacks($request, $e)) { - return $response; - } - - return match (true) { - $e instanceof HttpResponseException => $e->getResponse(), - $e instanceof AuthenticationException => $this->unauthenticated($request, $e), - $e instanceof ValidationException => $this->convertValidationExceptionToResponse($e, $request), - default => $this->renderExceptionResponse($request, $e), - }; - } - - /** - * Prepare exception for rendering. - * - * @param \Throwable $e - * @return \Throwable - */ - protected function prepareException(Throwable $e) - { - return match (true) { - $e instanceof BackedEnumCaseNotFoundException => new NotFoundHttpException($e->getMessage(), $e), - $e instanceof ModelNotFoundException => new NotFoundHttpException($e->getMessage(), $e), - $e instanceof AuthorizationException && $e->hasStatus() => new HttpException( - $e->status(), $e->response()?->message() ?: (Response::$statusTexts[$e->status()] ?? 'Whoops, looks like something went wrong.'), $e - ), - $e instanceof AuthorizationException && ! $e->hasStatus() => new AccessDeniedHttpException($e->getMessage(), $e), - $e instanceof TokenMismatchException => new HttpException(419, $e->getMessage(), $e), - $e instanceof SuspiciousOperationException => new NotFoundHttpException('Bad hostname provided.', $e), - $e instanceof RecordsNotFoundException => new NotFoundHttpException('Not found.', $e), - default => $e, - }; - } - - /** - * Map the exception using a registered mapper if possible. - * - * @param \Throwable $e - * @return \Throwable - */ - protected function mapException(Throwable $e) - { - if (method_exists($e, 'getInnerException') && - ($inner = $e->getInnerException()) instanceof Throwable) { - return $inner; - } - - foreach ($this->exceptionMap as $class => $mapper) { - if (is_a($e, $class)) { - return $mapper($e); - } - } - - return $e; - } - - /** - * Try to render a response from request and exception via render callbacks. - * - * @param \Illuminate\Http\Request $request - * @param \Throwable $e - * @return mixed - * - * @throws \ReflectionException - */ - protected function renderViaCallbacks($request, Throwable $e) - { - foreach ($this->renderCallbacks as $renderCallback) { - foreach ($this->firstClosureParameterTypes($renderCallback) as $type) { - if (is_a($e, $type)) { - $response = $renderCallback($e, $request); - - if (! is_null($response)) { - return $response; - } - } - } - } - } - - /** - * Render a default exception response if any. - * - * @param \Illuminate\Http\Request $request - * @param \Throwable $e - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function renderExceptionResponse($request, Throwable $e) - { - return $this->shouldReturnJson($request, $e) - ? $this->prepareJsonResponse($request, $e) - : $this->prepareResponse($request, $e); - } - - /** - * Convert an authentication exception into a response. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Auth\AuthenticationException $exception - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function unauthenticated($request, AuthenticationException $exception) - { - return $this->shouldReturnJson($request, $exception) - ? response()->json(['message' => $exception->getMessage()], 401) - : redirect()->guest($exception->redirectTo() ?? route('login')); - } - - /** - * Create a response object from the given validation exception. - * - * @param \Illuminate\Validation\ValidationException $e - * @param \Illuminate\Http\Request $request - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function convertValidationExceptionToResponse(ValidationException $e, $request) - { - if ($e->response) { - return $e->response; - } - - return $this->shouldReturnJson($request, $e) - ? $this->invalidJson($request, $e) - : $this->invalid($request, $e); - } - - /** - * Convert a validation exception into a response. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Validation\ValidationException $exception - * @return \Illuminate\Http\Response - */ - protected function invalid($request, ValidationException $exception) - { - return redirect($exception->redirectTo ?? url()->previous()) - ->withInput(Arr::except($request->input(), $this->dontFlash)) - ->withErrors($exception->errors(), $request->input('_error_bag', $exception->errorBag)); - } - - /** - * Convert a validation exception into a JSON response. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Validation\ValidationException $exception - * @return \Illuminate\Http\JsonResponse - */ - protected function invalidJson($request, ValidationException $exception) - { - return response()->json([ - 'message' => $exception->getMessage(), - 'errors' => $exception->errors(), - ], $exception->status); - } - - /** - * Determine if the exception handler response should be JSON. - * - * @param \Illuminate\Http\Request $request - * @param \Throwable $e - * @return bool - */ - protected function shouldReturnJson($request, Throwable $e) - { - return $request->expectsJson(); - } - - /** - * Prepare a response for the given exception. - * - * @param \Illuminate\Http\Request $request - * @param \Throwable $e - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function prepareResponse($request, Throwable $e) - { - if (! $this->isHttpException($e) && config('app.debug')) { - return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e)->prepare($request); - } - - if (! $this->isHttpException($e)) { - $e = new HttpException(500, $e->getMessage(), $e); - } - - return $this->toIlluminateResponse( - $this->renderHttpException($e), $e - )->prepare($request); - } - - /** - * Create a Symfony response for the given exception. - * - * @param \Throwable $e - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function convertExceptionToResponse(Throwable $e) - { - return new SymfonyResponse( - $this->renderExceptionContent($e), - $this->isHttpException($e) ? $e->getStatusCode() : 500, - $this->isHttpException($e) ? $e->getHeaders() : [] - ); - } - - /** - * Get the response content for the given exception. - * - * @param \Throwable $e - * @return string - */ - protected function renderExceptionContent(Throwable $e) - { - try { - return config('app.debug') && app()->has(ExceptionRenderer::class) - ? $this->renderExceptionWithCustomRenderer($e) - : $this->renderExceptionWithSymfony($e, config('app.debug')); - } catch (Throwable $e) { - return $this->renderExceptionWithSymfony($e, config('app.debug')); - } - } - - /** - * Render an exception to a string using the registered `ExceptionRenderer`. - * - * @param \Throwable $e - * @return string - */ - protected function renderExceptionWithCustomRenderer(Throwable $e) - { - return app(ExceptionRenderer::class)->render($e); - } - - /** - * Render an exception to a string using Symfony. - * - * @param \Throwable $e - * @param bool $debug - * @return string - */ - protected function renderExceptionWithSymfony(Throwable $e, $debug) - { - $renderer = new HtmlErrorRenderer($debug); - - return $renderer->render($e)->getAsString(); - } - - /** - * Render the given HttpException. - * - * @param \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function renderHttpException(HttpExceptionInterface $e) - { - $this->registerErrorViewPaths(); - - if ($view = $this->getHttpExceptionView($e)) { - return response()->view($view, [ - 'errors' => new ViewErrorBag, - 'exception' => $e, - ], $e->getStatusCode(), $e->getHeaders()); - } - - return $this->convertExceptionToResponse($e); - } - - /** - * Register the error template hint paths. - * - * @return void - */ - protected function registerErrorViewPaths() - { - (new RegisterErrorViewPaths)(); - } - - /** - * Get the view used to render HTTP exceptions. - * - * @param \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e - * @return string|null - */ - protected function getHttpExceptionView(HttpExceptionInterface $e) - { - $view = 'errors::'.$e->getStatusCode(); - - if (view()->exists($view)) { - return $view; - } - - $view = substr($view, 0, -2).'xx'; - - if (view()->exists($view)) { - return $view; - } - - return null; - } - - /** - * Map the given exception into an Illuminate response. - * - * @param \Symfony\Component\HttpFoundation\Response $response - * @param \Throwable $e - * @return \Illuminate\Http\Response - */ - protected function toIlluminateResponse($response, Throwable $e) - { - if ($response instanceof SymfonyRedirectResponse) { - $response = new RedirectResponse( - $response->getTargetUrl(), $response->getStatusCode(), $response->headers->all() - ); - } else { - $response = new Response( - $response->getContent(), $response->getStatusCode(), $response->headers->all() - ); - } - - return $response->withException($e); - } - - /** - * Prepare a JSON response for the given exception. - * - * @param \Illuminate\Http\Request $request - * @param \Throwable $e - * @return \Illuminate\Http\JsonResponse - */ - protected function prepareJsonResponse($request, Throwable $e) - { - return new JsonResponse( - $this->convertExceptionToArray($e), - $this->isHttpException($e) ? $e->getStatusCode() : 500, - $this->isHttpException($e) ? $e->getHeaders() : [], - JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES - ); - } - - /** - * Convert the given exception to an array. - * - * @param \Throwable $e - * @return array - */ - protected function convertExceptionToArray(Throwable $e) - { - return config('app.debug') ? [ - 'message' => $e->getMessage(), - 'exception' => get_class($e), - 'file' => $e->getFile(), - 'line' => $e->getLine(), - 'trace' => collect($e->getTrace())->map(fn ($trace) => Arr::except($trace, ['args']))->all(), - ] : [ - 'message' => $this->isHttpException($e) ? $e->getMessage() : 'Server Error', - ]; - } - - /** - * Render an exception to the console. - * - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @param \Throwable $e - * @return void - * - * @internal This method is not meant to be used or overwritten outside the framework. - */ - public function renderForConsole($output, Throwable $e) - { - if ($e instanceof CommandNotFoundException) { - $message = str($e->getMessage())->explode('.')->first(); - - if (! empty($alternatives = $e->getAlternatives())) { - $message .= '. Did you mean one of these?'; - - with(new Error($output))->render($message); - with(new BulletList($output))->render($e->getAlternatives()); - - $output->writeln(''); - } else { - with(new Error($output))->render($message); - } - - return; - } - - (new ConsoleApplication)->renderThrowable($e, $output); - } - - /** - * Determine if the given exception is an HTTP exception. - * - * @param \Throwable $e - * @return bool - */ - protected function isHttpException(Throwable $e) - { - return $e instanceof HttpExceptionInterface; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php deleted file mode 100644 index c88f326..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php +++ /dev/null @@ -1,20 +0,0 @@ -map(function ($path) { - return "{$path}/errors"; - })->push(__DIR__.'/views')->all()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/ReportableHandler.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/ReportableHandler.php deleted file mode 100644 index 06a6172..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/ReportableHandler.php +++ /dev/null @@ -1,82 +0,0 @@ -callback = $callback; - } - - /** - * Invoke the handler. - * - * @param \Throwable $e - * @return bool - */ - public function __invoke(Throwable $e) - { - $result = call_user_func($this->callback, $e); - - if ($result === false) { - return false; - } - - return ! $this->shouldStop; - } - - /** - * Determine if the callback handles the given exception. - * - * @param \Throwable $e - * @return bool - */ - public function handles(Throwable $e) - { - foreach ($this->firstClosureParameterTypes($this->callback) as $type) { - if (is_a($e, $type)) { - return true; - } - } - - return false; - } - - /** - * Indicate that report handling should stop after invoking this callback. - * - * @return $this - */ - public function stop() - { - $this->shouldStop = true; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Whoops/WhoopsExceptionRenderer.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Whoops/WhoopsExceptionRenderer.php deleted file mode 100644 index 908d9a2..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Whoops/WhoopsExceptionRenderer.php +++ /dev/null @@ -1,37 +0,0 @@ -appendHandler($this->whoopsHandler()); - - $whoops->writeToOutput(false); - - $whoops->allowQuit(false); - })->handleException($throwable); - } - - /** - * Get the Whoops handler for the application. - * - * @return \Whoops\Handler\Handler - */ - protected function whoopsHandler() - { - return (new WhoopsHandler)->forDebug(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Whoops/WhoopsHandler.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Whoops/WhoopsHandler.php deleted file mode 100644 index 40ee9f2..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/Whoops/WhoopsHandler.php +++ /dev/null @@ -1,86 +0,0 @@ -handleUnconditionally(true); - - $this->registerApplicationPaths($handler) - ->registerBlacklist($handler) - ->registerEditor($handler); - }); - } - - /** - * Register the application paths with the handler. - * - * @param \Whoops\Handler\PrettyPageHandler $handler - * @return $this - */ - protected function registerApplicationPaths($handler) - { - $handler->setApplicationPaths( - array_flip($this->directoriesExceptVendor()) - ); - - return $this; - } - - /** - * Get the application paths except for the "vendor" directory. - * - * @return array - */ - protected function directoriesExceptVendor() - { - return Arr::except( - array_flip((new Filesystem)->directories(base_path())), - [base_path('vendor')] - ); - } - - /** - * Register the blacklist with the handler. - * - * @param \Whoops\Handler\PrettyPageHandler $handler - * @return $this - */ - protected function registerBlacklist($handler) - { - foreach (config('app.debug_blacklist', config('app.debug_hide', [])) as $key => $secrets) { - foreach ($secrets as $secret) { - $handler->blacklist($key, $secret); - } - } - - return $this; - } - - /** - * Register the editor with the handler. - * - * @param \Whoops\Handler\PrettyPageHandler $handler - * @return $this - */ - protected function registerEditor($handler) - { - if (config('app.editor', false)) { - $handler->setEditor(config('app.editor')); - } - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/401.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/401.blade.php deleted file mode 100644 index 5c586db..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/401.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('errors::minimal') - -@section('title', __('Unauthorized')) -@section('code', '401') -@section('message', __('Unauthorized')) diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/402.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/402.blade.php deleted file mode 100644 index 3bc23ef..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/402.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('errors::minimal') - -@section('title', __('Payment Required')) -@section('code', '402') -@section('message', __('Payment Required')) diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/403.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/403.blade.php deleted file mode 100644 index a5506f0..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/403.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('errors::minimal') - -@section('title', __('Forbidden')) -@section('code', '403') -@section('message', __($exception->getMessage() ?: 'Forbidden')) diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/404.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/404.blade.php deleted file mode 100644 index 7549540..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/404.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('errors::minimal') - -@section('title', __('Not Found')) -@section('code', '404') -@section('message', __('Not Found')) diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/419.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/419.blade.php deleted file mode 100644 index c09216e..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/419.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('errors::minimal') - -@section('title', __('Page Expired')) -@section('code', '419') -@section('message', __('Page Expired')) diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/429.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/429.blade.php deleted file mode 100644 index f01b07b..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/429.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('errors::minimal') - -@section('title', __('Too Many Requests')) -@section('code', '429') -@section('message', __('Too Many Requests')) diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/500.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/500.blade.php deleted file mode 100644 index d9e95d9..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/500.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('errors::minimal') - -@section('title', __('Server Error')) -@section('code', '500') -@section('message', __('Server Error')) diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/503.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/503.blade.php deleted file mode 100644 index c5a9dde..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/503.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('errors::minimal') - -@section('title', __('Service Unavailable')) -@section('code', '503') -@section('message', __('Service Unavailable')) diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/layout.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/layout.blade.php deleted file mode 100644 index 019c2cd..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/layout.blade.php +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - @yield('title') - - - - - -
-
-
- @yield('message') -
-
-
- - diff --git a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/minimal.blade.php b/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/minimal.blade.php deleted file mode 100644 index db69f25..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Exceptions/views/minimal.blade.php +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - @yield('title') - - - - - - -
-
-
-
- @yield('code') -
- -
- @yield('message') -
-
-
-
- - diff --git a/framework-9.50.2/src/Illuminate/Foundation/FileBasedMaintenanceMode.php b/framework-9.50.2/src/Illuminate/Foundation/FileBasedMaintenanceMode.php deleted file mode 100644 index c63522c..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/FileBasedMaintenanceMode.php +++ /dev/null @@ -1,64 +0,0 @@ -path(), - json_encode($payload, JSON_PRETTY_PRINT) - ); - } - - /** - * Take the application out of maintenance. - * - * @return void - */ - public function deactivate(): void - { - if ($this->active()) { - unlink($this->path()); - } - } - - /** - * Determine if the application is currently down for maintenance. - * - * @return bool - */ - public function active(): bool - { - return file_exists($this->path()); - } - - /** - * Get the data array which was provided when the application was placed into maintenance. - * - * @return array - */ - public function data(): array - { - return json_decode(file_get_contents($this->path()), true); - } - - /** - * Get the path where the file is stored that signals that the application is down for maintenance. - * - * @return string - */ - protected function path(): string - { - return storage_path('framework/down'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Http/Events/RequestHandled.php b/framework-9.50.2/src/Illuminate/Foundation/Http/Events/RequestHandled.php deleted file mode 100644 index d6f71e0..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Http/Events/RequestHandled.php +++ /dev/null @@ -1,33 +0,0 @@ -request = $request; - $this->response = $response; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php b/framework-9.50.2/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php deleted file mode 100644 index 5553fde..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php +++ /dev/null @@ -1,58 +0,0 @@ -wentDownAt = Date::createFromTimestamp($time); - - if ($retryAfter) { - $this->retryAfter = $retryAfter; - - $this->willBeAvailableAt = Date::instance(Carbon::createFromTimestamp($time)->addRealSeconds($this->retryAfter)); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Http/FormRequest.php b/framework-9.50.2/src/Illuminate/Foundation/Http/FormRequest.php deleted file mode 100644 index cdf2229..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Http/FormRequest.php +++ /dev/null @@ -1,286 +0,0 @@ -validator) { - return $this->validator; - } - - $factory = $this->container->make(ValidationFactory::class); - - if (method_exists($this, 'validator')) { - $validator = $this->container->call([$this, 'validator'], compact('factory')); - } else { - $validator = $this->createDefaultValidator($factory); - } - - if (method_exists($this, 'withValidator')) { - $this->withValidator($validator); - } - - $this->setValidator($validator); - - return $this->validator; - } - - /** - * Create the default validator instance. - * - * @param \Illuminate\Contracts\Validation\Factory $factory - * @return \Illuminate\Contracts\Validation\Validator - */ - protected function createDefaultValidator(ValidationFactory $factory) - { - $rules = $this->container->call([$this, 'rules']); - - $validator = $factory->make( - $this->validationData(), $rules, - $this->messages(), $this->attributes() - )->stopOnFirstFailure($this->stopOnFirstFailure); - - if ($this->isPrecognitive()) { - $validator->setRules( - $this->filterPrecognitiveRules($validator->getRulesWithoutPlaceholders()) - ); - } - - return $validator; - } - - /** - * Get data to be validated from the request. - * - * @return array - */ - public function validationData() - { - return $this->all(); - } - - /** - * Handle a failed validation attempt. - * - * @param \Illuminate\Contracts\Validation\Validator $validator - * @return void - * - * @throws \Illuminate\Validation\ValidationException - */ - protected function failedValidation(Validator $validator) - { - throw (new ValidationException($validator)) - ->errorBag($this->errorBag) - ->redirectTo($this->getRedirectUrl()); - } - - /** - * Get the URL to redirect to on a validation error. - * - * @return string - */ - protected function getRedirectUrl() - { - $url = $this->redirector->getUrlGenerator(); - - if ($this->redirect) { - return $url->to($this->redirect); - } elseif ($this->redirectRoute) { - return $url->route($this->redirectRoute); - } elseif ($this->redirectAction) { - return $url->action($this->redirectAction); - } - - return $url->previous(); - } - - /** - * Determine if the request passes the authorization check. - * - * @return bool - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - protected function passesAuthorization() - { - if (method_exists($this, 'authorize')) { - $result = $this->container->call([$this, 'authorize']); - - return $result instanceof Response ? $result->authorize() : $result; - } - - return true; - } - - /** - * Handle a failed authorization attempt. - * - * @return void - * - * @throws \Illuminate\Auth\Access\AuthorizationException - */ - protected function failedAuthorization() - { - throw new AuthorizationException; - } - - /** - * Get a validated input container for the validated input. - * - * @param array|null $keys - * @return \Illuminate\Support\ValidatedInput|array - */ - public function safe(array $keys = null) - { - return is_array($keys) - ? $this->validator->safe()->only($keys) - : $this->validator->safe(); - } - - /** - * Get the validated data from the request. - * - * @param array|int|string|null $key - * @param mixed $default - * @return mixed - */ - public function validated($key = null, $default = null) - { - return data_get($this->validator->validated(), $key, $default); - } - - /** - * Get custom messages for validator errors. - * - * @return array - */ - public function messages() - { - return []; - } - - /** - * Get custom attributes for validator errors. - * - * @return array - */ - public function attributes() - { - return []; - } - - /** - * Set the Validator instance. - * - * @param \Illuminate\Contracts\Validation\Validator $validator - * @return $this - */ - public function setValidator(Validator $validator) - { - $this->validator = $validator; - - return $this; - } - - /** - * Set the Redirector instance. - * - * @param \Illuminate\Routing\Redirector $redirector - * @return $this - */ - public function setRedirector(Redirector $redirector) - { - $this->redirector = $redirector; - - return $this; - } - - /** - * Set the container implementation. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/Http/HtmlDumper.php b/framework-9.50.2/src/Illuminate/Foundation/Http/HtmlDumper.php deleted file mode 100644 index 2df0901..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/Http/HtmlDumper.php +++ /dev/null @@ -1,140 +0,0 @@ -'; - - /** - * Where the source should be placed on "non expanded" kind of dumps. - * - * @var string - */ - const NON_EXPANDED_SEPARATOR = "\n'; - } - - /** - * Generate a link tag with attributes for the given URL. - * - * @param string $url - * @param array $attributes - * @return string - */ - protected function makeStylesheetTagWithAttributes($url, $attributes) - { - $attributes = $this->parseAttributes(array_merge([ - 'rel' => 'stylesheet', - 'href' => $url, - 'nonce' => $this->nonce ?? false, - ], $attributes)); - - return ''; - } - - /** - * Determine whether the given path is a CSS file. - * - * @param string $path - * @return bool - */ - protected function isCssPath($path) - { - return preg_match('/\.(css|less|sass|scss|styl|stylus|pcss|postcss)$/', $path) === 1; - } - - /** - * Parse the attributes into key="value" strings. - * - * @param array $attributes - * @return array - */ - protected function parseAttributes($attributes) - { - return Collection::make($attributes) - ->reject(fn ($value, $key) => in_array($value, [false, null], true)) - ->flatMap(fn ($value, $key) => $value === true ? [$key] : [$key => $value]) - ->map(fn ($value, $key) => is_int($key) ? $value : $key.'="'.$value.'"') - ->values() - ->all(); - } - - /** - * Generate React refresh runtime script. - * - * @return \Illuminate\Support\HtmlString|void - */ - public function reactRefresh() - { - if (! $this->isRunningHot()) { - return; - } - - $attributes = $this->parseAttributes([ - 'nonce' => $this->cspNonce(), - ]); - - return new HtmlString( - sprintf( - <<<'HTML' - - HTML, - implode(' ', $attributes), - $this->hotAsset('@react-refresh') - ) - ); - } - - /** - * Get the path to a given asset when running in HMR mode. - * - * @return string - */ - protected function hotAsset($asset) - { - return rtrim(file_get_contents($this->hotFile())).'/'.$asset; - } - - /** - * Get the URL for an asset. - * - * @param string $asset - * @param string|null $buildDirectory - * @return string - */ - public function asset($asset, $buildDirectory = null) - { - $buildDirectory ??= $this->buildDirectory; - - if ($this->isRunningHot()) { - return $this->hotAsset($asset); - } - - $chunk = $this->chunk($this->manifest($buildDirectory), $asset); - - return $this->assetPath($buildDirectory.'/'.$chunk['file']); - } - - /** - * Generate an asset path for the application. - * - * @param string $path - * @param bool|null $secure - * @return string - */ - protected function assetPath($path, $secure = null) - { - return asset($path, $secure); - } - - /** - * Get the the manifest file for the given build directory. - * - * @param string $buildDirectory - * @return array - * - * @throws \Exception - */ - protected function manifest($buildDirectory) - { - $path = $this->manifestPath($buildDirectory); - - if (! isset(static::$manifests[$path])) { - if (! is_file($path)) { - throw new Exception("Vite manifest not found at: {$path}"); - } - - static::$manifests[$path] = json_decode(file_get_contents($path), true); - } - - return static::$manifests[$path]; - } - - /** - * Get the path to the manifest file for the given build directory. - * - * @param string $buildDirectory - * @return string - */ - protected function manifestPath($buildDirectory) - { - return public_path($buildDirectory.'/'.$this->manifestFilename); - } - - /** - * Get a unique hash representing the current manifest, or null if there is no manifest. - * - * @param string|null $buildDirectory - * @return string|null - */ - public function manifestHash($buildDirectory = null) - { - $buildDirectory ??= $this->buildDirectory; - - if ($this->isRunningHot()) { - return null; - } - - if (! is_file($path = $this->manifestPath($buildDirectory))) { - return null; - } - - return md5_file($path) ?: null; - } - - /** - * Get the chunk for the given entry point / asset. - * - * @param array $manifest - * @param string $file - * @return array - * - * @throws \Exception - */ - protected function chunk($manifest, $file) - { - if (! isset($manifest[$file])) { - throw new Exception("Unable to locate file in Vite manifest: {$file}."); - } - - return $manifest[$file]; - } - - /** - * Determine if the HMR server is running. - * - * @return bool - */ - public function isRunningHot() - { - return is_file($this->hotFile()); - } - - /** - * Get the Vite tag content as a string of HTML. - * - * @return string - */ - public function toHtml() - { - return $this->__invoke($this->entryPoints)->toHtml(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/helpers.php b/framework-9.50.2/src/Illuminate/Foundation/helpers.php deleted file mode 100644 index 8540f48..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/helpers.php +++ /dev/null @@ -1,1037 +0,0 @@ -toResponse(request())); - } - - app()->abort($code, $message, $headers); - } -} - -if (! function_exists('abort_if')) { - /** - * Throw an HttpException with the given data if the given condition is true. - * - * @param bool $boolean - * @param \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Support\Responsable|int $code - * @param string $message - * @param array $headers - * @return void - * - * @throws \Symfony\Component\HttpKernel\Exception\HttpException - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - function abort_if($boolean, $code, $message = '', array $headers = []) - { - if ($boolean) { - abort($code, $message, $headers); - } - } -} - -if (! function_exists('abort_unless')) { - /** - * Throw an HttpException with the given data unless the given condition is true. - * - * @param bool $boolean - * @param \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Support\Responsable|int $code - * @param string $message - * @param array $headers - * @return void - * - * @throws \Symfony\Component\HttpKernel\Exception\HttpException - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - function abort_unless($boolean, $code, $message = '', array $headers = []) - { - if (! $boolean) { - abort($code, $message, $headers); - } - } -} - -if (! function_exists('action')) { - /** - * Generate the URL to a controller action. - * - * @param string|array $name - * @param mixed $parameters - * @param bool $absolute - * @return string - */ - function action($name, $parameters = [], $absolute = true) - { - return app('url')->action($name, $parameters, $absolute); - } -} - -if (! function_exists('app')) { - /** - * Get the available container instance. - * - * @param string|null $abstract - * @param array $parameters - * @return mixed|\Illuminate\Contracts\Foundation\Application - */ - function app($abstract = null, array $parameters = []) - { - if (is_null($abstract)) { - return Container::getInstance(); - } - - return Container::getInstance()->make($abstract, $parameters); - } -} - -if (! function_exists('app_path')) { - /** - * Get the path to the application folder. - * - * @param string $path - * @return string - */ - function app_path($path = '') - { - return app()->path($path); - } -} - -if (! function_exists('asset')) { - /** - * Generate an asset path for the application. - * - * @param string $path - * @param bool|null $secure - * @return string - */ - function asset($path, $secure = null) - { - return app('url')->asset($path, $secure); - } -} - -if (! function_exists('auth')) { - /** - * Get the available auth instance. - * - * @param string|null $guard - * @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard - */ - function auth($guard = null) - { - if (is_null($guard)) { - return app(AuthFactory::class); - } - - return app(AuthFactory::class)->guard($guard); - } -} - -if (! function_exists('back')) { - /** - * Create a new redirect response to the previous location. - * - * @param int $status - * @param array $headers - * @param mixed $fallback - * @return \Illuminate\Http\RedirectResponse - */ - function back($status = 302, $headers = [], $fallback = false) - { - return app('redirect')->back($status, $headers, $fallback); - } -} - -if (! function_exists('base_path')) { - /** - * Get the path to the base of the install. - * - * @param string $path - * @return string - */ - function base_path($path = '') - { - return app()->basePath($path); - } -} - -if (! function_exists('bcrypt')) { - /** - * Hash the given value against the bcrypt algorithm. - * - * @param string $value - * @param array $options - * @return string - */ - function bcrypt($value, $options = []) - { - return app('hash')->driver('bcrypt')->make($value, $options); - } -} - -if (! function_exists('broadcast')) { - /** - * Begin broadcasting an event. - * - * @param mixed|null $event - * @return \Illuminate\Broadcasting\PendingBroadcast - */ - function broadcast($event = null) - { - return app(BroadcastFactory::class)->event($event); - } -} - -if (! function_exists('cache')) { - /** - * Get / set the specified cache value. - * - * If an array is passed, we'll assume you want to put to the cache. - * - * @param dynamic key|key,default|data,expiration|null - * @return mixed|\Illuminate\Cache\CacheManager - * - * @throws \InvalidArgumentException - */ - function cache() - { - $arguments = func_get_args(); - - if (empty($arguments)) { - return app('cache'); - } - - if (is_string($arguments[0])) { - return app('cache')->get(...$arguments); - } - - if (! is_array($arguments[0])) { - throw new InvalidArgumentException( - 'When setting a value in the cache, you must pass an array of key / value pairs.' - ); - } - - return app('cache')->put(key($arguments[0]), reset($arguments[0]), $arguments[1] ?? null); - } -} - -if (! function_exists('config')) { - /** - * Get / set the specified configuration value. - * - * If an array is passed as the key, we will assume you want to set an array of values. - * - * @param array|string|null $key - * @param mixed $default - * @return mixed|\Illuminate\Config\Repository - */ - function config($key = null, $default = null) - { - if (is_null($key)) { - return app('config'); - } - - if (is_array($key)) { - return app('config')->set($key); - } - - return app('config')->get($key, $default); - } -} - -if (! function_exists('config_path')) { - /** - * Get the configuration path. - * - * @param string $path - * @return string - */ - function config_path($path = '') - { - return app()->configPath($path); - } -} - -if (! function_exists('cookie')) { - /** - * Create a new cookie instance. - * - * @param string|null $name - * @param string|null $value - * @param int $minutes - * @param string|null $path - * @param string|null $domain - * @param bool|null $secure - * @param bool $httpOnly - * @param bool $raw - * @param string|null $sameSite - * @return \Illuminate\Cookie\CookieJar|\Symfony\Component\HttpFoundation\Cookie - */ - function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) - { - $cookie = app(CookieFactory::class); - - if (is_null($name)) { - return $cookie; - } - - return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly, $raw, $sameSite); - } -} - -if (! function_exists('csrf_field')) { - /** - * Generate a CSRF token form field. - * - * @return \Illuminate\Support\HtmlString - */ - function csrf_field() - { - return new HtmlString(''); - } -} - -if (! function_exists('csrf_token')) { - /** - * Get the CSRF token value. - * - * @return string - * - * @throws \RuntimeException - */ - function csrf_token() - { - $session = app('session'); - - if (isset($session)) { - return $session->token(); - } - - throw new RuntimeException('Application session store not set.'); - } -} - -if (! function_exists('database_path')) { - /** - * Get the database path. - * - * @param string $path - * @return string - */ - function database_path($path = '') - { - return app()->databasePath($path); - } -} - -if (! function_exists('decrypt')) { - /** - * Decrypt the given value. - * - * @param string $value - * @param bool $unserialize - * @return mixed - */ - function decrypt($value, $unserialize = true) - { - return app('encrypter')->decrypt($value, $unserialize); - } -} - -if (! function_exists('dispatch')) { - /** - * Dispatch a job to its appropriate handler. - * - * @param mixed $job - * @return \Illuminate\Foundation\Bus\PendingDispatch - */ - function dispatch($job) - { - return $job instanceof Closure - ? new PendingClosureDispatch(CallQueuedClosure::create($job)) - : new PendingDispatch($job); - } -} - -if (! function_exists('dispatch_sync')) { - /** - * Dispatch a command to its appropriate handler in the current process. - * - * Queueable jobs will be dispatched to the "sync" queue. - * - * @param mixed $job - * @param mixed $handler - * @return mixed - */ - function dispatch_sync($job, $handler = null) - { - return app(Dispatcher::class)->dispatchSync($job, $handler); - } -} - -if (! function_exists('dispatch_now')) { - /** - * Dispatch a command to its appropriate handler in the current process. - * - * @param mixed $job - * @param mixed $handler - * @return mixed - * - * @deprecated Will be removed in a future Laravel version. - */ - function dispatch_now($job, $handler = null) - { - return app(Dispatcher::class)->dispatchNow($job, $handler); - } -} - -if (! function_exists('encrypt')) { - /** - * Encrypt the given value. - * - * @param mixed $value - * @param bool $serialize - * @return string - */ - function encrypt($value, $serialize = true) - { - return app('encrypter')->encrypt($value, $serialize); - } -} - -if (! function_exists('event')) { - /** - * Dispatch an event and call the listeners. - * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * @return array|null - */ - function event(...$args) - { - return app('events')->dispatch(...$args); - } -} - -if (! function_exists('fake') && class_exists(\Faker\Factory::class)) { - /** - * Get a faker instance. - * - * @param string|null $locale - * @return \Faker\Generator - */ - function fake($locale = null) - { - if (app()->bound('config')) { - $locale ??= app('config')->get('app.faker_locale'); - } - - $locale ??= 'en_US'; - - $abstract = \Faker\Generator::class.':'.$locale; - - if (! app()->bound($abstract)) { - app()->singleton($abstract, fn () => \Faker\Factory::create($locale)); - } - - return app()->make($abstract); - } -} - -if (! function_exists('info')) { - /** - * Write some information to the log. - * - * @param string $message - * @param array $context - * @return void - */ - function info($message, $context = []) - { - app('log')->info($message, $context); - } -} - -if (! function_exists('logger')) { - /** - * Log a debug message to the logs. - * - * @param string|null $message - * @param array $context - * @return \Illuminate\Log\LogManager|null - */ - function logger($message = null, array $context = []) - { - if (is_null($message)) { - return app('log'); - } - - return app('log')->debug($message, $context); - } -} - -if (! function_exists('lang_path')) { - /** - * Get the path to the language folder. - * - * @param string $path - * @return string - */ - function lang_path($path = '') - { - return app()->langPath($path); - } -} - -if (! function_exists('logs')) { - /** - * Get a log driver instance. - * - * @param string|null $driver - * @return \Illuminate\Log\LogManager|\Psr\Log\LoggerInterface - */ - function logs($driver = null) - { - return $driver ? app('log')->driver($driver) : app('log'); - } -} - -if (! function_exists('method_field')) { - /** - * Generate a form field to spoof the HTTP verb used by forms. - * - * @param string $method - * @return \Illuminate\Support\HtmlString - */ - function method_field($method) - { - return new HtmlString(''); - } -} - -if (! function_exists('mix')) { - /** - * Get the path to a versioned Mix file. - * - * @param string $path - * @param string $manifestDirectory - * @return \Illuminate\Support\HtmlString|string - * - * @throws \Exception - */ - function mix($path, $manifestDirectory = '') - { - return app(Mix::class)(...func_get_args()); - } -} - -if (! function_exists('now')) { - /** - * Create a new Carbon instance for the current time. - * - * @param \DateTimeZone|string|null $tz - * @return \Illuminate\Support\Carbon - */ - function now($tz = null) - { - return Date::now($tz); - } -} - -if (! function_exists('old')) { - /** - * Retrieve an old input item. - * - * @param string|null $key - * @param mixed $default - * @return mixed - */ - function old($key = null, $default = null) - { - return app('request')->old($key, $default); - } -} - -if (! function_exists('policy')) { - /** - * Get a policy instance for a given class. - * - * @param object|string $class - * @return mixed - * - * @throws \InvalidArgumentException - */ - function policy($class) - { - return app(Gate::class)->getPolicyFor($class); - } -} - -if (! function_exists('precognitive')) { - /** - * Handle a Precognition controller hook. - * - * @param null|callable $callable - * @return mixed - */ - function precognitive($callable = null) - { - $callable ??= function () { - // - }; - - $payload = $callable(function ($default, $precognition = null) { - $response = request()->isPrecognitive() - ? ($precognition ?? $default) - : $default; - - abort(Router::toResponse(request(), value($response))); - }); - - if (request()->isPrecognitive()) { - abort(204); - } - - return $payload; - } -} - -if (! function_exists('public_path')) { - /** - * Get the path to the public folder. - * - * @param string $path - * @return string - */ - function public_path($path = '') - { - return app()->make('path.public').($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path); - } -} - -if (! function_exists('redirect')) { - /** - * Get an instance of the redirector. - * - * @param string|null $to - * @param int $status - * @param array $headers - * @param bool|null $secure - * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse - */ - function redirect($to = null, $status = 302, $headers = [], $secure = null) - { - if (is_null($to)) { - return app('redirect'); - } - - return app('redirect')->to($to, $status, $headers, $secure); - } -} - -if (! function_exists('report')) { - /** - * Report an exception. - * - * @param \Throwable|string $exception - * @return void - */ - function report($exception) - { - if (is_string($exception)) { - $exception = new Exception($exception); - } - - app(ExceptionHandler::class)->report($exception); - } -} - -if (! function_exists('report_if')) { - /** - * Report an exception if the given condition is true. - * - * @param bool $boolean - * @param \Throwable|string $exception - * @return void - */ - function report_if($boolean, $exception) - { - if ($boolean) { - report($exception); - } - } -} - -if (! function_exists('report_unless')) { - /** - * Report an exception unless the given condition is true. - * - * @param bool $boolean - * @param \Throwable|string $exception - * @return void - */ - function report_unless($boolean, $exception) - { - if (! $boolean) { - report($exception); - } - } -} - -if (! function_exists('request')) { - /** - * Get an instance of the current request or an input item from the request. - * - * @param array|string|null $key - * @param mixed $default - * @return mixed|\Illuminate\Http\Request|string|array|null - */ - function request($key = null, $default = null) - { - if (is_null($key)) { - return app('request'); - } - - if (is_array($key)) { - return app('request')->only($key); - } - - $value = app('request')->__get($key); - - return is_null($value) ? value($default) : $value; - } -} - -if (! function_exists('rescue')) { - /** - * Catch a potential exception and return a default value. - * - * @param callable $callback - * @param mixed $rescue - * @param bool|callable $report - * @return mixed - */ - function rescue(callable $callback, $rescue = null, $report = true) - { - try { - return $callback(); - } catch (Throwable $e) { - if (value($report, $e)) { - report($e); - } - - return value($rescue, $e); - } - } -} - -if (! function_exists('resolve')) { - /** - * Resolve a service from the container. - * - * @param string $name - * @param array $parameters - * @return mixed - */ - function resolve($name, array $parameters = []) - { - return app($name, $parameters); - } -} - -if (! function_exists('resource_path')) { - /** - * Get the path to the resources folder. - * - * @param string $path - * @return string - */ - function resource_path($path = '') - { - return app()->resourcePath($path); - } -} - -if (! function_exists('response')) { - /** - * Return a new response from the application. - * - * @param \Illuminate\Contracts\View\View|string|array|null $content - * @param int $status - * @param array $headers - * @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory - */ - function response($content = '', $status = 200, array $headers = []) - { - $factory = app(ResponseFactory::class); - - if (func_num_args() === 0) { - return $factory; - } - - return $factory->make($content, $status, $headers); - } -} - -if (! function_exists('route')) { - /** - * Generate the URL to a named route. - * - * @param array|string $name - * @param mixed $parameters - * @param bool $absolute - * @return string - */ - function route($name, $parameters = [], $absolute = true) - { - return app('url')->route($name, $parameters, $absolute); - } -} - -if (! function_exists('secure_asset')) { - /** - * Generate an asset path for the application. - * - * @param string $path - * @return string - */ - function secure_asset($path) - { - return asset($path, true); - } -} - -if (! function_exists('secure_url')) { - /** - * Generate a HTTPS url for the application. - * - * @param string $path - * @param mixed $parameters - * @return string - */ - function secure_url($path, $parameters = []) - { - return url($path, $parameters, true); - } -} - -if (! function_exists('session')) { - /** - * Get / set the specified session value. - * - * If an array is passed as the key, we will assume you want to set an array of values. - * - * @param array|string|null $key - * @param mixed $default - * @return mixed|\Illuminate\Session\Store|\Illuminate\Session\SessionManager - */ - function session($key = null, $default = null) - { - if (is_null($key)) { - return app('session'); - } - - if (is_array($key)) { - return app('session')->put($key); - } - - return app('session')->get($key, $default); - } -} - -if (! function_exists('storage_path')) { - /** - * Get the path to the storage folder. - * - * @param string $path - * @return string - */ - function storage_path($path = '') - { - return app()->storagePath($path); - } -} - -if (! function_exists('to_route')) { - /** - * Create a new redirect response to a named route. - * - * @param string $route - * @param mixed $parameters - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - function to_route($route, $parameters = [], $status = 302, $headers = []) - { - return redirect()->route($route, $parameters, $status, $headers); - } -} - -if (! function_exists('today')) { - /** - * Create a new Carbon instance for the current date. - * - * @param \DateTimeZone|string|null $tz - * @return \Illuminate\Support\Carbon - */ - function today($tz = null) - { - return Date::today($tz); - } -} - -if (! function_exists('trans')) { - /** - * Translate the given message. - * - * @param string|null $key - * @param array $replace - * @param string|null $locale - * @return \Illuminate\Contracts\Translation\Translator|string|array|null - */ - function trans($key = null, $replace = [], $locale = null) - { - if (is_null($key)) { - return app('translator'); - } - - return app('translator')->get($key, $replace, $locale); - } -} - -if (! function_exists('trans_choice')) { - /** - * Translates the given message based on a count. - * - * @param string $key - * @param \Countable|int|array $number - * @param array $replace - * @param string|null $locale - * @return string - */ - function trans_choice($key, $number, array $replace = [], $locale = null) - { - return app('translator')->choice($key, $number, $replace, $locale); - } -} - -if (! function_exists('__')) { - /** - * Translate the given message. - * - * @param string|null $key - * @param array $replace - * @param string|null $locale - * @return string|array|null - */ - function __($key = null, $replace = [], $locale = null) - { - if (is_null($key)) { - return $key; - } - - return trans($key, $replace, $locale); - } -} - -if (! function_exists('url')) { - /** - * Generate a url for the application. - * - * @param string|null $path - * @param mixed $parameters - * @param bool|null $secure - * @return \Illuminate\Contracts\Routing\UrlGenerator|string - */ - function url($path = null, $parameters = [], $secure = null) - { - if (is_null($path)) { - return app(UrlGenerator::class); - } - - return app(UrlGenerator::class)->to($path, $parameters, $secure); - } -} - -if (! function_exists('validator')) { - /** - * Create a new Validator instance. - * - * @param array $data - * @param array $rules - * @param array $messages - * @param array $customAttributes - * @return \Illuminate\Contracts\Validation\Validator|\Illuminate\Contracts\Validation\Factory - */ - function validator(array $data = [], array $rules = [], array $messages = [], array $customAttributes = []) - { - $factory = app(ValidationFactory::class); - - if (func_num_args() === 0) { - return $factory; - } - - return $factory->make($data, $rules, $messages, $customAttributes); - } -} - -if (! function_exists('view')) { - /** - * Get the evaluated view contents for the given view. - * - * @param string|null $view - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @param array $mergeData - * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory - */ - function view($view = null, $data = [], $mergeData = []) - { - $factory = app(ViewFactory::class); - - if (func_num_args() === 0) { - return $factory; - } - - return $factory->make($view, $data, $mergeData); - } -} diff --git a/framework-9.50.2/src/Illuminate/Foundation/resources/server.php b/framework-9.50.2/src/Illuminate/Foundation/resources/server.php deleted file mode 100644 index 99eddcc..0000000 --- a/framework-9.50.2/src/Illuminate/Foundation/resources/server.php +++ /dev/null @@ -1,16 +0,0 @@ -verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'argon2id') { - throw new RuntimeException('This password does not use the Argon2id algorithm.'); - } - - if (is_null($hashedValue) || strlen($hashedValue) === 0) { - return false; - } - - return password_verify($value, $hashedValue); - } - - /** - * Get the algorithm that should be used for hashing. - * - * @return int - */ - protected function algorithm() - { - return PASSWORD_ARGON2ID; - } -} diff --git a/framework-9.50.2/src/Illuminate/Hashing/ArgonHasher.php b/framework-9.50.2/src/Illuminate/Hashing/ArgonHasher.php deleted file mode 100644 index b999257..0000000 --- a/framework-9.50.2/src/Illuminate/Hashing/ArgonHasher.php +++ /dev/null @@ -1,196 +0,0 @@ -time = $options['time'] ?? $this->time; - $this->memory = $options['memory'] ?? $this->memory; - $this->threads = $this->threads($options); - $this->verifyAlgorithm = $options['verify'] ?? $this->verifyAlgorithm; - } - - /** - * Hash the given value. - * - * @param string $value - * @param array $options - * @return string - * - * @throws \RuntimeException - */ - public function make($value, array $options = []) - { - $hash = @password_hash($value, $this->algorithm(), [ - 'memory_cost' => $this->memory($options), - 'time_cost' => $this->time($options), - 'threads' => $this->threads($options), - ]); - - if (! is_string($hash)) { - throw new RuntimeException('Argon2 hashing not supported.'); - } - - return $hash; - } - - /** - * Get the algorithm that should be used for hashing. - * - * @return int - */ - protected function algorithm() - { - return PASSWORD_ARGON2I; - } - - /** - * Check the given plain value against a hash. - * - * @param string $value - * @param string $hashedValue - * @param array $options - * @return bool - * - * @throws \RuntimeException - */ - public function check($value, $hashedValue, array $options = []) - { - if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'argon2i') { - throw new RuntimeException('This password does not use the Argon2i algorithm.'); - } - - return parent::check($value, $hashedValue, $options); - } - - /** - * Check if the given hash has been hashed using the given options. - * - * @param string $hashedValue - * @param array $options - * @return bool - */ - public function needsRehash($hashedValue, array $options = []) - { - return password_needs_rehash($hashedValue, $this->algorithm(), [ - 'memory_cost' => $this->memory($options), - 'time_cost' => $this->time($options), - 'threads' => $this->threads($options), - ]); - } - - /** - * Set the default password memory factor. - * - * @param int $memory - * @return $this - */ - public function setMemory(int $memory) - { - $this->memory = $memory; - - return $this; - } - - /** - * Set the default password timing factor. - * - * @param int $time - * @return $this - */ - public function setTime(int $time) - { - $this->time = $time; - - return $this; - } - - /** - * Set the default password threads factor. - * - * @param int $threads - * @return $this - */ - public function setThreads(int $threads) - { - $this->threads = $threads; - - return $this; - } - - /** - * Extract the memory cost value from the options array. - * - * @param array $options - * @return int - */ - protected function memory(array $options) - { - return $options['memory'] ?? $this->memory; - } - - /** - * Extract the time cost value from the options array. - * - * @param array $options - * @return int - */ - protected function time(array $options) - { - return $options['time'] ?? $this->time; - } - - /** - * Extract the thread's value from the options array. - * - * @param array $options - * @return int - */ - protected function threads(array $options) - { - if (defined('PASSWORD_ARGON2_PROVIDER') && PASSWORD_ARGON2_PROVIDER === 'sodium') { - return 1; - } - - return $options['threads'] ?? $this->threads; - } -} diff --git a/framework-9.50.2/src/Illuminate/Hashing/BcryptHasher.php b/framework-9.50.2/src/Illuminate/Hashing/BcryptHasher.php deleted file mode 100755 index 26f928c..0000000 --- a/framework-9.50.2/src/Illuminate/Hashing/BcryptHasher.php +++ /dev/null @@ -1,114 +0,0 @@ -rounds = $options['rounds'] ?? $this->rounds; - $this->verifyAlgorithm = $options['verify'] ?? $this->verifyAlgorithm; - } - - /** - * Hash the given value. - * - * @param string $value - * @param array $options - * @return string - * - * @throws \RuntimeException - */ - public function make($value, array $options = []) - { - $hash = password_hash($value, PASSWORD_BCRYPT, [ - 'cost' => $this->cost($options), - ]); - - if ($hash === false) { - throw new RuntimeException('Bcrypt hashing not supported.'); - } - - return $hash; - } - - /** - * Check the given plain value against a hash. - * - * @param string $value - * @param string $hashedValue - * @param array $options - * @return bool - * - * @throws \RuntimeException - */ - public function check($value, $hashedValue, array $options = []) - { - if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'bcrypt') { - throw new RuntimeException('This password does not use the Bcrypt algorithm.'); - } - - return parent::check($value, $hashedValue, $options); - } - - /** - * Check if the given hash has been hashed using the given options. - * - * @param string $hashedValue - * @param array $options - * @return bool - */ - public function needsRehash($hashedValue, array $options = []) - { - return password_needs_rehash($hashedValue, PASSWORD_BCRYPT, [ - 'cost' => $this->cost($options), - ]); - } - - /** - * Set the default password work factor. - * - * @param int $rounds - * @return $this - */ - public function setRounds($rounds) - { - $this->rounds = (int) $rounds; - - return $this; - } - - /** - * Extract the cost value from the options array. - * - * @param array $options - * @return int - */ - protected function cost(array $options = []) - { - return $options['rounds'] ?? $this->rounds; - } -} diff --git a/framework-9.50.2/src/Illuminate/Hashing/HashManager.php b/framework-9.50.2/src/Illuminate/Hashing/HashManager.php deleted file mode 100644 index 5584f7a..0000000 --- a/framework-9.50.2/src/Illuminate/Hashing/HashManager.php +++ /dev/null @@ -1,100 +0,0 @@ -config->get('hashing.bcrypt') ?? []); - } - - /** - * Create an instance of the Argon2i hash Driver. - * - * @return \Illuminate\Hashing\ArgonHasher - */ - public function createArgonDriver() - { - return new ArgonHasher($this->config->get('hashing.argon') ?? []); - } - - /** - * Create an instance of the Argon2id hash Driver. - * - * @return \Illuminate\Hashing\Argon2IdHasher - */ - public function createArgon2idDriver() - { - return new Argon2IdHasher($this->config->get('hashing.argon') ?? []); - } - - /** - * Get information about the given hashed value. - * - * @param string $hashedValue - * @return array - */ - public function info($hashedValue) - { - return $this->driver()->info($hashedValue); - } - - /** - * Hash the given value. - * - * @param string $value - * @param array $options - * @return string - */ - public function make($value, array $options = []) - { - return $this->driver()->make($value, $options); - } - - /** - * Check the given plain value against a hash. - * - * @param string $value - * @param string $hashedValue - * @param array $options - * @return bool - */ - public function check($value, $hashedValue, array $options = []) - { - return $this->driver()->check($value, $hashedValue, $options); - } - - /** - * Check if the given hash has been hashed using the given options. - * - * @param string $hashedValue - * @param array $options - * @return bool - */ - public function needsRehash($hashedValue, array $options = []) - { - return $this->driver()->needsRehash($hashedValue, $options); - } - - /** - * Get the default driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->config->get('hashing.driver', 'bcrypt'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Hashing/HashServiceProvider.php b/framework-9.50.2/src/Illuminate/Hashing/HashServiceProvider.php deleted file mode 100755 index 2ed56a4..0000000 --- a/framework-9.50.2/src/Illuminate/Hashing/HashServiceProvider.php +++ /dev/null @@ -1,35 +0,0 @@ -app->singleton('hash', function ($app) { - return new HashManager($app); - }); - - $this->app->singleton('hash.driver', function ($app) { - return $app['hash']->driver(); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['hash', 'hash.driver']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Hashing/LICENSE.md b/framework-9.50.2/src/Illuminate/Hashing/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Hashing/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Hashing/composer.json b/framework-9.50.2/src/Illuminate/Hashing/composer.json deleted file mode 100755 index 77f9280..0000000 --- a/framework-9.50.2/src/Illuminate/Hashing/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "illuminate/hashing", - "description": "The Illuminate Hashing package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/contracts": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Hashing\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/Concerns/DeterminesStatusCode.php b/framework-9.50.2/src/Illuminate/Http/Client/Concerns/DeterminesStatusCode.php deleted file mode 100644 index ab91320..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/Concerns/DeterminesStatusCode.php +++ /dev/null @@ -1,157 +0,0 @@ -status() === 200; - } - - /** - * Determine if the response code was 201 "Created" response. - * - * @return bool - */ - public function created() - { - return $this->status() === 201; - } - - /** - * Determine if the response code was 202 "Accepted" response. - * - * @return bool - */ - public function accepted() - { - return $this->status() === 202; - } - - /** - * Determine if the response code was the given status code and the body has no content. - * - * @param int $status - * @return bool - */ - public function noContent($status = 204) - { - return $this->status() === $status && $this->body() === ''; - } - - /** - * Determine if the response code was a 301 "Moved Permanently". - * - * @return bool - */ - public function movedPermanently() - { - return $this->status() === 301; - } - - /** - * Determine if the response code was a 302 "Found" response. - * - * @return bool - */ - public function found() - { - return $this->status() === 302; - } - - /** - * Determine if the response was a 400 "Bad Request" response. - * - * @return bool - */ - public function badRequest() - { - return $this->status() === 400; - } - - /** - * Determine if the response was a 401 "Unauthorized" response. - * - * @return bool - */ - public function unauthorized() - { - return $this->status() === 401; - } - - /** - * Determine if the response was a 402 "Payment Required" response. - * - * @return bool - */ - public function paymentRequired() - { - return $this->status() === 402; - } - - /** - * Determine if the response was a 403 "Forbidden" response. - * - * @return bool - */ - public function forbidden() - { - return $this->status() === 403; - } - - /** - * Determine if the response was a 404 "Not Found" response. - * - * @return bool - */ - public function notFound() - { - return $this->status() === 404; - } - - /** - * Determine if the response was a 408 "Request Timeout" response. - * - * @return bool - */ - public function requestTimeout() - { - return $this->status() === 408; - } - - /** - * Determine if the response was a 409 "Conflict" response. - * - * @return bool - */ - public function conflict() - { - return $this->status() === 409; - } - - /** - * Determine if the response was a 422 "Unprocessable Entity" response. - * - * @return bool - */ - public function unprocessableEntity() - { - return $this->status() === 422; - } - - /** - * Determine if the response was a 429 "Too Many Requests" response. - * - * @return bool - */ - public function tooManyRequests() - { - return $this->status() === 429; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/ConnectionException.php b/framework-9.50.2/src/Illuminate/Http/Client/ConnectionException.php deleted file mode 100644 index eac85dc..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/ConnectionException.php +++ /dev/null @@ -1,8 +0,0 @@ -request = $request; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/Events/RequestSending.php b/framework-9.50.2/src/Illuminate/Http/Client/Events/RequestSending.php deleted file mode 100644 index 1b363fb..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/Events/RequestSending.php +++ /dev/null @@ -1,26 +0,0 @@ -request = $request; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/Events/ResponseReceived.php b/framework-9.50.2/src/Illuminate/Http/Client/Events/ResponseReceived.php deleted file mode 100644 index 77be7ab..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/Events/ResponseReceived.php +++ /dev/null @@ -1,36 +0,0 @@ -request = $request; - $this->response = $response; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/Factory.php b/framework-9.50.2/src/Illuminate/Http/Client/Factory.php deleted file mode 100644 index 457714b..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/Factory.php +++ /dev/null @@ -1,387 +0,0 @@ -dispatcher = $dispatcher; - - $this->stubCallbacks = collect(); - } - - /** - * Create a new response instance for use during stubbing. - * - * @param array|string|null $body - * @param int $status - * @param array $headers - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public static function response($body = null, $status = 200, $headers = []) - { - if (is_array($body)) { - $body = json_encode($body); - - $headers['Content-Type'] = 'application/json'; - } - - $response = new Psr7Response($status, $headers, $body); - - return class_exists(\GuzzleHttp\Promise\Create::class) - ? \GuzzleHttp\Promise\Create::promiseFor($response) - : \GuzzleHttp\Promise\promise_for($response); - } - - /** - * Get an invokable object that returns a sequence of responses in order for use during stubbing. - * - * @param array $responses - * @return \Illuminate\Http\Client\ResponseSequence - */ - public function sequence(array $responses = []) - { - return $this->responseSequences[] = new ResponseSequence($responses); - } - - /** - * Register a stub callable that will intercept requests and be able to return stub responses. - * - * @param callable|array|null $callback - * @return $this - */ - public function fake($callback = null) - { - $this->record(); - - $this->recorded = []; - - if (is_null($callback)) { - $callback = function () { - return static::response(); - }; - } - - if (is_array($callback)) { - foreach ($callback as $url => $callable) { - $this->stubUrl($url, $callable); - } - - return $this; - } - - $this->stubCallbacks = $this->stubCallbacks->merge(collect([ - function ($request, $options) use ($callback) { - $response = $callback instanceof Closure - ? $callback($request, $options) - : $callback; - - if ($response instanceof PromiseInterface) { - $options['on_stats'](new TransferStats( - $request->toPsrRequest(), - $response->wait(), - )); - } - - return $response; - }, - ])); - - return $this; - } - - /** - * Register a response sequence for the given URL pattern. - * - * @param string $url - * @return \Illuminate\Http\Client\ResponseSequence - */ - public function fakeSequence($url = '*') - { - return tap($this->sequence(), function ($sequence) use ($url) { - $this->fake([$url => $sequence]); - }); - } - - /** - * Stub the given URL using the given callback. - * - * @param string $url - * @param \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface|callable $callback - * @return $this - */ - public function stubUrl($url, $callback) - { - return $this->fake(function ($request, $options) use ($url, $callback) { - if (! Str::is(Str::start($url, '*'), $request->url())) { - return; - } - - return $callback instanceof Closure || $callback instanceof ResponseSequence - ? $callback($request, $options) - : $callback; - }); - } - - /** - * Indicate that an exception should be thrown if any request is not faked. - * - * @param bool $prevent - * @return $this - */ - public function preventStrayRequests($prevent = true) - { - $this->preventStrayRequests = $prevent; - - return $this; - } - - /** - * Indicate that an exception should not be thrown if any request is not faked. - * - * @return $this - */ - public function allowStrayRequests() - { - return $this->preventStrayRequests(false); - } - - /** - * Begin recording request / response pairs. - * - * @return $this - */ - protected function record() - { - $this->recording = true; - - return $this; - } - - /** - * Record a request response pair. - * - * @param \Illuminate\Http\Client\Request $request - * @param \Illuminate\Http\Client\Response $response - * @return void - */ - public function recordRequestResponsePair($request, $response) - { - if ($this->recording) { - $this->recorded[] = [$request, $response]; - } - } - - /** - * Assert that a request / response pair was recorded matching a given truth test. - * - * @param callable $callback - * @return void - */ - public function assertSent($callback) - { - PHPUnit::assertTrue( - $this->recorded($callback)->count() > 0, - 'An expected request was not recorded.' - ); - } - - /** - * Assert that the given request was sent in the given order. - * - * @param array $callbacks - * @return void - */ - public function assertSentInOrder($callbacks) - { - $this->assertSentCount(count($callbacks)); - - foreach ($callbacks as $index => $url) { - $callback = is_callable($url) ? $url : function ($request) use ($url) { - return $request->url() == $url; - }; - - PHPUnit::assertTrue($callback( - $this->recorded[$index][0], - $this->recorded[$index][1] - ), 'An expected request (#'.($index + 1).') was not recorded.'); - } - } - - /** - * Assert that a request / response pair was not recorded matching a given truth test. - * - * @param callable $callback - * @return void - */ - public function assertNotSent($callback) - { - PHPUnit::assertFalse( - $this->recorded($callback)->count() > 0, - 'Unexpected request was recorded.' - ); - } - - /** - * Assert that no request / response pair was recorded. - * - * @return void - */ - public function assertNothingSent() - { - PHPUnit::assertEmpty( - $this->recorded, - 'Requests were recorded.' - ); - } - - /** - * Assert how many requests have been recorded. - * - * @param int $count - * @return void - */ - public function assertSentCount($count) - { - PHPUnit::assertCount($count, $this->recorded); - } - - /** - * Assert that every created response sequence is empty. - * - * @return void - */ - public function assertSequencesAreEmpty() - { - foreach ($this->responseSequences as $responseSequence) { - PHPUnit::assertTrue( - $responseSequence->isEmpty(), - 'Not all response sequences are empty.' - ); - } - } - - /** - * Get a collection of the request / response pairs matching the given truth test. - * - * @param callable $callback - * @return \Illuminate\Support\Collection - */ - public function recorded($callback = null) - { - if (empty($this->recorded)) { - return collect(); - } - - $callback = $callback ?: function () { - return true; - }; - - return collect($this->recorded)->filter(function ($pair) use ($callback) { - return $callback($pair[0], $pair[1]); - }); - } - - /** - * Create a new pending request instance for this factory. - * - * @return \Illuminate\Http\Client\PendingRequest - */ - protected function newPendingRequest() - { - return new PendingRequest($this); - } - - /** - * Get the current event dispatcher implementation. - * - * @return \Illuminate\Contracts\Events\Dispatcher|null - */ - public function getDispatcher() - { - return $this->dispatcher; - } - - /** - * Execute a method against a new pending request instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - return tap($this->newPendingRequest(), function ($request) { - $request->stub($this->stubCallbacks)->preventStrayRequests($this->preventStrayRequests); - })->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/HttpClientException.php b/framework-9.50.2/src/Illuminate/Http/Client/HttpClientException.php deleted file mode 100644 index b15b8d3..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/HttpClientException.php +++ /dev/null @@ -1,10 +0,0 @@ -factory = $factory; - $this->middleware = new Collection; - - $this->asJson(); - - $this->options = [ - 'connect_timeout' => 10, - 'http_errors' => false, - 'timeout' => 30, - ]; - - $this->beforeSendingCallbacks = collect([function (Request $request, array $options, PendingRequest $pendingRequest) { - $pendingRequest->request = $request; - $pendingRequest->cookies = $options['cookies']; - - $pendingRequest->dispatchRequestSendingEvent(); - }]); - } - - /** - * Set the base URL for the pending request. - * - * @param string $url - * @return $this - */ - public function baseUrl(string $url) - { - $this->baseUrl = $url; - - return $this; - } - - /** - * Attach a raw body to the request. - * - * @param string $content - * @param string $contentType - * @return $this - */ - public function withBody($content, $contentType) - { - $this->bodyFormat('body'); - - $this->pendingBody = $content; - - $this->contentType($contentType); - - return $this; - } - - /** - * Indicate the request contains JSON. - * - * @return $this - */ - public function asJson() - { - return $this->bodyFormat('json')->contentType('application/json'); - } - - /** - * Indicate the request contains form parameters. - * - * @return $this - */ - public function asForm() - { - return $this->bodyFormat('form_params')->contentType('application/x-www-form-urlencoded'); - } - - /** - * Attach a file to the request. - * - * @param string|array $name - * @param string|resource $contents - * @param string|null $filename - * @param array $headers - * @return $this - */ - public function attach($name, $contents = '', $filename = null, array $headers = []) - { - if (is_array($name)) { - foreach ($name as $file) { - $this->attach(...$file); - } - - return $this; - } - - $this->asMultipart(); - - $this->pendingFiles[] = array_filter([ - 'name' => $name, - 'contents' => $contents, - 'headers' => $headers, - 'filename' => $filename, - ]); - - return $this; - } - - /** - * Indicate the request is a multi-part form request. - * - * @return $this - */ - public function asMultipart() - { - return $this->bodyFormat('multipart'); - } - - /** - * Specify the body format of the request. - * - * @param string $format - * @return $this - */ - public function bodyFormat(string $format) - { - return tap($this, function () use ($format) { - $this->bodyFormat = $format; - }); - } - - /** - * Specify the request's content type. - * - * @param string $contentType - * @return $this - */ - public function contentType(string $contentType) - { - return $this->withHeaders(['Content-Type' => $contentType]); - } - - /** - * Indicate that JSON should be returned by the server. - * - * @return $this - */ - public function acceptJson() - { - return $this->accept('application/json'); - } - - /** - * Indicate the type of content that should be returned by the server. - * - * @param string $contentType - * @return $this - */ - public function accept($contentType) - { - return $this->withHeaders(['Accept' => $contentType]); - } - - /** - * Add the given headers to the request. - * - * @param array $headers - * @return $this - */ - public function withHeaders(array $headers) - { - return tap($this, function () use ($headers) { - $this->options = array_merge_recursive($this->options, [ - 'headers' => $headers, - ]); - }); - } - - /** - * Specify the basic authentication username and password for the request. - * - * @param string $username - * @param string $password - * @return $this - */ - public function withBasicAuth(string $username, string $password) - { - return tap($this, function () use ($username, $password) { - $this->options['auth'] = [$username, $password]; - }); - } - - /** - * Specify the digest authentication username and password for the request. - * - * @param string $username - * @param string $password - * @return $this - */ - public function withDigestAuth($username, $password) - { - return tap($this, function () use ($username, $password) { - $this->options['auth'] = [$username, $password, 'digest']; - }); - } - - /** - * Specify an authorization token for the request. - * - * @param string $token - * @param string $type - * @return $this - */ - public function withToken($token, $type = 'Bearer') - { - return tap($this, function () use ($token, $type) { - $this->options['headers']['Authorization'] = trim($type.' '.$token); - }); - } - - /** - * Specify the user agent for the request. - * - * @param string $userAgent - * @return $this - */ - public function withUserAgent($userAgent) - { - return tap($this, function () use ($userAgent) { - $this->options['headers']['User-Agent'] = trim($userAgent); - }); - } - - /** - * Specify the cookies that should be included with the request. - * - * @param array $cookies - * @param string $domain - * @return $this - */ - public function withCookies(array $cookies, string $domain) - { - return tap($this, function () use ($cookies, $domain) { - $this->options = array_merge_recursive($this->options, [ - 'cookies' => CookieJar::fromArray($cookies, $domain), - ]); - }); - } - - /** - * Specify the maximum number of redirects to allow. - * - * @param int $max - * @return $this - */ - public function maxRedirects(int $max) - { - return tap($this, function () use ($max) { - $this->options['allow_redirects']['max'] = $max; - }); - } - - /** - * Indicate that redirects should not be followed. - * - * @return $this - */ - public function withoutRedirecting() - { - return tap($this, function () { - $this->options['allow_redirects'] = false; - }); - } - - /** - * Indicate that TLS certificates should not be verified. - * - * @return $this - */ - public function withoutVerifying() - { - return tap($this, function () { - $this->options['verify'] = false; - }); - } - - /** - * Specify the path where the body of the response should be stored. - * - * @param string|resource $to - * @return $this - */ - public function sink($to) - { - return tap($this, function () use ($to) { - $this->options['sink'] = $to; - }); - } - - /** - * Specify the timeout (in seconds) for the request. - * - * @param int $seconds - * @return $this - */ - public function timeout(int $seconds) - { - return tap($this, function () use ($seconds) { - $this->options['timeout'] = $seconds; - }); - } - - /** - * Specify the connect timeout (in seconds) for the request. - * - * @param int $seconds - * @return $this - */ - public function connectTimeout(int $seconds) - { - return tap($this, function () use ($seconds) { - $this->options['connect_timeout'] = $seconds; - }); - } - - /** - * Specify the number of times the request should be attempted. - * - * @param int $times - * @param int $sleepMilliseconds - * @param callable|null $when - * @param bool $throw - * @return $this - */ - public function retry(int $times, int $sleepMilliseconds = 0, ?callable $when = null, bool $throw = true) - { - $this->tries = $times; - $this->retryDelay = $sleepMilliseconds; - $this->retryThrow = $throw; - $this->retryWhenCallback = $when; - - return $this; - } - - /** - * Replace the specified options on the request. - * - * @param array $options - * @return $this - */ - public function withOptions(array $options) - { - return tap($this, function () use ($options) { - $this->options = array_replace_recursive( - array_merge_recursive($this->options, Arr::only($options, $this->mergableOptions)), - $options - ); - }); - } - - /** - * Add new middleware the client handler stack. - * - * @param callable $middleware - * @return $this - */ - public function withMiddleware(callable $middleware) - { - $this->middleware->push($middleware); - - return $this; - } - - /** - * Add a new "before sending" callback to the request. - * - * @param callable $callback - * @return $this - */ - public function beforeSending($callback) - { - return tap($this, function () use ($callback) { - $this->beforeSendingCallbacks[] = $callback; - }); - } - - /** - * Throw an exception if a server or client error occurs. - * - * @param callable|null $callback - * @return $this - */ - public function throw(callable $callback = null) - { - $this->throwCallback = $callback ?: fn () => null; - - return $this; - } - - /** - * Throw an exception if a server or client error occurred and the given condition evaluates to true. - * - * @param callable|bool $condition - * @param callable|null $throwCallback - * @return $this - */ - public function throwIf($condition) - { - if (is_callable($condition)) { - $this->throwIfCallback = $condition; - } - - return $condition ? $this->throw(func_get_args()[1] ?? null) : $this; - } - - /** - * Throw an exception if a server or client error occurred and the given condition evaluates to false. - * - * @param bool $condition - * @return $this - */ - public function throwUnless($condition) - { - return $this->throwIf(! $condition); - } - - /** - * Dump the request before sending. - * - * @return $this - */ - public function dump() - { - $values = func_get_args(); - - return $this->beforeSending(function (Request $request, array $options) use ($values) { - foreach (array_merge($values, [$request, $options]) as $value) { - VarDumper::dump($value); - } - }); - } - - /** - * Dump the request before sending and end the script. - * - * @return $this - */ - public function dd() - { - $values = func_get_args(); - - return $this->beforeSending(function (Request $request, array $options) use ($values) { - foreach (array_merge($values, [$request, $options]) as $value) { - VarDumper::dump($value); - } - - exit(1); - }); - } - - /** - * Issue a GET request to the given URL. - * - * @param string $url - * @param array|string|null $query - * @return \Illuminate\Http\Client\Response - */ - public function get(string $url, $query = null) - { - return $this->send('GET', $url, func_num_args() === 1 ? [] : [ - 'query' => $query, - ]); - } - - /** - * Issue a HEAD request to the given URL. - * - * @param string $url - * @param array|string|null $query - * @return \Illuminate\Http\Client\Response - */ - public function head(string $url, $query = null) - { - return $this->send('HEAD', $url, func_num_args() === 1 ? [] : [ - 'query' => $query, - ]); - } - - /** - * Issue a POST request to the given URL. - * - * @param string $url - * @param array $data - * @return \Illuminate\Http\Client\Response - */ - public function post(string $url, $data = []) - { - return $this->send('POST', $url, [ - $this->bodyFormat => $data, - ]); - } - - /** - * Issue a PATCH request to the given URL. - * - * @param string $url - * @param array $data - * @return \Illuminate\Http\Client\Response - */ - public function patch($url, $data = []) - { - return $this->send('PATCH', $url, [ - $this->bodyFormat => $data, - ]); - } - - /** - * Issue a PUT request to the given URL. - * - * @param string $url - * @param array $data - * @return \Illuminate\Http\Client\Response - */ - public function put($url, $data = []) - { - return $this->send('PUT', $url, [ - $this->bodyFormat => $data, - ]); - } - - /** - * Issue a DELETE request to the given URL. - * - * @param string $url - * @param array $data - * @return \Illuminate\Http\Client\Response - */ - public function delete($url, $data = []) - { - return $this->send('DELETE', $url, empty($data) ? [] : [ - $this->bodyFormat => $data, - ]); - } - - /** - * Send a pool of asynchronous requests concurrently. - * - * @param callable $callback - * @return array - */ - public function pool(callable $callback) - { - $results = []; - - $requests = tap(new Pool($this->factory), $callback)->getRequests(); - - foreach ($requests as $key => $item) { - $results[$key] = $item instanceof static ? $item->getPromise()->wait() : $item->wait(); - } - - return $results; - } - - /** - * Send the request to the given URL. - * - * @param string $method - * @param string $url - * @param array $options - * @return \Illuminate\Http\Client\Response - * - * @throws \Exception - */ - public function send(string $method, string $url, array $options = []) - { - if (! Str::startsWith($url, ['http://', 'https://'])) { - $url = ltrim(rtrim($this->baseUrl, '/').'/'.ltrim($url, '/'), '/'); - } - - $options = $this->parseHttpOptions($options); - - [$this->pendingBody, $this->pendingFiles] = [null, []]; - - if ($this->async) { - return $this->makePromise($method, $url, $options); - } - - $shouldRetry = null; - - return retry($this->tries ?? 1, function ($attempt) use ($method, $url, $options, &$shouldRetry) { - try { - return tap(new Response($this->sendRequest($method, $url, $options)), function ($response) use ($attempt, &$shouldRetry) { - $this->populateResponse($response); - - $this->dispatchResponseReceivedEvent($response); - - if (! $response->successful()) { - try { - $shouldRetry = $this->retryWhenCallback ? call_user_func($this->retryWhenCallback, $response->toException(), $this) : true; - } catch (Exception $exception) { - $shouldRetry = false; - - throw $exception; - } - - if ($this->throwCallback && - ($this->throwIfCallback === null || - call_user_func($this->throwIfCallback, $response))) { - $response->throw($this->throwCallback); - } - - if ($attempt < $this->tries && $shouldRetry) { - $response->throw(); - } - - if ($this->tries > 1 && $this->retryThrow) { - $response->throw(); - } - } - }); - } catch (ConnectException $e) { - $this->dispatchConnectionFailedEvent(); - - throw new ConnectionException($e->getMessage(), 0, $e); - } - }, $this->retryDelay ?? 100, function ($exception) use (&$shouldRetry) { - $result = $shouldRetry ?? ($this->retryWhenCallback ? call_user_func($this->retryWhenCallback, $exception, $this) : true); - - $shouldRetry = null; - - return $result; - }); - } - - /** - * Parse the given HTTP options and set the appropriate additional options. - * - * @param array $options - * @return array - */ - protected function parseHttpOptions(array $options) - { - if (isset($options[$this->bodyFormat])) { - if ($this->bodyFormat === 'multipart') { - $options[$this->bodyFormat] = $this->parseMultipartBodyFormat($options[$this->bodyFormat]); - } elseif ($this->bodyFormat === 'body') { - $options[$this->bodyFormat] = $this->pendingBody; - } - - if (is_array($options[$this->bodyFormat])) { - $options[$this->bodyFormat] = array_merge( - $options[$this->bodyFormat], $this->pendingFiles - ); - } - } else { - $options[$this->bodyFormat] = $this->pendingBody; - } - - return collect($options)->map(function ($value, $key) { - if ($key === 'json' && $value instanceof JsonSerializable) { - return $value; - } - - return $value instanceof Arrayable ? $value->toArray() : $value; - })->all(); - } - - /** - * Parse multi-part form data. - * - * @param array $data - * @return array|array[] - */ - protected function parseMultipartBodyFormat(array $data) - { - return collect($data)->map(function ($value, $key) { - return is_array($value) ? $value : ['name' => $key, 'contents' => $value]; - })->values()->all(); - } - - /** - * Send an asynchronous request to the given URL. - * - * @param string $method - * @param string $url - * @param array $options - * @return \GuzzleHttp\Promise\PromiseInterface - */ - protected function makePromise(string $method, string $url, array $options = []) - { - return $this->promise = $this->sendRequest($method, $url, $options) - ->then(function (MessageInterface $message) { - return tap(new Response($message), function ($response) { - $this->populateResponse($response); - $this->dispatchResponseReceivedEvent($response); - }); - }) - ->otherwise(function (TransferException $e) { - return $e instanceof RequestException && $e->hasResponse() ? $this->populateResponse(new Response($e->getResponse())) : $e; - }); - } - - /** - * Send a request either synchronously or asynchronously. - * - * @param string $method - * @param string $url - * @param array $options - * @return \Psr\Http\Message\MessageInterface|\GuzzleHttp\Promise\PromiseInterface - * - * @throws \Exception - */ - protected function sendRequest(string $method, string $url, array $options = []) - { - $clientMethod = $this->async ? 'requestAsync' : 'request'; - - $laravelData = $this->parseRequestData($method, $url, $options); - - return $this->buildClient()->$clientMethod($method, $url, $this->mergeOptions([ - 'laravel_data' => $laravelData, - 'on_stats' => function ($transferStats) { - $this->transferStats = $transferStats; - }, - ], $options)); - } - - /** - * Get the request data as an array so that we can attach it to the request for convenient assertions. - * - * @param string $method - * @param string $url - * @param array $options - * @return array - */ - protected function parseRequestData($method, $url, array $options) - { - if ($this->bodyFormat === 'body') { - return []; - } - - $laravelData = $options[$this->bodyFormat] ?? $options['query'] ?? []; - - $urlString = Str::of($url); - - if (empty($laravelData) && $method === 'GET' && $urlString->contains('?')) { - $laravelData = (string) $urlString->after('?'); - } - - if (is_string($laravelData)) { - parse_str($laravelData, $parsedData); - - $laravelData = is_array($parsedData) ? $parsedData : []; - } - - if ($laravelData instanceof JsonSerializable) { - $laravelData = $laravelData->jsonSerialize(); - } - - return is_array($laravelData) ? $laravelData : []; - } - - /** - * Populate the given response with additional data. - * - * @param \Illuminate\Http\Client\Response $response - * @return \Illuminate\Http\Client\Response - */ - protected function populateResponse(Response $response) - { - $response->cookies = $this->cookies; - - $response->transferStats = $this->transferStats; - - return $response; - } - - /** - * Build the Guzzle client. - * - * @return \GuzzleHttp\Client - */ - public function buildClient() - { - return $this->client ?? $this->createClient($this->buildHandlerStack()); - } - - /** - * Determine if a reusable client is required. - * - * @return bool - */ - protected function requestsReusableClient() - { - return ! is_null($this->client) || $this->async; - } - - /** - * Retrieve a reusable Guzzle client. - * - * @return \GuzzleHttp\Client - */ - protected function getReusableClient() - { - return $this->client = $this->client ?: $this->createClient($this->buildHandlerStack()); - } - - /** - * Create new Guzzle client. - * - * @param \GuzzleHttp\HandlerStack $handlerStack - * @return \GuzzleHttp\Client - */ - public function createClient($handlerStack) - { - return new Client([ - 'handler' => $handlerStack, - 'cookies' => true, - ]); - } - - /** - * Build the Guzzle client handler stack. - * - * @return \GuzzleHttp\HandlerStack - */ - public function buildHandlerStack() - { - return $this->pushHandlers(HandlerStack::create($this->handler)); - } - - /** - * Add the necessary handlers to the given handler stack. - * - * @param \GuzzleHttp\HandlerStack $handlerStack - * @return \GuzzleHttp\HandlerStack - */ - public function pushHandlers($handlerStack) - { - return tap($handlerStack, function ($stack) { - $stack->push($this->buildBeforeSendingHandler()); - $stack->push($this->buildRecorderHandler()); - - $this->middleware->each(function ($middleware) use ($stack) { - $stack->push($middleware); - }); - - $stack->push($this->buildStubHandler()); - }); - } - - /** - * Build the before sending handler. - * - * @return \Closure - */ - public function buildBeforeSendingHandler() - { - return function ($handler) { - return function ($request, $options) use ($handler) { - return $handler($this->runBeforeSendingCallbacks($request, $options), $options); - }; - }; - } - - /** - * Build the recorder handler. - * - * @return \Closure - */ - public function buildRecorderHandler() - { - return function ($handler) { - return function ($request, $options) use ($handler) { - $promise = $handler($request, $options); - - return $promise->then(function ($response) use ($request, $options) { - $this->factory?->recordRequestResponsePair( - (new Request($request))->withData($options['laravel_data']), - new Response($response) - ); - - return $response; - }); - }; - }; - } - - /** - * Build the stub handler. - * - * @return \Closure - */ - public function buildStubHandler() - { - return function ($handler) { - return function ($request, $options) use ($handler) { - $response = ($this->stubCallbacks ?? collect()) - ->map - ->__invoke((new Request($request))->withData($options['laravel_data']), $options) - ->filter() - ->first(); - - if (is_null($response)) { - if ($this->preventStrayRequests) { - throw new RuntimeException('Attempted request to ['.(string) $request->getUri().'] without a matching fake.'); - } - - return $handler($request, $options); - } - - $response = is_array($response) ? Factory::response($response) : $response; - - $sink = $options['sink'] ?? null; - - if ($sink) { - $response->then($this->sinkStubHandler($sink)); - } - - return $response; - }; - }; - } - - /** - * Get the sink stub handler callback. - * - * @param string $sink - * @return \Closure - */ - protected function sinkStubHandler($sink) - { - return function ($response) use ($sink) { - $body = $response->getBody()->getContents(); - - if (is_string($sink)) { - file_put_contents($sink, $body); - - return; - } - - fwrite($sink, $body); - rewind($sink); - }; - } - - /** - * Execute the "before sending" callbacks. - * - * @param \GuzzleHttp\Psr7\RequestInterface $request - * @param array $options - * @return \GuzzleHttp\Psr7\RequestInterface - */ - public function runBeforeSendingCallbacks($request, array $options) - { - return tap($request, function (&$request) use ($options) { - $this->beforeSendingCallbacks->each(function ($callback) use (&$request, $options) { - $callbackResult = call_user_func( - $callback, (new Request($request))->withData($options['laravel_data']), $options, $this - ); - - if ($callbackResult instanceof RequestInterface) { - $request = $callbackResult; - } elseif ($callbackResult instanceof Request) { - $request = $callbackResult->toPsrRequest(); - } - }); - }); - } - - /** - * Replace the given options with the current request options. - * - * @param array ...$options - * @return array - */ - public function mergeOptions(...$options) - { - return array_replace_recursive( - array_merge_recursive($this->options, Arr::only($options, $this->mergableOptions)), - ...$options - ); - } - - /** - * Register a stub callable that will intercept requests and be able to return stub responses. - * - * @param callable $callback - * @return $this - */ - public function stub($callback) - { - $this->stubCallbacks = collect($callback); - - return $this; - } - - /** - * Indicate that an exception should be thrown if any request is not faked. - * - * @param bool $prevent - * @return $this - */ - public function preventStrayRequests($prevent = true) - { - $this->preventStrayRequests = $prevent; - - return $this; - } - - /** - * Toggle asynchronicity in requests. - * - * @param bool $async - * @return $this - */ - public function async(bool $async = true) - { - $this->async = $async; - - return $this; - } - - /** - * Retrieve the pending request promise. - * - * @return \GuzzleHttp\Promise\PromiseInterface|null - */ - public function getPromise() - { - return $this->promise; - } - - /** - * Dispatch the RequestSending event if a dispatcher is available. - * - * @return void - */ - protected function dispatchRequestSendingEvent() - { - if ($dispatcher = $this->factory?->getDispatcher()) { - $dispatcher->dispatch(new RequestSending($this->request)); - } - } - - /** - * Dispatch the ResponseReceived event if a dispatcher is available. - * - * @param \Illuminate\Http\Client\Response $response - * @return void - */ - protected function dispatchResponseReceivedEvent(Response $response) - { - if (! ($dispatcher = $this->factory?->getDispatcher()) || - ! $this->request) { - return; - } - - $dispatcher->dispatch(new ResponseReceived($this->request, $response)); - } - - /** - * Dispatch the ConnectionFailed event if a dispatcher is available. - * - * @return void - */ - protected function dispatchConnectionFailedEvent() - { - if ($dispatcher = $this->factory?->getDispatcher()) { - $dispatcher->dispatch(new ConnectionFailed($this->request)); - } - } - - /** - * Set the client instance. - * - * @param \GuzzleHttp\Client $client - * @return $this - */ - public function setClient(Client $client) - { - $this->client = $client; - - return $this; - } - - /** - * Create a new client instance using the given handler. - * - * @param callable $handler - * @return $this - */ - public function setHandler($handler) - { - $this->handler = $handler; - - return $this; - } - - /** - * Get the pending request options. - * - * @return array - */ - public function getOptions() - { - return $this->options; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/Pool.php b/framework-9.50.2/src/Illuminate/Http/Client/Pool.php deleted file mode 100644 index bedffcb..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/Pool.php +++ /dev/null @@ -1,92 +0,0 @@ -factory = $factory ?: new Factory(); - - if (method_exists(Utils::class, 'chooseHandler')) { - $this->handler = Utils::chooseHandler(); - } else { - $this->handler = \GuzzleHttp\choose_handler(); - } - } - - /** - * Add a request to the pool with a key. - * - * @param string $key - * @return \Illuminate\Http\Client\PendingRequest - */ - public function as(string $key) - { - return $this->pool[$key] = $this->asyncRequest(); - } - - /** - * Retrieve a new async pending request. - * - * @return \Illuminate\Http\Client\PendingRequest - */ - protected function asyncRequest() - { - return $this->factory->setHandler($this->handler)->async(); - } - - /** - * Retrieve the requests in the pool. - * - * @return array - */ - public function getRequests() - { - return $this->pool; - } - - /** - * Add a request to the pool with a numeric index. - * - * @param string $method - * @param array $parameters - * @return \Illuminate\Http\Client\PendingRequest - */ - public function __call($method, $parameters) - { - return $this->pool[] = $this->asyncRequest()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/Request.php b/framework-9.50.2/src/Illuminate/Http/Client/Request.php deleted file mode 100644 index 3c2d6a9..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/Request.php +++ /dev/null @@ -1,305 +0,0 @@ -request = $request; - } - - /** - * Get the request method. - * - * @return string - */ - public function method() - { - return $this->request->getMethod(); - } - - /** - * Get the URL of the request. - * - * @return string - */ - public function url() - { - return (string) $this->request->getUri(); - } - - /** - * Determine if the request has a given header. - * - * @param string $key - * @param mixed $value - * @return bool - */ - public function hasHeader($key, $value = null) - { - if (is_null($value)) { - return ! empty($this->request->getHeaders()[$key]); - } - - $headers = $this->headers(); - - if (! Arr::has($headers, $key)) { - return false; - } - - $value = is_array($value) ? $value : [$value]; - - return empty(array_diff($value, $headers[$key])); - } - - /** - * Determine if the request has the given headers. - * - * @param array|string $headers - * @return bool - */ - public function hasHeaders($headers) - { - if (is_string($headers)) { - $headers = [$headers => null]; - } - - foreach ($headers as $key => $value) { - if (! $this->hasHeader($key, $value)) { - return false; - } - } - - return true; - } - - /** - * Get the values for the header with the given name. - * - * @param string $key - * @return array - */ - public function header($key) - { - return Arr::get($this->headers(), $key, []); - } - - /** - * Get the request headers. - * - * @return array - */ - public function headers() - { - return $this->request->getHeaders(); - } - - /** - * Get the body of the request. - * - * @return string - */ - public function body() - { - return (string) $this->request->getBody(); - } - - /** - * Determine if the request contains the given file. - * - * @param string $name - * @param string|null $value - * @param string|null $filename - * @return bool - */ - public function hasFile($name, $value = null, $filename = null) - { - if (! $this->isMultipart()) { - return false; - } - - return collect($this->data)->reject(function ($file) use ($name, $value, $filename) { - return $file['name'] != $name || - ($value && $file['contents'] != $value) || - ($filename && $file['filename'] != $filename); - })->count() > 0; - } - - /** - * Get the request's data (form parameters or JSON). - * - * @return array - */ - public function data() - { - if ($this->isForm()) { - return $this->parameters(); - } elseif ($this->isJson()) { - return $this->json(); - } - - return $this->data ?? []; - } - - /** - * Get the request's form parameters. - * - * @return array - */ - protected function parameters() - { - if (! $this->data) { - parse_str($this->body(), $parameters); - - $this->data = $parameters; - } - - return $this->data; - } - - /** - * Get the JSON decoded body of the request. - * - * @return array - */ - protected function json() - { - if (! $this->data) { - $this->data = json_decode($this->body(), true); - } - - return $this->data; - } - - /** - * Determine if the request is simple form data. - * - * @return bool - */ - public function isForm() - { - return $this->hasHeader('Content-Type', 'application/x-www-form-urlencoded'); - } - - /** - * Determine if the request is JSON. - * - * @return bool - */ - public function isJson() - { - return $this->hasHeader('Content-Type') && - str_contains($this->header('Content-Type')[0], 'json'); - } - - /** - * Determine if the request is multipart. - * - * @return bool - */ - public function isMultipart() - { - return $this->hasHeader('Content-Type') && - str_contains($this->header('Content-Type')[0], 'multipart'); - } - - /** - * Set the decoded data on the request. - * - * @param array $data - * @return $this - */ - public function withData(array $data) - { - $this->data = $data; - - return $this; - } - - /** - * Get the underlying PSR compliant request instance. - * - * @return \Psr\Http\Message\RequestInterface - */ - public function toPsrRequest() - { - return $this->request; - } - - /** - * Determine if the given offset exists. - * - * @param string $offset - * @return bool - */ - public function offsetExists($offset): bool - { - return isset($this->data()[$offset]); - } - - /** - * Get the value for a given offset. - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset): mixed - { - return $this->data()[$offset]; - } - - /** - * Set the value at the given offset. - * - * @param string $offset - * @param mixed $value - * @return void - * - * @throws \LogicException - */ - public function offsetSet($offset, $value): void - { - throw new LogicException('Request data may not be mutated using array access.'); - } - - /** - * Unset the value at the given offset. - * - * @param string $offset - * @return void - * - * @throws \LogicException - */ - public function offsetUnset($offset): void - { - throw new LogicException('Request data may not be mutated using array access.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/RequestException.php b/framework-9.50.2/src/Illuminate/Http/Client/RequestException.php deleted file mode 100644 index fa4f418..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/RequestException.php +++ /dev/null @@ -1,43 +0,0 @@ -prepareMessage($response), $response->status()); - - $this->response = $response; - } - - /** - * Prepare the exception message. - * - * @param \Illuminate\Http\Client\Response $response - * @return string - */ - protected function prepareMessage(Response $response) - { - $message = "HTTP request returned status code {$response->status()}"; - - $summary = class_exists(\GuzzleHttp\Psr7\Message::class) - ? \GuzzleHttp\Psr7\Message::bodySummary($response->toPsrResponse()) - : \GuzzleHttp\Psr7\get_message_body_summary($response->toPsrResponse()); - - return is_null($summary) ? $message : $message .= ":\n{$summary}\n"; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/Response.php b/framework-9.50.2/src/Illuminate/Http/Client/Response.php deleted file mode 100644 index 65fda60..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/Response.php +++ /dev/null @@ -1,445 +0,0 @@ -response = $response; - } - - /** - * Get the body of the response. - * - * @return string - */ - public function body() - { - return (string) $this->response->getBody(); - } - - /** - * Get the JSON decoded body of the response as an array or scalar value. - * - * @param string|null $key - * @param mixed $default - * @return mixed - */ - public function json($key = null, $default = null) - { - if (! $this->decoded) { - $this->decoded = json_decode($this->body(), true); - } - - if (is_null($key)) { - return $this->decoded; - } - - return data_get($this->decoded, $key, $default); - } - - /** - * Get the JSON decoded body of the response as an object. - * - * @return object|array - */ - public function object() - { - return json_decode($this->body(), false); - } - - /** - * Get the JSON decoded body of the response as a collection. - * - * @param string|null $key - * @return \Illuminate\Support\Collection - */ - public function collect($key = null) - { - return Collection::make($this->json($key)); - } - - /** - * Get a header from the response. - * - * @param string $header - * @return string - */ - public function header(string $header) - { - return $this->response->getHeaderLine($header); - } - - /** - * Get the headers from the response. - * - * @return array - */ - public function headers() - { - return $this->response->getHeaders(); - } - - /** - * Get the status code of the response. - * - * @return int - */ - public function status() - { - return (int) $this->response->getStatusCode(); - } - - /** - * Get the reason phrase of the response. - * - * @return string - */ - public function reason() - { - return $this->response->getReasonPhrase(); - } - - /** - * Get the effective URI of the response. - * - * @return \Psr\Http\Message\UriInterface|null - */ - public function effectiveUri() - { - return $this->transferStats?->getEffectiveUri(); - } - - /** - * Determine if the request was successful. - * - * @return bool - */ - public function successful() - { - return $this->status() >= 200 && $this->status() < 300; - } - - /** - * Determine if the response was a redirect. - * - * @return bool - */ - public function redirect() - { - return $this->status() >= 300 && $this->status() < 400; - } - - /** - * Determine if the response indicates a client or server error occurred. - * - * @return bool - */ - public function failed() - { - return $this->serverError() || $this->clientError(); - } - - /** - * Determine if the response indicates a client error occurred. - * - * @return bool - */ - public function clientError() - { - return $this->status() >= 400 && $this->status() < 500; - } - - /** - * Determine if the response indicates a server error occurred. - * - * @return bool - */ - public function serverError() - { - return $this->status() >= 500; - } - - /** - * Execute the given callback if there was a server or client error. - * - * @param callable $callback - * @return $this - */ - public function onError(callable $callback) - { - if ($this->failed()) { - $callback($this); - } - - return $this; - } - - /** - * Get the response cookies. - * - * @return \GuzzleHttp\Cookie\CookieJar - */ - public function cookies() - { - return $this->cookies; - } - - /** - * Get the handler stats of the response. - * - * @return array - */ - public function handlerStats() - { - return $this->transferStats?->getHandlerStats() ?? []; - } - - /** - * Close the stream and any underlying resources. - * - * @return $this - */ - public function close() - { - $this->response->getBody()->close(); - - return $this; - } - - /** - * Get the underlying PSR response for the response. - * - * @return \Psr\Http\Message\ResponseInterface - */ - public function toPsrResponse() - { - return $this->response; - } - - /** - * Create an exception if a server or client error occurred. - * - * @return \Illuminate\Http\Client\RequestException|null - */ - public function toException() - { - if ($this->failed()) { - return new RequestException($this); - } - } - - /** - * Throw an exception if a server or client error occurred. - * - * @param \Closure|null $callback - * @return $this - * - * @throws \Illuminate\Http\Client\RequestException - */ - public function throw() - { - $callback = func_get_args()[0] ?? null; - - if ($this->failed()) { - throw tap($this->toException(), function ($exception) use ($callback) { - if ($callback && is_callable($callback)) { - $callback($this, $exception); - } - }); - } - - return $this; - } - - /** - * Throw an exception if a server or client error occurred and the given condition evaluates to true. - * - * @param \Closure|bool $condition - * @param \Closure|null $throwCallback - * @return $this - * - * @throws \Illuminate\Http\Client\RequestException - */ - public function throwIf($condition) - { - return value($condition, $this) ? $this->throw(func_get_args()[1] ?? null) : $this; - } - - /** - * Throw an exception if the response status code matches the given code. - * - * @param callable|int $statusCode - * @return $this - * - * @throws \Illuminate\Http\Client\RequestException - */ - public function throwIfStatus($statusCode) - { - if (is_callable($statusCode) && - $statusCode($this->status(), $this)) { - return $this->throw(); - } - - return $this->status() === $statusCode ? $this->throw() : $this; - } - - /** - * Throw an exception unless the response status code matches the given code. - * - * @param callable|int $statusCode - * @return $this - * - * @throws \Illuminate\Http\Client\RequestException - */ - public function throwUnlessStatus($statusCode) - { - if (is_callable($statusCode) && - ! $statusCode($this->status(), $this)) { - return $this->throw(); - } - - return $this->status() === $statusCode ? $this : $this->throw(); - } - - /** - * Throw an exception if the response status code is a 4xx level code. - * - * @return $this - * - * @throws \Illuminate\Http\Client\RequestException - */ - public function throwIfClientError() - { - return $this->clientError() ? $this->throw() : $this; - } - - /** - * Throw an exception if the response status code is a 5xx level code. - * - * @return $this - * - * @throws \Illuminate\Http\Client\RequestException - */ - public function throwIfServerError() - { - return $this->serverError() ? $this->throw() : $this; - } - - /** - * Determine if the given offset exists. - * - * @param string $offset - * @return bool - */ - public function offsetExists($offset): bool - { - return isset($this->json()[$offset]); - } - - /** - * Get the value for a given offset. - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset): mixed - { - return $this->json()[$offset]; - } - - /** - * Set the value at the given offset. - * - * @param string $offset - * @param mixed $value - * @return void - * - * @throws \LogicException - */ - public function offsetSet($offset, $value): void - { - throw new LogicException('Response data may not be mutated using array access.'); - } - - /** - * Unset the value at the given offset. - * - * @param string $offset - * @return void - * - * @throws \LogicException - */ - public function offsetUnset($offset): void - { - throw new LogicException('Response data may not be mutated using array access.'); - } - - /** - * Get the body of the response. - * - * @return string - */ - public function __toString() - { - return $this->body(); - } - - /** - * Dynamically proxy other methods to the underlying response. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return static::hasMacro($method) - ? $this->macroCall($method, $parameters) - : $this->response->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Client/ResponseSequence.php b/framework-9.50.2/src/Illuminate/Http/Client/ResponseSequence.php deleted file mode 100644 index 5925c03..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Client/ResponseSequence.php +++ /dev/null @@ -1,156 +0,0 @@ -responses = $responses; - } - - /** - * Push a response to the sequence. - * - * @param string|array|null $body - * @param int $status - * @param array $headers - * @return $this - */ - public function push($body = null, int $status = 200, array $headers = []) - { - return $this->pushResponse( - Factory::response($body, $status, $headers) - ); - } - - /** - * Push a response with the given status code to the sequence. - * - * @param int $status - * @param array $headers - * @return $this - */ - public function pushStatus(int $status, array $headers = []) - { - return $this->pushResponse( - Factory::response('', $status, $headers) - ); - } - - /** - * Push response with the contents of a file as the body to the sequence. - * - * @param string $filePath - * @param int $status - * @param array $headers - * @return $this - */ - public function pushFile(string $filePath, int $status = 200, array $headers = []) - { - $string = file_get_contents($filePath); - - return $this->pushResponse( - Factory::response($string, $status, $headers) - ); - } - - /** - * Push a response to the sequence. - * - * @param mixed $response - * @return $this - */ - public function pushResponse($response) - { - $this->responses[] = $response; - - return $this; - } - - /** - * Make the sequence return a default response when it is empty. - * - * @param \GuzzleHttp\Promise\PromiseInterface|\Closure $response - * @return $this - */ - public function whenEmpty($response) - { - $this->failWhenEmpty = false; - $this->emptyResponse = $response; - - return $this; - } - - /** - * Make the sequence return a default response when it is empty. - * - * @return $this - */ - public function dontFailWhenEmpty() - { - return $this->whenEmpty(Factory::response()); - } - - /** - * Indicate that this sequence has depleted all of its responses. - * - * @return bool - */ - public function isEmpty() - { - return count($this->responses) === 0; - } - - /** - * Get the next response in the sequence. - * - * @return mixed - * - * @throws \OutOfBoundsException - */ - public function __invoke() - { - if ($this->failWhenEmpty && $this->isEmpty()) { - throw new OutOfBoundsException('A request was made, but the response sequence is empty.'); - } - - if (! $this->failWhenEmpty && $this->isEmpty()) { - return value($this->emptyResponse ?? Factory::response()); - } - - return array_shift($this->responses); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Concerns/CanBePrecognitive.php b/framework-9.50.2/src/Illuminate/Http/Concerns/CanBePrecognitive.php deleted file mode 100644 index 54cd79d..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Concerns/CanBePrecognitive.php +++ /dev/null @@ -1,45 +0,0 @@ -headers->has('Precognition-Validate-Only')) { - return $rules; - } - - return Collection::make($rules) - ->only(explode(',', $this->header('Precognition-Validate-Only'))) - ->all(); - } - - /** - * Determine if the request is attempting to be precognitive. - * - * @return bool - */ - public function isAttemptingPrecognition() - { - return $this->header('Precognition') === 'true'; - } - - /** - * Determine if the request is precognitive. - * - * @return bool - */ - public function isPrecognitive() - { - return $this->attributes->get('precognitive', false); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php b/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php deleted file mode 100644 index 0d5f62f..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php +++ /dev/null @@ -1,179 +0,0 @@ -header('CONTENT_TYPE') ?? '', ['/json', '+json']); - } - - /** - * Determine if the current request probably expects a JSON response. - * - * @return bool - */ - public function expectsJson() - { - return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); - } - - /** - * Determine if the current request is asking for JSON. - * - * @return bool - */ - public function wantsJson() - { - $acceptable = $this->getAcceptableContentTypes(); - - return isset($acceptable[0]) && Str::contains(strtolower($acceptable[0]), ['/json', '+json']); - } - - /** - * Determines whether the current requests accepts a given content type. - * - * @param string|array $contentTypes - * @return bool - */ - public function accepts($contentTypes) - { - $accepts = $this->getAcceptableContentTypes(); - - if (count($accepts) === 0) { - return true; - } - - $types = (array) $contentTypes; - - foreach ($accepts as $accept) { - if ($accept === '*/*' || $accept === '*') { - return true; - } - - foreach ($types as $type) { - $accept = strtolower($accept); - - $type = strtolower($type); - - if ($this->matchesType($accept, $type) || $accept === strtok($type, '/').'/*') { - return true; - } - } - } - - return false; - } - - /** - * Return the most suitable content type from the given array based on content negotiation. - * - * @param string|array $contentTypes - * @return string|null - */ - public function prefers($contentTypes) - { - $accepts = $this->getAcceptableContentTypes(); - - $contentTypes = (array) $contentTypes; - - foreach ($accepts as $accept) { - if (in_array($accept, ['*/*', '*'])) { - return $contentTypes[0]; - } - - foreach ($contentTypes as $contentType) { - $type = $contentType; - - if (! is_null($mimeType = $this->getMimeType($contentType))) { - $type = $mimeType; - } - - $accept = strtolower($accept); - - $type = strtolower($type); - - if ($this->matchesType($type, $accept) || $accept === strtok($type, '/').'/*') { - return $contentType; - } - } - } - } - - /** - * Determine if the current request accepts any content type. - * - * @return bool - */ - public function acceptsAnyContentType() - { - $acceptable = $this->getAcceptableContentTypes(); - - return count($acceptable) === 0 || ( - isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*') - ); - } - - /** - * Determines whether a request accepts JSON. - * - * @return bool - */ - public function acceptsJson() - { - return $this->accepts('application/json'); - } - - /** - * Determines whether a request accepts HTML. - * - * @return bool - */ - public function acceptsHtml() - { - return $this->accepts('text/html'); - } - - /** - * Determine if the given content types match. - * - * @param string $actual - * @param string $type - * @return bool - */ - public static function matchesType($actual, $type) - { - if ($actual === $type) { - return true; - } - - $split = explode('/', $actual); - - return isset($split[1]) && preg_match('#'.preg_quote($split[0], '#').'/.+\+'.preg_quote($split[1], '#').'#', $type); - } - - /** - * Get the data format expected in the response. - * - * @param string $default - * @return string - */ - public function format($default = 'html') - { - foreach ($this->getAcceptableContentTypes() as $type) { - if ($format = $this->getFormat($type)) { - return $format; - } - } - - return $default; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithFlashData.php b/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithFlashData.php deleted file mode 100644 index a7dfa1c..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithFlashData.php +++ /dev/null @@ -1,68 +0,0 @@ -getAttribute($key) : $default; - - return $this->hasSession() ? $this->session()->getOldInput($key, $default) : $default; - } - - /** - * Flash the input for the current request to the session. - * - * @return void - */ - public function flash() - { - $this->session()->flashInput($this->input()); - } - - /** - * Flash only some of the input to the session. - * - * @param array|mixed $keys - * @return void - */ - public function flashOnly($keys) - { - $this->session()->flashInput( - $this->only(is_array($keys) ? $keys : func_get_args()) - ); - } - - /** - * Flash only some of the input to the session. - * - * @param array|mixed $keys - * @return void - */ - public function flashExcept($keys) - { - $this->session()->flashInput( - $this->except(is_array($keys) ? $keys : func_get_args()) - ); - } - - /** - * Flush all of the old input from the session. - * - * @return void - */ - public function flush() - { - $this->session()->flashInput([]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithInput.php b/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithInput.php deleted file mode 100644 index 45d8b64..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Concerns/InteractsWithInput.php +++ /dev/null @@ -1,637 +0,0 @@ -retrieveItem('server', $key, $default); - } - - /** - * Determine if a header is set on the request. - * - * @param string $key - * @return bool - */ - public function hasHeader($key) - { - return ! is_null($this->header($key)); - } - - /** - * Retrieve a header from the request. - * - * @param string|null $key - * @param string|array|null $default - * @return string|array|null - */ - public function header($key = null, $default = null) - { - return $this->retrieveItem('headers', $key, $default); - } - - /** - * Get the bearer token from the request headers. - * - * @return string|null - */ - public function bearerToken() - { - $header = $this->header('Authorization', ''); - - $position = strrpos($header, 'Bearer '); - - if ($position !== false) { - $header = substr($header, $position + 7); - - return str_contains($header, ',') ? strstr($header, ',', true) : $header; - } - } - - /** - * Determine if the request contains a given input item key. - * - * @param string|array $key - * @return bool - */ - public function exists($key) - { - return $this->has($key); - } - - /** - * Determine if the request contains a given input item key. - * - * @param string|array $key - * @return bool - */ - public function has($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - $input = $this->all(); - - foreach ($keys as $value) { - if (! Arr::has($input, $value)) { - return false; - } - } - - return true; - } - - /** - * Determine if the request contains any of the given inputs. - * - * @param string|array $keys - * @return bool - */ - public function hasAny($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - $input = $this->all(); - - return Arr::hasAny($input, $keys); - } - - /** - * Apply the callback if the request contains the given input item key. - * - * @param string $key - * @param callable $callback - * @param callable|null $default - * @return $this|mixed - */ - public function whenHas($key, callable $callback, callable $default = null) - { - if ($this->has($key)) { - return $callback(data_get($this->all(), $key)) ?: $this; - } - - if ($default) { - return $default(); - } - - return $this; - } - - /** - * Determine if the request contains a non-empty value for an input item. - * - * @param string|array $key - * @return bool - */ - public function filled($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $value) { - if ($this->isEmptyString($value)) { - return false; - } - } - - return true; - } - - /** - * Determine if the request contains an empty value for an input item. - * - * @param string|array $key - * @return bool - */ - public function isNotFilled($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $value) { - if (! $this->isEmptyString($value)) { - return false; - } - } - - return true; - } - - /** - * Determine if the request contains a non-empty value for any of the given inputs. - * - * @param string|array $keys - * @return bool - */ - public function anyFilled($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - foreach ($keys as $key) { - if ($this->filled($key)) { - return true; - } - } - - return false; - } - - /** - * Apply the callback if the request contains a non-empty value for the given input item key. - * - * @param string $key - * @param callable $callback - * @param callable|null $default - * @return $this|mixed - */ - public function whenFilled($key, callable $callback, callable $default = null) - { - if ($this->filled($key)) { - return $callback(data_get($this->all(), $key)) ?: $this; - } - - if ($default) { - return $default(); - } - - return $this; - } - - /** - * Determine if the request is missing a given input item key. - * - * @param string|array $key - * @return bool - */ - public function missing($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - return ! $this->has($keys); - } - - /** - * Apply the callback if the request is missing the given input item key. - * - * @param string $key - * @param callable $callback - * @param callable|null $default - * @return $this|mixed - */ - public function whenMissing($key, callable $callback, callable $default = null) - { - if ($this->missing($key)) { - return $callback(data_get($this->all(), $key)) ?: $this; - } - - if ($default) { - return $default(); - } - - return $this; - } - - /** - * Determine if the given input key is an empty string for "filled". - * - * @param string $key - * @return bool - */ - protected function isEmptyString($key) - { - $value = $this->input($key); - - return ! is_bool($value) && ! is_array($value) && trim((string) $value) === ''; - } - - /** - * Get the keys for all of the input and files. - * - * @return array - */ - public function keys() - { - return array_merge(array_keys($this->input()), $this->files->keys()); - } - - /** - * Get all of the input and files for the request. - * - * @param array|mixed|null $keys - * @return array - */ - public function all($keys = null) - { - $input = array_replace_recursive($this->input(), $this->allFiles()); - - if (! $keys) { - return $input; - } - - $results = []; - - foreach (is_array($keys) ? $keys : func_get_args() as $key) { - Arr::set($results, $key, Arr::get($input, $key)); - } - - return $results; - } - - /** - * Retrieve an input item from the request. - * - * @param string|null $key - * @param mixed $default - * @return mixed - */ - public function input($key = null, $default = null) - { - return data_get( - $this->getInputSource()->all() + $this->query->all(), $key, $default - ); - } - - /** - * Retrieve input from the request as a Stringable instance. - * - * @param string $key - * @param mixed $default - * @return \Illuminate\Support\Stringable - */ - public function str($key, $default = null) - { - return $this->string($key, $default); - } - - /** - * Retrieve input from the request as a Stringable instance. - * - * @param string $key - * @param mixed $default - * @return \Illuminate\Support\Stringable - */ - public function string($key, $default = null) - { - return str($this->input($key, $default)); - } - - /** - * Retrieve input as a boolean value. - * - * Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false. - * - * @param string|null $key - * @param bool $default - * @return bool - */ - public function boolean($key = null, $default = false) - { - return filter_var($this->input($key, $default), FILTER_VALIDATE_BOOLEAN); - } - - /** - * Retrieve input as an integer value. - * - * @param string $key - * @param int $default - * @return int - */ - public function integer($key, $default = 0) - { - return intval($this->input($key, $default)); - } - - /** - * Retrieve input as a float value. - * - * @param string $key - * @param float $default - * @return float - */ - public function float($key, $default = 0.0) - { - return floatval($this->input($key, $default)); - } - - /** - * Retrieve input from the request as a Carbon instance. - * - * @param string $key - * @param string|null $format - * @param string|null $tz - * @return \Illuminate\Support\Carbon|null - * - * @throws \Carbon\Exceptions\InvalidFormatException - */ - public function date($key, $format = null, $tz = null) - { - if ($this->isNotFilled($key)) { - return null; - } - - if (is_null($format)) { - return Date::parse($this->input($key), $tz); - } - - return Date::createFromFormat($format, $this->input($key), $tz); - } - - /** - * Retrieve input from the request as an enum. - * - * @template TEnum - * - * @param string $key - * @param class-string $enumClass - * @return TEnum|null - */ - public function enum($key, $enumClass) - { - if ($this->isNotFilled($key) || - ! function_exists('enum_exists') || - ! enum_exists($enumClass) || - ! method_exists($enumClass, 'tryFrom')) { - return null; - } - - return $enumClass::tryFrom($this->input($key)); - } - - /** - * Retrieve input from the request as a collection. - * - * @param array|string|null $key - * @return \Illuminate\Support\Collection - */ - public function collect($key = null) - { - return collect(is_array($key) ? $this->only($key) : $this->input($key)); - } - - /** - * Get a subset containing the provided keys with values from the input data. - * - * @param array|mixed $keys - * @return array - */ - public function only($keys) - { - $results = []; - - $input = $this->all(); - - $placeholder = new stdClass; - - foreach (is_array($keys) ? $keys : func_get_args() as $key) { - $value = data_get($input, $key, $placeholder); - - if ($value !== $placeholder) { - Arr::set($results, $key, $value); - } - } - - return $results; - } - - /** - * Get all of the input except for a specified array of items. - * - * @param array|mixed $keys - * @return array - */ - public function except($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - $results = $this->all(); - - Arr::forget($results, $keys); - - return $results; - } - - /** - * Retrieve a query string item from the request. - * - * @param string|null $key - * @param string|array|null $default - * @return string|array|null - */ - public function query($key = null, $default = null) - { - return $this->retrieveItem('query', $key, $default); - } - - /** - * Retrieve a request payload item from the request. - * - * @param string|null $key - * @param string|array|null $default - * @return string|array|null - */ - public function post($key = null, $default = null) - { - return $this->retrieveItem('request', $key, $default); - } - - /** - * Determine if a cookie is set on the request. - * - * @param string $key - * @return bool - */ - public function hasCookie($key) - { - return ! is_null($this->cookie($key)); - } - - /** - * Retrieve a cookie from the request. - * - * @param string|null $key - * @param string|array|null $default - * @return string|array|null - */ - public function cookie($key = null, $default = null) - { - return $this->retrieveItem('cookies', $key, $default); - } - - /** - * Get an array of all of the files on the request. - * - * @return array - */ - public function allFiles() - { - $files = $this->files->all(); - - return $this->convertedFiles = $this->convertedFiles ?? $this->convertUploadedFiles($files); - } - - /** - * Convert the given array of Symfony UploadedFiles to custom Laravel UploadedFiles. - * - * @param array $files - * @return array - */ - protected function convertUploadedFiles(array $files) - { - return array_map(function ($file) { - if (is_null($file) || (is_array($file) && empty(array_filter($file)))) { - return $file; - } - - return is_array($file) - ? $this->convertUploadedFiles($file) - : UploadedFile::createFromBase($file); - }, $files); - } - - /** - * Determine if the uploaded data contains a file. - * - * @param string $key - * @return bool - */ - public function hasFile($key) - { - if (! is_array($files = $this->file($key))) { - $files = [$files]; - } - - foreach ($files as $file) { - if ($this->isValidFile($file)) { - return true; - } - } - - return false; - } - - /** - * Check that the given file is a valid file instance. - * - * @param mixed $file - * @return bool - */ - protected function isValidFile($file) - { - return $file instanceof SplFileInfo && $file->getPath() !== ''; - } - - /** - * Retrieve a file from the request. - * - * @param string|null $key - * @param mixed $default - * @return \Illuminate\Http\UploadedFile|\Illuminate\Http\UploadedFile[]|array|null - */ - public function file($key = null, $default = null) - { - return data_get($this->allFiles(), $key, $default); - } - - /** - * Retrieve a parameter item from a given source. - * - * @param string $source - * @param string|null $key - * @param string|array|null $default - * @return string|array|null - */ - protected function retrieveItem($source, $key, $default) - { - if (is_null($key)) { - return $this->$source->all(); - } - - if ($this->$source instanceof InputBag) { - return $this->$source->all()[$key] ?? $default; - } - - return $this->$source->get($key, $default); - } - - /** - * Dump the request items and end the script. - * - * @param mixed ...$keys - * @return never - */ - public function dd(...$keys) - { - $this->dump(...$keys); - - exit(1); - } - - /** - * Dump the items. - * - * @param mixed $keys - * @return $this - */ - public function dump($keys = []) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - VarDumper::dump(count($keys) > 0 ? $this->only($keys) : $this->all()); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Exceptions/HttpResponseException.php b/framework-9.50.2/src/Illuminate/Http/Exceptions/HttpResponseException.php deleted file mode 100644 index b27052f..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Exceptions/HttpResponseException.php +++ /dev/null @@ -1,37 +0,0 @@ -response = $response; - } - - /** - * Get the underlying response instance. - * - * @return \Symfony\Component\HttpFoundation\Response - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Exceptions/PostTooLargeException.php b/framework-9.50.2/src/Illuminate/Http/Exceptions/PostTooLargeException.php deleted file mode 100644 index d5bbc60..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Exceptions/PostTooLargeException.php +++ /dev/null @@ -1,23 +0,0 @@ -getRealPath(); - } - - /** - * Get the file's extension. - * - * @return string - */ - public function extension() - { - return $this->guessExtension(); - } - - /** - * Get a filename for the file. - * - * @param string|null $path - * @return string - */ - public function hashName($path = null) - { - if ($path) { - $path = rtrim($path, '/').'/'; - } - - $hash = $this->hashName ?: $this->hashName = Str::random(40); - - if ($extension = $this->guessExtension()) { - $extension = '.'.$extension; - } - - return $path.$hash.$extension; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/JsonResponse.php b/framework-9.50.2/src/Illuminate/Http/JsonResponse.php deleted file mode 100755 index 6e2f51d..0000000 --- a/framework-9.50.2/src/Illuminate/Http/JsonResponse.php +++ /dev/null @@ -1,139 +0,0 @@ -encodingOptions = $options; - - parent::__construct($data, $status, $headers, $json); - } - - /** - * {@inheritdoc} - * - * @return static - */ - public static function fromJsonString(?string $data = null, int $status = 200, array $headers = []): static - { - return new static($data, $status, $headers, 0, true); - } - - /** - * Sets the JSONP callback. - * - * @param string|null $callback - * @return $this - */ - public function withCallback($callback = null) - { - return $this->setCallback($callback); - } - - /** - * Get the json_decoded data from the response. - * - * @param bool $assoc - * @param int $depth - * @return mixed - */ - public function getData($assoc = false, $depth = 512) - { - return json_decode($this->data, $assoc, $depth); - } - - /** - * {@inheritdoc} - * - * @return static - */ - public function setData($data = []): static - { - $this->original = $data; - - // Ensure json_last_error() is cleared... - json_decode('[]'); - - if ($data instanceof Jsonable) { - $this->data = $data->toJson($this->encodingOptions); - } elseif ($data instanceof JsonSerializable) { - $this->data = json_encode($data->jsonSerialize(), $this->encodingOptions); - } elseif ($data instanceof Arrayable) { - $this->data = json_encode($data->toArray(), $this->encodingOptions); - } else { - $this->data = json_encode($data, $this->encodingOptions); - } - - if (! $this->hasValidJson(json_last_error())) { - throw new InvalidArgumentException(json_last_error_msg()); - } - - return $this->update(); - } - - /** - * Determine if an error occurred during JSON encoding. - * - * @param int $jsonError - * @return bool - */ - protected function hasValidJson($jsonError) - { - if ($jsonError === JSON_ERROR_NONE) { - return true; - } - - return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) && - in_array($jsonError, [ - JSON_ERROR_RECURSION, - JSON_ERROR_INF_OR_NAN, - JSON_ERROR_UNSUPPORTED_TYPE, - ]); - } - - /** - * {@inheritdoc} - * - * @return static - */ - public function setEncodingOptions($options): static - { - $this->encodingOptions = (int) $options; - - return $this->setData($this->getData()); - } - - /** - * Determine if a JSON encoding option is set. - * - * @param int $option - * @return bool - */ - public function hasEncodingOption($option) - { - return (bool) ($this->encodingOptions & $option); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/LICENSE.md b/framework-9.50.2/src/Illuminate/Http/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Http/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Http/Middleware/AddLinkHeadersForPreloadedAssets.php b/framework-9.50.2/src/Illuminate/Http/Middleware/AddLinkHeadersForPreloadedAssets.php deleted file mode 100644 index 93ca06e..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Middleware/AddLinkHeadersForPreloadedAssets.php +++ /dev/null @@ -1,27 +0,0 @@ -header('Link', Collection::make(Vite::preloadedAssets()) - ->map(fn ($attributes, $url) => "<{$url}>; ".implode('; ', $attributes)) - ->join(', ')); - } - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Middleware/CheckResponseForModifications.php b/framework-9.50.2/src/Illuminate/Http/Middleware/CheckResponseForModifications.php deleted file mode 100644 index 2a93e21..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Middleware/CheckResponseForModifications.php +++ /dev/null @@ -1,27 +0,0 @@ -isNotModified($request); - } - - return $response; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Middleware/FrameGuard.php b/framework-9.50.2/src/Illuminate/Http/Middleware/FrameGuard.php deleted file mode 100644 index 66edce4..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Middleware/FrameGuard.php +++ /dev/null @@ -1,24 +0,0 @@ -headers->set('X-Frame-Options', 'SAMEORIGIN', false); - - return $response; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Middleware/HandleCors.php b/framework-9.50.2/src/Illuminate/Http/Middleware/HandleCors.php deleted file mode 100644 index eee0305..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Middleware/HandleCors.php +++ /dev/null @@ -1,112 +0,0 @@ -container = $container; - $this->cors = $cors; - } - - /** - * Handle the incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return \Illuminate\Http\Response - */ - public function handle($request, Closure $next) - { - if (! $this->hasMatchingPath($request)) { - return $next($request); - } - - $this->cors->setOptions($this->container['config']->get('cors', [])); - - if ($this->cors->isPreflightRequest($request)) { - $response = $this->cors->handlePreflightRequest($request); - - $this->cors->varyHeader($response, 'Access-Control-Request-Method'); - - return $response; - } - - $response = $next($request); - - if ($request->getMethod() === 'OPTIONS') { - $this->cors->varyHeader($response, 'Access-Control-Request-Method'); - } - - return $this->cors->addActualRequestHeaders($response, $request); - } - - /** - * Get the path from the configuration to determine if the CORS service should run. - * - * @param \Illuminate\Http\Request $request - * @return bool - */ - protected function hasMatchingPath(Request $request): bool - { - $paths = $this->getPathsByHost($request->getHost()); - - foreach ($paths as $path) { - if ($path !== '/') { - $path = trim($path, '/'); - } - - if ($request->fullUrlIs($path) || $request->is($path)) { - return true; - } - } - - return false; - } - - /** - * Get the CORS paths for the given host. - * - * @param string $host - * @return array - */ - protected function getPathsByHost(string $host) - { - $paths = $this->container['config']->get('cors.paths', []); - - if (isset($paths[$host])) { - return $paths[$host]; - } - - return array_filter($paths, function ($path) { - return is_string($path); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Middleware/SetCacheHeaders.php b/framework-9.50.2/src/Illuminate/Http/Middleware/SetCacheHeaders.php deleted file mode 100644 index 0a1a156..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Middleware/SetCacheHeaders.php +++ /dev/null @@ -1,65 +0,0 @@ -isMethodCacheable() || (! $response->getContent() && ! $response instanceof BinaryFileResponse)) { - return $response; - } - - if (is_string($options)) { - $options = $this->parseOptions($options); - } - - if (isset($options['etag']) && $options['etag'] === true) { - $options['etag'] = $response->getEtag() ?? md5($response->getContent()); - } - - if (isset($options['last_modified'])) { - if (is_numeric($options['last_modified'])) { - $options['last_modified'] = Carbon::createFromTimestamp($options['last_modified']); - } else { - $options['last_modified'] = Carbon::parse($options['last_modified']); - } - } - - $response->setCache($options); - $response->isNotModified($request); - - return $response; - } - - /** - * Parse the given header options. - * - * @param string $options - * @return array - */ - protected function parseOptions($options) - { - return collect(explode(';', rtrim($options, ';')))->mapWithKeys(function ($option) { - $data = explode('=', $option, 2); - - return [$data[0] => $data[1] ?? true]; - })->all(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Middleware/TrustHosts.php b/framework-9.50.2/src/Illuminate/Http/Middleware/TrustHosts.php deleted file mode 100644 index 00a5a44..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Middleware/TrustHosts.php +++ /dev/null @@ -1,73 +0,0 @@ -app = $app; - } - - /** - * Get the host patterns that should be trusted. - * - * @return array - */ - abstract public function hosts(); - - /** - * Handle the incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return \Illuminate\Http\Response - */ - public function handle(Request $request, $next) - { - if ($this->shouldSpecifyTrustedHosts()) { - Request::setTrustedHosts(array_filter($this->hosts())); - } - - return $next($request); - } - - /** - * Determine if the application should specify trusted hosts. - * - * @return bool - */ - protected function shouldSpecifyTrustedHosts() - { - return ! $this->app->environment('local') && - ! $this->app->runningUnitTests(); - } - - /** - * Get a regular expression matching the application URL and all of its subdomains. - * - * @return string|null - */ - protected function allSubdomainsOfApplicationUrl() - { - if ($host = parse_url($this->app['config']->get('app.url'), PHP_URL_HOST)) { - return '^(.+\.)?'.preg_quote($host).'$'; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Middleware/TrustProxies.php b/framework-9.50.2/src/Illuminate/Http/Middleware/TrustProxies.php deleted file mode 100644 index faf5daf..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Middleware/TrustProxies.php +++ /dev/null @@ -1,116 +0,0 @@ -|string|null - */ - protected $proxies; - - /** - * The proxy header mappings. - * - * @var int - */ - protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_PREFIX | Request::HEADER_X_FORWARDED_AWS_ELB; - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\HttpException - */ - public function handle(Request $request, Closure $next) - { - $request::setTrustedProxies([], $this->getTrustedHeaderNames()); - - $this->setTrustedProxyIpAddresses($request); - - return $next($request); - } - - /** - * Sets the trusted proxies on the request. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - protected function setTrustedProxyIpAddresses(Request $request) - { - $trustedIps = $this->proxies() ?: config('trustedproxy.proxies'); - - if ($trustedIps === '*' || $trustedIps === '**') { - return $this->setTrustedProxyIpAddressesToTheCallingIp($request); - } - - $trustedIps = is_string($trustedIps) - ? array_map('trim', explode(',', $trustedIps)) - : $trustedIps; - - if (is_array($trustedIps)) { - return $this->setTrustedProxyIpAddressesToSpecificIps($request, $trustedIps); - } - } - - /** - * Specify the IP addresses to trust explicitly. - * - * @param \Illuminate\Http\Request $request - * @param array $trustedIps - * @return void - */ - protected function setTrustedProxyIpAddressesToSpecificIps(Request $request, array $trustedIps) - { - $request->setTrustedProxies($trustedIps, $this->getTrustedHeaderNames()); - } - - /** - * Set the trusted proxy to be the IP address calling this servers. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - protected function setTrustedProxyIpAddressesToTheCallingIp(Request $request) - { - $request->setTrustedProxies([$request->server->get('REMOTE_ADDR')], $this->getTrustedHeaderNames()); - } - - /** - * Retrieve trusted header name(s), falling back to defaults if config not set. - * - * @return int A bit field of Request::HEADER_*, to set which headers to trust from your proxies. - */ - protected function getTrustedHeaderNames() - { - return match ($this->headers) { - 'HEADER_X_FORWARDED_AWS_ELB', Request::HEADER_X_FORWARDED_AWS_ELB => Request::HEADER_X_FORWARDED_AWS_ELB, - 'HEADER_FORWARDED', Request::HEADER_FORWARDED => Request::HEADER_FORWARDED, - 'HEADER_X_FORWARDED_FOR', Request::HEADER_X_FORWARDED_FOR => Request::HEADER_X_FORWARDED_FOR, - 'HEADER_X_FORWARDED_HOST', Request::HEADER_X_FORWARDED_HOST => Request::HEADER_X_FORWARDED_HOST, - 'HEADER_X_FORWARDED_PORT', Request::HEADER_X_FORWARDED_PORT => Request::HEADER_X_FORWARDED_PORT, - 'HEADER_X_FORWARDED_PROTO', Request::HEADER_X_FORWARDED_PROTO => Request::HEADER_X_FORWARDED_PROTO, - 'HEADER_X_FORWARDED_PREFIX', Request::HEADER_X_FORWARDED_PREFIX => Request::HEADER_X_FORWARDED_PREFIX, - default => Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_PREFIX | Request::HEADER_X_FORWARDED_AWS_ELB, - }; - } - - /** - * Get the trusted proxies. - * - * @return array|string|null - */ - protected function proxies() - { - return $this->proxies; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/RedirectResponse.php b/framework-9.50.2/src/Illuminate/Http/RedirectResponse.php deleted file mode 100755 index 6edd57e..0000000 --- a/framework-9.50.2/src/Illuminate/Http/RedirectResponse.php +++ /dev/null @@ -1,258 +0,0 @@ - $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|null $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 $this - */ - 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); - } - - /** - * Add a fragment identifier to the URL. - * - * @param string $fragment - * @return $this - */ - public function withFragment($fragment) - { - return $this->withoutFragment() - ->setTargetUrl($this->getTargetUrl().'#'.Str::after($fragment, '#')); - } - - /** - * Remove any fragment identifier from the response URL. - * - * @return $this - */ - public function withoutFragment() - { - return $this->setTargetUrl(Str::before($this->getTargetUrl(), '#')); - } - - /** - * 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 instance. - * - * @return \Illuminate\Session\Store|null - */ - public function getSession() - { - return $this->session; - } - - /** - * Set the session store instance. - * - * @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 mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - if (str_starts_with($method, 'with')) { - return $this->with(Str::snake(substr($method, 4)), $parameters[0]); - } - - static::throwBadMethodCallException($method); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Request.php b/framework-9.50.2/src/Illuminate/Http/Request.php deleted file mode 100644 index a0255fc..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Request.php +++ /dev/null @@ -1,790 +0,0 @@ -getMethod(); - } - - /** - * Get the root URL for the application. - * - * @return string - */ - public function root() - { - return rtrim($this->getSchemeAndHttpHost().$this->getBaseUrl(), '/'); - } - - /** - * Get the URL (no query string) for the request. - * - * @return string - */ - public function url() - { - return rtrim(preg_replace('/\?.*/', '', $this->getUri()), '/'); - } - - /** - * Get the full URL for the request. - * - * @return string - */ - public function fullUrl() - { - $query = $this->getQueryString(); - - $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; - - return $query ? $this->url().$question.$query : $this->url(); - } - - /** - * Get the full URL for the request with the added query string parameters. - * - * @param array $query - * @return string - */ - public function fullUrlWithQuery(array $query) - { - $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; - - return count($this->query()) > 0 - ? $this->url().$question.Arr::query(array_merge($this->query(), $query)) - : $this->fullUrl().$question.Arr::query($query); - } - - /** - * Get the full URL for the request without the given query string parameters. - * - * @param array|string $keys - * @return string - */ - public function fullUrlWithoutQuery($keys) - { - $query = Arr::except($this->query(), $keys); - - $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; - - return count($query) > 0 - ? $this->url().$question.Arr::query($query) - : $this->url(); - } - - /** - * Get the current path info for the request. - * - * @return string - */ - public function path() - { - $pattern = trim($this->getPathInfo(), '/'); - - return $pattern === '' ? '/' : $pattern; - } - - /** - * Get the current decoded path info for the request. - * - * @return string - */ - public function decodedPath() - { - return rawurldecode($this->path()); - } - - /** - * Get a segment from the URI (1 based index). - * - * @param int $index - * @param string|null $default - * @return string|null - */ - public function segment($index, $default = null) - { - return Arr::get($this->segments(), $index - 1, $default); - } - - /** - * Get all of the segments for the request path. - * - * @return array - */ - public function segments() - { - $segments = explode('/', $this->decodedPath()); - - return array_values(array_filter($segments, function ($value) { - return $value !== ''; - })); - } - - /** - * Determine if the current request URI matches a pattern. - * - * @param mixed ...$patterns - * @return bool - */ - public function is(...$patterns) - { - $path = $this->decodedPath(); - - return collect($patterns)->contains(fn ($pattern) => Str::is($pattern, $path)); - } - - /** - * Determine if the route name matches a given pattern. - * - * @param mixed ...$patterns - * @return bool - */ - public function routeIs(...$patterns) - { - return $this->route() && $this->route()->named(...$patterns); - } - - /** - * Determine if the current request URL and query string match a pattern. - * - * @param mixed ...$patterns - * @return bool - */ - public function fullUrlIs(...$patterns) - { - $url = $this->fullUrl(); - - return collect($patterns)->contains(fn ($pattern) => Str::is($pattern, $url)); - } - - /** - * Get the host name. - * - * @return string - */ - public function host() - { - return $this->getHost(); - } - - /** - * Get the HTTP host being requested. - * - * @return string - */ - public function httpHost() - { - return $this->getHttpHost(); - } - - /** - * Get the scheme and HTTP host. - * - * @return string - */ - public function schemeAndHttpHost() - { - return $this->getSchemeAndHttpHost(); - } - - /** - * Determine if the request is the result of an AJAX call. - * - * @return bool - */ - public function ajax() - { - return $this->isXmlHttpRequest(); - } - - /** - * Determine if the request is the result of a PJAX call. - * - * @return bool - */ - public function pjax() - { - return $this->headers->get('X-PJAX') == true; - } - - /** - * Determine if the request is the result of a prefetch call. - * - * @return bool - */ - public function prefetch() - { - return strcasecmp($this->server->get('HTTP_X_MOZ') ?? '', 'prefetch') === 0 || - strcasecmp($this->headers->get('Purpose') ?? '', 'prefetch') === 0; - } - - /** - * Determine if the request is over HTTPS. - * - * @return bool - */ - public function secure() - { - return $this->isSecure(); - } - - /** - * Get the client IP address. - * - * @return string|null - */ - public function ip() - { - return $this->getClientIp(); - } - - /** - * Get the client IP addresses. - * - * @return array - */ - public function ips() - { - return $this->getClientIps(); - } - - /** - * Get the client user agent. - * - * @return string|null - */ - public function userAgent() - { - return $this->headers->get('User-Agent'); - } - - /** - * Merge new input into the current request's input array. - * - * @param array $input - * @return $this - */ - public function merge(array $input) - { - $this->getInputSource()->add($input); - - return $this; - } - - /** - * Merge new input into the request's input, but only when that key is missing from the request. - * - * @param array $input - * @return $this - */ - public function mergeIfMissing(array $input) - { - return $this->merge(collect($input)->filter(function ($value, $key) { - return $this->missing($key); - })->toArray()); - } - - /** - * Replace the input for the current request. - * - * @param array $input - * @return $this - */ - public function replace(array $input) - { - $this->getInputSource()->replace($input); - - return $this; - } - - /** - * This method belongs to Symfony HttpFoundation and is not usually needed when using Laravel. - * - * Instead, you may use the "input" method. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get(string $key, mixed $default = null): mixed - { - return parent::get($key, $default); - } - - /** - * Get the JSON payload for the request. - * - * @param string|null $key - * @param mixed $default - * @return \Symfony\Component\HttpFoundation\ParameterBag|mixed - */ - public function json($key = null, $default = null) - { - if (! isset($this->json)) { - $this->json = new ParameterBag((array) json_decode($this->getContent(), true)); - } - - if (is_null($key)) { - return $this->json; - } - - return data_get($this->json->all(), $key, $default); - } - - /** - * Get the input source for the request. - * - * @return \Symfony\Component\HttpFoundation\ParameterBag - */ - protected function getInputSource() - { - if ($this->isJson()) { - return $this->json(); - } - - return in_array($this->getRealMethod(), ['GET', 'HEAD']) ? $this->query : $this->request; - } - - /** - * Create a new request instance from the given Laravel request. - * - * @param \Illuminate\Http\Request $from - * @param \Illuminate\Http\Request|null $to - * @return static - */ - public static function createFrom(self $from, $to = null) - { - $request = $to ?: new static; - - $files = array_filter($from->files->all()); - - $request->initialize( - $from->query->all(), - $from->request->all(), - $from->attributes->all(), - $from->cookies->all(), - $files, - $from->server->all(), - $from->getContent() - ); - - $request->headers->replace($from->headers->all()); - - $request->setRequestLocale($from->getLocale()); - - $request->setDefaultRequestLocale($from->getDefaultLocale()); - - $request->setJson($from->json()); - - if ($from->hasSession() && $session = $from->session()) { - $request->setLaravelSession($session); - } - - $request->setUserResolver($from->getUserResolver()); - - $request->setRouteResolver($from->getRouteResolver()); - - return $request; - } - - /** - * Create an Illuminate request from a Symfony instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return static - */ - public static function createFromBase(SymfonyRequest $request) - { - $newRequest = (new static)->duplicate( - $request->query->all(), $request->request->all(), $request->attributes->all(), - $request->cookies->all(), $request->files->all(), $request->server->all() - ); - - $newRequest->headers->replace($request->headers->all()); - - $newRequest->content = $request->content; - - if ($newRequest->isJson()) { - $newRequest->request = $newRequest->json(); - } - - return $newRequest; - } - - /** - * {@inheritdoc} - * - * @return static - */ - public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null): static - { - return parent::duplicate($query, $request, $attributes, $cookies, $this->filterFiles($files), $server); - } - - /** - * Filter the given array of files, removing any empty values. - * - * @param mixed $files - * @return mixed - */ - protected function filterFiles($files) - { - if (! $files) { - return; - } - - foreach ($files as $key => $file) { - if (is_array($file)) { - $files[$key] = $this->filterFiles($files[$key]); - } - - if (empty($files[$key])) { - unset($files[$key]); - } - } - - return $files; - } - - /** - * {@inheritdoc} - */ - public function hasSession(bool $skipIfUninitialized = false): bool - { - return ! is_null($this->session); - } - - /** - * {@inheritdoc} - */ - public function getSession(): SessionInterface - { - return $this->hasSession() - ? new SymfonySessionDecorator($this->session()) - : throw new SessionNotFoundException; - } - - /** - * Get the session associated with the request. - * - * @return \Illuminate\Contracts\Session\Session - * - * @throws \RuntimeException - */ - public function session() - { - if (! $this->hasSession()) { - throw new RuntimeException('Session store not set on request.'); - } - - return $this->session; - } - - /** - * Set the session instance on the request. - * - * @param \Illuminate\Contracts\Session\Session $session - * @return void - */ - public function setLaravelSession($session) - { - $this->session = $session; - } - - /** - * Set the locale for the request instance. - * - * @param string $locale - * @return void - */ - public function setRequestLocale(string $locale) - { - $this->locale = $locale; - } - - /** - * Set the default locale for the request instance. - * - * @param string $locale - * @return void - */ - public function setDefaultRequestLocale(string $locale) - { - $this->defaultLocale = $locale; - } - - /** - * Get the user making the request. - * - * @param string|null $guard - * @return mixed - */ - public function user($guard = null) - { - return call_user_func($this->getUserResolver(), $guard); - } - - /** - * Get the route handling the request. - * - * @param string|null $param - * @param mixed $default - * @return \Illuminate\Routing\Route|object|string|null - */ - public function route($param = null, $default = null) - { - $route = call_user_func($this->getRouteResolver()); - - if (is_null($route) || is_null($param)) { - return $route; - } - - return $route->parameter($param, $default); - } - - /** - * Get a unique fingerprint for the request / route / IP address. - * - * @return string - * - * @throws \RuntimeException - */ - public function fingerprint() - { - if (! $route = $this->route()) { - throw new RuntimeException('Unable to generate fingerprint. Route unavailable.'); - } - - return sha1(implode('|', array_merge( - $route->methods(), - [$route->getDomain(), $route->uri(), $this->ip()] - ))); - } - - /** - * Set the JSON payload for the request. - * - * @param \Symfony\Component\HttpFoundation\ParameterBag $json - * @return $this - */ - public function setJson($json) - { - $this->json = $json; - - return $this; - } - - /** - * Get the user resolver callback. - * - * @return \Closure - */ - public function getUserResolver() - { - return $this->userResolver ?: function () { - // - }; - } - - /** - * Set the user resolver callback. - * - * @param \Closure $callback - * @return $this - */ - public function setUserResolver(Closure $callback) - { - $this->userResolver = $callback; - - return $this; - } - - /** - * Get the route resolver callback. - * - * @return \Closure - */ - public function getRouteResolver() - { - return $this->routeResolver ?: function () { - // - }; - } - - /** - * Set the route resolver callback. - * - * @param \Closure $callback - * @return $this - */ - public function setRouteResolver(Closure $callback) - { - $this->routeResolver = $callback; - - return $this; - } - - /** - * Get all of the input and files for the request. - * - * @return array - */ - public function toArray(): array - { - return $this->all(); - } - - /** - * Determine if the given offset exists. - * - * @param string $offset - * @return bool - */ - public function offsetExists($offset): bool - { - $route = $this->route(); - - return Arr::has( - $this->all() + ($route ? $route->parameters() : []), - $offset - ); - } - - /** - * Get the value at the given offset. - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset): mixed - { - return $this->__get($offset); - } - - /** - * Set the value at the given offset. - * - * @param string $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset, $value): void - { - $this->getInputSource()->set($offset, $value); - } - - /** - * Remove the value at the given offset. - * - * @param string $offset - * @return void - */ - public function offsetUnset($offset): void - { - $this->getInputSource()->remove($offset); - } - - /** - * Check if an input element is set on the request. - * - * @param string $key - * @return bool - */ - public function __isset($key) - { - return ! is_null($this->__get($key)); - } - - /** - * Get an input element from the request. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return Arr::get($this->all(), $key, fn () => $this->route($key)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/CollectsResources.php b/framework-9.50.2/src/Illuminate/Http/Resources/CollectsResources.php deleted file mode 100644 index b84c344..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/CollectsResources.php +++ /dev/null @@ -1,94 +0,0 @@ -collects(); - - $this->collection = $collects && ! $resource->first() instanceof $collects - ? $resource->mapInto($collects) - : $resource->toBase(); - - return ($resource instanceof AbstractPaginator || $resource instanceof AbstractCursorPaginator) - ? $resource->setCollection($this->collection) - : $this->collection; - } - - /** - * Get the resource that this resource collects. - * - * @return string|null - */ - protected function collects() - { - $collects = null; - - if ($this->collects) { - $collects = $this->collects; - } elseif (str_ends_with(class_basename($this), 'Collection') && - (class_exists($class = Str::replaceLast('Collection', '', get_class($this))) || - class_exists($class = Str::replaceLast('Collection', 'Resource', get_class($this))))) { - $collects = $class; - } - - if (! $collects || is_a($collects, JsonResource::class, true)) { - return $collects; - } - - throw new LogicException('Resource collections must collect instances of '.JsonResource::class.'.'); - } - - /** - * Get the JSON serialization options that should be applied to the resource response. - * - * @return int - */ - public function jsonOptions() - { - $collects = $this->collects(); - - if (! $collects) { - return 0; - } - - return (new ReflectionClass($collects)) - ->newInstanceWithoutConstructor() - ->jsonOptions(); - } - - /** - * Get an iterator for the resource collection. - * - * @return \ArrayIterator - */ - public function getIterator(): Traversable - { - return $this->collection->getIterator(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php b/framework-9.50.2/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php deleted file mode 100644 index 72a0466..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php +++ /dev/null @@ -1,353 +0,0 @@ - $value) { - $index++; - - if (is_array($value)) { - $data[$key] = $this->filter($value); - - continue; - } - - if (is_numeric($key) && $value instanceof MergeValue) { - return $this->mergeData( - $data, $index, $this->filter($value->data), - array_values($value->data) === $value->data - ); - } - - if ($value instanceof self && is_null($value->resource)) { - $data[$key] = null; - } - } - - return $this->removeMissingValues($data); - } - - /** - * Merge the given data in at the given index. - * - * @param array $data - * @param int $index - * @param array $merge - * @param bool $numericKeys - * @return array - */ - protected function mergeData($data, $index, $merge, $numericKeys) - { - if ($numericKeys) { - return $this->removeMissingValues(array_merge( - array_merge(array_slice($data, 0, $index, true), $merge), - $this->filter(array_values(array_slice($data, $index + 1, null, true))) - )); - } - - return $this->removeMissingValues(array_slice($data, 0, $index, true) + - $merge + - $this->filter(array_slice($data, $index + 1, null, true))); - } - - /** - * Remove the missing values from the filtered data. - * - * @param array $data - * @return array - */ - protected function removeMissingValues($data) - { - $numericKeys = true; - - foreach ($data as $key => $value) { - if (($value instanceof PotentiallyMissing && $value->isMissing()) || - ($value instanceof self && - $value->resource instanceof PotentiallyMissing && - $value->isMissing())) { - unset($data[$key]); - } else { - $numericKeys = $numericKeys && is_numeric($key); - } - } - - if (property_exists($this, 'preserveKeys') && $this->preserveKeys === true) { - return $data; - } - - return $numericKeys ? array_values($data) : $data; - } - - /** - * Retrieve a value if the given "condition" is truthy. - * - * @param bool $condition - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - protected function when($condition, $value, $default = null) - { - if ($condition) { - return value($value); - } - - return func_num_args() === 3 ? value($default) : new MissingValue; - } - - /** - * Retrieve a value if the given "condition" is falsy. - * - * @param bool $condition - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - public function unless($condition, $value, $default = null) - { - $arguments = func_num_args() === 2 ? [$value] : [$value, $default]; - - return $this->when(! $condition, ...$arguments); - } - - /** - * Merge a value into the array. - * - * @param mixed $value - * @return \Illuminate\Http\Resources\MergeValue|mixed - */ - protected function merge($value) - { - return $this->mergeWhen(true, $value); - } - - /** - * Merge a value if the given condition is truthy. - * - * @param bool $condition - * @param mixed $value - * @return \Illuminate\Http\Resources\MergeValue|mixed - */ - protected function mergeWhen($condition, $value) - { - return $condition ? new MergeValue(value($value)) : new MissingValue; - } - - /** - * Merge a value unless the given condition is truthy. - * - * @param bool $condition - * @param mixed $value - * @return \Illuminate\Http\Resources\MergeValue|mixed - */ - protected function mergeUnless($condition, $value) - { - return ! $condition ? new MergeValue(value($value)) : new MissingValue; - } - - /** - * Merge the given attributes. - * - * @param array $attributes - * @return \Illuminate\Http\Resources\MergeValue - */ - protected function attributes($attributes) - { - return new MergeValue( - Arr::only($this->resource->toArray(), $attributes) - ); - } - - /** - * Retrieve an attribute if it exists on the resource. - * - * @param string $attribute - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - public function whenHas($attribute, $value = null, $default = null) - { - if (func_num_args() < 3) { - $default = new MissingValue; - } - - if (! array_key_exists($attribute, $this->resource->getAttributes())) { - return value($default); - } - - return func_num_args() === 1 - ? $this->resource->{$attribute} - : value($value, $this->resource->{$attribute}); - } - - /** - * Retrieve a model attribute if it is null. - * - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - protected function whenNull($value, $default = null) - { - $arguments = func_num_args() == 1 ? [$value] : [$value, $default]; - - return $this->when(is_null($value), ...$arguments); - } - - /** - * Retrieve a model attribute if it is not null. - * - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - protected function whenNotNull($value, $default = null) - { - $arguments = func_num_args() == 1 ? [$value] : [$value, $default]; - - return $this->when(! is_null($value), ...$arguments); - } - - /** - * Retrieve an accessor when it has been appended. - * - * @param string $attribute - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - protected function whenAppended($attribute, $value = null, $default = null) - { - if ($this->resource->hasAppended($attribute)) { - return func_num_args() >= 2 ? value($value) : $this->resource->$attribute; - } - - return func_num_args() === 3 ? value($default) : new MissingValue; - } - - /** - * Retrieve a relationship if it has been loaded. - * - * @param string $relationship - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - protected function whenLoaded($relationship, $value = null, $default = null) - { - if (func_num_args() < 3) { - $default = new MissingValue; - } - - if (! $this->resource->relationLoaded($relationship)) { - return value($default); - } - - if (func_num_args() === 1) { - return $this->resource->{$relationship}; - } - - if ($this->resource->{$relationship} === null) { - return; - } - - return value($value); - } - - /** - * Retrieve a relationship count if it exists. - * - * @param string $relationship - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - public function whenCounted($relationship, $value = null, $default = null) - { - if (func_num_args() < 3) { - $default = new MissingValue; - } - - $attribute = (string) Str::of($relationship)->snake()->finish('_count'); - - if (! isset($this->resource->getAttributes()[$attribute])) { - return value($default); - } - - if (func_num_args() === 1) { - return $this->resource->{$attribute}; - } - - if ($this->resource->{$attribute} === null) { - return; - } - - return value($value, $this->resource->{$attribute}); - } - - /** - * Execute a callback if the given pivot table has been loaded. - * - * @param string $table - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - protected function whenPivotLoaded($table, $value, $default = null) - { - return $this->whenPivotLoadedAs('pivot', ...func_get_args()); - } - - /** - * Execute a callback if the given pivot table with a custom accessor has been loaded. - * - * @param string $accessor - * @param string $table - * @param mixed $value - * @param mixed $default - * @return \Illuminate\Http\Resources\MissingValue|mixed - */ - protected function whenPivotLoadedAs($accessor, $table, $value, $default = null) - { - if (func_num_args() === 3) { - $default = new MissingValue; - } - - return $this->when( - isset($this->resource->$accessor) && - ($this->resource->$accessor instanceof $table || - $this->resource->$accessor->getTable() === $table), - ...[$value, $default] - ); - } - - /** - * Transform the given value if it is present. - * - * @param mixed $value - * @param callable $callback - * @param mixed $default - * @return mixed - */ - protected function transform($value, callable $callback, $default = null) - { - return transform( - $value, $callback, func_num_args() === 3 ? $default : new MissingValue - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/DelegatesToResource.php b/framework-9.50.2/src/Illuminate/Http/Resources/DelegatesToResource.php deleted file mode 100644 index e932646..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/DelegatesToResource.php +++ /dev/null @@ -1,157 +0,0 @@ -resource->getRouteKey(); - } - - /** - * Get the route key for the resource. - * - * @return string - */ - public function getRouteKeyName() - { - return $this->resource->getRouteKeyName(); - } - - /** - * Retrieve the model for a bound value. - * - * @param mixed $value - * @param string|null $field - * @return void - * - * @throws \Exception - */ - public function resolveRouteBinding($value, $field = null) - { - throw new Exception('Resources may not be implicitly resolved from route bindings.'); - } - - /** - * Retrieve the model for a bound value. - * - * @param string $childType - * @param mixed $value - * @param string|null $field - * @return void - * - * @throws \Exception - */ - public function resolveChildRouteBinding($childType, $value, $field = null) - { - throw new Exception('Resources may not be implicitly resolved from route bindings.'); - } - - /** - * Determine if the given attribute exists. - * - * @param mixed $offset - * @return bool - */ - public function offsetExists($offset): bool - { - return isset($this->resource[$offset]); - } - - /** - * Get the value for a given offset. - * - * @param mixed $offset - * @return mixed - */ - public function offsetGet($offset): mixed - { - return $this->resource[$offset]; - } - - /** - * Set the value for a given offset. - * - * @param mixed $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset, $value): void - { - $this->resource[$offset] = $value; - } - - /** - * Unset the value for a given offset. - * - * @param mixed $offset - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->resource[$offset]); - } - - /** - * Determine if an attribute exists on the resource. - * - * @param string $key - * @return bool - */ - public function __isset($key) - { - return isset($this->resource->{$key}); - } - - /** - * Unset an attribute on the resource. - * - * @param string $key - * @return void - */ - public function __unset($key) - { - unset($this->resource->{$key}); - } - - /** - * Dynamically get properties from the underlying resource. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->resource->{$key}; - } - - /** - * Dynamically pass method calls to the underlying resource. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - return $this->forwardCallTo($this->resource, $method, $parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php b/framework-9.50.2/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php deleted file mode 100644 index 26f5c46..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php +++ /dev/null @@ -1,34 +0,0 @@ -collects = $collects; - - parent::__construct($resource); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/Json/JsonResource.php b/framework-9.50.2/src/Illuminate/Http/Resources/Json/JsonResource.php deleted file mode 100644 index 62b75b1..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/Json/JsonResource.php +++ /dev/null @@ -1,243 +0,0 @@ -resource = $resource; - } - - /** - * Create a new resource instance. - * - * @param mixed ...$parameters - * @return static - */ - public static function make(...$parameters) - { - return new static(...$parameters); - } - - /** - * Create a new anonymous resource collection. - * - * @param mixed $resource - * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection - */ - public static function collection($resource) - { - return tap(new AnonymousResourceCollection($resource, static::class), function ($collection) { - if (property_exists(static::class, 'preserveKeys')) { - $collection->preserveKeys = (new static([]))->preserveKeys === true; - } - }); - } - - /** - * Resolve the resource to an array. - * - * @param \Illuminate\Http\Request|null $request - * @return array - */ - public function resolve($request = null) - { - $data = $this->toArray( - $request = $request ?: Container::getInstance()->make('request') - ); - - if ($data instanceof Arrayable) { - $data = $data->toArray(); - } elseif ($data instanceof JsonSerializable) { - $data = $data->jsonSerialize(); - } - - return $this->filter((array) $data); - } - - /** - * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray($request) - { - if (is_null($this->resource)) { - return []; - } - - return is_array($this->resource) - ? $this->resource - : $this->resource->toArray(); - } - - /** - * Convert the model instance to JSON. - * - * @param int $options - * @return string - * - * @throws \Illuminate\Database\Eloquent\JsonEncodingException - */ - public function toJson($options = 0) - { - $json = json_encode($this->jsonSerialize(), $options); - - if (json_last_error() !== JSON_ERROR_NONE) { - throw JsonEncodingException::forResource($this, json_last_error_msg()); - } - - return $json; - } - - /** - * Get any additional data that should be returned with the resource array. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - public function with($request) - { - return $this->with; - } - - /** - * Add additional meta data to the resource response. - * - * @param array $data - * @return $this - */ - public function additional(array $data) - { - $this->additional = $data; - - return $this; - } - - /** - * Get the JSON serialization options that should be applied to the resource response. - * - * @return int - */ - public function jsonOptions() - { - return 0; - } - - /** - * Customize the response for a request. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Http\JsonResponse $response - * @return void - */ - public function withResponse($request, $response) - { - // - } - - /** - * Set the string that should wrap the outer-most resource array. - * - * @param string $value - * @return void - */ - public static function wrap($value) - { - static::$wrap = $value; - } - - /** - * Disable wrapping of the outer-most resource array. - * - * @return void - */ - public static function withoutWrapping() - { - static::$wrap = null; - } - - /** - * Transform the resource into an HTTP response. - * - * @param \Illuminate\Http\Request|null $request - * @return \Illuminate\Http\JsonResponse - */ - public function response($request = null) - { - return $this->toResponse( - $request ?: Container::getInstance()->make('request') - ); - } - - /** - * Create an HTTP response that represents the object. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - */ - public function toResponse($request) - { - return (new ResourceResponse($this))->toResponse($request); - } - - /** - * Prepare the resource for JSON serialization. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->resolve(Container::getInstance()->make('request')); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php b/framework-9.50.2/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php deleted file mode 100644 index bd3e8f9..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php +++ /dev/null @@ -1,92 +0,0 @@ -json( - $this->wrap( - $this->resource->resolve($request), - array_merge_recursive( - $this->paginationInformation($request), - $this->resource->with($request), - $this->resource->additional - ) - ), - $this->calculateStatus(), - [], - $this->resource->jsonOptions() - ), function ($response) use ($request) { - $response->original = $this->resource->resource->map(function ($item) { - return is_array($item) ? Arr::get($item, 'resource') : $item->resource; - }); - - $this->resource->withResponse($request, $response); - }); - } - - /** - * Add the pagination information to the response. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - protected function paginationInformation($request) - { - $paginated = $this->resource->resource->toArray(); - - $default = [ - 'links' => $this->paginationLinks($paginated), - 'meta' => $this->meta($paginated), - ]; - - if (method_exists($this->resource, 'paginationInformation')) { - return $this->resource->paginationInformation($request, $paginated, $default); - } - - return $default; - } - - /** - * Get the pagination links for the response. - * - * @param array $paginated - * @return array - */ - protected function paginationLinks($paginated) - { - return [ - 'first' => $paginated['first_page_url'] ?? null, - 'last' => $paginated['last_page_url'] ?? null, - 'prev' => $paginated['prev_page_url'] ?? null, - 'next' => $paginated['next_page_url'] ?? null, - ]; - } - - /** - * Gather the meta data for the response. - * - * @param array $paginated - * @return array - */ - protected function meta($paginated) - { - return Arr::except($paginated, [ - 'data', - 'first_page_url', - 'last_page_url', - 'prev_page_url', - 'next_page_url', - ]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/Json/ResourceCollection.php b/framework-9.50.2/src/Illuminate/Http/Resources/Json/ResourceCollection.php deleted file mode 100644 index 6b825cb..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/Json/ResourceCollection.php +++ /dev/null @@ -1,135 +0,0 @@ -resource = $this->collectResource($resource); - } - - /** - * Indicate that all current query parameters should be appended to pagination links. - * - * @return $this - */ - public function preserveQuery() - { - $this->preserveAllQueryParameters = true; - - return $this; - } - - /** - * Specify the query string parameters that should be present on pagination links. - * - * @param array $query - * @return $this - */ - public function withQuery(array $query) - { - $this->preserveAllQueryParameters = false; - - $this->queryParameters = $query; - - return $this; - } - - /** - * Return the count of items in the resource collection. - * - * @return int - */ - public function count(): int - { - return $this->collection->count(); - } - - /** - * Transform the resource into a JSON array. - * - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray($request) - { - return $this->collection->map->toArray($request)->all(); - } - - /** - * Create an HTTP response that represents the object. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - */ - public function toResponse($request) - { - if ($this->resource instanceof AbstractPaginator || $this->resource instanceof AbstractCursorPaginator) { - return $this->preparePaginatedResponse($request); - } - - return parent::toResponse($request); - } - - /** - * Create a paginate-aware HTTP response. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - */ - protected function preparePaginatedResponse($request) - { - if ($this->preserveAllQueryParameters) { - $this->resource->appends($request->query()); - } elseif (! is_null($this->queryParameters)) { - $this->resource->appends($this->queryParameters); - } - - return (new PaginatedResourceResponse($this))->toResponse($request); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/Json/ResourceResponse.php b/framework-9.50.2/src/Illuminate/Http/Resources/Json/ResourceResponse.php deleted file mode 100644 index 51f3657..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/Json/ResourceResponse.php +++ /dev/null @@ -1,122 +0,0 @@ -resource = $resource; - } - - /** - * Create an HTTP response that represents the object. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse - */ - public function toResponse($request) - { - return tap(response()->json( - $this->wrap( - $this->resource->resolve($request), - $this->resource->with($request), - $this->resource->additional - ), - $this->calculateStatus(), - [], - $this->resource->jsonOptions() - ), function ($response) use ($request) { - $response->original = $this->resource->resource; - - $this->resource->withResponse($request, $response); - }); - } - - /** - * Wrap the given data if necessary. - * - * @param array $data - * @param array $with - * @param array $additional - * @return array - */ - protected function wrap($data, $with = [], $additional = []) - { - if ($data instanceof Collection) { - $data = $data->all(); - } - - if ($this->haveDefaultWrapperAndDataIsUnwrapped($data)) { - $data = [$this->wrapper() => $data]; - } elseif ($this->haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional)) { - $data = [($this->wrapper() ?? 'data') => $data]; - } - - return array_merge_recursive($data, $with, $additional); - } - - /** - * Determine if we have a default wrapper and the given data is unwrapped. - * - * @param array $data - * @return bool - */ - protected function haveDefaultWrapperAndDataIsUnwrapped($data) - { - return $this->wrapper() && ! array_key_exists($this->wrapper(), $data); - } - - /** - * Determine if "with" data has been added and our data is unwrapped. - * - * @param array $data - * @param array $with - * @param array $additional - * @return bool - */ - protected function haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional) - { - return (! empty($with) || ! empty($additional)) && - (! $this->wrapper() || - ! array_key_exists($this->wrapper(), $data)); - } - - /** - * Get the default data wrapper for the resource. - * - * @return string - */ - protected function wrapper() - { - return get_class($this->resource)::$wrap; - } - - /** - * Calculate the appropriate status code for the response. - * - * @return int - */ - protected function calculateStatus() - { - return $this->resource->resource instanceof Model && - $this->resource->resource->wasRecentlyCreated ? 201 : 200; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/MergeValue.php b/framework-9.50.2/src/Illuminate/Http/Resources/MergeValue.php deleted file mode 100644 index fb6880f..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/MergeValue.php +++ /dev/null @@ -1,33 +0,0 @@ -data = $data->all(); - } elseif ($data instanceof JsonSerializable) { - $this->data = $data->jsonSerialize(); - } else { - $this->data = $data; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Resources/MissingValue.php b/framework-9.50.2/src/Illuminate/Http/Resources/MissingValue.php deleted file mode 100644 index d0d8dfa..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Resources/MissingValue.php +++ /dev/null @@ -1,16 +0,0 @@ -headers = new ResponseHeaderBag($headers); - - $this->setContent($content); - $this->setStatusCode($status); - $this->setProtocolVersion('1.0'); - } - - /** - * Set the content on the response. - * - * @param mixed $content - * @return $this - * - * @throws \InvalidArgumentException - */ - public function setContent(mixed $content): static - { - $this->original = $content; - - // If the content is "JSONable" we will set the appropriate header and convert - // the content to JSON. This is useful when returning something like models - // from routes that will be automatically transformed to their JSON form. - if ($this->shouldBeJson($content)) { - $this->header('Content-Type', 'application/json'); - - $content = $this->morphToJson($content); - - if ($content === false) { - throw new InvalidArgumentException(json_last_error_msg()); - } - } - - // If this content implements the "Renderable" interface then we will call the - // render method on the object so we will avoid any "__toString" exceptions - // that might be thrown and have their errors obscured by PHP's handling. - elseif ($content instanceof Renderable) { - $content = $content->render(); - } - - parent::setContent($content); - - return $this; - } - - /** - * Determine if the given content should be turned into JSON. - * - * @param mixed $content - * @return bool - */ - protected function shouldBeJson($content) - { - return $content instanceof Arrayable || - $content instanceof Jsonable || - $content instanceof ArrayObject || - $content instanceof JsonSerializable || - is_array($content); - } - - /** - * Morph the given content into JSON. - * - * @param mixed $content - * @return string - */ - protected function morphToJson($content) - { - if ($content instanceof Jsonable) { - return $content->toJson(); - } elseif ($content instanceof Arrayable) { - return json_encode($content->toArray()); - } - - return json_encode($content); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/ResponseTrait.php b/framework-9.50.2/src/Illuminate/Http/ResponseTrait.php deleted file mode 100644 index cbe29dc..0000000 --- a/framework-9.50.2/src/Illuminate/Http/ResponseTrait.php +++ /dev/null @@ -1,182 +0,0 @@ -getStatusCode(); - } - - /** - * Get the status text for the response. - * - * @return string - */ - public function statusText() - { - return $this->statusText; - } - - /** - * Get the content of the response. - * - * @return string - */ - public function content() - { - return $this->getContent(); - } - - /** - * Get the original response content. - * - * @return mixed - */ - public function getOriginalContent() - { - $original = $this->original; - - return $original instanceof self ? $original->{__FUNCTION__}() : $original; - } - - /** - * Set a header on the Response. - * - * @param string $key - * @param array|string $values - * @param bool $replace - * @return $this - */ - public function header($key, $values, $replace = true) - { - $this->headers->set($key, $values, $replace); - - return $this; - } - - /** - * Add an array of headers to the response. - * - * @param \Symfony\Component\HttpFoundation\HeaderBag|array $headers - * @return $this - */ - public function withHeaders($headers) - { - if ($headers instanceof HeaderBag) { - $headers = $headers->all(); - } - - foreach ($headers as $key => $value) { - $this->headers->set($key, $value); - } - - return $this; - } - - /** - * Add a cookie to the response. - * - * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie - * @return $this - */ - public function cookie($cookie) - { - return $this->withCookie(...func_get_args()); - } - - /** - * Add a cookie to the response. - * - * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie - * @return $this - */ - public function withCookie($cookie) - { - if (is_string($cookie) && function_exists('cookie')) { - $cookie = cookie(...func_get_args()); - } - - $this->headers->setCookie($cookie); - - return $this; - } - - /** - * Expire a cookie when sending the response. - * - * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie - * @param string|null $path - * @param string|null $domain - * @return $this - */ - public function withoutCookie($cookie, $path = null, $domain = null) - { - if (is_string($cookie) && function_exists('cookie')) { - $cookie = cookie($cookie, null, -2628000, $path, $domain); - } - - $this->headers->setCookie($cookie); - - return $this; - } - - /** - * Get the callback of the response. - * - * @return string|null - */ - public function getCallback() - { - return $this->callback ?? null; - } - - /** - * Set the exception to attach to the response. - * - * @param \Throwable $e - * @return $this - */ - public function withException(Throwable $e) - { - $this->exception = $e; - - return $this; - } - - /** - * Throws the response in a HttpResponseException instance. - * - * @return void - * - * @throws \Illuminate\Http\Exceptions\HttpResponseException - */ - public function throwResponse() - { - throw new HttpResponseException($this); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Testing/File.php b/framework-9.50.2/src/Illuminate/Http/Testing/File.php deleted file mode 100644 index aaba539..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Testing/File.php +++ /dev/null @@ -1,147 +0,0 @@ -name = $name; - $this->tempFile = $tempFile; - - parent::__construct( - $this->tempFilePath(), $name, $this->getMimeType(), - null, true - ); - } - - /** - * Create a new fake file. - * - * @param string $name - * @param string|int $kilobytes - * @return \Illuminate\Http\Testing\File - */ - public static function create($name, $kilobytes = 0) - { - return (new FileFactory)->create($name, $kilobytes); - } - - /** - * Create a new fake file with content. - * - * @param string $name - * @param string $content - * @return \Illuminate\Http\Testing\File - */ - public static function createWithContent($name, $content) - { - return (new FileFactory)->createWithContent($name, $content); - } - - /** - * Create a new fake image. - * - * @param string $name - * @param int $width - * @param int $height - * @return \Illuminate\Http\Testing\File - */ - public static function image($name, $width = 10, $height = 10) - { - return (new FileFactory)->image($name, $width, $height); - } - - /** - * Set the "size" of the file in kilobytes. - * - * @param int $kilobytes - * @return $this - */ - public function size($kilobytes) - { - $this->sizeToReport = $kilobytes * 1024; - - return $this; - } - - /** - * Get the size of the file. - * - * @return int - */ - public function getSize(): int - { - return $this->sizeToReport ?: parent::getSize(); - } - - /** - * Set the "MIME type" for the file. - * - * @param string $mimeType - * @return $this - */ - public function mimeType($mimeType) - { - $this->mimeTypeToReport = $mimeType; - - return $this; - } - - /** - * Get the MIME type of the file. - * - * @return string - */ - public function getMimeType(): string - { - return $this->mimeTypeToReport ?: MimeType::from($this->name); - } - - /** - * Get the path to the temporary file. - * - * @return string - */ - protected function tempFilePath() - { - return stream_get_meta_data($this->tempFile)['uri']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Testing/FileFactory.php b/framework-9.50.2/src/Illuminate/Http/Testing/FileFactory.php deleted file mode 100644 index 9e25d72..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Testing/FileFactory.php +++ /dev/null @@ -1,84 +0,0 @@ -createWithContent($name, $kilobytes); - } - - return tap(new File($name, tmpfile()), function ($file) use ($kilobytes, $mimeType) { - $file->sizeToReport = $kilobytes * 1024; - $file->mimeTypeToReport = $mimeType; - }); - } - - /** - * Create a new fake file with content. - * - * @param string $name - * @param string $content - * @return \Illuminate\Http\Testing\File - */ - public function createWithContent($name, $content) - { - $tmpfile = tmpfile(); - - fwrite($tmpfile, $content); - - return tap(new File($name, $tmpfile), function ($file) use ($tmpfile) { - $file->sizeToReport = fstat($tmpfile)['size']; - }); - } - - /** - * Create a new fake image. - * - * @param string $name - * @param int $width - * @param int $height - * @return \Illuminate\Http\Testing\File - */ - public function image($name, $width = 10, $height = 10) - { - return new File($name, $this->generateImage( - $width, $height, pathinfo($name, PATHINFO_EXTENSION) - )); - } - - /** - * Generate a dummy image of the given width and height. - * - * @param int $width - * @param int $height - * @param string $extension - * @return resource - */ - protected function generateImage($width, $height, $extension) - { - return tap(tmpfile(), function ($temp) use ($width, $height, $extension) { - ob_start(); - - $extension = in_array($extension, ['jpeg', 'png', 'gif', 'webp', 'wbmp', 'bmp']) - ? strtolower($extension) - : 'jpeg'; - - $image = imagecreatetruecolor($width, $height); - - call_user_func("image{$extension}", $image); - - fwrite($temp, ob_get_clean()); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/Testing/MimeType.php b/framework-9.50.2/src/Illuminate/Http/Testing/MimeType.php deleted file mode 100644 index d188a4b..0000000 --- a/framework-9.50.2/src/Illuminate/Http/Testing/MimeType.php +++ /dev/null @@ -1,65 +0,0 @@ -getMimeTypes($extension)) ?? 'application/octet-stream'; - } - - /** - * Search for the extension of a given MIME type. - * - * @param string $mimeType - * @return string|null - */ - public static function search($mimeType) - { - return Arr::first(self::getMimeTypes()->getExtensions($mimeType)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/UploadedFile.php b/framework-9.50.2/src/Illuminate/Http/UploadedFile.php deleted file mode 100644 index 7779683..0000000 --- a/framework-9.50.2/src/Illuminate/Http/UploadedFile.php +++ /dev/null @@ -1,149 +0,0 @@ -storeAs($path, $this->hashName(), $this->parseOptions($options)); - } - - /** - * Store the uploaded file on a filesystem disk with public visibility. - * - * @param string $path - * @param array|string $options - * @return string|false - */ - public function storePublicly($path, $options = []) - { - $options = $this->parseOptions($options); - - $options['visibility'] = 'public'; - - return $this->storeAs($path, $this->hashName(), $options); - } - - /** - * Store the uploaded file on a filesystem disk with public visibility. - * - * @param string $path - * @param string $name - * @param array|string $options - * @return string|false - */ - public function storePubliclyAs($path, $name, $options = []) - { - $options = $this->parseOptions($options); - - $options['visibility'] = 'public'; - - return $this->storeAs($path, $name, $options); - } - - /** - * Store the uploaded file on a filesystem disk. - * - * @param string $path - * @param string $name - * @param array|string $options - * @return string|false - */ - public function storeAs($path, $name, $options = []) - { - $options = $this->parseOptions($options); - - $disk = Arr::pull($options, 'disk'); - - return Container::getInstance()->make(FilesystemFactory::class)->disk($disk)->putFileAs( - $path, $this, $name, $options - ); - } - - /** - * Get the contents of the uploaded file. - * - * @return false|string - * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function get() - { - if (! $this->isValid()) { - throw new FileNotFoundException("File does not exist at path {$this->getPathname()}."); - } - - return file_get_contents($this->getPathname()); - } - - /** - * Get the file's extension supplied by the client. - * - * @return string - */ - public function clientExtension() - { - return $this->guessClientExtension(); - } - - /** - * Create a new file instance from a base instance. - * - * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file - * @param bool $test - * @return static - */ - public static function createFromBase(SymfonyUploadedFile $file, $test = false) - { - return $file instanceof static ? $file : new static( - $file->getPathname(), - $file->getClientOriginalName(), - $file->getClientMimeType(), - $file->getError(), - $test - ); - } - - /** - * Parse and format the given options. - * - * @param array|string $options - * @return array - */ - protected function parseOptions($options) - { - if (is_string($options)) { - $options = ['disk' => $options]; - } - - return $options; - } -} diff --git a/framework-9.50.2/src/Illuminate/Http/composer.json b/framework-9.50.2/src/Illuminate/Http/composer.json deleted file mode 100755 index 081009b..0000000 --- a/framework-9.50.2/src/Illuminate/Http/composer.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "illuminate/http", - "description": "The Illuminate Http package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "fruitcake/php-cors": "^1.2", - "illuminate/collections": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/session": "^9.0", - "illuminate/support": "^9.0", - "symfony/http-foundation": "^6.0", - "symfony/http-kernel": "^6.0", - "symfony/mime": "^6.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Http\\": "" - } - }, - "suggest": { - "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", - "guzzlehttp/guzzle": "Required to use the HTTP Client (^7.5)." - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Log/Events/MessageLogged.php b/framework-9.50.2/src/Illuminate/Log/Events/MessageLogged.php deleted file mode 100644 index 312b343..0000000 --- a/framework-9.50.2/src/Illuminate/Log/Events/MessageLogged.php +++ /dev/null @@ -1,42 +0,0 @@ -level = $level; - $this->message = $message; - $this->context = $context; - } -} diff --git a/framework-9.50.2/src/Illuminate/Log/LICENSE.md b/framework-9.50.2/src/Illuminate/Log/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Log/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Log/LogManager.php b/framework-9.50.2/src/Illuminate/Log/LogManager.php deleted file mode 100644 index bf6f1d9..0000000 --- a/framework-9.50.2/src/Illuminate/Log/LogManager.php +++ /dev/null @@ -1,725 +0,0 @@ -app = $app; - } - - /** - * Build an on-demand log channel. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - */ - public function build(array $config) - { - unset($this->channels['ondemand']); - - return $this->get('ondemand', $config); - } - - /** - * Create a new, on-demand aggregate logger instance. - * - * @param array $channels - * @param string|null $channel - * @return \Psr\Log\LoggerInterface - */ - public function stack(array $channels, $channel = null) - { - return (new Logger( - $this->createStackDriver(compact('channels', 'channel')), - $this->app['events'] - ))->withContext($this->sharedContext); - } - - /** - * Get a log channel instance. - * - * @param string|null $channel - * @return \Psr\Log\LoggerInterface - */ - public function channel($channel = null) - { - return $this->driver($channel); - } - - /** - * Get a log driver instance. - * - * @param string|null $driver - * @return \Psr\Log\LoggerInterface - */ - public function driver($driver = null) - { - return $this->get($this->parseDriver($driver)); - } - - /** - * Attempt to get the log from the local cache. - * - * @param string $name - * @param array|null $config - * @return \Psr\Log\LoggerInterface - */ - protected function get($name, ?array $config = null) - { - try { - return $this->channels[$name] ?? with($this->resolve($name, $config), function ($logger) use ($name) { - return $this->channels[$name] = $this->tap($name, new Logger($logger, $this->app['events']))->withContext($this->sharedContext); - }); - } catch (Throwable $e) { - return tap($this->createEmergencyLogger(), function ($logger) use ($e) { - $logger->emergency('Unable to create configured logger. Using emergency logger.', [ - 'exception' => $e, - ]); - }); - } - } - - /** - * Apply the configured taps for the logger. - * - * @param string $name - * @param \Illuminate\Log\Logger $logger - * @return \Illuminate\Log\Logger - */ - protected function tap($name, Logger $logger) - { - foreach ($this->configurationFor($name)['tap'] ?? [] as $tap) { - [$class, $arguments] = $this->parseTap($tap); - - $this->app->make($class)->__invoke($logger, ...explode(',', $arguments)); - } - - return $logger; - } - - /** - * Parse the given tap class string into a class name and arguments string. - * - * @param string $tap - * @return array - */ - protected function parseTap($tap) - { - return str_contains($tap, ':') ? explode(':', $tap, 2) : [$tap, '']; - } - - /** - * Create an emergency log handler to avoid white screens of death. - * - * @return \Psr\Log\LoggerInterface - */ - protected function createEmergencyLogger() - { - $config = $this->configurationFor('emergency'); - - $handler = new StreamHandler( - $config['path'] ?? $this->app->storagePath().'/logs/laravel.log', - $this->level(['level' => 'debug']) - ); - - return new Logger( - new Monolog('laravel', $this->prepareHandlers([$handler])), - $this->app['events'] - ); - } - - /** - * Resolve the given log instance by name. - * - * @param string $name - * @param array|null $config - * @return \Psr\Log\LoggerInterface - * - * @throws \InvalidArgumentException - */ - protected function resolve($name, ?array $config = null) - { - $config ??= $this->configurationFor($name); - - if (is_null($config)) { - throw new InvalidArgumentException("Log [{$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)) { - return $this->{$driverMethod}($config); - } - - throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); - } - - /** - * Call a custom driver creator. - * - * @param array $config - * @return mixed - */ - protected function callCustomCreator(array $config) - { - return $this->customCreators[$config['driver']]($this->app, $config); - } - - /** - * Create a custom log driver instance. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - */ - protected function createCustomDriver(array $config) - { - $factory = is_callable($via = $config['via']) ? $via : $this->app->make($via); - - return $factory($config); - } - - /** - * Create an aggregate log driver instance. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - */ - protected function createStackDriver(array $config) - { - if (is_string($config['channels'])) { - $config['channels'] = explode(',', $config['channels']); - } - - $handlers = collect($config['channels'])->flatMap(function ($channel) { - return $channel instanceof LoggerInterface - ? $channel->getHandlers() - : $this->channel($channel)->getHandlers(); - })->all(); - - $processors = collect($config['channels'])->flatMap(function ($channel) { - return $channel instanceof LoggerInterface - ? $channel->getProcessors() - : $this->channel($channel)->getProcessors(); - })->all(); - - if ($config['ignore_exceptions'] ?? false) { - $handlers = [new WhatFailureGroupHandler($handlers)]; - } - - return new Monolog($this->parseChannel($config), $handlers, $processors); - } - - /** - * Create an instance of the single file log driver. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - */ - protected function createSingleDriver(array $config) - { - return new Monolog($this->parseChannel($config), [ - $this->prepareHandler( - new StreamHandler( - $config['path'], $this->level($config), - $config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false - ), $config - ), - ]); - } - - /** - * Create an instance of the daily file log driver. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - */ - protected function createDailyDriver(array $config) - { - return new Monolog($this->parseChannel($config), [ - $this->prepareHandler(new RotatingFileHandler( - $config['path'], $config['days'] ?? 7, $this->level($config), - $config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false - ), $config), - ]); - } - - /** - * Create an instance of the Slack log driver. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - */ - protected function createSlackDriver(array $config) - { - return new Monolog($this->parseChannel($config), [ - $this->prepareHandler(new SlackWebhookHandler( - $config['url'], - $config['channel'] ?? null, - $config['username'] ?? 'Laravel', - $config['attachment'] ?? true, - $config['emoji'] ?? ':boom:', - $config['short'] ?? false, - $config['context'] ?? true, - $this->level($config), - $config['bubble'] ?? true, - $config['exclude_fields'] ?? [] - ), $config), - ]); - } - - /** - * Create an instance of the syslog log driver. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - */ - protected function createSyslogDriver(array $config) - { - return new Monolog($this->parseChannel($config), [ - $this->prepareHandler(new SyslogHandler( - Str::snake($this->app['config']['app.name'], '-'), - $config['facility'] ?? LOG_USER, $this->level($config) - ), $config), - ]); - } - - /** - * Create an instance of the "error log" log driver. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - */ - protected function createErrorlogDriver(array $config) - { - return new Monolog($this->parseChannel($config), [ - $this->prepareHandler(new ErrorLogHandler( - $config['type'] ?? ErrorLogHandler::OPERATING_SYSTEM, $this->level($config) - )), - ]); - } - - /** - * Create an instance of any handler available in Monolog. - * - * @param array $config - * @return \Psr\Log\LoggerInterface - * - * @throws \InvalidArgumentException - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected function createMonologDriver(array $config) - { - if (! is_a($config['handler'], HandlerInterface::class, true)) { - throw new InvalidArgumentException( - $config['handler'].' must be an instance of '.HandlerInterface::class - ); - } - - $with = array_merge( - ['level' => $this->level($config)], - $config['with'] ?? [], - $config['handler_with'] ?? [] - ); - - return new Monolog($this->parseChannel($config), [$this->prepareHandler( - $this->app->make($config['handler'], $with), $config - )]); - } - - /** - * Prepare the handlers for usage by Monolog. - * - * @param array $handlers - * @return array - */ - protected function prepareHandlers(array $handlers) - { - foreach ($handlers as $key => $handler) { - $handlers[$key] = $this->prepareHandler($handler); - } - - return $handlers; - } - - /** - * Prepare the handler for usage by Monolog. - * - * @param \Monolog\Handler\HandlerInterface $handler - * @param array $config - * @return \Monolog\Handler\HandlerInterface - */ - protected function prepareHandler(HandlerInterface $handler, array $config = []) - { - if (isset($config['action_level'])) { - $handler = new FingersCrossedHandler( - $handler, - $this->actionLevel($config), - 0, - true, - $config['stop_buffering'] ?? true - ); - } - - if (! $handler instanceof FormattableHandlerInterface) { - return $handler; - } - - if (! isset($config['formatter'])) { - $handler->setFormatter($this->formatter()); - } elseif ($config['formatter'] !== 'default') { - $handler->setFormatter($this->app->make($config['formatter'], $config['formatter_with'] ?? [])); - } - - return $handler; - } - - /** - * Get a Monolog formatter instance. - * - * @return \Monolog\Formatter\FormatterInterface - */ - protected function formatter() - { - return tap(new LineFormatter(null, $this->dateFormat, true, true), function ($formatter) { - $formatter->includeStacktraces(); - }); - } - - /** - * Share context across channels and stacks. - * - * @param array $context - * @return $this - */ - public function shareContext(array $context) - { - foreach ($this->channels as $channel) { - $channel->withContext($context); - } - - $this->sharedContext = array_merge($this->sharedContext, $context); - - return $this; - } - - /** - * The context shared across channels and stacks. - * - * @return array - */ - public function sharedContext() - { - return $this->sharedContext; - } - - /** - * Flush the shared context. - * - * @return $this - */ - public function flushSharedContext() - { - $this->sharedContext = []; - - return $this; - } - - /** - * Get fallback log channel name. - * - * @return string - */ - protected function getFallbackChannelName() - { - return $this->app->bound('env') ? $this->app->environment() : 'production'; - } - - /** - * Get the log connection configuration. - * - * @param string $name - * @return array - */ - protected function configurationFor($name) - { - return $this->app['config']["logging.channels.{$name}"]; - } - - /** - * Get the default log driver name. - * - * @return string|null - */ - public function getDefaultDriver() - { - return $this->app['config']['logging.default']; - } - - /** - * Set the default log driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['logging.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->bindTo($this, $this); - - return $this; - } - - /** - * Unset the given channel instance. - * - * @param string|null $driver - * @return void - */ - public function forgetChannel($driver = null) - { - $driver = $this->parseDriver($driver); - - if (isset($this->channels[$driver])) { - unset($this->channels[$driver]); - } - } - - /** - * Parse the driver name. - * - * @param string|null $driver - * @return string|null - */ - protected function parseDriver($driver) - { - $driver ??= $this->getDefaultDriver(); - - if ($this->app->runningUnitTests()) { - $driver ??= 'null'; - } - - return $driver; - } - - /** - * Get all of the resolved log channels. - * - * @return array - */ - public function getChannels() - { - return $this->channels; - } - - /** - * System is unusable. - * - * @param string $message - * @param array $context - * @return void - */ - public function emergency($message, array $context = []): void - { - $this->driver()->emergency($message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * @return void - */ - public function alert($message, array $context = []): void - { - $this->driver()->alert($message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * @return void - */ - public function critical($message, array $context = []): void - { - $this->driver()->critical($message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * @return void - */ - public function error($message, array $context = []): void - { - $this->driver()->error($message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * @return void - */ - public function warning($message, array $context = []): void - { - $this->driver()->warning($message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * @return void - */ - public function notice($message, array $context = []): void - { - $this->driver()->notice($message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * @return void - */ - public function info($message, array $context = []): void - { - $this->driver()->info($message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * @return void - */ - public function debug($message, array $context = []): void - { - $this->driver()->debug($message, $context); - } - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * @return void - */ - public function log($level, $message, array $context = []): void - { - $this->driver()->log($level, $message, $context); - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->driver()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Log/LogServiceProvider.php b/framework-9.50.2/src/Illuminate/Log/LogServiceProvider.php deleted file mode 100644 index ebe5453..0000000 --- a/framework-9.50.2/src/Illuminate/Log/LogServiceProvider.php +++ /dev/null @@ -1,20 +0,0 @@ -app->singleton('log', function ($app) { - return new LogManager($app); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Log/Logger.php b/framework-9.50.2/src/Illuminate/Log/Logger.php deleted file mode 100755 index 40626a0..0000000 --- a/framework-9.50.2/src/Illuminate/Log/Logger.php +++ /dev/null @@ -1,310 +0,0 @@ -logger = $logger; - $this->dispatcher = $dispatcher; - } - - /** - * Log an emergency message to the logs. - * - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function emergency($message, array $context = []): void - { - $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log an alert message to the logs. - * - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function alert($message, array $context = []): void - { - $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a critical message to the logs. - * - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function critical($message, array $context = []): void - { - $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log an error message to the logs. - * - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function error($message, array $context = []): void - { - $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a warning message to the logs. - * - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function warning($message, array $context = []): void - { - $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a notice to the logs. - * - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function notice($message, array $context = []): void - { - $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log an informational message to the logs. - * - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function info($message, array $context = []): void - { - $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a debug message to the logs. - * - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function debug($message, array $context = []): void - { - $this->writeLog(__FUNCTION__, $message, $context); - } - - /** - * Log a message to the logs. - * - * @param string $level - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function log($level, $message, array $context = []): void - { - $this->writeLog($level, $message, $context); - } - - /** - * Dynamically pass log calls into the writer. - * - * @param string $level - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - public function write($level, $message, array $context = []): void - { - $this->writeLog($level, $message, $context); - } - - /** - * Write a message to the log. - * - * @param string $level - * @param \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @param array $context - * @return void - */ - protected function writeLog($level, $message, $context): void - { - $this->logger->{$level}( - $message = $this->formatMessage($message), - $context = array_merge($this->context, $context) - ); - - $this->fireLogEvent($level, $message, $context); - } - - /** - * Add context to all future logs. - * - * @param array $context - * @return $this - */ - public function withContext(array $context = []) - { - $this->context = array_merge($this->context, $context); - - return $this; - } - - /** - * Flush the existing context array. - * - * @return $this - */ - public function withoutContext() - { - $this->context = []; - - return $this; - } - - /** - * 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 \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message - * @return string - */ - 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 (string) $message; - } - - /** - * Get the underlying logger implementation. - * - * @return \Psr\Log\LoggerInterface - */ - public function getLogger() - { - return $this->logger; - } - - /** - * 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; - } - - /** - * Dynamically proxy method calls to the underlying logger. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->logger->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Log/ParsesLogConfiguration.php b/framework-9.50.2/src/Illuminate/Log/ParsesLogConfiguration.php deleted file mode 100644 index fd0d5ed..0000000 --- a/framework-9.50.2/src/Illuminate/Log/ParsesLogConfiguration.php +++ /dev/null @@ -1,79 +0,0 @@ - Monolog::DEBUG, - 'info' => Monolog::INFO, - 'notice' => Monolog::NOTICE, - 'warning' => Monolog::WARNING, - 'error' => Monolog::ERROR, - 'critical' => Monolog::CRITICAL, - 'alert' => Monolog::ALERT, - 'emergency' => Monolog::EMERGENCY, - ]; - - /** - * Get fallback log channel name. - * - * @return string - */ - abstract protected function getFallbackChannelName(); - - /** - * Parse the string level into a Monolog constant. - * - * @param array $config - * @return int - * - * @throws \InvalidArgumentException - */ - protected function level(array $config) - { - $level = $config['level'] ?? 'debug'; - - if (isset($this->levels[$level])) { - return $this->levels[$level]; - } - - throw new InvalidArgumentException('Invalid log level.'); - } - - /** - * Parse the action level from the given configuration. - * - * @param array $config - * @return int - */ - protected function actionLevel(array $config) - { - $level = $config['action_level'] ?? 'debug'; - - if (isset($this->levels[$level])) { - return $this->levels[$level]; - } - - throw new InvalidArgumentException('Invalid log action level.'); - } - - /** - * Extract the log channel from the given configuration. - * - * @param array $config - * @return string - */ - protected function parseChannel(array $config) - { - return $config['name'] ?? $this->getFallbackChannelName(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Log/composer.json b/framework-9.50.2/src/Illuminate/Log/composer.json deleted file mode 100755 index f6bfd0e..0000000 --- a/framework-9.50.2/src/Illuminate/Log/composer.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "illuminate/log", - "description": "The Illuminate Log package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/contracts": "^9.0", - "illuminate/support": "^9.0", - "monolog/monolog": "^2.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Log\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Macroable/LICENSE.md b/framework-9.50.2/src/Illuminate/Macroable/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Macroable/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Macroable/Traits/Macroable.php b/framework-9.50.2/src/Illuminate/Macroable/Traits/Macroable.php deleted file mode 100644 index 2269142..0000000 --- a/framework-9.50.2/src/Illuminate/Macroable/Traits/Macroable.php +++ /dev/null @@ -1,126 +0,0 @@ -getMethods( - ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED - ); - - foreach ($methods as $method) { - if ($replace || ! static::hasMacro($method->name)) { - $method->setAccessible(true); - static::macro($method->name, $method->invoke($mixin)); - } - } - } - - /** - * Checks if macro is registered. - * - * @param string $name - * @return bool - */ - public static function hasMacro($name) - { - return isset(static::$macros[$name]); - } - - /** - * Flush the existing macros. - * - * @return void - */ - public static function flushMacros() - { - static::$macros = []; - } - - /** - * Dynamically handle calls to the class. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public static function __callStatic($method, $parameters) - { - if (! static::hasMacro($method)) { - throw new BadMethodCallException(sprintf( - 'Method %s::%s does not exist.', static::class, $method - )); - } - - $macro = static::$macros[$method]; - - if ($macro instanceof Closure) { - $macro = $macro->bindTo(null, static::class); - } - - return $macro(...$parameters); - } - - /** - * Dynamically handle calls to the class. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (! static::hasMacro($method)) { - throw new BadMethodCallException(sprintf( - 'Method %s::%s does not exist.', static::class, $method - )); - } - - $macro = static::$macros[$method]; - - if ($macro instanceof Closure) { - $macro = $macro->bindTo($this, static::class); - } - - return $macro(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Macroable/composer.json b/framework-9.50.2/src/Illuminate/Macroable/composer.json deleted file mode 100644 index 0417dbe..0000000 --- a/framework-9.50.2/src/Illuminate/Macroable/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "illuminate/macroable", - "description": "The Illuminate Macroable package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2" - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Attachment.php b/framework-9.50.2/src/Illuminate/Mail/Attachment.php deleted file mode 100644 index 5c78ddf..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Attachment.php +++ /dev/null @@ -1,172 +0,0 @@ -resolver = $resolver; - } - - /** - * Create a mail attachment from a path. - * - * @param string $path - * @return static - */ - public static function fromPath($path) - { - return new static(fn ($attachment, $pathStrategy) => $pathStrategy($path, $attachment)); - } - - /** - * Create a mail attachment from in-memory data. - * - * @param \Closure $data - * @param string $name - * @return static - */ - public static function fromData(Closure $data, $name) - { - return (new static( - fn ($attachment, $pathStrategy, $dataStrategy) => $dataStrategy($data, $attachment) - ))->as($name); - } - - /** - * Create a mail attachment from a file in the default storage disk. - * - * @param string $path - * @return static - */ - public static function fromStorage($path) - { - return static::fromStorageDisk(null, $path); - } - - /** - * Create a mail attachment from a file in the specified storage disk. - * - * @param string|null $disk - * @param string $path - * @return static - */ - public static function fromStorageDisk($disk, $path) - { - return new static(function ($attachment, $pathStrategy, $dataStrategy) use ($disk, $path) { - $storage = Container::getInstance()->make( - FilesystemFactory::class - )->disk($disk); - - $attachment - ->as($attachment->as ?? basename($path)) - ->withMime($attachment->mime ?? $storage->mimeType($path)); - - return $dataStrategy(fn () => $storage->get($path), $attachment); - }); - } - - /** - * Set the attached file's filename. - * - * @param string $name - * @return $this - */ - public function as($name) - { - $this->as = $name; - - return $this; - } - - /** - * Set the attached file's mime type. - * - * @param string $mime - * @return $this - */ - public function withMime($mime) - { - $this->mime = $mime; - - return $this; - } - - /** - * Attach the attachment with the given strategies. - * - * @param \Closure $pathStrategy - * @param \Closure $dataStrategy - * @return mixed - */ - public function attachWith(Closure $pathStrategy, Closure $dataStrategy) - { - return ($this->resolver)($this, $pathStrategy, $dataStrategy); - } - - /** - * Attach the attachment to a built-in mail type. - * - * @param \Illuminate\Mail\Mailable|\Illuminate\Mail\Message|\Illuminate\Notifications\Messages\MailMessage $mail - * @return mixed - */ - public function attachTo($mail) - { - return $this->attachWith( - fn ($path) => $mail->attach($path, ['as' => $this->as, 'mime' => $this->mime]), - fn ($data) => $mail->attachData($data(), $this->as, ['mime' => $this->mime]) - ); - } - - /** - * Determine if the given attachment is equivalent to this attachment. - * - * @param \Illuminate\Mail\Attachment $attachment - * @return bool - */ - public function isEquivalent(Attachment $attachment) - { - return $this->attachWith( - fn ($path) => [$path, ['as' => $this->as, 'mime' => $this->mime]], - fn ($data) => [$data(), ['as' => $this->as, 'mime' => $this->mime]], - ) === $attachment->attachWith( - fn ($path) => [$path, ['as' => $attachment->as, 'mime' => $attachment->mime]], - fn ($data) => [$data(), ['as' => $attachment->as, 'mime' => $attachment->mime]], - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Events/MessageSending.php b/framework-9.50.2/src/Illuminate/Mail/Events/MessageSending.php deleted file mode 100644 index 31435fb..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Events/MessageSending.php +++ /dev/null @@ -1,35 +0,0 @@ -data = $data; - $this->message = $message; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Events/MessageSent.php b/framework-9.50.2/src/Illuminate/Mail/Events/MessageSent.php deleted file mode 100644 index c482e07..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Events/MessageSent.php +++ /dev/null @@ -1,93 +0,0 @@ -sent = $message; - $this->data = $data; - } - - /** - * Get the serializable representation of the object. - * - * @return array - */ - public function __serialize() - { - $hasAttachments = collect($this->message->getAttachments())->isNotEmpty(); - - return $hasAttachments ? [ - 'sent' => base64_encode(serialize($this->sent)), - 'data' => base64_encode(serialize($this->data)), - 'hasAttachments' => true, - ] : [ - 'sent' => $this->sent, - 'data' => $this->data, - 'hasAttachments' => false, - ]; - } - - /** - * Marshal the object from its serialized data. - * - * @param array $data - * @return void - */ - public function __unserialize(array $data) - { - if (isset($data['hasAttachments']) && $data['hasAttachments'] === true) { - $this->sent = unserialize(base64_decode($data['sent'])); - $this->data = unserialize(base64_decode($data['data'])); - } else { - $this->sent = $data['sent']; - $this->data = $data['data']; - } - } - - /** - * Dynamically get the original message. - * - * @param string $key - * @return mixed - * - * @throws \Exception - */ - public function __get($key) - { - if ($key === 'message') { - return $this->sent->getOriginalMessage(); - } - - throw new Exception('Unable to access undefined property on '.__CLASS__.': '.$key); - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/LICENSE.md b/framework-9.50.2/src/Illuminate/Mail/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Mail/MailManager.php b/framework-9.50.2/src/Illuminate/Mail/MailManager.php deleted file mode 100644 index 779c84c..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/MailManager.php +++ /dev/null @@ -1,531 +0,0 @@ -app = $app; - } - - /** - * Get a mailer instance by name. - * - * @param string|null $name - * @return \Illuminate\Contracts\Mail\Mailer - */ - public function mailer($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - return $this->mailers[$name] = $this->get($name); - } - - /** - * Get a mailer driver instance. - * - * @param string|null $driver - * @return \Illuminate\Mail\Mailer - */ - public function driver($driver = null) - { - return $this->mailer($driver); - } - - /** - * Attempt to get the mailer from the local cache. - * - * @param string $name - * @return \Illuminate\Mail\Mailer - */ - protected function get($name) - { - return $this->mailers[$name] ?? $this->resolve($name); - } - - /** - * Resolve the given mailer. - * - * @param string $name - * @return \Illuminate\Mail\Mailer - * - * @throws \InvalidArgumentException - */ - protected function resolve($name) - { - $config = $this->getConfig($name); - - if (is_null($config)) { - throw new InvalidArgumentException("Mailer [{$name}] is not defined."); - } - - // Once we have created the mailer instance we will set a container instance - // on the mailer. This allows us to resolve mailer classes via containers - // for maximum testability on said classes instead of passing Closures. - $mailer = new Mailer( - $name, - $this->app['view'], - $this->createSymfonyTransport($config), - $this->app['events'] - ); - - if ($this->app->bound('queue')) { - $mailer->setQueue($this->app['queue']); - } - - // Next we will set all of the global addresses on this mailer, which allows - // for easy unification of all "from" addresses as well as easy debugging - // of sent messages since these will be sent to a single email address. - foreach (['from', 'reply_to', 'to', 'return_path'] as $type) { - $this->setGlobalAddress($mailer, $config, $type); - } - - return $mailer; - } - - /** - * Create a new transport instance. - * - * @param array $config - * @return \Symfony\Component\Mailer\Transport\TransportInterface - * - * @throws \InvalidArgumentException - */ - public function createSymfonyTransport(array $config) - { - // Here we will check if the "transport" key exists and if it doesn't we will - // assume an application is still using the legacy mail configuration file - // format and use the "mail.driver" configuration option instead for BC. - $transport = $config['transport'] ?? $this->app['config']['mail.driver']; - - if (isset($this->customCreators[$transport])) { - return call_user_func($this->customCreators[$transport], $config); - } - - if (trim($transport ?? '') === '' || ! method_exists($this, $method = 'create'.ucfirst($transport).'Transport')) { - throw new InvalidArgumentException("Unsupported mail transport [{$transport}]."); - } - - return $this->{$method}($config); - } - - /** - * Create an instance of the Symfony SMTP Transport driver. - * - * @param array $config - * @return \Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport - */ - protected function createSmtpTransport(array $config) - { - $factory = new EsmtpTransportFactory; - - $scheme = $config['scheme'] ?? null; - - if (! $scheme) { - $scheme = ! empty($config['encryption']) && $config['encryption'] === 'tls' - ? (($config['port'] == 465) ? 'smtps' : 'smtp') - : ''; - } - - $transport = $factory->create(new Dsn( - $scheme, - $config['host'], - $config['username'] ?? null, - $config['password'] ?? null, - $config['port'] ?? null, - $config - )); - - return $this->configureSmtpTransport($transport, $config); - } - - /** - * Configure the additional SMTP driver options. - * - * @param \Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport $transport - * @param array $config - * @return \Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport - */ - protected function configureSmtpTransport(EsmtpTransport $transport, array $config) - { - $stream = $transport->getStream(); - - if ($stream instanceof SocketStream) { - if (isset($config['source_ip'])) { - $stream->setSourceIp($config['source_ip']); - } - - if (isset($config['timeout'])) { - $stream->setTimeout($config['timeout']); - } - } - - return $transport; - } - - /** - * Create an instance of the Symfony Sendmail Transport driver. - * - * @param array $config - * @return \Symfony\Component\Mailer\Transport\SendmailTransport - */ - protected function createSendmailTransport(array $config) - { - return new SendmailTransport( - $config['path'] ?? $this->app['config']->get('mail.sendmail') - ); - } - - /** - * Create an instance of the Symfony Amazon SES Transport driver. - * - * @param array $config - * @return \Illuminate\Mail\Transport\SesTransport - */ - protected function createSesTransport(array $config) - { - $config = array_merge( - $this->app['config']->get('services.ses', []), - ['version' => 'latest', 'service' => 'email'], - $config - ); - - $config = Arr::except($config, ['transport']); - - return new SesTransport( - new SesClient($this->addSesCredentials($config)), - $config['options'] ?? [] - ); - } - - /** - * Add the SES credentials to the configuration array. - * - * @param array $config - * @return array - */ - protected function addSesCredentials(array $config) - { - if (! empty($config['key']) && ! empty($config['secret'])) { - $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); - } - - return Arr::except($config, ['token']); - } - - /** - * Create an instance of the Symfony Mail Transport driver. - * - * @return \Symfony\Component\Mailer\Transport\SendmailTransport - */ - protected function createMailTransport() - { - return new SendmailTransport; - } - - /** - * Create an instance of the Symfony Mailgun Transport driver. - * - * @param array $config - * @return \Symfony\Component\Mailer\Transport\TransportInterface - */ - protected function createMailgunTransport(array $config) - { - $factory = new MailgunTransportFactory(null, $this->getHttpClient($config)); - - if (! isset($config['secret'])) { - $config = $this->app['config']->get('services.mailgun', []); - } - - return $factory->create(new Dsn( - 'mailgun+'.($config['scheme'] ?? 'https'), - $config['endpoint'] ?? 'default', - $config['secret'], - $config['domain'] - )); - } - - /** - * Create an instance of the Symfony Postmark Transport driver. - * - * @param array $config - * @return \Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkApiTransport - */ - protected function createPostmarkTransport(array $config) - { - $factory = new PostmarkTransportFactory(null, $this->getHttpClient($config)); - - $options = isset($config['message_stream_id']) - ? ['message_stream' => $config['message_stream_id']] - : []; - - return $factory->create(new Dsn( - 'postmark+api', - 'default', - $config['token'] ?? $this->app['config']->get('services.postmark.token'), - null, - null, - $options - )); - } - - /** - * Create an instance of the Symfony Failover Transport driver. - * - * @param array $config - * @return \Symfony\Component\Mailer\Transport\FailoverTransport - */ - protected function createFailoverTransport(array $config) - { - $transports = []; - - foreach ($config['mailers'] as $name) { - $config = $this->getConfig($name); - - if (is_null($config)) { - throw new InvalidArgumentException("Mailer [{$name}] is not defined."); - } - - // Now, we will check if the "driver" key exists and if it does we will set - // the transport configuration parameter in order to offer compatibility - // with any Laravel <= 6.x application style mail configuration files. - $transports[] = $this->app['config']['mail.driver'] - ? $this->createSymfonyTransport(array_merge($config, ['transport' => $name])) - : $this->createSymfonyTransport($config); - } - - return new FailoverTransport($transports); - } - - /** - * Create an instance of the Log Transport driver. - * - * @param array $config - * @return \Illuminate\Mail\Transport\LogTransport - */ - protected function createLogTransport(array $config) - { - $logger = $this->app->make(LoggerInterface::class); - - if ($logger instanceof LogManager) { - $logger = $logger->channel( - $config['channel'] ?? $this->app['config']->get('mail.log_channel') - ); - } - - return new LogTransport($logger); - } - - /** - * Create an instance of the Array Transport Driver. - * - * @return \Illuminate\Mail\Transport\ArrayTransport - */ - protected function createArrayTransport() - { - return new ArrayTransport; - } - - /** - * Get a configured Symfony HTTP client instance. - * - * @return \Symfony\Contracts\HttpClient\HttpClientInterface|null - */ - protected function getHttpClient(array $config) - { - if ($options = ($config['client'] ?? false)) { - $maxHostConnections = Arr::pull($options, 'max_host_connections', 6); - $maxPendingPushes = Arr::pull($options, 'max_pending_pushes', 50); - - return HttpClient::create($options, $maxHostConnections, $maxPendingPushes); - } - } - - /** - * Set a global address on the mailer by type. - * - * @param \Illuminate\Mail\Mailer $mailer - * @param array $config - * @param string $type - * @return void - */ - protected function setGlobalAddress($mailer, array $config, string $type) - { - $address = Arr::get($config, $type, $this->app['config']['mail.'.$type]); - - if (is_array($address) && isset($address['address'])) { - $mailer->{'always'.Str::studly($type)}($address['address'], $address['name']); - } - } - - /** - * Get the mail connection configuration. - * - * @param string $name - * @return array - */ - protected function getConfig(string $name) - { - // Here we will check if the "driver" key exists and if it does we will use - // the entire mail configuration file as the "driver" config in order to - // provide "BC" for any Laravel <= 6.x style mail configuration files. - return $this->app['config']['mail.driver'] - ? $this->app['config']['mail'] - : $this->app['config']["mail.mailers.{$name}"]; - } - - /** - * Get the default mail driver name. - * - * @return string - */ - public function getDefaultDriver() - { - // Here we will check if the "driver" key exists and if it does we will use - // that as the default driver in order to provide support for old styles - // of the Laravel mail configuration file for backwards compatibility. - return $this->app['config']['mail.driver'] ?? - $this->app['config']['mail.default']; - } - - /** - * Set the default mail driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver(string $name) - { - if ($this->app['config']['mail.driver']) { - $this->app['config']['mail.driver'] = $name; - } - - $this->app['config']['mail.default'] = $name; - } - - /** - * Disconnect the given mailer and remove from local cache. - * - * @param string|null $name - * @return void - */ - public function purge($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - unset($this->mailers[$name]); - } - - /** - * Register a custom transport creator Closure. - * - * @param string $driver - * @param \Closure $callback - * @return $this - */ - public function extend($driver, Closure $callback) - { - $this->customCreators[$driver] = $callback; - - return $this; - } - - /** - * Get the application instance used by the manager. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public function getApplication() - { - return $this->app; - } - - /** - * Set the application instance used by the manager. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return $this - */ - public function setApplication($app) - { - $this->app = $app; - - return $this; - } - - /** - * Forget all of the resolved mailer instances. - * - * @return $this - */ - public function forgetMailers() - { - $this->mailers = []; - - return $this; - } - - /** - * Dynamically call the default driver instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->mailer()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/MailServiceProvider.php b/framework-9.50.2/src/Illuminate/Mail/MailServiceProvider.php deleted file mode 100755 index d4f4682..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/MailServiceProvider.php +++ /dev/null @@ -1,73 +0,0 @@ -registerIlluminateMailer(); - $this->registerMarkdownRenderer(); - } - - /** - * Register the Illuminate mailer instance. - * - * @return void - */ - protected function registerIlluminateMailer() - { - $this->app->singleton('mail.manager', function ($app) { - return new MailManager($app); - }); - - $this->app->bind('mailer', function ($app) { - return $app->make('mail.manager')->mailer(); - }); - } - - /** - * Register the Markdown renderer instance. - * - * @return void - */ - protected function registerMarkdownRenderer() - { - if ($this->app->runningInConsole()) { - $this->publishes([ - __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/mail'), - ], 'laravel-mail'); - } - - $this->app->singleton(Markdown::class, function ($app) { - $config = $app->make('config'); - - return new Markdown($app->make('view'), [ - 'theme' => $config->get('mail.markdown.theme', 'default'), - 'paths' => $config->get('mail.markdown.paths', []), - ]); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'mail.manager', - 'mailer', - Markdown::class, - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Mailable.php b/framework-9.50.2/src/Illuminate/Mail/Mailable.php deleted file mode 100644 index 4c291f6..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Mailable.php +++ /dev/null @@ -1,1760 +0,0 @@ -withLocale($this->locale, function () use ($mailer) { - $this->prepareMailableForDelivery(); - - $mailer = $mailer instanceof MailFactory - ? $mailer->mailer($this->mailer) - : $mailer; - - return $mailer->send($this->buildView(), $this->buildViewData(), function ($message) { - $this->buildFrom($message) - ->buildRecipients($message) - ->buildSubject($message) - ->buildTags($message) - ->buildMetadata($message) - ->runCallbacks($message) - ->buildAttachments($message); - }); - }); - } - - /** - * Queue the message for sending. - * - * @param \Illuminate\Contracts\Queue\Factory $queue - * @return mixed - */ - public function queue(Queue $queue) - { - if (isset($this->delay)) { - return $this->later($this->delay, $queue); - } - - $connection = property_exists($this, 'connection') ? $this->connection : null; - - $queueName = property_exists($this, 'queue') ? $this->queue : null; - - return $queue->connection($connection)->pushOn( - $queueName ?: null, $this->newQueuedJob() - ); - } - - /** - * Deliver the queued message after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param \Illuminate\Contracts\Queue\Factory $queue - * @return mixed - */ - public function later($delay, Queue $queue) - { - $connection = property_exists($this, 'connection') ? $this->connection : null; - - $queueName = property_exists($this, 'queue') ? $this->queue : null; - - return $queue->connection($connection)->laterOn( - $queueName ?: null, $delay, $this->newQueuedJob() - ); - } - - /** - * Make the queued mailable job instance. - * - * @return mixed - */ - protected function newQueuedJob() - { - return Container::getInstance()->make(SendQueuedMailable::class, ['mailable' => $this]) - ->through(array_merge( - method_exists($this, 'middleware') ? $this->middleware() : [], - $this->middleware ?? [] - )); - } - - /** - * Render the mailable into a view. - * - * @return string - * - * @throws \ReflectionException - */ - public function render() - { - return $this->withLocale($this->locale, function () { - $this->prepareMailableForDelivery(); - - return Container::getInstance()->make('mailer')->render( - $this->buildView(), $this->buildViewData() - ); - }); - } - - /** - * Build the view for the message. - * - * @return array|string - * - * @throws \ReflectionException - */ - protected function buildView() - { - if (isset($this->html)) { - return array_filter([ - 'html' => new HtmlString($this->html), - 'text' => $this->textView ?? null, - ]); - } - - if (isset($this->markdown)) { - return $this->buildMarkdownView(); - } - - if (isset($this->view, $this->textView)) { - return [$this->view, $this->textView]; - } elseif (isset($this->textView)) { - return ['text' => $this->textView]; - } - - return $this->view; - } - - /** - * Build the Markdown view for the message. - * - * @return array - * - * @throws \ReflectionException - */ - protected function buildMarkdownView() - { - $markdown = Container::getInstance()->make(Markdown::class); - - if (isset($this->theme)) { - $markdown->theme($this->theme); - } - - $data = $this->buildViewData(); - - return [ - 'html' => $markdown->render($this->markdown, $data), - 'text' => $this->buildMarkdownText($markdown, $data), - ]; - } - - /** - * Build the view data for the message. - * - * @return array - * - * @throws \ReflectionException - */ - public function buildViewData() - { - $data = $this->viewData; - - if (static::$viewDataCallback) { - $data = array_merge($data, call_user_func(static::$viewDataCallback, $this)); - } - - foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { - if ($property->getDeclaringClass()->getName() !== self::class) { - $data[$property->getName()] = $property->getValue($this); - } - } - - return $data; - } - - /** - * Build the text view for a Markdown message. - * - * @param \Illuminate\Mail\Markdown $markdown - * @param array $data - * @return string - */ - protected function buildMarkdownText($markdown, $data) - { - return $this->textView - ?? $markdown->renderText($this->markdown, $data); - } - - /** - * Add the sender to the message. - * - * @param \Illuminate\Mail\Message $message - * @return $this - */ - protected function buildFrom($message) - { - if (! empty($this->from)) { - $message->from($this->from[0]['address'], $this->from[0]['name']); - } - - return $this; - } - - /** - * Add all of the recipients to the message. - * - * @param \Illuminate\Mail\Message $message - * @return $this - */ - protected function buildRecipients($message) - { - foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) { - foreach ($this->{$type} as $recipient) { - $message->{$type}($recipient['address'], $recipient['name']); - } - } - - return $this; - } - - /** - * Set the subject for the message. - * - * @param \Illuminate\Mail\Message $message - * @return $this - */ - protected function buildSubject($message) - { - if ($this->subject) { - $message->subject($this->subject); - } else { - $message->subject(Str::title(Str::snake(class_basename($this), ' '))); - } - - return $this; - } - - /** - * Add all of the attachments to the message. - * - * @param \Illuminate\Mail\Message $message - * @return $this - */ - protected function buildAttachments($message) - { - foreach ($this->attachments as $attachment) { - $message->attach($attachment['file'], $attachment['options']); - } - - foreach ($this->rawAttachments as $attachment) { - $message->attachData( - $attachment['data'], $attachment['name'], $attachment['options'] - ); - } - - $this->buildDiskAttachments($message); - - return $this; - } - - /** - * Add all of the disk attachments to the message. - * - * @param \Illuminate\Mail\Message $message - * @return void - */ - protected function buildDiskAttachments($message) - { - foreach ($this->diskAttachments as $attachment) { - $storage = Container::getInstance()->make( - FilesystemFactory::class - )->disk($attachment['disk']); - - $message->attachData( - $storage->get($attachment['path']), - $attachment['name'] ?? basename($attachment['path']), - array_merge(['mime' => $storage->mimeType($attachment['path'])], $attachment['options']) - ); - } - } - - /** - * Add all defined tags to the message. - * - * @param \Illuminate\Mail\Message $message - * @return $this - */ - protected function buildTags($message) - { - if ($this->tags) { - foreach ($this->tags as $tag) { - $message->getHeaders()->add(new TagHeader($tag)); - } - } - - return $this; - } - - /** - * Add all defined metadata to the message. - * - * @param \Illuminate\Mail\Message $message - * @return $this - */ - protected function buildMetadata($message) - { - if ($this->metadata) { - foreach ($this->metadata as $key => $value) { - $message->getHeaders()->add(new MetadataHeader($key, $value)); - } - } - - return $this; - } - - /** - * Run the callbacks for the message. - * - * @param \Illuminate\Mail\Message $message - * @return $this - */ - protected function runCallbacks($message) - { - foreach ($this->callbacks as $callback) { - $callback($message->getSymfonyMessage()); - } - - return $this; - } - - /** - * Set the locale of the message. - * - * @param string $locale - * @return $this - */ - public function locale($locale) - { - $this->locale = $locale; - - return $this; - } - - /** - * Set the priority of this message. - * - * The value is an integer where 1 is the highest priority and 5 is the lowest. - * - * @param int $level - * @return $this - */ - public function priority($level = 3) - { - $this->callbacks[] = function ($message) use ($level) { - $message->priority($level); - }; - - return $this; - } - - /** - * Set the sender of the message. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function from($address, $name = null) - { - return $this->setAddress($address, $name, 'from'); - } - - /** - * Determine if the given recipient is set on the mailable. - * - * @param object|array|string $address - * @param string|null $name - * @return bool - */ - public function hasFrom($address, $name = null) - { - return $this->hasRecipient($address, $name, 'from'); - } - - /** - * Set the recipients of the message. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function to($address, $name = null) - { - if (! $this->locale && $address instanceof HasLocalePreference) { - $this->locale($address->preferredLocale()); - } - - return $this->setAddress($address, $name, 'to'); - } - - /** - * Determine if the given recipient is set on the mailable. - * - * @param object|array|string $address - * @param string|null $name - * @return bool - */ - public function hasTo($address, $name = null) - { - return $this->hasRecipient($address, $name, 'to'); - } - - /** - * Set the recipients of the message. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function cc($address, $name = null) - { - return $this->setAddress($address, $name, 'cc'); - } - - /** - * Determine if the given recipient is set on the mailable. - * - * @param object|array|string $address - * @param string|null $name - * @return bool - */ - public function hasCc($address, $name = null) - { - return $this->hasRecipient($address, $name, 'cc'); - } - - /** - * Set the recipients of the message. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function bcc($address, $name = null) - { - return $this->setAddress($address, $name, 'bcc'); - } - - /** - * Determine if the given recipient is set on the mailable. - * - * @param object|array|string $address - * @param string|null $name - * @return bool - */ - public function hasBcc($address, $name = null) - { - return $this->hasRecipient($address, $name, 'bcc'); - } - - /** - * Set the "reply to" address of the message. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function replyTo($address, $name = null) - { - return $this->setAddress($address, $name, 'replyTo'); - } - - /** - * Determine if the given replyTo is set on the mailable. - * - * @param object|array|string $address - * @param string|null $name - * @return bool - */ - public function hasReplyTo($address, $name = null) - { - return $this->hasRecipient($address, $name, 'replyTo'); - } - - /** - * Set the recipients of the message. - * - * All recipients are stored internally as [['name' => ?, 'address' => ?]] - * - * @param object|array|string $address - * @param string|null $name - * @param string $property - * @return $this - */ - protected function setAddress($address, $name = null, $property = 'to') - { - if (empty($address)) { - return $this; - } - - foreach ($this->addressesToArray($address, $name) as $recipient) { - $recipient = $this->normalizeRecipient($recipient); - - $this->{$property}[] = [ - 'name' => $recipient->name ?? null, - 'address' => $recipient->email, - ]; - } - - $this->{$property} = collect($this->{$property}) - ->reverse() - ->unique('address') - ->reverse() - ->values() - ->all(); - - return $this; - } - - /** - * Convert the given recipient arguments to an array. - * - * @param object|array|string $address - * @param string|null $name - * @return array - */ - protected function addressesToArray($address, $name) - { - if (! is_array($address) && ! $address instanceof Collection) { - $address = is_string($name) ? [['name' => $name, 'email' => $address]] : [$address]; - } - - return $address; - } - - /** - * Convert the given recipient into an object. - * - * @param mixed $recipient - * @return object - */ - protected function normalizeRecipient($recipient) - { - if (is_array($recipient)) { - if (array_values($recipient) === $recipient) { - return (object) array_map(function ($email) { - return compact('email'); - }, $recipient); - } - - return (object) $recipient; - } elseif (is_string($recipient)) { - return (object) ['email' => $recipient]; - } elseif ($recipient instanceof Address) { - return (object) ['email' => $recipient->getAddress(), 'name' => $recipient->getName()]; - } elseif ($recipient instanceof Mailables\Address) { - return (object) ['email' => $recipient->address, 'name' => $recipient->name]; - } - - return $recipient; - } - - /** - * Determine if the given recipient is set on the mailable. - * - * @param object|array|string $address - * @param string|null $name - * @param string $property - * @return bool - */ - protected function hasRecipient($address, $name = null, $property = 'to') - { - if (empty($address)) { - return false; - } - - $expected = $this->normalizeRecipient( - $this->addressesToArray($address, $name)[0] - ); - - $expected = [ - 'name' => $expected->name ?? null, - 'address' => $expected->email, - ]; - - if ($this->hasEnvelopeRecipient($expected['address'], $expected['name'], $property)) { - return true; - } - - return collect($this->{$property})->contains(function ($actual) use ($expected) { - if (! isset($expected['name'])) { - return $actual['address'] == $expected['address']; - } - - return $actual == $expected; - }); - } - - /** - * Determine if the mailable "envelope" method defines a recipient. - * - * @param string $address - * @param string|null $name - * @param string $property - * @return bool - */ - private function hasEnvelopeRecipient($address, $name, $property) - { - return method_exists($this, 'envelope') && match ($property) { - 'from' => $this->envelope()->isFrom($address, $name), - 'to' => $this->envelope()->hasTo($address, $name), - 'cc' => $this->envelope()->hasCc($address, $name), - 'bcc' => $this->envelope()->hasBcc($address, $name), - 'replyTo' => $this->envelope()->hasReplyTo($address, $name), - }; - } - - /** - * Set the subject of the message. - * - * @param string $subject - * @return $this - */ - public function subject($subject) - { - $this->subject = $subject; - - return $this; - } - - /** - * Determine if the mailable has the given subject. - * - * @param string $subject - * @return bool - */ - public function hasSubject($subject) - { - return $this->subject === $subject || - (method_exists($this, 'envelope') && $this->envelope()->hasSubject($subject)); - } - - /** - * Set the Markdown template for the message. - * - * @param string $view - * @param array $data - * @return $this - */ - public function markdown($view, array $data = []) - { - $this->markdown = $view; - $this->viewData = array_merge($this->viewData, $data); - - return $this; - } - - /** - * Set the view and view data for the message. - * - * @param string $view - * @param array $data - * @return $this - */ - public function view($view, array $data = []) - { - $this->view = $view; - $this->viewData = array_merge($this->viewData, $data); - - return $this; - } - - /** - * Set the rendered HTML content for the message. - * - * @param string $html - * @return $this - */ - public function html($html) - { - $this->html = $html; - - return $this; - } - - /** - * Set the plain text view for the message. - * - * @param string $textView - * @param array $data - * @return $this - */ - public function text($textView, array $data = []) - { - $this->textView = $textView; - $this->viewData = array_merge($this->viewData, $data); - - return $this; - } - - /** - * Set the view data for the message. - * - * @param string|array $key - * @param mixed $value - * @return $this - */ - public function with($key, $value = null) - { - if (is_array($key)) { - $this->viewData = array_merge($this->viewData, $key); - } else { - $this->viewData[$key] = $value; - } - - return $this; - } - - /** - * Attach a file to the message. - * - * @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file - * @param array $options - * @return $this - */ - public function attach($file, array $options = []) - { - if ($file instanceof Attachable) { - $file = $file->toMailAttachment(); - } - - if ($file instanceof Attachment) { - return $file->attachTo($this); - } - - $this->attachments = collect($this->attachments) - ->push(compact('file', 'options')) - ->unique('file') - ->all(); - - return $this; - } - - /** - * Attach multiple files to the message. - * - * @param array $files - * @return $this - */ - public function attachMany($files) - { - foreach ($files as $file => $options) { - if (is_int($file)) { - $this->attach($options); - } else { - $this->attach($file, $options); - } - } - - return $this; - } - - /** - * Determine if the mailable has the given attachment. - * - * @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file - * @param array $options - * @return bool - */ - public function hasAttachment($file, array $options = []) - { - if ($file instanceof Attachable) { - $file = $file->toMailAttachment(); - } - - if ($file instanceof Attachment && $this->hasEnvelopeAttachment($file)) { - return true; - } - - if ($file instanceof Attachment) { - $parts = $file->attachWith( - fn ($path) => [$path, ['as' => $file->as, 'mime' => $file->mime]], - fn ($data) => $this->hasAttachedData($data(), $file->as, ['mime' => $file->mime]) - ); - - if ($parts === true) { - return true; - } - - [$file, $options] = $parts === false - ? [null, []] - : $parts; - } - - return collect($this->attachments)->contains( - fn ($attachment) => $attachment['file'] === $file && array_filter($attachment['options']) === array_filter($options) - ); - } - - /** - * Determine if the mailable has the given envelope attachment. - * - * @param \Illuminate\Mail\Attachment $attachment - * @return bool - */ - private function hasEnvelopeAttachment($attachment) - { - if (! method_exists($this, 'envelope')) { - return false; - } - - $attachments = $this->attachments(); - - return Collection::make(is_object($attachments) ? [$attachments] : $attachments) - ->map(fn ($attached) => $attached instanceof Attachable ? $attached->toMailAttachment() : $attached) - ->contains(fn ($attached) => $attached->isEquivalent($attachment)); - } - - /** - * Attach a file to the message from storage. - * - * @param string $path - * @param string|null $name - * @param array $options - * @return $this - */ - public function attachFromStorage($path, $name = null, array $options = []) - { - return $this->attachFromStorageDisk(null, $path, $name, $options); - } - - /** - * Attach a file to the message from storage. - * - * @param string $disk - * @param string $path - * @param string|null $name - * @param array $options - * @return $this - */ - public function attachFromStorageDisk($disk, $path, $name = null, array $options = []) - { - $this->diskAttachments = collect($this->diskAttachments)->push([ - 'disk' => $disk, - 'path' => $path, - 'name' => $name ?? basename($path), - 'options' => $options, - ])->unique(function ($file) { - return $file['name'].$file['disk'].$file['path']; - })->all(); - - return $this; - } - - /** - * Determine if the mailable has the given attachment from storage. - * - * @param string $path - * @param string|null $name - * @param array $options - * @return bool - */ - public function hasAttachmentFromStorage($path, $name = null, array $options = []) - { - return $this->hasAttachmentFromStorageDisk(null, $path, $name, $options); - } - - /** - * Determine if the mailable has the given attachment from a specific storage disk. - * - * @param string $disk - * @param string $path - * @param string|null $name - * @param array $options - * @return bool - */ - public function hasAttachmentFromStorageDisk($disk, $path, $name = null, array $options = []) - { - return collect($this->diskAttachments)->contains( - fn ($attachment) => $attachment['disk'] === $disk - && $attachment['path'] === $path - && $attachment['name'] === ($name ?? basename($path)) - && $attachment['options'] === $options - ); - } - - /** - * Attach in-memory data as an attachment. - * - * @param string $data - * @param string $name - * @param array $options - * @return $this - */ - public function attachData($data, $name, array $options = []) - { - $this->rawAttachments = collect($this->rawAttachments) - ->push(compact('data', 'name', 'options')) - ->unique(function ($file) { - return $file['name'].$file['data']; - })->all(); - - return $this; - } - - /** - * Determine if the mailable has the given data as an attachment. - * - * @param string $data - * @param string $name - * @param array $options - * @return bool - */ - public function hasAttachedData($data, $name, array $options = []) - { - return collect($this->rawAttachments)->contains( - fn ($attachment) => $attachment['data'] === $data - && $attachment['name'] === $name - && array_filter($attachment['options']) === array_filter($options) - ); - } - - /** - * Add a tag header to the message when supported by the underlying transport. - * - * @param string $value - * @return $this - */ - public function tag($value) - { - array_push($this->tags, $value); - - return $this; - } - - /** - * Determine if the mailable has the given tag. - * - * @param string $value - * @return bool - */ - public function hasTag($value) - { - return in_array($value, $this->tags) || - (method_exists($this, 'envelope') && in_array($value, $this->envelope()->tags)); - } - - /** - * Add a metadata header to the message when supported by the underlying transport. - * - * @param string $key - * @param string $value - * @return $this - */ - public function metadata($key, $value) - { - $this->metadata[$key] = $value; - - return $this; - } - - /** - * Determine if the mailable has the given metadata. - * - * @param string $key - * @param string $value - * @return bool - */ - public function hasMetadata($key, $value) - { - return (isset($this->metadata[$key]) && $this->metadata[$key] === $value) || - (method_exists($this, 'envelope') && $this->envelope()->hasMetadata($key, $value)); - } - - /** - * Assert that the mailable is from the given address. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function assertFrom($address, $name = null) - { - $recipient = $this->formatAssertionRecipient($address, $name); - - PHPUnit::assertTrue( - $this->hasFrom($address, $name), - "Email was not from expected address [{$recipient}]." - ); - - return $this; - } - - /** - * Assert that the mailable has the given recipient. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function assertTo($address, $name = null) - { - $recipient = $this->formatAssertionRecipient($address, $name); - - PHPUnit::assertTrue( - $this->hasTo($address, $name), - "Did not see expected recipient [{$recipient}] in email recipients." - ); - - return $this; - } - - /** - * Assert that the mailable has the given recipient. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function assertHasTo($address, $name = null) - { - return $this->assertTo($address, $name); - } - - /** - * Assert that the mailable has the given recipient. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function assertHasCc($address, $name = null) - { - $recipient = $this->formatAssertionRecipient($address, $name); - - PHPUnit::assertTrue( - $this->hasCc($address, $name), - "Did not see expected recipient [{$recipient}] in email recipients." - ); - - return $this; - } - - /** - * Assert that the mailable has the given recipient. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function assertHasBcc($address, $name = null) - { - $recipient = $this->formatAssertionRecipient($address, $name); - - PHPUnit::assertTrue( - $this->hasBcc($address, $name), - "Did not see expected recipient [{$recipient}] in email recipients." - ); - - return $this; - } - - /** - * Assert that the mailable has the given "reply to" address. - * - * @param object|array|string $address - * @param string|null $name - * @return $this - */ - public function assertHasReplyTo($address, $name = null) - { - $replyTo = $this->formatAssertionRecipient($address, $name); - - PHPUnit::assertTrue( - $this->hasReplyTo($address, $name), - "Did not see expected address [{$replyTo}] as email 'reply to' recipient." - ); - - return $this; - } - - /** - * Format the mailable recipient for display in an assertion message. - * - * @param object|array|string $address - * @param string|null $name - * @return string - */ - private function formatAssertionRecipient($address, $name = null) - { - if (! is_string($address)) { - $address = json_encode($address); - } - - if (filled($name)) { - $address .= ' ('.$name.')'; - } - - return $address; - } - - /** - * Assert that the mailable has the given subject. - * - * @param string $subject - * @return $this - */ - public function assertHasSubject($subject) - { - PHPUnit::assertTrue( - $this->hasSubject($subject), - "Did not see expected text [{$subject}] in email subject." - ); - - return $this; - } - - /** - * Assert that the given text is present in the HTML email body. - * - * @param string $string - * @return $this - */ - public function assertSeeInHtml($string) - { - [$html, $text] = $this->renderForAssertions(); - - PHPUnit::assertStringContainsString( - $string, - $html, - "Did not see expected text [{$string}] within email body." - ); - - return $this; - } - - /** - * Assert that the given text is not present in the HTML email body. - * - * @param string $string - * @return $this - */ - public function assertDontSeeInHtml($string) - { - [$html, $text] = $this->renderForAssertions(); - - PHPUnit::assertStringNotContainsString( - $string, - $html, - "Saw unexpected text [{$string}] within email body." - ); - - return $this; - } - - /** - * Assert that the given text strings are present in order in the HTML email body. - * - * @param array $strings - * @return $this - */ - public function assertSeeInOrderInHtml($strings) - { - [$html, $text] = $this->renderForAssertions(); - - PHPUnit::assertThat($strings, new SeeInOrder($html)); - - return $this; - } - - /** - * Assert that the given text is present in the plain-text email body. - * - * @param string $string - * @return $this - */ - public function assertSeeInText($string) - { - [$html, $text] = $this->renderForAssertions(); - - PHPUnit::assertStringContainsString( - $string, - $text, - "Did not see expected text [{$string}] within text email body." - ); - - return $this; - } - - /** - * Assert that the given text is not present in the plain-text email body. - * - * @param string $string - * @return $this - */ - public function assertDontSeeInText($string) - { - [$html, $text] = $this->renderForAssertions(); - - PHPUnit::assertStringNotContainsString( - $string, - $text, - "Saw unexpected text [{$string}] within text email body." - ); - - return $this; - } - - /** - * Assert that the given text strings are present in order in the plain-text email body. - * - * @param array $strings - * @return $this - */ - public function assertSeeInOrderInText($strings) - { - [$html, $text] = $this->renderForAssertions(); - - PHPUnit::assertThat($strings, new SeeInOrder($text)); - - return $this; - } - - /** - * Assert the mailable has the given attachment. - * - * @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file - * @param array $options - * @return $this - */ - public function assertHasAttachment($file, array $options = []) - { - $this->renderForAssertions(); - - PHPUnit::assertTrue( - $this->hasAttachment($file, $options), - 'Did not find the expected attachment.' - ); - - return $this; - } - - /** - * Assert the mailable has the given data as an attachment. - * - * @param string $data - * @param string $name - * @param array $options - * @return $this - */ - public function assertHasAttachedData($data, $name, array $options = []) - { - $this->renderForAssertions(); - - PHPUnit::assertTrue( - $this->hasAttachedData($data, $name, $options), - 'Did not find the expected attachment.' - ); - - return $this; - } - - /** - * Assert the mailable has the given attachment from storage. - * - * @param string $path - * @param string|null $name - * @param array $options - * @return $this - */ - public function assertHasAttachmentFromStorage($path, $name = null, array $options = []) - { - $this->renderForAssertions(); - - PHPUnit::assertTrue( - $this->hasAttachmentFromStorage($path, $name, $options), - 'Did not find the expected attachment.' - ); - - return $this; - } - - /** - * Assert the mailable has the given attachment from a specific storage disk. - * - * @param string $disk - * @param string $path - * @param string|null $name - * @param array $options - * @return $this - */ - public function assertHasAttachmentFromStorageDisk($disk, $path, $name = null, array $options = []) - { - $this->renderForAssertions(); - - PHPUnit::assertTrue( - $this->hasAttachmentFromStorageDisk($disk, $path, $name, $options), - 'Did not find the expected attachment.' - ); - - return $this; - } - - /** - * Assert that the mailable has the given tag. - * - * @param string $tag - * @return $this - */ - public function assertHasTag($tag) - { - PHPUnit::assertTrue( - $this->hasTag($tag), - "Did not see expected tag [{$tag}] in email tags." - ); - - return $this; - } - - /** - * Assert that the mailable has the given metadata. - * - * @param string $key - * @param string $value - * @return $this - */ - public function assertHasMetadata($key, $value) - { - PHPUnit::assertTrue( - $this->hasMetadata($key, $value), - "Did not see expected key [{$key}] and value [{$value}] in email metadata." - ); - - return $this; - } - - /** - * Render the HTML and plain-text version of the mailable into views for assertions. - * - * @return array - * - * @throws \ReflectionException - */ - protected function renderForAssertions() - { - if ($this->assertionableRenderStrings) { - return $this->assertionableRenderStrings; - } - - return $this->assertionableRenderStrings = $this->withLocale($this->locale, function () { - $this->prepareMailableForDelivery(); - - $html = Container::getInstance()->make('mailer')->render( - $view = $this->buildView(), $this->buildViewData() - ); - - if (is_array($view) && isset($view[1])) { - $text = $view[1]; - } - - $text ??= $view['text'] ?? ''; - - if (! empty($text) && ! $text instanceof Htmlable) { - $text = Container::getInstance()->make('mailer')->render( - $text, $this->buildViewData() - ); - } - - return [(string) $html, (string) $text]; - }); - } - - /** - * Prepare the mailable instance for delivery. - * - * @return void - */ - private function prepareMailableForDelivery() - { - if (method_exists($this, 'build')) { - Container::getInstance()->call([$this, 'build']); - } - - $this->ensureHeadersAreHydrated(); - $this->ensureEnvelopeIsHydrated(); - $this->ensureContentIsHydrated(); - $this->ensureAttachmentsAreHydrated(); - } - - /** - * Ensure the mailable's headers are hydrated from the "headers" method. - * - * @return void - */ - private function ensureHeadersAreHydrated() - { - if (! method_exists($this, 'headers')) { - return; - } - - $headers = $this->headers(); - - $this->withSymfonyMessage(function ($message) use ($headers) { - if ($headers->messageId) { - $message->getHeaders()->addIdHeader('Message-Id', $headers->messageId); - } - - if (count($headers->references) > 0) { - $message->getHeaders()->addTextHeader('References', $headers->referencesString()); - } - - foreach ($headers->text as $key => $value) { - $message->getHeaders()->addTextHeader($key, $value); - } - }); - } - - /** - * Ensure the mailable's "envelope" data is hydrated from the "envelope" method. - * - * @return void - */ - private function ensureEnvelopeIsHydrated() - { - if (! method_exists($this, 'envelope')) { - return; - } - - $envelope = $this->envelope(); - - if (isset($envelope->from)) { - $this->from($envelope->from->address, $envelope->from->name); - } - - foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) { - foreach ($envelope->{$type} as $address) { - $this->{$type}($address->address, $address->name); - } - } - - if ($envelope->subject) { - $this->subject($envelope->subject); - } - - foreach ($envelope->tags as $tag) { - $this->tag($tag); - } - - foreach ($envelope->metadata as $key => $value) { - $this->metadata($key, $value); - } - - foreach ($envelope->using as $callback) { - $this->withSymfonyMessage($callback); - } - } - - /** - * Ensure the mailable's content is hydrated from the "content" method. - * - * @return void - */ - private function ensureContentIsHydrated() - { - if (! method_exists($this, 'content')) { - return; - } - - $content = $this->content(); - - if ($content->view) { - $this->view($content->view); - } - - if ($content->html) { - $this->view($content->html); - } - - if ($content->text) { - $this->text($content->text); - } - - if ($content->markdown) { - $this->markdown($content->markdown); - } - - if ($content->htmlString) { - $this->html($content->htmlString); - } - - foreach ($content->with as $key => $value) { - $this->with($key, $value); - } - } - - /** - * Ensure the mailable's attachments are hydrated from the "attachments" method. - * - * @return void - */ - private function ensureAttachmentsAreHydrated() - { - if (! method_exists($this, 'attachments')) { - return; - } - - $attachments = $this->attachments(); - - Collection::make(is_object($attachments) ? [$attachments] : $attachments) - ->each(function ($attachment) { - $this->attach($attachment); - }); - } - - /** - * Set the name of the mailer that should send the message. - * - * @param string $mailer - * @return $this - */ - public function mailer($mailer) - { - $this->mailer = $mailer; - - return $this; - } - - /** - * Register a callback to be called with the Symfony message instance. - * - * @param callable $callback - * @return $this - */ - public function withSymfonyMessage($callback) - { - $this->callbacks[] = $callback; - - return $this; - } - - /** - * Register a callback to be called while building the view data. - * - * @param callable $callback - * @return void - */ - public static function buildViewDataUsing(callable $callback) - { - static::$viewDataCallback = $callback; - } - - /** - * Dynamically bind parameters to the message. - * - * @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_starts_with($method, 'with')) { - return $this->with(Str::camel(substr($method, 4)), $parameters[0]); - } - - static::throwBadMethodCallException($method); - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Mailables/Address.php b/framework-9.50.2/src/Illuminate/Mail/Mailables/Address.php deleted file mode 100644 index be54a24..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Mailables/Address.php +++ /dev/null @@ -1,33 +0,0 @@ -address = $address; - $this->name = $name; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Mailables/Attachment.php b/framework-9.50.2/src/Illuminate/Mail/Mailables/Attachment.php deleted file mode 100644 index e11d2e9..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Mailables/Attachment.php +++ /dev/null @@ -1,10 +0,0 @@ -view = $view; - $this->html = $html; - $this->text = $text; - $this->markdown = $markdown; - $this->with = $with; - $this->htmlString = $htmlString; - } - - /** - * Set the view for the message. - * - * @param string $view - * @return $this - */ - public function view(string $view) - { - $this->view = $view; - - return $this; - } - - /** - * Set the view for the message. - * - * @param string $view - * @return $this - */ - public function html(string $view) - { - return $this->view($view); - } - - /** - * Set the plain text view for the message. - * - * @param string $view - * @return $this - */ - public function text(string $view) - { - $this->text = $view; - - return $this; - } - - /** - * Set the Markdown view for the message. - * - * @param string $view - * @return $this - */ - public function markdown(string $view) - { - $this->markdown = $view; - - return $this; - } - - /** - * Set the pre-rendered HTML for the message. - * - * @param string $html - * @return $this - */ - public function htmlString(string $html) - { - $this->htmlString = $html; - - return $this; - } - - /** - * Add a piece of view data to the message. - * - * @param string $key - * @param mixed|null $value - * @return $this - */ - public function with($key, $value = null) - { - if (is_array($key)) { - $this->with = array_merge($this->with, $key); - } else { - $this->with[$key] = $value; - } - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Mailables/Envelope.php b/framework-9.50.2/src/Illuminate/Mail/Mailables/Envelope.php deleted file mode 100644 index 7d6c4b1..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Mailables/Envelope.php +++ /dev/null @@ -1,369 +0,0 @@ -from = is_string($from) ? new Address($from) : $from; - $this->to = $this->normalizeAddresses($to); - $this->cc = $this->normalizeAddresses($cc); - $this->bcc = $this->normalizeAddresses($bcc); - $this->replyTo = $this->normalizeAddresses($replyTo); - $this->subject = $subject; - $this->tags = $tags; - $this->metadata = $metadata; - $this->using = Arr::wrap($using); - } - - /** - * Normalize the given array of addresses. - * - * @param array $addresses - * @return array - */ - protected function normalizeAddresses($addresses) - { - return collect($addresses)->map(function ($address) { - return is_string($address) ? new Address($address) : $address; - })->all(); - } - - /** - * Specify who the message will be "from". - * - * @param \Illuminate\Mail\Mailables\Address|string $address - * @param string|null $name - * @return $this - */ - public function from(Address|string $address, $name = null) - { - $this->from = is_string($address) ? new Address($address, $name) : $address; - - return $this; - } - - /** - * Add a "to" recipient to the message envelope. - * - * @param \Illuminate\Mail\Mailables\Address|array|string $address - * @param string|null $name - * @return $this - */ - public function to(Address|array|string $address, $name = null) - { - $this->to = array_merge($this->to, $this->normalizeAddresses( - is_string($name) ? [new Address($address, $name)] : Arr::wrap($address), - )); - - return $this; - } - - /** - * Add a "cc" recipient to the message envelope. - * - * @param \Illuminate\Mail\Mailables\Address|array|string $address - * @param string|null $name - * @return $this - */ - public function cc(Address|array|string $address, $name = null) - { - $this->cc = array_merge($this->cc, $this->normalizeAddresses( - is_string($name) ? [new Address($address, $name)] : Arr::wrap($address), - )); - - return $this; - } - - /** - * Add a "bcc" recipient to the message envelope. - * - * @param \Illuminate\Mail\Mailables\Address|array|string $address - * @param string|null $name - * @return $this - */ - public function bcc(Address|array|string $address, $name = null) - { - $this->bcc = array_merge($this->bcc, $this->normalizeAddresses( - is_string($name) ? [new Address($address, $name)] : Arr::wrap($address), - )); - - return $this; - } - - /** - * Add a "reply to" recipient to the message envelope. - * - * @param \Illuminate\Mail\Mailables\Address|array|string $address - * @param string|null $name - * @return $this - */ - public function replyTo(Address|array|string $address, $name = null) - { - $this->replyTo = array_merge($this->replyTo, $this->normalizeAddresses( - is_string($name) ? [new Address($address, $name)] : Arr::wrap($address), - )); - - return $this; - } - - /** - * Set the subject of the message. - * - * @param string $subject - * @return $this - */ - public function subject(string $subject) - { - $this->subject = $subject; - - return $this; - } - - /** - * Add "tags" to the message. - * - * @param array $tags - * @return $this - */ - public function tags(array $tags) - { - $this->tags = array_merge($this->tags, $tags); - - return $this; - } - - /** - * Add a "tag" to the message. - * - * @param string $tag - * @return $this - */ - public function tag(string $tag) - { - $this->tags[] = $tag; - - return $this; - } - - /** - * Add metadata to the message. - * - * @param string $key - * @param string|int $value - * @return $this - */ - public function metadata(string $key, string|int $value) - { - $this->metadata[$key] = $value; - - return $this; - } - - /** - * Add a Symfony Message customization callback to the message. - * - * @param \Closure $callback - * @return $this - */ - public function using(Closure $callback) - { - $this->using[] = $callback; - - return $this; - } - - /** - * Determine if the message is from the given address. - * - * @param string $address - * @param string|null $name - * @return bool - */ - public function isFrom(string $address, string $name = null) - { - if (is_null($name)) { - return $this->from->address === $address; - } - - return $this->from->address === $address && - $this->from->name === $name; - } - - /** - * Determine if the message has the given address as a recipient. - * - * @param string $address - * @param string|null $name - * @return bool - */ - public function hasTo(string $address, string $name = null) - { - return $this->hasRecipient($this->to, $address, $name); - } - - /** - * Determine if the message has the given address as a "cc" recipient. - * - * @param string $address - * @param string|null $name - * @return bool - */ - public function hasCc(string $address, string $name = null) - { - return $this->hasRecipient($this->cc, $address, $name); - } - - /** - * Determine if the message has the given address as a "bcc" recipient. - * - * @param string $address - * @param string|null $name - * @return bool - */ - public function hasBcc(string $address, string $name = null) - { - return $this->hasRecipient($this->bcc, $address, $name); - } - - /** - * Determine if the message has the given address as a "reply to" recipient. - * - * @param string $address - * @param string|null $name - * @return bool - */ - public function hasReplyTo(string $address, string $name = null) - { - return $this->hasRecipient($this->replyTo, $address, $name); - } - - /** - * Determine if the message has the given recipient. - * - * @param array $recipients - * @param string $address - * @param string|null $name - * @return bool - */ - protected function hasRecipient(array $recipients, string $address, ?string $name = null) - { - return collect($recipients)->contains(function ($recipient) use ($address, $name) { - if (is_null($name)) { - return $recipient->address === $address; - } - - return $recipient->address === $address && - $recipient->name === $name; - }); - } - - /** - * Determine if the message has the given subject. - * - * @param string $subject - * @return bool - */ - public function hasSubject(string $subject) - { - return $this->subject === $subject; - } - - /** - * Determine if the message has the given metadata. - * - * @param string $key - * @param string $value - * @return bool - */ - public function hasMetadata(string $key, string $value) - { - return isset($this->metadata[$key]) && (string) $this->metadata[$key] === $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Mailables/Headers.php b/framework-9.50.2/src/Illuminate/Mail/Mailables/Headers.php deleted file mode 100644 index 87cee52..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Mailables/Headers.php +++ /dev/null @@ -1,100 +0,0 @@ -messageId = $messageId; - $this->references = $references; - $this->text = $text; - } - - /** - * Set the message ID. - * - * @param string $messageId - * @return $this - */ - public function messageId(string $messageId) - { - $this->messageId = $messageId; - - return $this; - } - - /** - * Set the message IDs referenced by this message. - * - * @param array $references - * @return $this - */ - public function references(array $references) - { - $this->references = array_merge($this->references, $references); - - return $this; - } - - /** - * Set the headers for this message. - * - * @param array $references - * @return $this - */ - public function text(array $text) - { - $this->text = array_merge($this->text, $text); - - return $this; - } - - /** - * Get the references header as a string. - * - * @return string - */ - public function referencesString(): string - { - return collect($this->references)->map(function ($messageId) { - return Str::finish(Str::start($messageId, '<'), '>'); - })->implode(' '); - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Mailer.php b/framework-9.50.2/src/Illuminate/Mail/Mailer.php deleted file mode 100755 index 4a253cf..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Mailer.php +++ /dev/null @@ -1,604 +0,0 @@ -name = $name; - $this->views = $views; - $this->events = $events; - $this->transport = $transport; - } - - /** - * 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 return path address. - * - * @param string $address - * @return void - */ - public function alwaysReturnPath($address) - { - $this->returnPath = compact('address'); - } - - /** - * 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 cc($users) - { - return (new PendingMail($this))->cc($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 with only an HTML part. - * - * @param string $html - * @param mixed $callback - * @return \Illuminate\Mail\SentMessage|null - */ - public function html($html, $callback) - { - return $this->send(['html' => new HtmlString($html)], [], $callback); - } - - /** - * Send a new message with only a raw text part. - * - * @param string $text - * @param mixed $callback - * @return \Illuminate\Mail\SentMessage|null - */ - public function raw($text, $callback) - { - return $this->send(['raw' => $text], [], $callback); - } - - /** - * Send a new message with only a plain part. - * - * @param string $view - * @param array $data - * @param mixed $callback - * @return \Illuminate\Mail\SentMessage|null - */ - 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. - [$view, $plain, $raw] = $this->parseView($view); - - $data['message'] = $this->createMessage(); - - return $this->renderView($view ?: $plain, $data); - } - - /** - * Send a new message using a view. - * - * @param \Illuminate\Contracts\Mail\Mailable|string|array $view - * @param array $data - * @param \Closure|string|null $callback - * @return \Illuminate\Mail\SentMessage|null - */ - 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. - [$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. - if (! is_null($callback)) { - $callback($message); - } - - $this->addContent($message, $view, $plain, $raw, $data); - - // 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->setGlobalToAndRemoveCcAndBcc($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. - $symfonyMessage = $message->getSymfonyMessage(); - - if ($this->shouldSendMessage($symfonyMessage, $data)) { - $symfonySentMessage = $this->sendSymfonyMessage($symfonyMessage); - - if ($symfonySentMessage) { - $sentMessage = new SentMessage($symfonySentMessage); - - $this->dispatchSentEvent($sentMessage, $data); - - return $sentMessage; - } - } - } - - /** - * Send the given mailable. - * - * @param \Illuminate\Contracts\Mail\Mailable $mailable - * @return \Illuminate\Mail\SentMessage|null - */ - protected function sendMailable(MailableContract $mailable) - { - return $mailable instanceof ShouldQueue - ? $mailable->mailer($this->name)->queue($this->queue) - : $mailable->mailer($this->name)->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->html($this->renderView($view, $data) ?: ' '); - } - - if (isset($plain)) { - $message->text($this->renderView($plain, $data) ?: ' '); - } - - if (isset($raw)) { - $message->text($raw); - } - } - - /** - * 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 setGlobalToAndRemoveCcAndBcc($message) - { - $message->forgetTo(); - - $message->to($this->to['address'], $this->to['name'], true); - - $message->forgetCc(); - $message->forgetBcc(); - } - - /** - * Queue a new e-mail message for sending. - * - * @param \Illuminate\Contracts\Mail\Mailable|string|array $view - * @param string|null $queue - * @return mixed - * - * @throws \InvalidArgumentException - */ - public function queue($view, $queue = null) - { - if (! $view instanceof MailableContract) { - throw new InvalidArgumentException('Only mailables may be queued.'); - } - - if (is_string($queue)) { - $view->onQueue($queue); - } - - return $view->mailer($this->name)->queue($this->queue); - } - - /** - * Queue a new e-mail message for sending on the given queue. - * - * @param string $queue - * @param \Illuminate\Contracts\Mail\Mailable $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 \Illuminate\Contracts\Mail\Mailable $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 \Illuminate\Contracts\Mail\Mailable $view - * @param string|null $queue - * @return mixed - * - * @throws \InvalidArgumentException - */ - public function later($delay, $view, $queue = null) - { - if (! $view instanceof MailableContract) { - throw new InvalidArgumentException('Only mailables may be queued.'); - } - - return $view->mailer($this->name)->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 \Illuminate\Contracts\Mail\Mailable $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(new Email()); - - // 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']); - } - - if (! empty($this->returnPath['address'])) { - $message->returnPath($this->returnPath['address']); - } - - return $message; - } - - /** - * Send a Symfony Email instance. - * - * @param \Symfony\Component\Mime\Email $message - * @return \Symfony\Component\Mailer\SentMessage|null - */ - protected function sendSymfonyMessage(Email $message) - { - try { - return $this->transport->send($message, Envelope::create($message)); - } finally { - // - } - } - - /** - * Determines if the email can be sent. - * - * @param \Symfony\Component\Mime\Email $message - * @param array $data - * @return bool - */ - protected function shouldSendMessage($message, $data = []) - { - if (! $this->events) { - return true; - } - - return $this->events->until( - new MessageSending($message, $data) - ) !== false; - } - - /** - * Dispatch the message sent event. - * - * @param \Illuminate\Mail\SentMessage $message - * @param array $data - * @return void - */ - protected function dispatchSentEvent($message, $data = []) - { - if ($this->events) { - $this->events->dispatch( - new MessageSent($message, $data) - ); - } - } - - /** - * Get the Symfony Transport instance. - * - * @return \Symfony\Component\Mailer\Transport\TransportInterface - */ - public function getSymfonyTransport() - { - return $this->transport; - } - - /** - * Get the view factory instance. - * - * @return \Illuminate\Contracts\View\Factory - */ - public function getViewFactory() - { - return $this->views; - } - - /** - * Set the Symfony Transport instance. - * - * @param \Symfony\Component\Mailer\Transport\TransportInterface $transport - * @return void - */ - public function setSymfonyTransport(TransportInterface $transport) - { - $this->transport = $transport; - } - - /** - * Set the queue manager instance. - * - * @param \Illuminate\Contracts\Queue\Factory $queue - * @return $this - */ - public function setQueue(QueueContract $queue) - { - $this->queue = $queue; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Markdown.php b/framework-9.50.2/src/Illuminate/Mail/Markdown.php deleted file mode 100644 index 8faf739..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Markdown.php +++ /dev/null @@ -1,189 +0,0 @@ -view = $view; - $this->theme = $options['theme'] ?? 'default'; - $this->loadComponentsFrom($options['paths'] ?? []); - } - - /** - * Render the Markdown template into HTML. - * - * @param string $view - * @param array $data - * @param \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles|null $inliner - * @return \Illuminate\Support\HtmlString - */ - public function render($view, array $data = [], $inliner = null) - { - $this->view->flushFinderCache(); - - $contents = $this->view->replaceNamespace( - 'mail', $this->htmlComponentPaths() - )->make($view, $data)->render(); - - if ($this->view->exists($customTheme = Str::start($this->theme, 'mail.'))) { - $theme = $customTheme; - } else { - $theme = str_contains($this->theme, '::') - ? $this->theme - : 'mail::themes.'.$this->theme; - } - - return new HtmlString(($inliner ?: new CssToInlineStyles)->convert( - $contents, $this->view->make($theme, $data)->render() - )); - } - - /** - * Render the Markdown template into text. - * - * @param string $view - * @param array $data - * @return \Illuminate\Support\HtmlString - */ - public function renderText($view, array $data = []) - { - $this->view->flushFinderCache(); - - $contents = $this->view->replaceNamespace( - 'mail', $this->textComponentPaths() - )->make($view, $data)->render(); - - return new HtmlString( - html_entity_decode(preg_replace("/[\r\n]{2,}/", "\n\n", $contents), ENT_QUOTES, 'UTF-8') - ); - } - - /** - * Parse the given Markdown text into HTML. - * - * @param string $text - * @return \Illuminate\Support\HtmlString - */ - public static function parse($text) - { - $environment = new Environment([ - 'allow_unsafe_links' => false, - ]); - - $environment->addExtension(new CommonMarkCoreExtension); - $environment->addExtension(new TableExtension); - - $converter = new MarkdownConverter($environment); - - return new HtmlString($converter->convert($text)->getContent()); - } - - /** - * Get the HTML component paths. - * - * @return array - */ - public function htmlComponentPaths() - { - return array_map(function ($path) { - return $path.'/html'; - }, $this->componentPaths()); - } - - /** - * Get the text component paths. - * - * @return array - */ - public function textComponentPaths() - { - return array_map(function ($path) { - return $path.'/text'; - }, $this->componentPaths()); - } - - /** - * Get the component paths. - * - * @return array - */ - protected function componentPaths() - { - return array_unique(array_merge($this->componentPaths, [ - __DIR__.'/resources/views', - ])); - } - - /** - * Register new mail component paths. - * - * @param array $paths - * @return void - */ - public function loadComponentsFrom(array $paths = []) - { - $this->componentPaths = $paths; - } - - /** - * Set the default theme to be used. - * - * @param string $theme - * @return $this - */ - public function theme($theme) - { - $this->theme = $theme; - - return $this; - } - - /** - * Get the theme currently being used by the renderer. - * - * @return string - */ - public function getTheme() - { - return $this->theme; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Message.php b/framework-9.50.2/src/Illuminate/Mail/Message.php deleted file mode 100755 index 88e83ee..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Message.php +++ /dev/null @@ -1,402 +0,0 @@ -message = $message; - } - - /** - * Add a "from" address to the message. - * - * @param string|array $address - * @param string|null $name - * @return $this - */ - public function from($address, $name = null) - { - is_array($address) - ? $this->message->from(...$address) - : $this->message->from(new Address($address, (string) $name)); - - return $this; - } - - /** - * Set the "sender" of the message. - * - * @param string|array $address - * @param string|null $name - * @return $this - */ - public function sender($address, $name = null) - { - is_array($address) - ? $this->message->sender(...$address) - : $this->message->sender(new Address($address, (string) $name)); - - return $this; - } - - /** - * Set the "return path" of the message. - * - * @param string $address - * @return $this - */ - public function returnPath($address) - { - $this->message->returnPath($address); - - return $this; - } - - /** - * Add a recipient to the message. - * - * @param string|array $address - * @param string|null $name - * @param bool $override - * @return $this - */ - public function to($address, $name = null, $override = false) - { - if ($override) { - is_array($address) - ? $this->message->to(...$address) - : $this->message->to(new Address($address, (string) $name)); - - return $this; - } - - return $this->addAddresses($address, $name, 'To'); - } - - /** - * Remove all "to" addresses from the message. - * - * @return $this - */ - public function forgetTo() - { - if ($header = $this->message->getHeaders()->get('To')) { - $this->addAddressDebugHeader('X-To', $this->message->getTo()); - - $header->setAddresses([]); - } - - return $this; - } - - /** - * Add a carbon copy to the message. - * - * @param string|array $address - * @param string|null $name - * @param bool $override - * @return $this - */ - public function cc($address, $name = null, $override = false) - { - if ($override) { - is_array($address) - ? $this->message->cc(...$address) - : $this->message->cc(new Address($address, (string) $name)); - - return $this; - } - - return $this->addAddresses($address, $name, 'Cc'); - } - - /** - * Remove all carbon copy addresses from the message. - * - * @return $this - */ - public function forgetCc() - { - if ($header = $this->message->getHeaders()->get('Cc')) { - $this->addAddressDebugHeader('X-Cc', $this->message->getCC()); - - $header->setAddresses([]); - } - - return $this; - } - - /** - * Add a blind carbon copy to the message. - * - * @param string|array $address - * @param string|null $name - * @param bool $override - * @return $this - */ - public function bcc($address, $name = null, $override = false) - { - if ($override) { - is_array($address) - ? $this->message->bcc(...$address) - : $this->message->bcc(new Address($address, (string) $name)); - - return $this; - } - - return $this->addAddresses($address, $name, 'Bcc'); - } - - /** - * Remove all of the blind carbon copy addresses from the message. - * - * @return $this - */ - public function forgetBcc() - { - if ($header = $this->message->getHeaders()->get('Bcc')) { - $this->addAddressDebugHeader('X-Bcc', $this->message->getBcc()); - - $header->setAddresses([]); - } - - return $this; - } - - /** - * Add a "reply to" address to the message. - * - * @param string|array $address - * @param string|null $name - * @return $this - */ - public function replyTo($address, $name = null) - { - return $this->addAddresses($address, $name, 'ReplyTo'); - } - - /** - * Add a recipient to the message. - * - * @param string|array $address - * @param string $name - * @param string $type - * @return $this - */ - protected function addAddresses($address, $name, $type) - { - if (is_array($address)) { - $type = lcfirst($type); - - $addresses = collect($address)->map(function ($address, $key) { - if (is_string($key) && is_string($address)) { - return new Address($key, $address); - } - - if (is_array($address)) { - return new Address($address['email'] ?? $address['address'], $address['name'] ?? null); - } - - if (is_null($address)) { - return new Address($key); - } - - return $address; - })->all(); - - $this->message->{"{$type}"}(...$addresses); - } else { - $this->message->{"add{$type}"}(new Address($address, (string) $name)); - } - - return $this; - } - - /** - * Add an address debug header for a list of recipients. - * - * @param string $header - * @param \Symfony\Component\Mime\Address[] $addresses - * @return $this - */ - protected function addAddressDebugHeader(string $header, array $addresses) - { - $this->message->getHeaders()->addTextHeader( - $header, - implode(', ', array_map(fn ($a) => $a->toString(), $addresses)), - ); - - return $this; - } - - /** - * Set the subject of the message. - * - * @param string $subject - * @return $this - */ - public function subject($subject) - { - $this->message->subject($subject); - - return $this; - } - - /** - * Set the message priority level. - * - * @param int $level - * @return $this - */ - public function priority($level) - { - $this->message->priority($level); - - return $this; - } - - /** - * Attach a file to the message. - * - * @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file - * @param array $options - * @return $this - */ - public function attach($file, array $options = []) - { - if ($file instanceof Attachable) { - $file = $file->toMailAttachment(); - } - - if ($file instanceof Attachment) { - return $file->attachTo($this); - } - - $this->message->attachFromPath($file, $options['as'] ?? null, $options['mime'] ?? null); - - return $this; - } - - /** - * Attach in-memory data as an attachment. - * - * @param string $data - * @param string $name - * @param array $options - * @return $this - */ - public function attachData($data, $name, array $options = []) - { - $this->message->attach($data, $name, $options['mime'] ?? null); - - return $this; - } - - /** - * Embed a file in the message and get the CID. - * - * @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file - * @return string - */ - public function embed($file) - { - if ($file instanceof Attachable) { - $file = $file->toMailAttachment(); - } - - if ($file instanceof Attachment) { - return $file->attachWith( - function ($path) use ($file) { - $cid = $file->as ?? Str::random(); - - $this->message->embedFromPath($path, $cid, $file->mime); - - return "cid:{$cid}"; - }, - function ($data) use ($file) { - $this->message->embed($data(), $file->as, $file->mime); - - return "cid:{$file->as}"; - } - ); - } - - $cid = Str::random(10); - - $this->message->embedFromPath($file, $cid); - - return "cid:$cid"; - } - - /** - * Embed in-memory data in the message and get the CID. - * - * @param string $data - * @param string $name - * @param string|null $contentType - * @return string - */ - public function embedData($data, $name, $contentType = null) - { - $this->message->embed($data, $name, $contentType); - - return "cid:$name"; - } - - /** - * Get the underlying Symfony Email instance. - * - * @return \Symfony\Component\Mime\Email - */ - public function getSymfonyMessage() - { - return $this->message; - } - - /** - * Dynamically pass missing methods to the Symfony instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->forwardDecoratedCallTo($this->message, $method, $parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/PendingMail.php b/framework-9.50.2/src/Illuminate/Mail/PendingMail.php deleted file mode 100644 index 330b643..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/PendingMail.php +++ /dev/null @@ -1,166 +0,0 @@ -mailer = $mailer; - } - - /** - * Set the locale of the message. - * - * @param string $locale - * @return $this - */ - public function locale($locale) - { - $this->locale = $locale; - - return $this; - } - - /** - * Set the recipients of the message. - * - * @param mixed $users - * @return $this - */ - public function to($users) - { - $this->to = $users; - - if (! $this->locale && $users instanceof HasLocalePreference) { - $this->locale($users->preferredLocale()); - } - - return $this; - } - - /** - * Set the recipients of the message. - * - * @param mixed $users - * @return $this - */ - public function cc($users) - { - $this->cc = $users; - - return $this; - } - - /** - * Set the recipients of the message. - * - * @param mixed $users - * @return $this - */ - public function bcc($users) - { - $this->bcc = $users; - - return $this; - } - - /** - * Send a new mailable message instance. - * - * @param \Illuminate\Contracts\Mail\Mailable $mailable - * @return \Illuminate\Mail\SentMessage|null - */ - public function send(MailableContract $mailable) - { - return $this->mailer->send($this->fill($mailable)); - } - - /** - * Push the given mailable onto the queue. - * - * @param \Illuminate\Contracts\Mail\Mailable $mailable - * @return mixed - */ - public function queue(MailableContract $mailable) - { - return $this->mailer->queue($this->fill($mailable)); - } - - /** - * Deliver the queued message after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param \Illuminate\Contracts\Mail\Mailable $mailable - * @return mixed - */ - public function later($delay, MailableContract $mailable) - { - return $this->mailer->later($delay, $this->fill($mailable)); - } - - /** - * Populate the mailable with the addresses. - * - * @param \Illuminate\Contracts\Mail\Mailable $mailable - * @return \Illuminate\Mail\Mailable - */ - protected function fill(MailableContract $mailable) - { - return tap($mailable->to($this->to) - ->cc($this->cc) - ->bcc($this->bcc), function (MailableContract $mailable) { - if ($this->locale) { - $mailable->locale($this->locale); - } - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/SendQueuedMailable.php b/framework-9.50.2/src/Illuminate/Mail/SendQueuedMailable.php deleted file mode 100644 index 7f20232..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/SendQueuedMailable.php +++ /dev/null @@ -1,137 +0,0 @@ -mailable = $mailable; - $this->tries = property_exists($mailable, 'tries') ? $mailable->tries : null; - $this->timeout = property_exists($mailable, 'timeout') ? $mailable->timeout : null; - $this->maxExceptions = property_exists($mailable, 'maxExceptions') ? $mailable->maxExceptions : null; - $this->afterCommit = property_exists($mailable, 'afterCommit') ? $mailable->afterCommit : null; - $this->shouldBeEncrypted = $mailable instanceof ShouldBeEncrypted; - } - - /** - * Handle the queued job. - * - * @param \Illuminate\Contracts\Mail\Factory $factory - * @return void - */ - public function handle(MailFactory $factory) - { - $this->mailable->send($factory); - } - - /** - * Get the number of seconds before a released mailable will be available. - * - * @return mixed - */ - public function backoff() - { - if (! method_exists($this->mailable, 'backoff') && ! isset($this->mailable->backoff)) { - return; - } - - return $this->mailable->backoff ?? $this->mailable->backoff(); - } - - /** - * Determine the time at which the job should timeout. - * - * @return \DateTime|null - */ - public function retryUntil() - { - if (! method_exists($this->mailable, 'retryUntil') && ! isset($this->mailable->retryUntil)) { - return; - } - - return $this->mailable->retryUntil ?? $this->mailable->retryUntil(); - } - - /** - * Call the failed method on the mailable instance. - * - * @param \Throwable $e - * @return void - */ - public function failed($e) - { - if (method_exists($this->mailable, 'failed')) { - $this->mailable->failed($e); - } - } - - /** - * Get the display name for the queued job. - * - * @return string - */ - public function displayName() - { - return get_class($this->mailable); - } - - /** - * Prepare the instance for cloning. - * - * @return void - */ - public function __clone() - { - $this->mailable = clone $this->mailable; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/SentMessage.php b/framework-9.50.2/src/Illuminate/Mail/SentMessage.php deleted file mode 100644 index cce42db..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/SentMessage.php +++ /dev/null @@ -1,54 +0,0 @@ -sentMessage = $sentMessage; - } - - /** - * Get the underlying Symfony Email instance. - * - * @return \Symfony\Component\Mailer\SentMessage - */ - public function getSymfonySentMessage() - { - return $this->sentMessage; - } - - /** - * Dynamically pass missing methods to the Symfony instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->forwardCallTo($this->sentMessage, $method, $parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Transport/ArrayTransport.php b/framework-9.50.2/src/Illuminate/Mail/Transport/ArrayTransport.php deleted file mode 100644 index dc26ed6..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Transport/ArrayTransport.php +++ /dev/null @@ -1,67 +0,0 @@ -messages = new Collection; - } - - /** - * {@inheritdoc} - */ - public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage - { - return $this->messages[] = new SentMessage($message, $envelope ?? Envelope::create($message)); - } - - /** - * Retrieve the collection of messages. - * - * @return \Illuminate\Support\Collection - */ - public function messages() - { - return $this->messages; - } - - /** - * Clear all of the messages from the local collection. - * - * @return \Illuminate\Support\Collection - */ - public function flush() - { - return $this->messages = new Collection; - } - - /** - * Get the string representation of the transport. - * - * @return string - */ - public function __toString(): string - { - return 'array'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Transport/LogTransport.php b/framework-9.50.2/src/Illuminate/Mail/Transport/LogTransport.php deleted file mode 100644 index d9ec8ac..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Transport/LogTransport.php +++ /dev/null @@ -1,60 +0,0 @@ -logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage - { - $this->logger->debug($message->toString()); - - return new SentMessage($message, $envelope ?? Envelope::create($message)); - } - - /** - * Get the logger for the LogTransport instance. - * - * @return \Psr\Log\LoggerInterface - */ - public function logger() - { - return $this->logger; - } - - /** - * Get the string representation of the transport. - * - * @return string - */ - public function __toString(): string - { - return 'log'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/Transport/SesTransport.php b/framework-9.50.2/src/Illuminate/Mail/Transport/SesTransport.php deleted file mode 100644 index d6a64da..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/Transport/SesTransport.php +++ /dev/null @@ -1,131 +0,0 @@ -ses = $ses; - $this->options = $options; - - parent::__construct(); - } - - /** - * {@inheritDoc} - */ - protected function doSend(SentMessage $message): void - { - $options = $this->options; - - if ($message->getOriginalMessage() instanceof Message) { - foreach ($message->getOriginalMessage()->getHeaders()->all() as $header) { - if ($header instanceof MetadataHeader) { - $options['Tags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()]; - } - } - } - - try { - $result = $this->ses->sendRawEmail( - array_merge( - $options, [ - 'Source' => $message->getEnvelope()->getSender()->toString(), - 'Destinations' => collect($message->getEnvelope()->getRecipients()) - ->map - ->toString() - ->values() - ->all(), - 'RawMessage' => [ - 'Data' => $message->toString(), - ], - ] - ) - ); - } catch (AwsException $e) { - $reason = $e->getAwsErrorMessage() ?? $e->getMessage(); - - throw new Exception( - sprintf('Request to AWS SES API failed. Reason: %s.', $reason), - is_int($e->getCode()) ? $e->getCode() : 0, - $e - ); - } - - $messageId = $result->get('MessageId'); - - $message->getOriginalMessage()->getHeaders()->addHeader('X-Message-ID', $messageId); - $message->getOriginalMessage()->getHeaders()->addHeader('X-SES-Message-ID', $messageId); - } - - /** - * Get the string representation of the transport. - * - * @return string - */ - public function __toString(): string - { - return 'ses'; - } - - /** - * Get the Amazon SES client for the SesTransport instance. - * - * @return \Aws\Ses\SesClient - */ - public function ses() - { - return $this->ses; - } - - /** - * Get the transmission options being used by the transport. - * - * @return array - */ - public function getOptions() - { - return $this->options; - } - - /** - * Set the transmission options being used by the transport. - * - * @param array $options - * @return array - */ - public function setOptions(array $options) - { - return $this->options = $options; - } -} diff --git a/framework-9.50.2/src/Illuminate/Mail/composer.json b/framework-9.50.2/src/Illuminate/Mail/composer.json deleted file mode 100755 index 20fda04..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/composer.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "illuminate/mail", - "description": "The Illuminate Mail package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "illuminate/collections": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0", - "league/commonmark": "^2.2", - "psr/log": "^1.0|^2.0|^3.0", - "symfony/mailer": "^6.0", - "tijsverkoyen/css-to-inline-styles": "^2.2.5" - }, - "autoload": { - "psr-4": { - "Illuminate\\Mail\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "aws/aws-sdk-php": "Required to use the SES mail driver (^3.235.5).", - "symfony/http-client": "Required to use the Symfony API mail transports (^6.0).", - "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).", - "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/button.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/button.blade.php deleted file mode 100644 index 4a9bf7d..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/button.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -@props([ - 'url', - 'color' => 'primary', - 'align' => 'center', -]) - - - - - diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/footer.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/footer.blade.php deleted file mode 100644 index 3ff41f8..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/footer.blade.php +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/header.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/header.blade.php deleted file mode 100644 index 56197f8..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/header.blade.php +++ /dev/null @@ -1,12 +0,0 @@ -@props(['url']) - - - -@if (trim($slot) === 'Laravel') - -@else -{{ $slot }} -@endif - - - diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/layout.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/layout.blade.php deleted file mode 100644 index e55f6a6..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/layout.blade.php +++ /dev/null @@ -1,57 +0,0 @@ - - - -{{ config('app.name') }} - - - - - - - - - - - - - - - diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/message.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/message.blade.php deleted file mode 100644 index f272460..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/message.blade.php +++ /dev/null @@ -1,27 +0,0 @@ - -{{-- Header --}} - - -{{ config('app.name') }} - - - -{{-- Body --}} -{{ $slot }} - -{{-- Subcopy --}} -@isset($subcopy) - - -{{ $subcopy }} - - -@endisset - -{{-- Footer --}} - - -© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') - - - diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/panel.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/panel.blade.php deleted file mode 100644 index 2975a60..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/panel.blade.php +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/subcopy.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/subcopy.blade.php deleted file mode 100644 index 790ce6c..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/subcopy.blade.php +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/table.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/table.blade.php deleted file mode 100644 index a5f3348..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/table.blade.php +++ /dev/null @@ -1,3 +0,0 @@ -
-{{ Illuminate\Mail\Markdown::parse($slot) }} -
diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/themes/default.css b/framework-9.50.2/src/Illuminate/Mail/resources/views/html/themes/default.css deleted file mode 100644 index 2483b11..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/html/themes/default.css +++ /dev/null @@ -1,290 +0,0 @@ -/* Base */ - -body, -body *:not(html):not(style):not(br):not(tr):not(code) { - box-sizing: border-box; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, - 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; - position: relative; -} - -body { - -webkit-text-size-adjust: none; - background-color: #ffffff; - color: #718096; - height: 100%; - line-height: 1.4; - margin: 0; - padding: 0; - width: 100% !important; -} - -p, -ul, -ol, -blockquote { - line-height: 1.4; - text-align: left; -} - -a { - color: #3869d4; -} - -a img { - border: none; -} - -/* Typography */ - -h1 { - color: #3d4852; - font-size: 18px; - font-weight: bold; - margin-top: 0; - text-align: left; -} - -h2 { - font-size: 16px; - font-weight: bold; - margin-top: 0; - text-align: left; -} - -h3 { - font-size: 14px; - font-weight: bold; - margin-top: 0; - text-align: left; -} - -p { - font-size: 16px; - line-height: 1.5em; - margin-top: 0; - text-align: left; -} - -p.sub { - font-size: 12px; -} - -img { - max-width: 100%; -} - -/* Layout */ - -.wrapper { - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; - background-color: #edf2f7; - margin: 0; - padding: 0; - width: 100%; -} - -.content { - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; - margin: 0; - padding: 0; - width: 100%; -} - -/* Header */ - -.header { - padding: 25px 0; - text-align: center; -} - -.header a { - color: #3d4852; - font-size: 19px; - font-weight: bold; - text-decoration: none; -} - -/* Logo */ - -.logo { - height: 75px; - max-height: 75px; - width: 75px; -} - -/* Body */ - -.body { - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; - background-color: #edf2f7; - border-bottom: 1px solid #edf2f7; - border-top: 1px solid #edf2f7; - margin: 0; - padding: 0; - width: 100%; -} - -.inner-body { - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 570px; - background-color: #ffffff; - border-color: #e8e5ef; - border-radius: 2px; - border-width: 1px; - box-shadow: 0 2px 0 rgba(0, 0, 150, 0.025), 2px 4px 0 rgba(0, 0, 150, 0.015); - margin: 0 auto; - padding: 0; - width: 570px; -} - -/* Subcopy */ - -.subcopy { - border-top: 1px solid #e8e5ef; - margin-top: 25px; - padding-top: 25px; -} - -.subcopy p { - font-size: 14px; -} - -/* Footer */ - -.footer { - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 570px; - margin: 0 auto; - padding: 0; - text-align: center; - width: 570px; -} - -.footer p { - color: #b0adc5; - font-size: 12px; - text-align: center; -} - -.footer a { - color: #b0adc5; - text-decoration: underline; -} - -/* Tables */ - -.table table { - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; - margin: 30px auto; - width: 100%; -} - -.table th { - border-bottom: 1px solid #edeff2; - margin: 0; - padding-bottom: 8px; -} - -.table td { - color: #74787e; - font-size: 15px; - line-height: 18px; - margin: 0; - padding: 10px 0; -} - -.content-cell { - max-width: 100vw; - padding: 32px; -} - -/* Buttons */ - -.action { - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; - margin: 30px auto; - padding: 0; - text-align: center; - width: 100%; -} - -.button { - -webkit-text-size-adjust: none; - border-radius: 4px; - color: #fff; - display: inline-block; - overflow: hidden; - text-decoration: none; -} - -.button-blue, -.button-primary { - background-color: #2d3748; - border-bottom: 8px solid #2d3748; - border-left: 18px solid #2d3748; - border-right: 18px solid #2d3748; - border-top: 8px solid #2d3748; -} - -.button-green, -.button-success { - background-color: #48bb78; - border-bottom: 8px solid #48bb78; - border-left: 18px solid #48bb78; - border-right: 18px solid #48bb78; - border-top: 8px solid #48bb78; -} - -.button-red, -.button-error { - background-color: #e53e3e; - border-bottom: 8px solid #e53e3e; - border-left: 18px solid #e53e3e; - border-right: 18px solid #e53e3e; - border-top: 8px solid #e53e3e; -} - -/* Panels */ - -.panel { - border-left: #2d3748 solid 4px; - margin: 21px 0; -} - -.panel-content { - background-color: #edf2f7; - color: #718096; - padding: 16px; -} - -.panel-content p { - color: #718096; -} - -.panel-item { - padding: 0; -} - -.panel-item p:last-of-type { - margin-bottom: 0; - padding-bottom: 0; -} - -/* Utilities */ - -.break-all { - word-break: break-all; -} diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/button.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/text/button.blade.php deleted file mode 100644 index 97444eb..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/button.blade.php +++ /dev/null @@ -1 +0,0 @@ -{{ $slot }}: {{ $url }} diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/footer.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/text/footer.blade.php deleted file mode 100644 index 3338f62..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/footer.blade.php +++ /dev/null @@ -1 +0,0 @@ -{{ $slot }} diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/header.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/text/header.blade.php deleted file mode 100644 index aaa3e57..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/header.blade.php +++ /dev/null @@ -1 +0,0 @@ -[{{ $slot }}]({{ $url }}) diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/layout.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/text/layout.blade.php deleted file mode 100644 index 9378baa..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/layout.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -{!! strip_tags($header) !!} - -{!! strip_tags($slot) !!} -@isset($subcopy) - -{!! strip_tags($subcopy) !!} -@endisset - -{!! strip_tags($footer) !!} diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/message.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/text/message.blade.php deleted file mode 100644 index 80bce21..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/message.blade.php +++ /dev/null @@ -1,27 +0,0 @@ - - {{-- Header --}} - - - {{ config('app.name') }} - - - - {{-- Body --}} - {{ $slot }} - - {{-- Subcopy --}} - @isset($subcopy) - - - {{ $subcopy }} - - - @endisset - - {{-- Footer --}} - - - © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') - - - diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/panel.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/text/panel.blade.php deleted file mode 100644 index 3338f62..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/panel.blade.php +++ /dev/null @@ -1 +0,0 @@ -{{ $slot }} diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/subcopy.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/text/subcopy.blade.php deleted file mode 100644 index 3338f62..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/subcopy.blade.php +++ /dev/null @@ -1 +0,0 @@ -{{ $slot }} diff --git a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/table.blade.php b/framework-9.50.2/src/Illuminate/Mail/resources/views/text/table.blade.php deleted file mode 100644 index 3338f62..0000000 --- a/framework-9.50.2/src/Illuminate/Mail/resources/views/text/table.blade.php +++ /dev/null @@ -1 +0,0 @@ -{{ $slot }} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Action.php b/framework-9.50.2/src/Illuminate/Notifications/Action.php deleted file mode 100644 index 071db2d..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Action.php +++ /dev/null @@ -1,33 +0,0 @@ -url = $url; - $this->text = $text; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/AnonymousNotifiable.php b/framework-9.50.2/src/Illuminate/Notifications/AnonymousNotifiable.php deleted file mode 100644 index aa4d7bb..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/AnonymousNotifiable.php +++ /dev/null @@ -1,79 +0,0 @@ -routes[$channel] = $route; - - return $this; - } - - /** - * Send the given notification. - * - * @param mixed $notification - * @return void - */ - public function notify($notification) - { - app(Dispatcher::class)->send($this, $notification); - } - - /** - * Send the given notification immediately. - * - * @param mixed $notification - * @return void - */ - public function notifyNow($notification) - { - app(Dispatcher::class)->sendNow($this, $notification); - } - - /** - * Get the notification routing information for the given driver. - * - * @param string $driver - * @return mixed - */ - public function routeNotificationFor($driver) - { - return $this->routes[$driver] ?? null; - } - - /** - * Get the value of the notifiable's primary key. - * - * @return mixed - */ - public function getKey() - { - // - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/ChannelManager.php b/framework-9.50.2/src/Illuminate/Notifications/ChannelManager.php deleted file mode 100644 index 8eb9c25..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/ChannelManager.php +++ /dev/null @@ -1,162 +0,0 @@ -container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale) - )->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) - { - (new NotificationSender( - $this, $this->container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale) - )->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->container->make(Channels\DatabaseChannel::class); - } - - /** - * Create an instance of the broadcast driver. - * - * @return \Illuminate\Notifications\Channels\BroadcastChannel - */ - protected function createBroadcastDriver() - { - return $this->container->make(Channels\BroadcastChannel::class); - } - - /** - * Create an instance of the mail driver. - * - * @return \Illuminate\Notifications\Channels\MailChannel - */ - protected function createMailDriver() - { - return $this->container->make(Channels\MailChannel::class); - } - - /** - * 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->container->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; - } - - /** - * Set the locale of notifications. - * - * @param string $locale - * @return $this - */ - public function locale($locale) - { - $this->locale = $locale; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Channels/BroadcastChannel.php b/framework-9.50.2/src/Illuminate/Notifications/Channels/BroadcastChannel.php deleted file mode 100644 index 1389f49..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Channels/BroadcastChannel.php +++ /dev/null @@ -1,75 +0,0 @@ -events = $events; - } - - /** - * Send the given notification. - * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @return array|null - */ - public function send($notifiable, Notification $notification) - { - $message = $this->getData($notifiable, $notification); - - $event = new BroadcastNotificationCreated( - $notifiable, $notification, is_array($message) ? $message : $message->data - ); - - if ($message instanceof BroadcastMessage) { - $event->onConnection($message->connection) - ->onQueue($message->queue); - } - - return $this->events->dispatch($event); - } - - /** - * Get the data for the notification. - * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @return mixed - * - * @throws \RuntimeException - */ - protected function getData($notifiable, Notification $notification) - { - if (method_exists($notification, 'toBroadcast')) { - return $notification->toBroadcast($notifiable); - } - - if (method_exists($notification, 'toArray')) { - return $notification->toArray($notifiable); - } - - throw new RuntimeException('Notification is missing toArray method.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Channels/DatabaseChannel.php b/framework-9.50.2/src/Illuminate/Notifications/Channels/DatabaseChannel.php deleted file mode 100644 index 8b3167b..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Channels/DatabaseChannel.php +++ /dev/null @@ -1,65 +0,0 @@ -routeNotificationFor('database', $notification)->create( - $this->buildPayload($notifiable, $notification) - ); - } - - /** - * Build an array payload for the DatabaseNotification Model. - * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @return array - */ - protected function buildPayload($notifiable, Notification $notification) - { - return [ - 'id' => $notification->id, - 'type' => method_exists($notification, 'databaseType') - ? $notification->databaseType($notifiable) - : get_class($notification), - 'data' => $this->getData($notifiable, $notification), - 'read_at' => null, - ]; - } - - /** - * Get the data for the notification. - * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @return array - * - * @throws \RuntimeException - */ - protected function getData($notifiable, Notification $notification) - { - if (method_exists($notification, 'toDatabase')) { - return is_array($data = $notification->toDatabase($notifiable)) - ? $data : $data->data; - } - - if (method_exists($notification, 'toArray')) { - return $notification->toArray($notifiable); - } - - throw new RuntimeException('Notification is missing toDatabase / toArray method.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Channels/MailChannel.php b/framework-9.50.2/src/Illuminate/Notifications/Channels/MailChannel.php deleted file mode 100644 index fd3a3cc..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Channels/MailChannel.php +++ /dev/null @@ -1,266 +0,0 @@ -mailer = $mailer; - $this->markdown = $markdown; - } - - /** - * Send the given notification. - * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @return void - */ - public function send($notifiable, Notification $notification) - { - $message = $notification->toMail($notifiable); - - if (! $notifiable->routeNotificationFor('mail', $notification) && - ! $message instanceof Mailable) { - return; - } - - if ($message instanceof Mailable) { - return $message->send($this->mailer); - } - - $this->mailer->mailer($message->mailer ?? null)->send( - $this->buildView($message), - array_merge($message->data(), $this->additionalMessageData($notification)), - $this->messageBuilder($notifiable, $notification, $message) - ); - } - - /** - * Get the mailer Closure for the message. - * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @param \Illuminate\Notifications\Messages\MailMessage $message - * @return \Closure - */ - protected function messageBuilder($notifiable, $notification, $message) - { - return function ($mailMessage) use ($notifiable, $notification, $message) { - $this->buildMessage($mailMessage, $notifiable, $notification, $message); - }; - } - - /** - * Build the notification's view. - * - * @param \Illuminate\Notifications\Messages\MailMessage $message - * @return string|array - */ - protected function buildView($message) - { - if ($message->view) { - return $message->view; - } - - if (property_exists($message, 'theme') && ! is_null($message->theme)) { - $this->markdown->theme($message->theme); - } - - return [ - 'html' => $this->markdown->render($message->markdown, $message->data()), - 'text' => $this->markdown->renderText($message->markdown, $message->data()), - ]; - } - - /** - * Get additional meta-data to pass along with the view data. - * - * @param \Illuminate\Notifications\Notification $notification - * @return array - */ - protected function additionalMessageData($notification) - { - return [ - '__laravel_notification_id' => $notification->id, - '__laravel_notification' => get_class($notification), - '__laravel_notification_queued' => in_array( - ShouldQueue::class, - class_implements($notification) - ), - ]; - } - - /** - * Build the mail message. - * - * @param \Illuminate\Mail\Message $mailMessage - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @param \Illuminate\Notifications\Messages\MailMessage $message - * @return void - */ - protected function buildMessage($mailMessage, $notifiable, $notification, $message) - { - $this->addressMessage($mailMessage, $notifiable, $notification, $message); - - $mailMessage->subject($message->subject ?: Str::title( - Str::snake(class_basename($notification), ' ') - )); - - $this->addAttachments($mailMessage, $message); - - if (! is_null($message->priority)) { - $mailMessage->priority($message->priority); - } - - if ($message->tags) { - foreach ($message->tags as $tag) { - $mailMessage->getHeaders()->add(new TagHeader($tag)); - } - } - - if ($message->metadata) { - foreach ($message->metadata as $key => $value) { - $mailMessage->getHeaders()->add(new MetadataHeader($key, $value)); - } - } - - $this->runCallbacks($mailMessage, $message); - } - - /** - * Address the mail message. - * - * @param \Illuminate\Mail\Message $mailMessage - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @param \Illuminate\Notifications\Messages\MailMessage $message - * @return void - */ - protected function addressMessage($mailMessage, $notifiable, $notification, $message) - { - $this->addSender($mailMessage, $message); - - $mailMessage->to($this->getRecipients($notifiable, $notification, $message)); - - if (! empty($message->cc)) { - foreach ($message->cc as $cc) { - $mailMessage->cc($cc[0], Arr::get($cc, 1)); - } - } - - if (! empty($message->bcc)) { - foreach ($message->bcc as $bcc) { - $mailMessage->bcc($bcc[0], Arr::get($bcc, 1)); - } - } - } - - /** - * Add the "from" and "reply to" addresses to the message. - * - * @param \Illuminate\Mail\Message $mailMessage - * @param \Illuminate\Notifications\Messages\MailMessage $message - * @return void - */ - protected function addSender($mailMessage, $message) - { - if (! empty($message->from)) { - $mailMessage->from($message->from[0], Arr::get($message->from, 1)); - } - - if (! empty($message->replyTo)) { - foreach ($message->replyTo as $replyTo) { - $mailMessage->replyTo($replyTo[0], Arr::get($replyTo, 1)); - } - } - } - - /** - * Get the recipients of the given message. - * - * @param mixed $notifiable - * @param \Illuminate\Notifications\Notification $notification - * @param \Illuminate\Notifications\Messages\MailMessage $message - * @return mixed - */ - protected function getRecipients($notifiable, $notification, $message) - { - if (is_string($recipients = $notifiable->routeNotificationFor('mail', $notification))) { - $recipients = [$recipients]; - } - - return collect($recipients)->mapWithKeys(function ($recipient, $email) { - return is_numeric($email) - ? [$email => (is_string($recipient) ? $recipient : $recipient->email)] - : [$email => $recipient]; - })->all(); - } - - /** - * Add the attachments to the message. - * - * @param \Illuminate\Mail\Message $mailMessage - * @param \Illuminate\Notifications\Messages\MailMessage $message - * @return void - */ - protected function addAttachments($mailMessage, $message) - { - foreach ($message->attachments as $attachment) { - $mailMessage->attach($attachment['file'], $attachment['options']); - } - - foreach ($message->rawAttachments as $attachment) { - $mailMessage->attachData($attachment['data'], $attachment['name'], $attachment['options']); - } - } - - /** - * Run the callbacks for the message. - * - * @param \Illuminate\Mail\Message $mailMessage - * @param \Illuminate\Notifications\Messages\MailMessage $message - * @return $this - */ - protected function runCallbacks($mailMessage, $message) - { - foreach ($message->callbacks as $callback) { - $callback($mailMessage->getSymfonyMessage()); - } - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Console/NotificationTableCommand.php b/framework-9.50.2/src/Illuminate/Notifications/Console/NotificationTableCommand.php deleted file mode 100644 index a0161ce..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Console/NotificationTableCommand.php +++ /dev/null @@ -1,94 +0,0 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $fullPath = $this->createBaseMigration(); - - $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/notifications.stub')); - - $this->components->info('Migration created successfully.'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the notifications. - * - * @return string - */ - protected function createBaseMigration() - { - $name = 'create_notifications_table'; - - $path = $this->laravel->databasePath().'/migrations'; - - return $this->laravel['migration.creator']->create($name, $path); - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Console/stubs/notifications.stub b/framework-9.50.2/src/Illuminate/Notifications/Console/stubs/notifications.stub deleted file mode 100644 index 4357c9e..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Console/stubs/notifications.stub +++ /dev/null @@ -1,35 +0,0 @@ -uuid('id')->primary(); - $table->string('type'); - $table->morphs('notifiable'); - $table->text('data'); - $table->timestamp('read_at')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('notifications'); - } -}; diff --git a/framework-9.50.2/src/Illuminate/Notifications/DatabaseNotification.php b/framework-9.50.2/src/Illuminate/Notifications/DatabaseNotification.php deleted file mode 100644 index 14bc9d6..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/DatabaseNotification.php +++ /dev/null @@ -1,134 +0,0 @@ - 'array', - 'read_at' => 'datetime', - ]; - - /** - * Get the notifiable entity that the notification belongs to. - * - * @return \Illuminate\Database\Eloquent\Relations\MorphTo - */ - public function notifiable() - { - return $this->morphTo(); - } - - /** - * Mark the notification as read. - * - * @return void - */ - public function markAsRead() - { - if (is_null($this->read_at)) { - $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); - } - } - - /** - * Mark the notification as unread. - * - * @return void - */ - public function markAsUnread() - { - if (! is_null($this->read_at)) { - $this->forceFill(['read_at' => null])->save(); - } - } - - /** - * Determine if a notification has been read. - * - * @return bool - */ - public function read() - { - return $this->read_at !== null; - } - - /** - * Determine if a notification has not been read. - * - * @return bool - */ - public function unread() - { - return $this->read_at === null; - } - - /** - * Scope a query to only include read notifications. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - public function scopeRead(Builder $query) - { - return $query->whereNotNull('read_at'); - } - - /** - * Scope a query to only include unread notifications. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder - */ - public function scopeUnread(Builder $query) - { - return $query->whereNull('read_at'); - } - - /** - * Create a new database notification collection instance. - * - * @param array $models - * @return \Illuminate\Notifications\DatabaseNotificationCollection - */ - public function newCollection(array $models = []) - { - return new DatabaseNotificationCollection($models); - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/DatabaseNotificationCollection.php b/framework-9.50.2/src/Illuminate/Notifications/DatabaseNotificationCollection.php deleted file mode 100644 index 05924ec..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/DatabaseNotificationCollection.php +++ /dev/null @@ -1,28 +0,0 @@ -each->markAsRead(); - } - - /** - * Mark all notifications as unread. - * - * @return void - */ - public function markAsUnread() - { - $this->each->markAsUnread(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php b/framework-9.50.2/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php deleted file mode 100644 index 3953087..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php +++ /dev/null @@ -1,123 +0,0 @@ -data = $data; - $this->notifiable = $notifiable; - $this->notification = $notification; - } - - /** - * Get the channels the event should broadcast on. - * - * @return array - */ - public function broadcastOn() - { - if ($this->notifiable instanceof AnonymousNotifiable && - $this->notifiable->routeNotificationFor('broadcast')) { - $channels = Arr::wrap($this->notifiable->routeNotificationFor('broadcast')); - } else { - $channels = $this->notification->broadcastOn(); - } - - if (! empty($channels)) { - return $channels; - } - - if (is_string($channels = $this->channelName())) { - return [new PrivateChannel($channels)]; - } - - return collect($channels)->map(function ($channel) { - return new PrivateChannel($channel); - })->all(); - } - - /** - * Get the broadcast channel name for the event. - * - * @return array|string - */ - protected function channelName() - { - if (method_exists($this->notifiable, 'receivesBroadcastNotificationsOn')) { - return $this->notifiable->receivesBroadcastNotificationsOn($this->notification); - } - - $class = str_replace('\\', '.', get_class($this->notifiable)); - - return $class.'.'.$this->notifiable->getKey(); - } - - /** - * Get the data that should be sent with the broadcasted event. - * - * @return array - */ - public function broadcastWith() - { - if (method_exists($this->notification, 'broadcastWith')) { - return $this->notification->broadcastWith(); - } - - return array_merge($this->data, [ - 'id' => $this->notification->id, - 'type' => $this->broadcastType(), - ]); - } - - /** - * Get the type of the notification being broadcast. - * - * @return string - */ - public function broadcastType() - { - return method_exists($this->notification, 'broadcastType') - ? $this->notification->broadcastType() - : get_class($this->notification); - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationFailed.php b/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationFailed.php deleted file mode 100644 index b69e1c5..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationFailed.php +++ /dev/null @@ -1,56 +0,0 @@ -data = $data; - $this->channel = $channel; - $this->notifiable = $notifiable; - $this->notification = $notification; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationSending.php b/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationSending.php deleted file mode 100644 index 6efd1d0..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationSending.php +++ /dev/null @@ -1,47 +0,0 @@ -channel = $channel; - $this->notifiable = $notifiable; - $this->notification = $notification; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationSent.php b/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationSent.php deleted file mode 100644 index 4f09069..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Events/NotificationSent.php +++ /dev/null @@ -1,56 +0,0 @@ -channel = $channel; - $this->response = $response; - $this->notifiable = $notifiable; - $this->notification = $notification; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/HasDatabaseNotifications.php b/framework-9.50.2/src/Illuminate/Notifications/HasDatabaseNotifications.php deleted file mode 100644 index 162d16c..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/HasDatabaseNotifications.php +++ /dev/null @@ -1,36 +0,0 @@ -morphMany(DatabaseNotification::class, 'notifiable')->latest(); - } - - /** - * Get the entity's read notifications. - * - * @return \Illuminate\Database\Query\Builder - */ - public function readNotifications() - { - return $this->notifications()->read(); - } - - /** - * Get the entity's unread notifications. - * - * @return \Illuminate\Database\Query\Builder - */ - public function unreadNotifications() - { - return $this->notifications()->unread(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/LICENSE.md b/framework-9.50.2/src/Illuminate/Notifications/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Notifications/Messages/BroadcastMessage.php b/framework-9.50.2/src/Illuminate/Notifications/Messages/BroadcastMessage.php deleted file mode 100644 index 9884a8f..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Messages/BroadcastMessage.php +++ /dev/null @@ -1,41 +0,0 @@ -data = $data; - } - - /** - * Set the message data. - * - * @param array $data - * @return $this - */ - public function data($data) - { - $this->data = $data; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Messages/DatabaseMessage.php b/framework-9.50.2/src/Illuminate/Notifications/Messages/DatabaseMessage.php deleted file mode 100644 index 55707a7..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Messages/DatabaseMessage.php +++ /dev/null @@ -1,24 +0,0 @@ -data = $data; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Messages/MailMessage.php b/framework-9.50.2/src/Illuminate/Notifications/Messages/MailMessage.php deleted file mode 100644 index d696c8a..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Messages/MailMessage.php +++ /dev/null @@ -1,387 +0,0 @@ -view = $view; - $this->viewData = $data; - - $this->markdown = null; - - return $this; - } - - /** - * Set the Markdown template for the notification. - * - * @param string $view - * @param array $data - * @return $this - */ - public function markdown($view, array $data = []) - { - $this->markdown = $view; - $this->viewData = $data; - - $this->view = null; - - return $this; - } - - /** - * Set the default markdown template. - * - * @param string $template - * @return $this - */ - public function template($template) - { - $this->markdown = $template; - - return $this; - } - - /** - * Set the theme to use with the Markdown template. - * - * @param string $theme - * @return $this - */ - public function theme($theme) - { - $this->theme = $theme; - - return $this; - } - - /** - * Set the from address for the mail message. - * - * @param string $address - * @param string|null $name - * @return $this - */ - public function from($address, $name = null) - { - $this->from = [$address, $name]; - - return $this; - } - - /** - * Set the "reply to" address of the message. - * - * @param array|string $address - * @param string|null $name - * @return $this - */ - public function replyTo($address, $name = null) - { - if ($this->arrayOfAddresses($address)) { - $this->replyTo += $this->parseAddresses($address); - } else { - $this->replyTo[] = [$address, $name]; - } - - return $this; - } - - /** - * Set the cc address for the mail message. - * - * @param array|string $address - * @param string|null $name - * @return $this - */ - public function cc($address, $name = null) - { - if ($this->arrayOfAddresses($address)) { - $this->cc += $this->parseAddresses($address); - } else { - $this->cc[] = [$address, $name]; - } - - return $this; - } - - /** - * Set the bcc address for the mail message. - * - * @param array|string $address - * @param string|null $name - * @return $this - */ - public function bcc($address, $name = null) - { - if ($this->arrayOfAddresses($address)) { - $this->bcc += $this->parseAddresses($address); - } else { - $this->bcc[] = [$address, $name]; - } - - return $this; - } - - /** - * Attach a file to the message. - * - * @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file - * @param array $options - * @return $this - */ - public function attach($file, array $options = []) - { - if ($file instanceof Attachable) { - $file = $file->toMailAttachment(); - } - - if ($file instanceof Attachment) { - return $file->attachTo($this); - } - - $this->attachments[] = compact('file', 'options'); - - return $this; - } - - /** - * Attach in-memory data as an attachment. - * - * @param string $data - * @param string $name - * @param array $options - * @return $this - */ - public function attachData($data, $name, array $options = []) - { - $this->rawAttachments[] = compact('data', 'name', 'options'); - - return $this; - } - - /** - * Add a tag header to the message when supported by the underlying transport. - * - * @param string $value - * @return $this - */ - public function tag($value) - { - array_push($this->tags, $value); - - return $this; - } - - /** - * Add a metadata header to the message when supported by the underlying transport. - * - * @param string $key - * @param string $value - * @return $this - */ - public function metadata($key, $value) - { - $this->metadata[$key] = $value; - - return $this; - } - - /** - * Set the priority of this message. - * - * The value is an integer where 1 is the highest priority and 5 is the lowest. - * - * @param int $level - * @return $this - */ - public function priority($level) - { - $this->priority = $level; - - return $this; - } - - /** - * Get the data array for the mail message. - * - * @return array - */ - public function data() - { - return array_merge($this->toArray(), $this->viewData); - } - - /** - * Parse the multi-address array into the necessary format. - * - * @param array $value - * @return array - */ - protected function parseAddresses($value) - { - return collect($value)->map(function ($address, $name) { - return [$address, is_numeric($name) ? null : $name]; - })->values()->all(); - } - - /** - * Determine if the given "address" is actually an array of addresses. - * - * @param mixed $address - * @return bool - */ - protected function arrayOfAddresses($address) - { - return is_iterable($address) || $address instanceof Arrayable; - } - - /** - * Render the mail notification message into an HTML string. - * - * @return \Illuminate\Support\HtmlString - */ - public function render() - { - if (isset($this->view)) { - return Container::getInstance()->make('mailer')->render( - $this->view, $this->data() - ); - } - - $markdown = Container::getInstance()->make(Markdown::class); - - return $markdown->theme($this->theme ?: $markdown->getTheme()) - ->render($this->markdown, $this->data()); - } - - /** - * Register a callback to be called with the Symfony message instance. - * - * @param callable $callback - * @return $this - */ - public function withSymfonyMessage($callback) - { - $this->callbacks[] = $callback; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Messages/SimpleMessage.php b/framework-9.50.2/src/Illuminate/Notifications/Messages/SimpleMessage.php deleted file mode 100644 index cb6d743..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Messages/SimpleMessage.php +++ /dev/null @@ -1,292 +0,0 @@ -level = 'success'; - - return $this; - } - - /** - * Indicate that the notification gives information about an error. - * - * @return $this - */ - public function error() - { - $this->level = 'error'; - - return $this; - } - - /** - * Set the "level" of the notification (success, error, etc.). - * - * @param string $level - * @return $this - */ - public function level($level) - { - $this->level = $level; - - return $this; - } - - /** - * Set the subject of the notification. - * - * @param string $subject - * @return $this - */ - public function subject($subject) - { - $this->subject = $subject; - - return $this; - } - - /** - * Set the greeting of the notification. - * - * @param string $greeting - * @return $this - */ - public function greeting($greeting) - { - $this->greeting = $greeting; - - return $this; - } - - /** - * Set the salutation of the notification. - * - * @param string $salutation - * @return $this - */ - public function salutation($salutation) - { - $this->salutation = $salutation; - - return $this; - } - - /** - * Add a line of text to the notification. - * - * @param mixed $line - * @return $this - */ - public function line($line) - { - return $this->with($line); - } - - /** - * Add a line of text to the notification if the given condition is true. - * - * @param bool $boolean - * @param mixed $line - * @return $this - */ - public function lineIf($boolean, $line) - { - if ($boolean) { - return $this->line($line); - } - - return $this; - } - - /** - * Add lines of text to the notification. - * - * @param iterable $lines - * @return $this - */ - public function lines($lines) - { - foreach ($lines as $line) { - $this->line($line); - } - - return $this; - } - - /** - * Add lines of text to the notification if the given condition is true. - * - * @param bool $boolean - * @param iterable $lines - * @return $this - */ - public function linesIf($boolean, $lines) - { - if ($boolean) { - return $this->lines($lines); - } - - return $this; - } - - /** - * Add a line of text to the notification. - * - * @param mixed $line - * @return $this - */ - public function with($line) - { - if ($line instanceof Action) { - $this->action($line->text, $line->url); - } elseif (! $this->actionText) { - $this->introLines[] = $this->formatLine($line); - } else { - $this->outroLines[] = $this->formatLine($line); - } - - return $this; - } - - /** - * Format the given line of text. - * - * @param \Illuminate\Contracts\Support\Htmlable|string|array $line - * @return \Illuminate\Contracts\Support\Htmlable|string - */ - protected function formatLine($line) - { - if ($line instanceof Htmlable) { - return $line; - } - - if (is_array($line)) { - return implode(' ', array_map('trim', $line)); - } - - return trim(implode(' ', array_map('trim', preg_split('/\\r\\n|\\r|\\n/', $line ?? '')))); - } - - /** - * Configure the "call to action" button. - * - * @param string $text - * @param string $url - * @return $this - */ - public function action($text, $url) - { - $this->actionText = $text; - $this->actionUrl = $url; - - return $this; - } - - /** - * Set the name of the mailer that should send the notification. - * - * @param string $mailer - * @return $this - */ - public function mailer($mailer) - { - $this->mailer = $mailer; - - return $this; - } - - /** - * Get an array representation of the message. - * - * @return array - */ - public function toArray() - { - return [ - 'level' => $this->level, - 'subject' => $this->subject, - 'greeting' => $this->greeting, - 'salutation' => $this->salutation, - 'introLines' => $this->introLines, - 'outroLines' => $this->outroLines, - 'actionText' => $this->actionText, - 'actionUrl' => $this->actionUrl, - 'displayableActionUrl' => str_replace(['mailto:', 'tel:'], '', $this->actionUrl ?? ''), - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/Notifiable.php b/framework-9.50.2/src/Illuminate/Notifications/Notifiable.php deleted file mode 100644 index 82381e1..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/Notifiable.php +++ /dev/null @@ -1,8 +0,0 @@ -locale = $locale; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/NotificationSender.php b/framework-9.50.2/src/Illuminate/Notifications/NotificationSender.php deleted file mode 100644 index 698d19d..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/NotificationSender.php +++ /dev/null @@ -1,255 +0,0 @@ -bus = $bus; - $this->events = $events; - $this->locale = $locale; - $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); - } - - $this->sendNow($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) - { - $notifiables = $this->formatNotifiables($notifiables); - - $original = clone $notification; - - foreach ($notifiables as $notifiable) { - if (empty($viaChannels = $channels ?: $notification->via($notifiable))) { - continue; - } - - $this->withLocale($this->preferredLocale($notifiable, $notification), function () use ($viaChannels, $notifiable, $original) { - $notificationId = Str::uuid()->toString(); - - foreach ((array) $viaChannels as $channel) { - if (! ($notifiable instanceof AnonymousNotifiable && $channel === 'database')) { - $this->sendToNotifiable($notifiable, $notificationId, clone $original, $channel); - } - } - }); - } - } - - /** - * Get the notifiable's preferred locale for the notification. - * - * @param mixed $notifiable - * @param mixed $notification - * @return string|null - */ - protected function preferredLocale($notifiable, $notification) - { - return $notification->locale ?? $this->locale ?? value(function () use ($notifiable) { - if ($notifiable instanceof HasLocalePreference) { - return $notifiable->preferredLocale(); - } - }); - } - - /** - * 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 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) - { - if (method_exists($notification, 'shouldSend') && - $notification->shouldSend($notifiable, $channel) === false) { - return false; - } - - return $this->events->until( - new NotificationSending($notifiable, $notification, $channel) - ) !== false; - } - - /** - * Queue the given notification instances. - * - * @param mixed $notifiables - * @param \Illuminate\Notifications\Notification $notification - * @return void - */ - protected function queueNotification($notifiables, $notification) - { - $notifiables = $this->formatNotifiables($notifiables); - - $original = clone $notification; - - foreach ($notifiables as $notifiable) { - $notificationId = Str::uuid()->toString(); - - foreach ((array) $original->via($notifiable) as $channel) { - $notification = clone $original; - - if (! $notification->id) { - $notification->id = $notificationId; - } - - if (! is_null($this->locale)) { - $notification->locale = $this->locale; - } - - $connection = $notification->connection; - - if (method_exists($notification, 'viaConnections')) { - $connection = $notification->viaConnections()[$channel] ?? null; - } - - $queue = $notification->queue; - - if (method_exists($notification, 'viaQueues')) { - $queue = $notification->viaQueues()[$channel] ?? null; - } - - $delay = $notification->delay; - - if (method_exists($notification, 'withDelay')) { - $delay = $notification->withDelay($notifiable, $channel) ?? null; - } - - $middleware = $notification->middleware ?? []; - - if (method_exists($notification, 'middleware')) { - $middleware = array_merge( - $notification->middleware($notifiable, $channel), - $middleware - ); - } - - $this->bus->dispatch( - (new SendQueuedNotifications($notifiable, $notification, [$channel])) - ->onConnection($connection) - ->onQueue($queue) - ->delay(is_array($delay) ? ($delay[$channel] ?? null) : $delay) - ->through($middleware) - ); - } - } - } - - /** - * 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; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/NotificationServiceProvider.php b/framework-9.50.2/src/Illuminate/Notifications/NotificationServiceProvider.php deleted file mode 100644 index fb202ed..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/NotificationServiceProvider.php +++ /dev/null @@ -1,46 +0,0 @@ -loadViewsFrom(__DIR__.'/resources/views', 'notifications'); - - if ($this->app->runningInConsole()) { - $this->publishes([ - __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/notifications'), - ], 'laravel-notifications'); - } - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->app->singleton(ChannelManager::class, function ($app) { - return new ChannelManager($app); - }); - - $this->app->alias( - ChannelManager::class, DispatcherContract::class - ); - - $this->app->alias( - ChannelManager::class, FactoryContract::class - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/RoutesNotifications.php b/framework-9.50.2/src/Illuminate/Notifications/RoutesNotifications.php deleted file mode 100644 index 15aa673..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/RoutesNotifications.php +++ /dev/null @@ -1,52 +0,0 @@ -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 - * @param \Illuminate\Notifications\Notification|null $notification - * @return mixed - */ - public function routeNotificationFor($driver, $notification = null) - { - if (method_exists($this, $method = 'routeNotificationFor'.Str::studly($driver))) { - return $this->{$method}($notification); - } - - return match ($driver) { - 'database' => $this->notifications(), - 'mail' => $this->email, - default => null, - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/SendQueuedNotifications.php b/framework-9.50.2/src/Illuminate/Notifications/SendQueuedNotifications.php deleted file mode 100644 index 19af188..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/SendQueuedNotifications.php +++ /dev/null @@ -1,176 +0,0 @@ -channels = $channels; - $this->notification = $notification; - $this->notifiables = $this->wrapNotifiables($notifiables); - $this->tries = property_exists($notification, 'tries') ? $notification->tries : null; - $this->timeout = property_exists($notification, 'timeout') ? $notification->timeout : null; - $this->maxExceptions = property_exists($notification, 'maxExceptions') ? $notification->maxExceptions : null; - $this->afterCommit = property_exists($notification, 'afterCommit') ? $notification->afterCommit : null; - $this->shouldBeEncrypted = $notification instanceof ShouldBeEncrypted; - } - - /** - * Wrap the notifiable(s) in a collection. - * - * @param \Illuminate\Notifications\Notifiable|\Illuminate\Support\Collection $notifiables - * @return \Illuminate\Support\Collection - */ - protected function wrapNotifiables($notifiables) - { - if ($notifiables instanceof Collection) { - return $notifiables; - } elseif ($notifiables instanceof Model) { - return EloquentCollection::wrap($notifiables); - } - - return Collection::wrap($notifiables); - } - - /** - * 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 \Throwable $e - * @return void - */ - public function failed($e) - { - if (method_exists($this->notification, 'failed')) { - $this->notification->failed($e); - } - } - - /** - * Get the number of seconds before a released notification will be available. - * - * @return mixed - */ - public function backoff() - { - if (! method_exists($this->notification, 'backoff') && ! isset($this->notification->backoff)) { - return; - } - - return $this->notification->backoff ?? $this->notification->backoff(); - } - - /** - * Determine the time at which the job should timeout. - * - * @return \DateTime|null - */ - public function retryUntil() - { - if (! method_exists($this->notification, 'retryUntil') && ! isset($this->notification->retryUntil)) { - return; - } - - return $this->notification->retryUntil ?? $this->notification->retryUntil(); - } - - /** - * Prepare the instance for cloning. - * - * @return void - */ - public function __clone() - { - $this->notifiables = clone $this->notifiables; - $this->notification = clone $this->notification; - } -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/composer.json b/framework-9.50.2/src/Illuminate/Notifications/composer.json deleted file mode 100644 index 1fd402e..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/composer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "illuminate/notifications", - "description": "The Illuminate Notifications package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/broadcasting": "^9.0", - "illuminate/bus": "^9.0", - "illuminate/collections": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/filesystem": "^9.0", - "illuminate/mail": "^9.0", - "illuminate/queue": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Notifications\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "illuminate/database": "Required to use the database transport (^9.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Notifications/resources/views/email.blade.php b/framework-9.50.2/src/Illuminate/Notifications/resources/views/email.blade.php deleted file mode 100644 index 678e259..0000000 --- a/framework-9.50.2/src/Illuminate/Notifications/resources/views/email.blade.php +++ /dev/null @@ -1,58 +0,0 @@ - -{{-- Greeting --}} -@if (! empty($greeting)) -# {{ $greeting }} -@else -@if ($level === 'error') -# @lang('Whoops!') -@else -# @lang('Hello!') -@endif -@endif - -{{-- Intro Lines --}} -@foreach ($introLines as $line) -{{ $line }} - -@endforeach - -{{-- Action Button --}} -@isset($actionText) - $level, - default => 'primary', - }; -?> - -{{ $actionText }} - -@endisset - -{{-- Outro Lines --}} -@foreach ($outroLines as $line) -{{ $line }} - -@endforeach - -{{-- Salutation --}} -@if (! empty($salutation)) -{{ $salutation }} -@else -@lang('Regards'),
-{{ config('app.name') }} -@endif - -{{-- Subcopy --}} -@isset($actionText) - -@lang( - "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\n". - 'into your web browser:', - [ - 'actionText' => $actionText, - ] -) [{{ $displayableActionUrl }}]({{ $actionUrl }}) - -@endisset -
diff --git a/framework-9.50.2/src/Illuminate/Pagination/AbstractCursorPaginator.php b/framework-9.50.2/src/Illuminate/Pagination/AbstractCursorPaginator.php deleted file mode 100644 index e670078..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/AbstractCursorPaginator.php +++ /dev/null @@ -1,671 +0,0 @@ -cursorName => $cursor->encode()]; - - if (count($this->query) > 0) { - $parameters = array_merge($this->query, $parameters); - } - - return $this->path() - .(str_contains($this->path(), '?') ? '&' : '?') - .Arr::query($parameters) - .$this->buildFragment(); - } - - /** - * Get the URL for the previous page. - * - * @return string|null - */ - public function previousPageUrl() - { - if (is_null($previousCursor = $this->previousCursor())) { - return null; - } - - return $this->url($previousCursor); - } - - /** - * The URL for the next page, or null. - * - * @return string|null - */ - public function nextPageUrl() - { - if (is_null($nextCursor = $this->nextCursor())) { - return null; - } - - return $this->url($nextCursor); - } - - /** - * Get the "cursor" that points to the previous set of items. - * - * @return \Illuminate\Pagination\Cursor|null - */ - public function previousCursor() - { - if (is_null($this->cursor) || - ($this->cursor->pointsToPreviousItems() && ! $this->hasMore)) { - return null; - } - - if ($this->items->isEmpty()) { - return null; - } - - return $this->getCursorForItem($this->items->first(), false); - } - - /** - * Get the "cursor" that points to the next set of items. - * - * @return \Illuminate\Pagination\Cursor|null - */ - public function nextCursor() - { - if ((is_null($this->cursor) && ! $this->hasMore) || - (! is_null($this->cursor) && $this->cursor->pointsToNextItems() && ! $this->hasMore)) { - return null; - } - - if ($this->items->isEmpty()) { - return null; - } - - return $this->getCursorForItem($this->items->last(), true); - } - - /** - * Get a cursor instance for the given item. - * - * @param \ArrayAccess|\stdClass $item - * @param bool $isNext - * @return \Illuminate\Pagination\Cursor - */ - public function getCursorForItem($item, $isNext = true) - { - return new Cursor($this->getParametersForItem($item), $isNext); - } - - /** - * Get the cursor parameters for a given object. - * - * @param \ArrayAccess|\stdClass $item - * @return array - * - * @throws \Exception - */ - public function getParametersForItem($item) - { - return collect($this->parameters) - ->flip() - ->map(function ($_, $parameterName) use ($item) { - if ($item instanceof JsonResource) { - $item = $item->resource; - } - - if ($item instanceof Model && - ! is_null($parameter = $this->getPivotParameterForItem($item, $parameterName))) { - return $parameter; - } elseif ($item instanceof ArrayAccess || is_array($item)) { - return $this->ensureParameterIsPrimitive( - $item[$parameterName] ?? $item[Str::afterLast($parameterName, '.')] - ); - } elseif (is_object($item)) { - return $this->ensureParameterIsPrimitive( - $item->{$parameterName} ?? $item->{Str::afterLast($parameterName, '.')} - ); - } - - throw new Exception('Only arrays and objects are supported when cursor paginating items.'); - })->toArray(); - } - - /** - * Get the cursor parameter value from a pivot model if applicable. - * - * @param \ArrayAccess|\stdClass $item - * @param string $parameterName - * @return string|null - */ - protected function getPivotParameterForItem($item, $parameterName) - { - $table = Str::beforeLast($parameterName, '.'); - - foreach ($item->getRelations() as $relation) { - if ($relation instanceof Pivot && $relation->getTable() === $table) { - return $this->ensureParameterIsPrimitive( - $relation->getAttribute(Str::afterLast($parameterName, '.')) - ); - } - } - } - - /** - * Ensure the parameter is a primitive type. - * - * This can resolve issues that arise the developer uses a value object for an attribute. - * - * @param mixed $parameter - * @return mixed - */ - protected function ensureParameterIsPrimitive($parameter) - { - return is_object($parameter) && method_exists($parameter, '__toString') - ? (string) $parameter - : $parameter; - } - - /** - * Get / set the URL fragment to be appended to URLs. - * - * @param string|null $fragment - * @return $this|string|null - */ - public function fragment($fragment = null) - { - if (is_null($fragment)) { - return $this->fragment; - } - - $this->fragment = $fragment; - - return $this; - } - - /** - * Add a set of query string values to the paginator. - * - * @param array|string|null $key - * @param string|null $value - * @return $this - */ - public function appends($key, $value = null) - { - if (is_null($key)) { - return $this; - } - - if (is_array($key)) { - return $this->appendArray($key); - } - - return $this->addQuery($key, $value); - } - - /** - * Add an array of query string values. - * - * @param array $keys - * @return $this - */ - protected function appendArray(array $keys) - { - foreach ($keys as $key => $value) { - $this->addQuery($key, $value); - } - - return $this; - } - - /** - * Add all current query string values to the paginator. - * - * @return $this - */ - public function withQueryString() - { - if (! is_null($query = Paginator::resolveQueryString())) { - return $this->appends($query); - } - - return $this; - } - - /** - * Add a query string value to the paginator. - * - * @param string $key - * @param string $value - * @return $this - */ - protected function addQuery($key, $value) - { - if ($key !== $this->cursorName) { - $this->query[$key] = $value; - } - - return $this; - } - - /** - * Build the full fragment portion of a URL. - * - * @return string - */ - protected function buildFragment() - { - return $this->fragment ? '#'.$this->fragment : ''; - } - - /** - * Load a set of relationships onto the mixed relationship collection. - * - * @param string $relation - * @param array $relations - * @return $this - */ - public function loadMorph($relation, $relations) - { - $this->getCollection()->loadMorph($relation, $relations); - - return $this; - } - - /** - * Load a set of relationship counts onto the mixed relationship collection. - * - * @param string $relation - * @param array $relations - * @return $this - */ - public function loadMorphCount($relation, $relations) - { - $this->getCollection()->loadMorphCount($relation, $relations); - - return $this; - } - - /** - * Get the slice of items being paginated. - * - * @return array - */ - public function items() - { - return $this->items->all(); - } - - /** - * Transform each item in the slice of items using a callback. - * - * @param callable $callback - * @return $this - */ - public function through(callable $callback) - { - $this->items->transform($callback); - - return $this; - } - - /** - * Get the number of items shown per page. - * - * @return int - */ - public function perPage() - { - return $this->perPage; - } - - /** - * Get the current cursor being paginated. - * - * @return \Illuminate\Pagination\Cursor|null - */ - public function cursor() - { - return $this->cursor; - } - - /** - * Get the query string variable used to store the cursor. - * - * @return string - */ - public function getCursorName() - { - return $this->cursorName; - } - - /** - * Set the query string variable used to store the cursor. - * - * @param string $name - * @return $this - */ - public function setCursorName($name) - { - $this->cursorName = $name; - - return $this; - } - - /** - * Set the base path to assign to all URLs. - * - * @param string $path - * @return $this - */ - public function withPath($path) - { - return $this->setPath($path); - } - - /** - * Set the base path to assign to all URLs. - * - * @param string $path - * @return $this - */ - public function setPath($path) - { - $this->path = $path; - - return $this; - } - - /** - * Get the base path for paginator generated URLs. - * - * @return string|null - */ - public function path() - { - return $this->path; - } - - /** - * Resolve the current cursor or return the default value. - * - * @param string $cursorName - * @return \Illuminate\Pagination\Cursor|null - */ - public static function resolveCurrentCursor($cursorName = 'cursor', $default = null) - { - if (isset(static::$currentCursorResolver)) { - return call_user_func(static::$currentCursorResolver, $cursorName); - } - - return $default; - } - - /** - * Set the current cursor resolver callback. - * - * @param \Closure $resolver - * @return void - */ - public static function currentCursorResolver(Closure $resolver) - { - static::$currentCursorResolver = $resolver; - } - - /** - * Get an instance of the view factory from the resolver. - * - * @return \Illuminate\Contracts\View\Factory - */ - public static function viewFactory() - { - return Paginator::viewFactory(); - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator(): Traversable - { - return $this->items->getIterator(); - } - - /** - * Determine if the list of items is empty. - * - * @return bool - */ - public function isEmpty() - { - return $this->items->isEmpty(); - } - - /** - * Determine if the list of items is not empty. - * - * @return bool - */ - public function isNotEmpty() - { - return $this->items->isNotEmpty(); - } - - /** - * Get the number of items for the current page. - * - * @return int - */ - public function count(): int - { - return $this->items->count(); - } - - /** - * Get the paginator's underlying collection. - * - * @return \Illuminate\Support\Collection - */ - public function getCollection() - { - return $this->items; - } - - /** - * Set the paginator's underlying collection. - * - * @param \Illuminate\Support\Collection $collection - * @return $this - */ - public function setCollection(Collection $collection) - { - $this->items = $collection; - - return $this; - } - - /** - * Get the paginator options. - * - * @return array - */ - public function getOptions() - { - return $this->options; - } - - /** - * Determine if the given item exists. - * - * @param mixed $key - * @return bool - */ - public function offsetExists($key): bool - { - return $this->items->has($key); - } - - /** - * Get the item at the given offset. - * - * @param mixed $key - * @return mixed - */ - public function offsetGet($key): mixed - { - return $this->items->get($key); - } - - /** - * Set the item at the given offset. - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value): void - { - $this->items->put($key, $value); - } - - /** - * Unset the item at the given key. - * - * @param mixed $key - * @return void - */ - public function offsetUnset($key): void - { - $this->items->forget($key); - } - - /** - * Render the contents of the paginator to HTML. - * - * @return string - */ - public function toHtml() - { - return (string) $this->render(); - } - - /** - * Make dynamic calls into the collection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->forwardCallTo($this->getCollection(), $method, $parameters); - } - - /** - * Render the contents of the paginator when casting to a string. - * - * @return string - */ - public function __toString() - { - return (string) $this->render(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/AbstractPaginator.php b/framework-9.50.2/src/Illuminate/Pagination/AbstractPaginator.php deleted file mode 100644 index a497984..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/AbstractPaginator.php +++ /dev/null @@ -1,797 +0,0 @@ -= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false; - } - - /** - * Get the URL for the previous page. - * - * @return string|null - */ - public function previousPageUrl() - { - if ($this->currentPage() > 1) { - return $this->url($this->currentPage() - 1); - } - } - - /** - * Create a range of pagination URLs. - * - * @param int $start - * @param int $end - * @return array - */ - public function getUrlRange($start, $end) - { - return collect(range($start, $end))->mapWithKeys(function ($page) { - return [$page => $this->url($page)]; - })->all(); - } - - /** - * Get the URL for a given page number. - * - * @param int $page - * @return string - */ - public function url($page) - { - if ($page <= 0) { - $page = 1; - } - - // If we have any extra query string key / value pairs that need to be added - // onto the URL, we will put them in query string form and then attach it - // to the URL. This allows for extra information like sortings storage. - $parameters = [$this->pageName => $page]; - - if (count($this->query) > 0) { - $parameters = array_merge($this->query, $parameters); - } - - return $this->path() - .(str_contains($this->path(), '?') ? '&' : '?') - .Arr::query($parameters) - .$this->buildFragment(); - } - - /** - * Get / set the URL fragment to be appended to URLs. - * - * @param string|null $fragment - * @return $this|string|null - */ - public function fragment($fragment = null) - { - if (is_null($fragment)) { - return $this->fragment; - } - - $this->fragment = $fragment; - - return $this; - } - - /** - * Add a set of query string values to the paginator. - * - * @param array|string|null $key - * @param string|null $value - * @return $this - */ - public function appends($key, $value = null) - { - if (is_null($key)) { - return $this; - } - - if (is_array($key)) { - return $this->appendArray($key); - } - - return $this->addQuery($key, $value); - } - - /** - * Add an array of query string values. - * - * @param array $keys - * @return $this - */ - protected function appendArray(array $keys) - { - foreach ($keys as $key => $value) { - $this->addQuery($key, $value); - } - - return $this; - } - - /** - * Add all current query string values to the paginator. - * - * @return $this - */ - public function withQueryString() - { - if (isset(static::$queryStringResolver)) { - return $this->appends(call_user_func(static::$queryStringResolver)); - } - - return $this; - } - - /** - * Add a query string value to the paginator. - * - * @param string $key - * @param string $value - * @return $this - */ - protected function addQuery($key, $value) - { - if ($key !== $this->pageName) { - $this->query[$key] = $value; - } - - return $this; - } - - /** - * Build the full fragment portion of a URL. - * - * @return string - */ - protected function buildFragment() - { - return $this->fragment ? '#'.$this->fragment : ''; - } - - /** - * Load a set of relationships onto the mixed relationship collection. - * - * @param string $relation - * @param array $relations - * @return $this - */ - public function loadMorph($relation, $relations) - { - $this->getCollection()->loadMorph($relation, $relations); - - return $this; - } - - /** - * Load a set of relationship counts onto the mixed relationship collection. - * - * @param string $relation - * @param array $relations - * @return $this - */ - public function loadMorphCount($relation, $relations) - { - $this->getCollection()->loadMorphCount($relation, $relations); - - return $this; - } - - /** - * Get the slice of items being paginated. - * - * @return array - */ - public function items() - { - return $this->items->all(); - } - - /** - * Get the number of the first item in the slice. - * - * @return int - */ - public function firstItem() - { - return count($this->items) > 0 ? ($this->currentPage - 1) * $this->perPage + 1 : null; - } - - /** - * Get the number of the last item in the slice. - * - * @return int - */ - public function lastItem() - { - return count($this->items) > 0 ? $this->firstItem() + $this->count() - 1 : null; - } - - /** - * Transform each item in the slice of items using a callback. - * - * @param callable $callback - * @return $this - */ - public function through(callable $callback) - { - $this->items->transform($callback); - - return $this; - } - - /** - * Get the number of items shown per page. - * - * @return int - */ - public function perPage() - { - return $this->perPage; - } - - /** - * Determine if there are enough items to split into multiple pages. - * - * @return bool - */ - public function hasPages() - { - return $this->currentPage() != 1 || $this->hasMorePages(); - } - - /** - * Determine if the paginator is on the first page. - * - * @return bool - */ - public function onFirstPage() - { - return $this->currentPage() <= 1; - } - - /** - * Determine if the paginator is on the last page. - * - * @return bool - */ - public function onLastPage() - { - return ! $this->hasMorePages(); - } - - /** - * Get the current page. - * - * @return int - */ - public function currentPage() - { - return $this->currentPage; - } - - /** - * Get the query string variable used to store the page. - * - * @return string - */ - public function getPageName() - { - return $this->pageName; - } - - /** - * Set the query string variable used to store the page. - * - * @param string $name - * @return $this - */ - public function setPageName($name) - { - $this->pageName = $name; - - return $this; - } - - /** - * Set the base path to assign to all URLs. - * - * @param string $path - * @return $this - */ - public function withPath($path) - { - return $this->setPath($path); - } - - /** - * Set the base path to assign to all URLs. - * - * @param string $path - * @return $this - */ - public function setPath($path) - { - $this->path = $path; - - return $this; - } - - /** - * Set the number of links to display on each side of current page link. - * - * @param int $count - * @return $this - */ - public function onEachSide($count) - { - $this->onEachSide = $count; - - return $this; - } - - /** - * Get the base path for paginator generated URLs. - * - * @return string|null - */ - public function path() - { - return $this->path; - } - - /** - * Resolve the current request path or return the default value. - * - * @param string $default - * @return string - */ - public static function resolveCurrentPath($default = '/') - { - if (isset(static::$currentPathResolver)) { - return call_user_func(static::$currentPathResolver); - } - - return $default; - } - - /** - * Set the current request path resolver callback. - * - * @param \Closure $resolver - * @return void - */ - public static function currentPathResolver(Closure $resolver) - { - static::$currentPathResolver = $resolver; - } - - /** - * Resolve the current page or return the default value. - * - * @param string $pageName - * @param int $default - * @return int - */ - public static function resolveCurrentPage($pageName = 'page', $default = 1) - { - if (isset(static::$currentPageResolver)) { - return (int) call_user_func(static::$currentPageResolver, $pageName); - } - - return $default; - } - - /** - * Set the current page resolver callback. - * - * @param \Closure $resolver - * @return void - */ - public static function currentPageResolver(Closure $resolver) - { - static::$currentPageResolver = $resolver; - } - - /** - * Resolve the query string or return the default value. - * - * @param string|array|null $default - * @return string - */ - public static function resolveQueryString($default = null) - { - if (isset(static::$queryStringResolver)) { - return (static::$queryStringResolver)(); - } - - return $default; - } - - /** - * Set with query string resolver callback. - * - * @param \Closure $resolver - * @return void - */ - public static function queryStringResolver(Closure $resolver) - { - static::$queryStringResolver = $resolver; - } - - /** - * Get an instance of the view factory from the resolver. - * - * @return \Illuminate\Contracts\View\Factory - */ - public static function viewFactory() - { - return call_user_func(static::$viewFactoryResolver); - } - - /** - * Set the view factory resolver callback. - * - * @param \Closure $resolver - * @return void - */ - public static function viewFactoryResolver(Closure $resolver) - { - static::$viewFactoryResolver = $resolver; - } - - /** - * Set the default pagination view. - * - * @param string $view - * @return void - */ - public static function defaultView($view) - { - static::$defaultView = $view; - } - - /** - * Set the default "simple" pagination view. - * - * @param string $view - * @return void - */ - public static function defaultSimpleView($view) - { - static::$defaultSimpleView = $view; - } - - /** - * Indicate that Tailwind styling should be used for generated links. - * - * @return void - */ - public static function useTailwind() - { - static::defaultView('pagination::tailwind'); - static::defaultSimpleView('pagination::simple-tailwind'); - } - - /** - * Indicate that Bootstrap 4 styling should be used for generated links. - * - * @return void - */ - public static function useBootstrap() - { - static::useBootstrapFour(); - } - - /** - * Indicate that Bootstrap 3 styling should be used for generated links. - * - * @return void - */ - public static function useBootstrapThree() - { - static::defaultView('pagination::default'); - static::defaultSimpleView('pagination::simple-default'); - } - - /** - * Indicate that Bootstrap 4 styling should be used for generated links. - * - * @return void - */ - public static function useBootstrapFour() - { - static::defaultView('pagination::bootstrap-4'); - static::defaultSimpleView('pagination::simple-bootstrap-4'); - } - - /** - * Indicate that Bootstrap 5 styling should be used for generated links. - * - * @return void - */ - public static function useBootstrapFive() - { - static::defaultView('pagination::bootstrap-5'); - static::defaultSimpleView('pagination::simple-bootstrap-5'); - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator(): Traversable - { - return $this->items->getIterator(); - } - - /** - * Determine if the list of items is empty. - * - * @return bool - */ - public function isEmpty() - { - return $this->items->isEmpty(); - } - - /** - * Determine if the list of items is not empty. - * - * @return bool - */ - public function isNotEmpty() - { - return $this->items->isNotEmpty(); - } - - /** - * Get the number of items for the current page. - * - * @return int - */ - public function count(): int - { - return $this->items->count(); - } - - /** - * Get the paginator's underlying collection. - * - * @return \Illuminate\Support\Collection - */ - public function getCollection() - { - return $this->items; - } - - /** - * Set the paginator's underlying collection. - * - * @param \Illuminate\Support\Collection $collection - * @return $this - */ - public function setCollection(Collection $collection) - { - $this->items = $collection; - - return $this; - } - - /** - * Get the paginator options. - * - * @return array - */ - public function getOptions() - { - return $this->options; - } - - /** - * Determine if the given item exists. - * - * @param mixed $key - * @return bool - */ - public function offsetExists($key): bool - { - return $this->items->has($key); - } - - /** - * Get the item at the given offset. - * - * @param mixed $key - * @return mixed - */ - public function offsetGet($key): mixed - { - return $this->items->get($key); - } - - /** - * Set the item at the given offset. - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value): void - { - $this->items->put($key, $value); - } - - /** - * Unset the item at the given key. - * - * @param mixed $key - * @return void - */ - public function offsetUnset($key): void - { - $this->items->forget($key); - } - - /** - * Render the contents of the paginator to HTML. - * - * @return string - */ - public function toHtml() - { - return (string) $this->render(); - } - - /** - * Make dynamic calls into the collection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->forwardCallTo($this->getCollection(), $method, $parameters); - } - - /** - * Render the contents of the paginator when casting to a string. - * - * @return string - */ - public function __toString() - { - return (string) $this->render(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/Cursor.php b/framework-9.50.2/src/Illuminate/Pagination/Cursor.php deleted file mode 100644 index 1d62280..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/Cursor.php +++ /dev/null @@ -1,132 +0,0 @@ -parameters = $parameters; - $this->pointsToNextItems = $pointsToNextItems; - } - - /** - * Get the given parameter from the cursor. - * - * @param string $parameterName - * @return string|null - * - * @throws \UnexpectedValueException - */ - public function parameter(string $parameterName) - { - if (! array_key_exists($parameterName, $this->parameters)) { - throw new UnexpectedValueException("Unable to find parameter [{$parameterName}] in pagination item."); - } - - return $this->parameters[$parameterName]; - } - - /** - * Get the given parameters from the cursor. - * - * @param array $parameterNames - * @return array - */ - public function parameters(array $parameterNames) - { - return collect($parameterNames)->map(function ($parameterName) { - return $this->parameter($parameterName); - })->toArray(); - } - - /** - * Determine whether the cursor points to the next set of items. - * - * @return bool - */ - public function pointsToNextItems() - { - return $this->pointsToNextItems; - } - - /** - * Determine whether the cursor points to the previous set of items. - * - * @return bool - */ - public function pointsToPreviousItems() - { - return ! $this->pointsToNextItems; - } - - /** - * Get the array representation of the cursor. - * - * @return array - */ - public function toArray() - { - return array_merge($this->parameters, [ - '_pointsToNextItems' => $this->pointsToNextItems, - ]); - } - - /** - * Get the encoded string representation of the cursor to construct a URL. - * - * @return string - */ - public function encode() - { - return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(json_encode($this->toArray()))); - } - - /** - * Get a cursor instance from the encoded string representation. - * - * @param string|null $encodedString - * @return static|null - */ - public static function fromEncoded($encodedString) - { - if (! is_string($encodedString)) { - return null; - } - - $parameters = json_decode(base64_decode(str_replace(['-', '_'], ['+', '/'], $encodedString)), true); - - if (json_last_error() !== JSON_ERROR_NONE) { - return null; - } - - $pointsToNextItems = $parameters['_pointsToNextItems']; - - unset($parameters['_pointsToNextItems']); - - return new static($parameters, $pointsToNextItems); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/CursorPaginator.php b/framework-9.50.2/src/Illuminate/Pagination/CursorPaginator.php deleted file mode 100644 index 4c0a896..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/CursorPaginator.php +++ /dev/null @@ -1,172 +0,0 @@ -options = $options; - - foreach ($options as $key => $value) { - $this->{$key} = $value; - } - - $this->perPage = (int) $perPage; - $this->cursor = $cursor; - $this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path; - - $this->setItems($items); - } - - /** - * Set the items for the paginator. - * - * @param mixed $items - * @return void - */ - protected function setItems($items) - { - $this->items = $items instanceof Collection ? $items : Collection::make($items); - - $this->hasMore = $this->items->count() > $this->perPage; - - $this->items = $this->items->slice(0, $this->perPage); - - if (! is_null($this->cursor) && $this->cursor->pointsToPreviousItems()) { - $this->items = $this->items->reverse()->values(); - } - } - - /** - * Render the paginator using the given view. - * - * @param string|null $view - * @param array $data - * @return \Illuminate\Contracts\Support\Htmlable - */ - public function links($view = null, $data = []) - { - return $this->render($view, $data); - } - - /** - * Render the paginator using the given view. - * - * @param string|null $view - * @param array $data - * @return \Illuminate\Contracts\Support\Htmlable - */ - public function render($view = null, $data = []) - { - return static::viewFactory()->make($view ?: Paginator::$defaultSimpleView, array_merge($data, [ - 'paginator' => $this, - ])); - } - - /** - * Determine if there are more items in the data source. - * - * @return bool - */ - public function hasMorePages() - { - return (is_null($this->cursor) && $this->hasMore) || - (! is_null($this->cursor) && $this->cursor->pointsToNextItems() && $this->hasMore) || - (! is_null($this->cursor) && $this->cursor->pointsToPreviousItems()); - } - - /** - * Determine if there are enough items to split into multiple pages. - * - * @return bool - */ - public function hasPages() - { - return ! $this->onFirstPage() || $this->hasMorePages(); - } - - /** - * Determine if the paginator is on the first page. - * - * @return bool - */ - public function onFirstPage() - { - return is_null($this->cursor) || ($this->cursor->pointsToPreviousItems() && ! $this->hasMore); - } - - /** - * Determine if the paginator is on the last page. - * - * @return bool - */ - public function onLastPage() - { - return ! $this->hasMorePages(); - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return [ - 'data' => $this->items->toArray(), - 'path' => $this->path(), - 'per_page' => $this->perPage(), - 'next_cursor' => $this->nextCursor()?->encode(), - 'next_page_url' => $this->nextPageUrl(), - 'prev_cursor' => $this->previousCursor()?->encode(), - 'prev_page_url' => $this->previousPageUrl(), - ]; - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->toArray(); - } - - /** - * Convert the object to its JSON representation. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->jsonSerialize(), $options); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/LICENSE.md b/framework-9.50.2/src/Illuminate/Pagination/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Pagination/LengthAwarePaginator.php b/framework-9.50.2/src/Illuminate/Pagination/LengthAwarePaginator.php deleted file mode 100644 index 8d3e0ab..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/LengthAwarePaginator.php +++ /dev/null @@ -1,231 +0,0 @@ -options = $options; - - foreach ($options as $key => $value) { - $this->{$key} = $value; - } - - $this->total = $total; - $this->perPage = (int) $perPage; - $this->lastPage = max((int) ceil($total / $perPage), 1); - $this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path; - $this->currentPage = $this->setCurrentPage($currentPage, $this->pageName); - $this->items = $items instanceof Collection ? $items : Collection::make($items); - } - - /** - * Get the current page for the request. - * - * @param int $currentPage - * @param string $pageName - * @return int - */ - protected function setCurrentPage($currentPage, $pageName) - { - $currentPage = $currentPage ?: static::resolveCurrentPage($pageName); - - return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; - } - - /** - * Render the paginator using the given view. - * - * @param string|null $view - * @param array $data - * @return \Illuminate\Contracts\Support\Htmlable - */ - public function links($view = null, $data = []) - { - return $this->render($view, $data); - } - - /** - * Render the paginator using the given view. - * - * @param string|null $view - * @param array $data - * @return \Illuminate\Contracts\Support\Htmlable - */ - public function render($view = null, $data = []) - { - return static::viewFactory()->make($view ?: static::$defaultView, array_merge($data, [ - 'paginator' => $this, - 'elements' => $this->elements(), - ])); - } - - /** - * Get the paginator links as a collection (for JSON responses). - * - * @return \Illuminate\Support\Collection - */ - public function linkCollection() - { - return collect($this->elements())->flatMap(function ($item) { - if (! is_array($item)) { - return [['url' => null, 'label' => '...', 'active' => false]]; - } - - return collect($item)->map(function ($url, $page) { - return [ - 'url' => $url, - 'label' => (string) $page, - 'active' => $this->currentPage() === $page, - ]; - }); - })->prepend([ - 'url' => $this->previousPageUrl(), - 'label' => function_exists('__') ? __('pagination.previous') : 'Previous', - 'active' => false, - ])->push([ - 'url' => $this->nextPageUrl(), - 'label' => function_exists('__') ? __('pagination.next') : 'Next', - 'active' => false, - ]); - } - - /** - * Get the array of elements to pass to the view. - * - * @return array - */ - protected function elements() - { - $window = UrlWindow::make($this); - - return array_filter([ - $window['first'], - is_array($window['slider']) ? '...' : null, - $window['slider'], - is_array($window['last']) ? '...' : null, - $window['last'], - ]); - } - - /** - * Get the total number of items being paginated. - * - * @return int - */ - public function total() - { - return $this->total; - } - - /** - * Determine if there are more items in the data source. - * - * @return bool - */ - public function hasMorePages() - { - return $this->currentPage() < $this->lastPage(); - } - - /** - * Get the URL for the next page. - * - * @return string|null - */ - public function nextPageUrl() - { - if ($this->hasMorePages()) { - return $this->url($this->currentPage() + 1); - } - } - - /** - * Get the last page. - * - * @return int - */ - public function lastPage() - { - return $this->lastPage; - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return [ - 'current_page' => $this->currentPage(), - 'data' => $this->items->toArray(), - 'first_page_url' => $this->url(1), - 'from' => $this->firstItem(), - 'last_page' => $this->lastPage(), - 'last_page_url' => $this->url($this->lastPage()), - 'links' => $this->linkCollection()->toArray(), - 'next_page_url' => $this->nextPageUrl(), - 'path' => $this->path(), - 'per_page' => $this->perPage(), - 'prev_page_url' => $this->previousPageUrl(), - 'to' => $this->lastItem(), - 'total' => $this->total(), - ]; - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->toArray(); - } - - /** - * Convert the object to its JSON representation. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->jsonSerialize(), $options); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/PaginationServiceProvider.php b/framework-9.50.2/src/Illuminate/Pagination/PaginationServiceProvider.php deleted file mode 100755 index e94cebd..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/PaginationServiceProvider.php +++ /dev/null @@ -1,34 +0,0 @@ -loadViewsFrom(__DIR__.'/resources/views', 'pagination'); - - if ($this->app->runningInConsole()) { - $this->publishes([ - __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/pagination'), - ], 'laravel-pagination'); - } - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - PaginationState::resolveUsing($this->app); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/PaginationState.php b/framework-9.50.2/src/Illuminate/Pagination/PaginationState.php deleted file mode 100644 index 347c6e2..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/PaginationState.php +++ /dev/null @@ -1,35 +0,0 @@ - $app['view']); - - Paginator::currentPathResolver(fn () => $app['request']->url()); - - Paginator::currentPageResolver(function ($pageName = 'page') use ($app) { - $page = $app['request']->input($pageName); - - if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { - return (int) $page; - } - - return 1; - }); - - Paginator::queryStringResolver(fn () => $app['request']->query()); - - CursorPaginator::currentCursorResolver(function ($cursorName = 'cursor') use ($app) { - return Cursor::fromEncoded($app['request']->input($cursorName)); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/Paginator.php b/framework-9.50.2/src/Illuminate/Pagination/Paginator.php deleted file mode 100644 index d307ee9..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/Paginator.php +++ /dev/null @@ -1,176 +0,0 @@ -options = $options; - - foreach ($options as $key => $value) { - $this->{$key} = $value; - } - - $this->perPage = $perPage; - $this->currentPage = $this->setCurrentPage($currentPage); - $this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path; - - $this->setItems($items); - } - - /** - * Get the current page for the request. - * - * @param int $currentPage - * @return int - */ - protected function setCurrentPage($currentPage) - { - $currentPage = $currentPage ?: static::resolveCurrentPage(); - - return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; - } - - /** - * Set the items for the paginator. - * - * @param mixed $items - * @return void - */ - protected function setItems($items) - { - $this->items = $items instanceof Collection ? $items : Collection::make($items); - - $this->hasMore = $this->items->count() > $this->perPage; - - $this->items = $this->items->slice(0, $this->perPage); - } - - /** - * Get the URL for the next page. - * - * @return string|null - */ - public function nextPageUrl() - { - if ($this->hasMorePages()) { - return $this->url($this->currentPage() + 1); - } - } - - /** - * Render the paginator using the given view. - * - * @param string|null $view - * @param array $data - * @return string - */ - public function links($view = null, $data = []) - { - return $this->render($view, $data); - } - - /** - * Render the paginator using the given view. - * - * @param string|null $view - * @param array $data - * @return \Illuminate\Contracts\Support\Htmlable - */ - public function render($view = null, $data = []) - { - return static::viewFactory()->make($view ?: static::$defaultSimpleView, array_merge($data, [ - 'paginator' => $this, - ])); - } - - /** - * Manually indicate that the paginator does have more pages. - * - * @param bool $hasMore - * @return $this - */ - public function hasMorePagesWhen($hasMore = true) - { - $this->hasMore = $hasMore; - - return $this; - } - - /** - * Determine if there are more items in the data source. - * - * @return bool - */ - public function hasMorePages() - { - return $this->hasMore; - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return [ - 'current_page' => $this->currentPage(), - 'data' => $this->items->toArray(), - 'first_page_url' => $this->url(1), - 'from' => $this->firstItem(), - 'next_page_url' => $this->nextPageUrl(), - 'path' => $this->path(), - 'per_page' => $this->perPage(), - 'prev_page_url' => $this->previousPageUrl(), - 'to' => $this->lastItem(), - ]; - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->toArray(); - } - - /** - * Convert the object to its JSON representation. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->jsonSerialize(), $options); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/UrlWindow.php b/framework-9.50.2/src/Illuminate/Pagination/UrlWindow.php deleted file mode 100644 index 99286f7..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/UrlWindow.php +++ /dev/null @@ -1,220 +0,0 @@ -paginator = $paginator; - } - - /** - * Create a new URL window instance. - * - * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator - * @return array - */ - public static function make(PaginatorContract $paginator) - { - return (new static($paginator))->get(); - } - - /** - * Get the window of URLs to be shown. - * - * @return array - */ - public function get() - { - $onEachSide = $this->paginator->onEachSide; - - if ($this->paginator->lastPage() < ($onEachSide * 2) + 8) { - return $this->getSmallSlider(); - } - - return $this->getUrlSlider($onEachSide); - } - - /** - * Get the slider of URLs there are not enough pages to slide. - * - * @return array - */ - protected function getSmallSlider() - { - return [ - 'first' => $this->paginator->getUrlRange(1, $this->lastPage()), - 'slider' => null, - 'last' => null, - ]; - } - - /** - * Create a URL slider links. - * - * @param int $onEachSide - * @return array - */ - protected function getUrlSlider($onEachSide) - { - $window = $onEachSide + 4; - - if (! $this->hasPages()) { - return ['first' => null, 'slider' => null, 'last' => null]; - } - - // If the current page is very close to the beginning of the page range, we will - // just render the beginning of the page range, followed by the last 2 of the - // links in this list, since we will not have room to create a full slider. - if ($this->currentPage() <= $window) { - return $this->getSliderTooCloseToBeginning($window, $onEachSide); - } - - // If the current page is close to the ending of the page range we will just get - // this first couple pages, followed by a larger window of these ending pages - // since we're too close to the end of the list to create a full on slider. - elseif ($this->currentPage() > ($this->lastPage() - $window)) { - return $this->getSliderTooCloseToEnding($window, $onEachSide); - } - - // If we have enough room on both sides of the current page to build a slider we - // will surround it with both the beginning and ending caps, with this window - // of pages in the middle providing a Google style sliding paginator setup. - return $this->getFullSlider($onEachSide); - } - - /** - * Get the slider of URLs when too close to the beginning of the window. - * - * @param int $window - * @param int $onEachSide - * @return array - */ - protected function getSliderTooCloseToBeginning($window, $onEachSide) - { - return [ - 'first' => $this->paginator->getUrlRange(1, $window + $onEachSide), - 'slider' => null, - 'last' => $this->getFinish(), - ]; - } - - /** - * Get the slider of URLs when too close to the ending of the window. - * - * @param int $window - * @param int $onEachSide - * @return array - */ - protected function getSliderTooCloseToEnding($window, $onEachSide) - { - $last = $this->paginator->getUrlRange( - $this->lastPage() - ($window + ($onEachSide - 1)), - $this->lastPage() - ); - - return [ - 'first' => $this->getStart(), - 'slider' => null, - 'last' => $last, - ]; - } - - /** - * Get the slider of URLs when a full slider can be made. - * - * @param int $onEachSide - * @return array - */ - protected function getFullSlider($onEachSide) - { - return [ - 'first' => $this->getStart(), - 'slider' => $this->getAdjacentUrlRange($onEachSide), - 'last' => $this->getFinish(), - ]; - } - - /** - * Get the page range for the current page window. - * - * @param int $onEachSide - * @return array - */ - public function getAdjacentUrlRange($onEachSide) - { - return $this->paginator->getUrlRange( - $this->currentPage() - $onEachSide, - $this->currentPage() + $onEachSide - ); - } - - /** - * Get the starting URLs of a pagination slider. - * - * @return array - */ - public function getStart() - { - return $this->paginator->getUrlRange(1, 2); - } - - /** - * Get the ending URLs of a pagination slider. - * - * @return array - */ - public function getFinish() - { - return $this->paginator->getUrlRange( - $this->lastPage() - 1, - $this->lastPage() - ); - } - - /** - * Determine if the underlying paginator being presented has pages to show. - * - * @return bool - */ - public function hasPages() - { - return $this->paginator->lastPage() > 1; - } - - /** - * Get the current page from the paginator. - * - * @return int - */ - protected function currentPage() - { - return $this->paginator->currentPage(); - } - - /** - * Get the last page from the paginator. - * - * @return int - */ - protected function lastPage() - { - return $this->paginator->lastPage(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/composer.json b/framework-9.50.2/src/Illuminate/Pagination/composer.json deleted file mode 100755 index 3edd0d7..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "illuminate/pagination", - "description": "The Illuminate Pagination package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Pagination\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php deleted file mode 100644 index 63c6f56..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php +++ /dev/null @@ -1,46 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/bootstrap-5.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/bootstrap-5.blade.php deleted file mode 100644 index a1795a4..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/bootstrap-5.blade.php +++ /dev/null @@ -1,88 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/default.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/default.blade.php deleted file mode 100644 index 0db70b5..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/default.blade.php +++ /dev/null @@ -1,46 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php deleted file mode 100644 index ef0dbb1..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php +++ /dev/null @@ -1,36 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php deleted file mode 100644 index 4bb4917..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-bootstrap-5.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-bootstrap-5.blade.php deleted file mode 100644 index a89005e..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-bootstrap-5.blade.php +++ /dev/null @@ -1,29 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-default.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-default.blade.php deleted file mode 100644 index 36bdbc1..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-default.blade.php +++ /dev/null @@ -1,19 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-tailwind.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-tailwind.blade.php deleted file mode 100644 index 6872cca..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/simple-tailwind.blade.php +++ /dev/null @@ -1,25 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pagination/resources/views/tailwind.blade.php b/framework-9.50.2/src/Illuminate/Pagination/resources/views/tailwind.blade.php deleted file mode 100644 index 5bf323b..0000000 --- a/framework-9.50.2/src/Illuminate/Pagination/resources/views/tailwind.blade.php +++ /dev/null @@ -1,106 +0,0 @@ -@if ($paginator->hasPages()) - -@endif diff --git a/framework-9.50.2/src/Illuminate/Pipeline/Hub.php b/framework-9.50.2/src/Illuminate/Pipeline/Hub.php deleted file mode 100644 index 91e9b3f..0000000 --- a/framework-9.50.2/src/Illuminate/Pipeline/Hub.php +++ /dev/null @@ -1,97 +0,0 @@ -container = $container; - } - - /** - * Define the default named pipeline. - * - * @param \Closure $callback - * @return void - */ - public function defaults(Closure $callback) - { - return $this->pipeline('default', $callback); - } - - /** - * Define a new named pipeline. - * - * @param string $name - * @param \Closure $callback - * @return void - */ - public function pipeline($name, Closure $callback) - { - $this->pipelines[$name] = $callback; - } - - /** - * Send an object through one of the available pipelines. - * - * @param mixed $object - * @param string|null $pipeline - * @return mixed - */ - public function pipe($object, $pipeline = null) - { - $pipeline = $pipeline ?: 'default'; - - return call_user_func( - $this->pipelines[$pipeline], new Pipeline($this->container), $object - ); - } - - /** - * Get the container instance used by the hub. - * - * @return \Illuminate\Contracts\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Set the container instance used by the hub. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Pipeline/LICENSE.md b/framework-9.50.2/src/Illuminate/Pipeline/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Pipeline/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Pipeline/Pipeline.php b/framework-9.50.2/src/Illuminate/Pipeline/Pipeline.php deleted file mode 100644 index 53b9fef..0000000 --- a/framework-9.50.2/src/Illuminate/Pipeline/Pipeline.php +++ /dev/null @@ -1,271 +0,0 @@ -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; - } - - /** - * Push additional pipes onto the pipeline. - * - * @param array|mixed $pipes - * @return $this - */ - public function pipe($pipes) - { - array_push($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); - } - - /** - * Run the pipeline and return the result. - * - * @return mixed - */ - public function thenReturn() - { - return $this->then(function ($passable) { - return $passable; - }); - } - - /** - * Get the final piece of the Closure onion. - * - * @param \Closure $destination - * @return \Closure - */ - protected function prepareDestination(Closure $destination) - { - return function ($passable) use ($destination) { - try { - return $destination($passable); - } catch (Throwable $e) { - return $this->handleException($passable, $e); - } - }; - } - - /** - * 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) { - try { - if (is_callable($pipe)) { - // If the pipe is a callable, then we will call it directly, but otherwise we - // will resolve the pipes out of the dependency container and call it with - // the appropriate method and arguments, returning the results back out. - return $pipe($passable, $stack); - } elseif (! is_object($pipe)) { - [$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]; - } - - $carry = method_exists($pipe, $this->method) - ? $pipe->{$this->method}(...$parameters) - : $pipe(...$parameters); - - return $this->handleCarry($carry); - } catch (Throwable $e) { - return $this->handleException($passable, $e); - } - }; - }; - } - - /** - * Parse full pipe string to get name and parameters. - * - * @param string $pipe - * @return array - */ - protected function parsePipeString($pipe) - { - [$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []); - - if (is_string($parameters)) { - $parameters = explode(',', $parameters); - } - - return [$name, $parameters]; - } - - /** - * Get the array of configured pipes. - * - * @return array - */ - protected function pipes() - { - return $this->pipes; - } - - /** - * 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; - } - - /** - * Set the container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } - - /** - * Handle the value returned from each pipe before passing it to the next. - * - * @param mixed $carry - * @return mixed - */ - protected function handleCarry($carry) - { - return $carry; - } - - /** - * Handle the given exception. - * - * @param mixed $passable - * @param \Throwable $e - * @return mixed - * - * @throws \Throwable - */ - protected function handleException($passable, Throwable $e) - { - throw $e; - } -} diff --git a/framework-9.50.2/src/Illuminate/Pipeline/PipelineServiceProvider.php b/framework-9.50.2/src/Illuminate/Pipeline/PipelineServiceProvider.php deleted file mode 100644 index 982608b..0000000 --- a/framework-9.50.2/src/Illuminate/Pipeline/PipelineServiceProvider.php +++ /dev/null @@ -1,34 +0,0 @@ -app->singleton( - PipelineHubContract::class, Hub::class - ); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - PipelineHubContract::class, - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Pipeline/composer.json b/framework-9.50.2/src/Illuminate/Pipeline/composer.json deleted file mode 100644 index 7e640af..0000000 --- a/framework-9.50.2/src/Illuminate/Pipeline/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "illuminate/pipeline", - "description": "The Illuminate Pipeline package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/contracts": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Pipeline\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Queue/BeanstalkdQueue.php b/framework-9.50.2/src/Illuminate/Queue/BeanstalkdQueue.php deleted file mode 100755 index 3f1e0a5..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/BeanstalkdQueue.php +++ /dev/null @@ -1,211 +0,0 @@ -default = $default; - $this->blockFor = $blockFor; - $this->timeToRun = $timeToRun; - $this->pheanstalk = $pheanstalk; - $this->dispatchAfterCommit = $dispatchAfterCommit; - } - - /** - * Get the size of the queue. - * - * @param string|null $queue - * @return int - */ - public function size($queue = null) - { - $queue = $this->getQueue($queue); - - return (int) $this->pheanstalk->statsTube($queue)->current_jobs_ready; - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function push($job, $data = '', $queue = null) - { - return $this->enqueueUsing( - $job, - $this->createPayload($job, $this->getQueue($queue), $data), - $queue, - null, - function ($payload, $queue) { - return $this->pushRaw($payload, $queue); - } - ); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string|null $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = []) - { - return $this->pheanstalk->useTube($this->getQueue($queue))->put( - $payload, Pheanstalk::DEFAULT_PRIORITY, Pheanstalk::DEFAULT_DELAY, $this->timeToRun - ); - } - - /** - * Push a new job onto the queue after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->enqueueUsing( - $job, - $this->createPayload($job, $this->getQueue($queue), $data), - $queue, - $delay, - function ($payload, $queue, $delay) { - return $this->pheanstalk->useTube($this->getQueue($queue))->put( - $payload, - Pheanstalk::DEFAULT_PRIORITY, - $this->secondsUntil($delay), - $this->timeToRun - ); - } - ); - } - - /** - * Push an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string|null $queue - * @return void - */ - public function bulk($jobs, $data = '', $queue = null) - { - foreach ((array) $jobs as $job) { - if (isset($job->delay)) { - $this->later($job->delay, $job, $data, $queue); - } else { - $this->push($job, $data, $queue); - } - } - } - - /** - * Pop the next job off of the queue. - * - * @param string|null $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - $queue = $this->getQueue($queue); - - $job = $this->pheanstalk->watchOnly($queue)->reserveWithTimeout($this->blockFor); - - if ($job instanceof PheanstalkJob) { - return new BeanstalkdJob( - $this->container, $this->pheanstalk, $job, $this->connectionName, $queue - ); - } - } - - /** - * Delete a message from the Beanstalk queue. - * - * @param string $queue - * @param string|int $id - * @return void - */ - public function deleteMessage($queue, $id) - { - $queue = $this->getQueue($queue); - - $this->pheanstalk->useTube($queue)->delete(new PheanstalkJob($id, '')); - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - public function getQueue($queue) - { - return $queue ?: $this->default; - } - - /** - * Get the underlying Pheanstalk instance. - * - * @return \Pheanstalk\Pheanstalk - */ - public function getPheanstalk() - { - return $this->pheanstalk; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/CallQueuedClosure.php b/framework-9.50.2/src/Illuminate/Queue/CallQueuedClosure.php deleted file mode 100644 index 5815552..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/CallQueuedClosure.php +++ /dev/null @@ -1,111 +0,0 @@ -closure = $closure; - } - - /** - * Create a new job instance. - * - * @param \Closure $job - * @return self - */ - public static function create(Closure $job) - { - return new self(new SerializableClosure($job)); - } - - /** - * Execute the job. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function handle(Container $container) - { - $container->call($this->closure->getClosure(), ['job' => $this]); - } - - /** - * Add a callback to be executed if the job fails. - * - * @param callable $callback - * @return $this - */ - public function onFailure($callback) - { - $this->failureCallbacks[] = $callback instanceof Closure - ? new SerializableClosure($callback) - : $callback; - - return $this; - } - - /** - * Handle a job failure. - * - * @param \Throwable $e - * @return void - */ - public function failed($e) - { - foreach ($this->failureCallbacks as $callback) { - $callback($e); - } - } - - /** - * Get the display name for the queued job. - * - * @return string - */ - public function displayName() - { - $reflection = new ReflectionFunction($this->closure->getClosure()); - - return 'Closure ('.basename($reflection->getFileName()).':'.$reflection->getStartLine().')'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/CallQueuedHandler.php b/framework-9.50.2/src/Illuminate/Queue/CallQueuedHandler.php deleted file mode 100644 index 22fe9cc..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/CallQueuedHandler.php +++ /dev/null @@ -1,297 +0,0 @@ -container = $container; - $this->dispatcher = $dispatcher; - } - - /** - * Handle the queued job. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param array $data - * @return void - */ - public function call(Job $job, array $data) - { - try { - $command = $this->setJobInstanceIfNecessary( - $job, $this->getCommand($data) - ); - } catch (ModelNotFoundException $e) { - return $this->handleModelNotFound($job, $e); - } - - if ($command instanceof ShouldBeUniqueUntilProcessing) { - $this->ensureUniqueJobLockIsReleased($command); - } - - $this->dispatchThroughMiddleware($job, $command); - - if (! $job->isReleased() && ! $command instanceof ShouldBeUniqueUntilProcessing) { - $this->ensureUniqueJobLockIsReleased($command); - } - - if (! $job->hasFailed() && ! $job->isReleased()) { - $this->ensureNextJobInChainIsDispatched($command); - $this->ensureSuccessfulBatchJobIsRecorded($command); - } - - if (! $job->isDeletedOrReleased()) { - $job->delete(); - } - } - - /** - * Get the command from the given payload. - * - * @param array $data - * @return mixed - * - * @throws \RuntimeException - */ - protected function getCommand(array $data) - { - if (str_starts_with($data['command'], 'O:')) { - return unserialize($data['command']); - } - - if ($this->container->bound(Encrypter::class)) { - return unserialize($this->container[Encrypter::class]->decrypt($data['command'])); - } - - throw new RuntimeException('Unable to extract job payload.'); - } - - /** - * Dispatch the given job / command through its specified middleware. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param mixed $command - * @return mixed - */ - protected function dispatchThroughMiddleware(Job $job, $command) - { - if ($command instanceof \__PHP_Incomplete_Class) { - throw new Exception('Job is incomplete class: '.json_encode($command)); - } - - return (new Pipeline($this->container))->send($command) - ->through(array_merge(method_exists($command, 'middleware') ? $command->middleware() : [], $command->middleware ?? [])) - ->then(function ($command) use ($job) { - return $this->dispatcher->dispatchNow( - $command, $this->resolveHandler($job, $command) - ); - }); - } - - /** - * Resolve the handler for the given command. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param mixed $command - * @return mixed - */ - protected function resolveHandler($job, $command) - { - $handler = $this->dispatcher->getCommandHandler($command) ?: null; - - if ($handler) { - $this->setJobInstanceIfNecessary($job, $handler); - } - - return $handler; - } - - /** - * Set the job instance of the given class if necessary. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param mixed $instance - * @return mixed - */ - protected function setJobInstanceIfNecessary(Job $job, $instance) - { - if (in_array(InteractsWithQueue::class, class_uses_recursive($instance))) { - $instance->setJob($job); - } - - return $instance; - } - - /** - * Ensure the next job in the chain is dispatched if applicable. - * - * @param mixed $command - * @return void - */ - protected function ensureNextJobInChainIsDispatched($command) - { - if (method_exists($command, 'dispatchNextJobInChain')) { - $command->dispatchNextJobInChain(); - } - } - - /** - * Ensure the batch is notified of the successful job completion. - * - * @param mixed $command - * @return void - */ - protected function ensureSuccessfulBatchJobIsRecorded($command) - { - $uses = class_uses_recursive($command); - - if (! in_array(Batchable::class, $uses) || - ! in_array(InteractsWithQueue::class, $uses)) { - return; - } - - if ($batch = $command->batch()) { - $batch->recordSuccessfulJob($command->job->uuid()); - } - } - - /** - * Ensure the lock for a unique job is released. - * - * @param mixed $command - * @return void - */ - protected function ensureUniqueJobLockIsReleased($command) - { - if ($command instanceof ShouldBeUnique) { - (new UniqueLock($this->container->make(Cache::class)))->release($command); - } - } - - /** - * Handle a model not found exception. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Throwable $e - * @return void - */ - protected function handleModelNotFound(Job $job, $e) - { - $class = $job->resolveName(); - - try { - $shouldDelete = (new ReflectionClass($class)) - ->getDefaultProperties()['deleteWhenMissingModels'] ?? false; - } catch (Exception $e) { - $shouldDelete = false; - } - - if ($shouldDelete) { - return $job->delete(); - } - - return $job->fail($e); - } - - /** - * Call the failed method on the job instance. - * - * The exception that caused the failure will be passed. - * - * @param array $data - * @param \Throwable|null $e - * @param string $uuid - * @return void - */ - public function failed(array $data, $e, string $uuid) - { - $command = $this->getCommand($data); - - if (! $command instanceof ShouldBeUniqueUntilProcessing) { - $this->ensureUniqueJobLockIsReleased($command); - } - - if ($command instanceof \__PHP_Incomplete_Class) { - return; - } - - $this->ensureFailedBatchJobIsRecorded($uuid, $command, $e); - $this->ensureChainCatchCallbacksAreInvoked($uuid, $command, $e); - - if (method_exists($command, 'failed')) { - $command->failed($e); - } - } - - /** - * Ensure the batch is notified of the failed job. - * - * @param string $uuid - * @param mixed $command - * @param \Throwable $e - * @return void - */ - protected function ensureFailedBatchJobIsRecorded(string $uuid, $command, $e) - { - if (! in_array(Batchable::class, class_uses_recursive($command))) { - return; - } - - if ($batch = $command->batch()) { - $batch->recordFailedJob($uuid, $e); - } - } - - /** - * Ensure the chained job catch callbacks are invoked. - * - * @param string $uuid - * @param mixed $command - * @param \Throwable $e - * @return void - */ - protected function ensureChainCatchCallbacksAreInvoked(string $uuid, $command, $e) - { - if (method_exists($command, 'invokeChainCatchCallbacks')) { - $command->invokeChainCatchCallbacks($e); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Capsule/Manager.php b/framework-9.50.2/src/Illuminate/Queue/Capsule/Manager.php deleted file mode 100644 index c5ceb87..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Capsule/Manager.php +++ /dev/null @@ -1,187 +0,0 @@ -setupContainer($container ?: new Container); - - // Once we have the container setup, we will set up the default configuration - // options in the container "config" bindings. This'll just make the queue - // manager behave correctly since all the correct bindings are in place. - $this->setupDefaultConfiguration(); - - $this->setupManager(); - - $this->registerConnectors(); - } - - /** - * Setup the default queue configuration options. - * - * @return void - */ - protected function setupDefaultConfiguration() - { - $this->container['config']['queue.default'] = 'default'; - } - - /** - * Build the queue manager instance. - * - * @return void - */ - protected function setupManager() - { - $this->manager = new QueueManager($this->container); - } - - /** - * Register the default connectors that the component ships with. - * - * @return void - */ - protected function registerConnectors() - { - $provider = new QueueServiceProvider($this->container); - - $provider->registerConnectors($this->manager); - } - - /** - * Get a connection instance from the global manager. - * - * @param string|null $connection - * @return \Illuminate\Contracts\Queue\Queue - */ - public static function connection($connection = null) - { - return static::$instance->getConnection($connection); - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string|null $queue - * @param string|null $connection - * @return mixed - */ - public static function push($job, $data = '', $queue = null, $connection = null) - { - return static::$instance->connection($connection)->push($job, $data, $queue); - } - - /** - * Push a new an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string|null $queue - * @param string|null $connection - * @return mixed - */ - public static function bulk($jobs, $data = '', $queue = null, $connection = null) - { - return static::$instance->connection($connection)->bulk($jobs, $data, $queue); - } - - /** - * Push a new job onto the queue after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string $job - * @param mixed $data - * @param string|null $queue - * @param string|null $connection - * @return mixed - */ - public static function later($delay, $job, $data = '', $queue = null, $connection = null) - { - return static::$instance->connection($connection)->later($delay, $job, $data, $queue); - } - - /** - * Get a registered connection instance. - * - * @param string|null $name - * @return \Illuminate\Contracts\Queue\Queue - */ - public function getConnection($name = null) - { - return $this->manager->connection($name); - } - - /** - * Register a connection with the manager. - * - * @param array $config - * @param string $name - * @return void - */ - public function addConnection(array $config, $name = 'default') - { - $this->container['config']["queue.connections.{$name}"] = $config; - } - - /** - * Get the queue manager instance. - * - * @return \Illuminate\Queue\QueueManager - */ - public function getQueueManager() - { - return $this->manager; - } - - /** - * Pass dynamic instance methods to the manager. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->manager->$method(...$parameters); - } - - /** - * Dynamically pass methods to the default connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public static function __callStatic($method, $parameters) - { - return static::connection()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php b/framework-9.50.2/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php deleted file mode 100755 index fdcdb35..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php +++ /dev/null @@ -1,42 +0,0 @@ -pheanstalk($config), - $config['queue'], - $config['retry_after'] ?? Pheanstalk::DEFAULT_TTR, - $config['block_for'] ?? 0, - $config['after_commit'] ?? null - ); - } - - /** - * Create a Pheanstalk instance. - * - * @param array $config - * @return \Pheanstalk\Pheanstalk - */ - protected function pheanstalk(array $config) - { - return Pheanstalk::create( - $config['host'], - $config['port'] ?? Pheanstalk::DEFAULT_PORT, - $config['timeout'] ?? Connection::DEFAULT_CONNECT_TIMEOUT - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Connectors/ConnectorInterface.php b/framework-9.50.2/src/Illuminate/Queue/Connectors/ConnectorInterface.php deleted file mode 100755 index 617bf09..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Connectors/ConnectorInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -connections = $connections; - } - - /** - * Establish a queue connection. - * - * @param array $config - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connect(array $config) - { - return new DatabaseQueue( - $this->connections->connection($config['connection'] ?? null), - $config['table'], - $config['queue'], - $config['retry_after'] ?? 60, - $config['after_commit'] ?? null - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Connectors/NullConnector.php b/framework-9.50.2/src/Illuminate/Queue/Connectors/NullConnector.php deleted file mode 100644 index 39de480..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Connectors/NullConnector.php +++ /dev/null @@ -1,19 +0,0 @@ -redis = $redis; - $this->connection = $connection; - } - - /** - * Establish a queue connection. - * - * @param array $config - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connect(array $config) - { - return new RedisQueue( - $this->redis, $config['queue'], - $config['connection'] ?? $this->connection, - $config['retry_after'] ?? 60, - $config['block_for'] ?? null, - $config['after_commit'] ?? null, - $config['migration_batch_size'] ?? -1 - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Connectors/SqsConnector.php b/framework-9.50.2/src/Illuminate/Queue/Connectors/SqsConnector.php deleted file mode 100755 index d70bd8e..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Connectors/SqsConnector.php +++ /dev/null @@ -1,52 +0,0 @@ -getDefaultConfiguration($config); - - if (! empty($config['key']) && ! empty($config['secret'])) { - $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); - } - - return new SqsQueue( - new SqsClient( - Arr::except($config, ['token']) - ), - $config['queue'], - $config['prefix'] ?? '', - $config['suffix'] ?? '', - $config['after_commit'] ?? null - ); - } - - /** - * Get the default configuration for SQS. - * - * @param array $config - * @return array - */ - protected function getDefaultConfiguration(array $config) - { - return array_merge([ - 'version' => 'latest', - 'http' => [ - 'timeout' => 60, - 'connect_timeout' => 60, - ], - ], $config); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Connectors/SyncConnector.php b/framework-9.50.2/src/Illuminate/Queue/Connectors/SyncConnector.php deleted file mode 100755 index 4269b80..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Connectors/SyncConnector.php +++ /dev/null @@ -1,19 +0,0 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $table = $this->laravel['config']['queue.batching.table'] ?? 'job_batches'; - - $this->replaceMigration( - $this->createBaseMigration($table), $table - ); - - $this->components->info('Migration created successfully.'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the table. - * - * @param string $table - * @return string - */ - protected function createBaseMigration($table = 'job_batches') - { - return $this->laravel['migration.creator']->create( - 'create_'.$table.'_table', $this->laravel->databasePath().'/migrations' - ); - } - - /** - * Replace the generated migration with the batches job table stub. - * - * @param string $path - * @param string $table - * @return void - */ - protected function replaceMigration($path, $table) - { - $stub = str_replace( - '{{table}}', $table, $this->files->get(__DIR__.'/stubs/batches.stub') - ); - - $this->files->put($path, $stub); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/ClearCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/ClearCommand.php deleted file mode 100644 index 8b48c3e..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/ClearCommand.php +++ /dev/null @@ -1,113 +0,0 @@ -confirmToProceed()) { - return 1; - } - - $connection = $this->argument('connection') - ?: $this->laravel['config']['queue.default']; - - // We need to get the right queue for the connection which is set in the queue - // configuration file for the application. We will pull it based on the set - // connection being run for the queue operation currently being executed. - $queueName = $this->getQueue($connection); - - $queue = $this->laravel['queue']->connection($connection); - - if ($queue instanceof ClearableQueue) { - $count = $queue->clear($queueName); - - $this->components->info('Cleared '.$count.' jobs from the ['.$queueName.'] queue'); - } else { - $this->components->error('Clearing queues is not supported on ['.(new ReflectionClass($queue))->getShortName().']'); - } - - return 0; - } - - /** - * Get the queue name to clear. - * - * @param string $connection - * @return string - */ - protected function getQueue($connection) - { - return $this->option('queue') ?: $this->laravel['config']->get( - "queue.connections.{$connection}.queue", 'default' - ); - } - - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['connection', InputArgument::OPTIONAL, 'The name of the queue connection to clear'], - ]; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['queue', null, InputOption::VALUE_OPTIONAL, 'The name of the queue to clear'], - - ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/FailedTableCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/FailedTableCommand.php deleted file mode 100644 index f3f20cc..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/FailedTableCommand.php +++ /dev/null @@ -1,111 +0,0 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $table = $this->laravel['config']['queue.failed.table']; - - $this->replaceMigration( - $this->createBaseMigration($table), $table - ); - - $this->components->info('Migration created successfully.'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the table. - * - * @param string $table - * @return string - */ - protected function createBaseMigration($table = 'failed_jobs') - { - return $this->laravel['migration.creator']->create( - 'create_'.$table.'_table', $this->laravel->databasePath().'/migrations' - ); - } - - /** - * Replace the generated migration with the failed job table stub. - * - * @param string $path - * @param string $table - * @return void - */ - protected function replaceMigration($path, $table) - { - $stub = str_replace( - '{{table}}', $table, $this->files->get(__DIR__.'/stubs/failed_jobs.stub') - ); - - $this->files->put($path, $stub); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/FlushFailedCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/FlushFailedCommand.php deleted file mode 100644 index 86a5d16..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/FlushFailedCommand.php +++ /dev/null @@ -1,53 +0,0 @@ -laravel['queue.failer']->flush($this->option('hours')); - - if ($this->option('hours')) { - $this->components->info("All jobs that failed more than {$this->option('hours')} hours ago have been deleted successfully."); - - return; - } - - $this->components->info('All failed jobs deleted successfully.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/ForgetFailedCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/ForgetFailedCommand.php deleted file mode 100644 index f4625e1..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/ForgetFailedCommand.php +++ /dev/null @@ -1,49 +0,0 @@ -laravel['queue.failer']->forget($this->argument('id'))) { - $this->components->info('Failed job deleted successfully.'); - } else { - $this->components->error('No failed job matches the given ID.'); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/ListFailedCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/ListFailedCommand.php deleted file mode 100644 index 4ccaf30..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/ListFailedCommand.php +++ /dev/null @@ -1,134 +0,0 @@ -getFailedJobs()) === 0) { - return $this->components->info('No failed jobs found.'); - } - - $this->newLine(); - $this->displayFailedJobs($jobs); - $this->newLine(); - } - - /** - * Compile the failed jobs into a displayable format. - * - * @return array - */ - protected function getFailedJobs() - { - $failed = $this->laravel['queue.failer']->all(); - - return collect($failed)->map(function ($failed) { - return $this->parseFailedJob((array) $failed); - })->filter()->all(); - } - - /** - * Parse the failed job row. - * - * @param array $failed - * @return array - */ - protected function parseFailedJob(array $failed) - { - $row = array_values(Arr::except($failed, ['payload', 'exception'])); - - array_splice($row, 3, 0, $this->extractJobName($failed['payload']) ?: ''); - - return $row; - } - - /** - * Extract the failed job name from payload. - * - * @param string $payload - * @return string|null - */ - private function extractJobName($payload) - { - $payload = json_decode($payload, true); - - if ($payload && (! isset($payload['data']['command']))) { - return $payload['job'] ?? null; - } elseif ($payload && isset($payload['data']['command'])) { - return $this->matchJobName($payload); - } - } - - /** - * Match the job name from the payload. - * - * @param array $payload - * @return string|null - */ - protected function matchJobName($payload) - { - preg_match('/"([^"]+)"/', $payload['data']['command'], $matches); - - return $matches[1] ?? $payload['job'] ?? null; - } - - /** - * Display the failed jobs in the console. - * - * @param array $jobs - * @return void - */ - protected function displayFailedJobs(array $jobs) - { - collect($jobs)->each( - fn ($job) => $this->components->twoColumnDetail( - sprintf('%s %s', $job[4], $job[0]), - sprintf('%s@%s %s', $job[1], $job[2], $job[3]) - ), - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/ListenCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/ListenCommand.php deleted file mode 100755 index 2952c62..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/ListenCommand.php +++ /dev/null @@ -1,141 +0,0 @@ -setOutputHandler($this->listener = $listener); - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - // We need to get the right queue for the connection which is set in the queue - // configuration file for the application. We will pull it based on the set - // connection being run for the queue operation currently being executed. - $queue = $this->getQueue( - $connection = $this->input->getArgument('connection') - ); - - $this->components->info(sprintf('Processing jobs from the [%s] %s.', $queue, str('queue')->plural(explode(',', $queue)))); - - $this->listener->listen( - $connection, $queue, $this->gatherOptions() - ); - } - - /** - * Get the name of the queue connection to listen on. - * - * @param string $connection - * @return string - */ - protected function getQueue($connection) - { - $connection = $connection ?: $this->laravel['config']['queue.default']; - - return $this->input->getOption('queue') ?: $this->laravel['config']->get( - "queue.connections.{$connection}.queue", 'default' - ); - } - - /** - * Get the listener options for the command. - * - * @return \Illuminate\Queue\ListenerOptions - */ - protected function gatherOptions() - { - $backoff = $this->hasOption('backoff') - ? $this->option('backoff') - : $this->option('delay'); - - return new ListenerOptions( - name: $this->option('name'), - environment: $this->option('env'), - backoff: $backoff, - memory: $this->option('memory'), - timeout: $this->option('timeout'), - sleep: $this->option('sleep'), - rest: $this->option('rest'), - maxTries: $this->option('tries'), - force: $this->option('force') - ); - } - - /** - * Set the options on the queue listener. - * - * @param \Illuminate\Queue\Listener $listener - * @return void - */ - protected function setOutputHandler(Listener $listener) - { - $listener->setOutputHandler(function ($type, $line) { - $this->output->write($line); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/MonitorCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/MonitorCommand.php deleted file mode 100644 index 527d6a8..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/MonitorCommand.php +++ /dev/null @@ -1,160 +0,0 @@ -manager = $manager; - $this->events = $events; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $queues = $this->parseQueues($this->argument('queues')); - - $this->displaySizes($queues); - - $this->dispatchEvents($queues); - } - - /** - * Parse the queues into an array of the connections and queues. - * - * @param string $queues - * @return \Illuminate\Support\Collection - */ - protected function parseQueues($queues) - { - return collect(explode(',', $queues))->map(function ($queue) { - [$connection, $queue] = array_pad(explode(':', $queue, 2), 2, null); - - if (! isset($queue)) { - $queue = $connection; - $connection = $this->laravel['config']['queue.default']; - } - - return [ - 'connection' => $connection, - 'queue' => $queue, - 'size' => $size = $this->manager->connection($connection)->size($queue), - 'status' => $size >= $this->option('max') ? 'ALERT' : 'OK', - ]; - }); - } - - /** - * Display the queue sizes in the console. - * - * @param \Illuminate\Support\Collection $queues - * @return void - */ - protected function displaySizes(Collection $queues) - { - $this->newLine(); - - $this->components->twoColumnDetail('Queue name', 'Size / Status'); - - $queues->each(function ($queue) { - $status = '['.$queue['size'].'] '.$queue['status']; - - $this->components->twoColumnDetail($queue['queue'], $status); - }); - - $this->newLine(); - } - - /** - * Fire the monitoring events. - * - * @param \Illuminate\Support\Collection $queues - * @return void - */ - protected function dispatchEvents(Collection $queues) - { - foreach ($queues as $queue) { - if ($queue['status'] == 'OK') { - continue; - } - - $this->events->dispatch( - new QueueBusy( - $queue['connection'], - $queue['queue'], - $queue['size'], - ) - ); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/PruneBatchesCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/PruneBatchesCommand.php deleted file mode 100644 index 5e2d323..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/PruneBatchesCommand.php +++ /dev/null @@ -1,80 +0,0 @@ -laravel[BatchRepository::class]; - - $count = 0; - - if ($repository instanceof PrunableBatchRepository) { - $count = $repository->prune(Carbon::now()->subHours($this->option('hours'))); - } - - $this->components->info("{$count} entries deleted."); - - if ($this->option('unfinished')) { - $count = 0; - - if ($repository instanceof DatabaseBatchRepository) { - $count = $repository->pruneUnfinished(Carbon::now()->subHours($this->option('unfinished'))); - } - - $this->components->info("{$count} unfinished entries deleted."); - } - - if ($this->option('cancelled')) { - $count = 0; - - if ($repository instanceof DatabaseBatchRepository) { - $count = $repository->pruneCancelled(Carbon::now()->subHours($this->option('cancelled'))); - } - - $this->components->info("{$count} cancelled entries deleted."); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/PruneFailedJobsCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/PruneFailedJobsCommand.php deleted file mode 100644 index 61f7903..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/PruneFailedJobsCommand.php +++ /dev/null @@ -1,58 +0,0 @@ -laravel['queue.failer']; - - if ($failer instanceof PrunableFailedJobProvider) { - $count = $failer->prune(Carbon::now()->subHours($this->option('hours'))); - } else { - $this->components->error('The ['.class_basename($failer).'] failed job storage driver does not support pruning.'); - - return 1; - } - - $this->components->info("{$count} entries deleted."); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/RestartCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/RestartCommand.php deleted file mode 100644 index 6dfbcb1..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/RestartCommand.php +++ /dev/null @@ -1,71 +0,0 @@ -cache = $cache; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $this->cache->forever('illuminate:queue:restart', $this->currentTime()); - - $this->components->info('Broadcasting queue restart signal.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/RetryBatchCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/RetryBatchCommand.php deleted file mode 100644 index b99e002..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/RetryBatchCommand.php +++ /dev/null @@ -1,64 +0,0 @@ -laravel[BatchRepository::class]->find($id = $this->argument('id')); - - if (! $batch) { - $this->components->error("Unable to find a batch with ID [{$id}]."); - - return 1; - } elseif (empty($batch->failedJobIds)) { - $this->components->error('The given batch does not contain any failed jobs.'); - - return 1; - } - - $this->components->info("Pushing failed queue jobs of the batch [$id] back onto the queue."); - - foreach ($batch->failedJobIds as $failedJobId) { - $this->components->task($failedJobId, fn () => $this->callSilent('queue:retry', ['id' => $failedJobId]) == 0); - } - - $this->newLine(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/RetryCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/RetryCommand.php deleted file mode 100644 index ef6a5ed..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/RetryCommand.php +++ /dev/null @@ -1,205 +0,0 @@ -getJobIds()) > 0; - - if ($jobsFound) { - $this->components->info('Pushing failed queue jobs back onto the queue.'); - } - - foreach ($ids as $id) { - $job = $this->laravel['queue.failer']->find($id); - - if (is_null($job)) { - $this->components->error("Unable to find failed job with ID [{$id}]."); - } else { - $this->laravel['events']->dispatch(new JobRetryRequested($job)); - - $this->components->task($id, fn () => $this->retryJob($job)); - - $this->laravel['queue.failer']->forget($id); - } - } - - $jobsFound ? $this->newLine() : $this->components->info('No retryable jobs found.'); - } - - /** - * Get the job IDs to be retried. - * - * @return array - */ - protected function getJobIds() - { - $ids = (array) $this->argument('id'); - - if (count($ids) === 1 && $ids[0] === 'all') { - return Arr::pluck($this->laravel['queue.failer']->all(), 'id'); - } - - if ($queue = $this->option('queue')) { - return $this->getJobIdsByQueue($queue); - } - - if ($ranges = (array) $this->option('range')) { - $ids = array_merge($ids, $this->getJobIdsByRanges($ranges)); - } - - return array_values(array_filter(array_unique($ids))); - } - - /** - * Get the job IDs by queue, if applicable. - * - * @param string $queue - * @return array - */ - protected function getJobIdsByQueue($queue) - { - $ids = collect($this->laravel['queue.failer']->all()) - ->where('queue', $queue) - ->pluck('id') - ->toArray(); - - if (count($ids) === 0) { - $this->components->error("Unable to find failed jobs for queue [{$queue}]."); - } - - return $ids; - } - - /** - * Get the job IDs ranges, if applicable. - * - * @param array $ranges - * @return array - */ - protected function getJobIdsByRanges(array $ranges) - { - $ids = []; - - foreach ($ranges as $range) { - if (preg_match('/^[0-9]+\-[0-9]+$/', $range)) { - $ids = array_merge($ids, range(...explode('-', $range))); - } - } - - return $ids; - } - - /** - * Retry the queue job. - * - * @param \stdClass $job - * @return void - */ - protected function retryJob($job) - { - $this->laravel['queue']->connection($job->connection)->pushRaw( - $this->refreshRetryUntil($this->resetAttempts($job->payload)), $job->queue - ); - } - - /** - * Reset the payload attempts. - * - * Applicable to Redis and other jobs which store attempts in their payload. - * - * @param string $payload - * @return string - */ - protected function resetAttempts($payload) - { - $payload = json_decode($payload, true); - - if (isset($payload['attempts'])) { - $payload['attempts'] = 0; - } - - return json_encode($payload); - } - - /** - * Refresh the "retry until" timestamp for the job. - * - * @param string $payload - * @return string - * - * @throws \RuntimeException - */ - protected function refreshRetryUntil($payload) - { - $payload = json_decode($payload, true); - - if (! isset($payload['data']['command'])) { - return json_encode($payload); - } - - if (str_starts_with($payload['data']['command'], 'O:')) { - $instance = unserialize($payload['data']['command']); - } elseif ($this->laravel->bound(Encrypter::class)) { - $instance = unserialize($this->laravel->make(Encrypter::class)->decrypt($payload['data']['command'])); - } - - if (! isset($instance)) { - throw new RuntimeException('Unable to extract job payload.'); - } - - if (is_object($instance) && ! $instance instanceof \__PHP_Incomplete_Class && method_exists($instance, 'retryUntil')) { - $retryUntil = $instance->retryUntil(); - - $payload['retryUntil'] = $retryUntil instanceof DateTimeInterface - ? $retryUntil->getTimestamp() - : $retryUntil; - } - - return json_encode($payload); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/TableCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/TableCommand.php deleted file mode 100644 index aa25daf..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/TableCommand.php +++ /dev/null @@ -1,111 +0,0 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $table = $this->laravel['config']['queue.connections.database.table']; - - $this->replaceMigration( - $this->createBaseMigration($table), $table - ); - - $this->components->info('Migration created successfully.'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the table. - * - * @param string $table - * @return string - */ - protected function createBaseMigration($table = 'jobs') - { - return $this->laravel['migration.creator']->create( - 'create_'.$table.'_table', $this->laravel->databasePath().'/migrations' - ); - } - - /** - * Replace the generated migration with the job table stub. - * - * @param string $path - * @param string $table - * @return void - */ - protected function replaceMigration($path, $table) - { - $stub = str_replace( - '{{table}}', $table, $this->files->get(__DIR__.'/stubs/jobs.stub') - ); - - $this->files->put($path, $stub); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/WorkCommand.php b/framework-9.50.2/src/Illuminate/Queue/Console/WorkCommand.php deleted file mode 100644 index 77e8221..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/WorkCommand.php +++ /dev/null @@ -1,300 +0,0 @@ -cache = $cache; - $this->worker = $worker; - } - - /** - * Execute the console command. - * - * @return int|null - */ - public function handle() - { - if ($this->downForMaintenance() && $this->option('once')) { - return $this->worker->sleep($this->option('sleep')); - } - - // We'll listen to the processed and failed events so we can write information - // to the console as jobs are processed, which will let the developer watch - // which jobs are coming through a queue and be informed on its progress. - $this->listenForEvents(); - - $connection = $this->argument('connection') - ?: $this->laravel['config']['queue.default']; - - // We need to get the right queue for the connection which is set in the queue - // configuration file for the application. We will pull it based on the set - // connection being run for the queue operation currently being executed. - $queue = $this->getQueue($connection); - - if (Terminal::hasSttyAvailable()) { - $this->components->info( - sprintf('Processing jobs from the [%s] %s.', $queue, str('queue')->plural(explode(',', $queue))) - ); - } - - return $this->runWorker( - $connection, $queue - ); - } - - /** - * Run the worker instance. - * - * @param string $connection - * @param string $queue - * @return int|null - */ - protected function runWorker($connection, $queue) - { - return $this->worker - ->setName($this->option('name')) - ->setCache($this->cache) - ->{$this->option('once') ? 'runNextJob' : 'daemon'}( - $connection, $queue, $this->gatherWorkerOptions() - ); - } - - /** - * Gather all of the queue worker options as a single object. - * - * @return \Illuminate\Queue\WorkerOptions - */ - protected function gatherWorkerOptions() - { - return new WorkerOptions( - $this->option('name'), - max($this->option('backoff'), $this->option('delay')), - $this->option('memory'), - $this->option('timeout'), - $this->option('sleep'), - $this->option('tries'), - $this->option('force'), - $this->option('stop-when-empty'), - $this->option('max-jobs'), - $this->option('max-time'), - $this->option('rest') - ); - } - - /** - * Listen for the queue events in order to update the console output. - * - * @return void - */ - protected function listenForEvents() - { - $this->laravel['events']->listen(JobProcessing::class, function ($event) { - $this->writeOutput($event->job, 'starting'); - }); - - $this->laravel['events']->listen(JobProcessed::class, function ($event) { - $this->writeOutput($event->job, 'success'); - }); - - $this->laravel['events']->listen(JobReleasedAfterException::class, function ($event) { - $this->writeOutput($event->job, 'released_after_exception'); - }); - - $this->laravel['events']->listen(JobFailed::class, function ($event) { - $this->writeOutput($event->job, 'failed'); - - $this->logFailedJob($event); - }); - } - - /** - * Write the status output for the queue worker. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param string $status - * @return void - */ - protected function writeOutput(Job $job, $status) - { - $this->output->write(sprintf( - ' %s %s%s', - $this->now()->format('Y-m-d H:i:s'), - $job->resolveName(), - $this->output->isVerbose() - ? sprintf(' %s', $job->getJobId()) - : '' - )); - - if ($status == 'starting') { - $this->latestStartedAt = microtime(true); - - $dots = max(terminal()->width() - mb_strlen($job->resolveName()) - ( - $this->output->isVerbose() ? (mb_strlen($job->getJobId()) + 1) : 0 - ) - 33, 0); - - $this->output->write(' '.str_repeat('.', $dots)); - - return $this->output->writeln(' RUNNING'); - } - - $runTime = number_format((microtime(true) - $this->latestStartedAt) * 1000, 2).'ms'; - - $dots = max(terminal()->width() - mb_strlen($job->resolveName()) - ( - $this->output->isVerbose() ? (mb_strlen($job->getJobId()) + 1) : 0 - ) - mb_strlen($runTime) - 31, 0); - - $this->output->write(' '.str_repeat('.', $dots)); - $this->output->write(" $runTime"); - - $this->output->writeln(match ($status) { - 'success' => ' DONE', - 'released_after_exception' => ' FAIL', - default => ' FAIL', - }); - } - - /** - * Get the current date / time. - * - * @return \Illuminate\Support\Carbon - */ - protected function now() - { - $queueTimezone = $this->laravel['config']->get('queue.output_timezone'); - - if ($queueTimezone && - $queueTimezone !== $this->laravel['config']->get('app.timezone')) { - return Carbon::now()->setTimezone($queueTimezone); - } - - return Carbon::now(); - } - - /** - * Store a failed job event. - * - * @param \Illuminate\Queue\Events\JobFailed $event - * @return void - */ - protected function logFailedJob(JobFailed $event) - { - $this->laravel['queue.failer']->log( - $event->connectionName, - $event->job->getQueue(), - $event->job->getRawBody(), - $event->exception - ); - } - - /** - * Get the queue name for the worker. - * - * @param string $connection - * @return string - */ - protected function getQueue($connection) - { - return $this->option('queue') ?: $this->laravel['config']->get( - "queue.connections.{$connection}.queue", 'default' - ); - } - - /** - * Determine if the worker should run in maintenance mode. - * - * @return bool - */ - protected function downForMaintenance() - { - return $this->option('force') ? false : $this->laravel->isDownForMaintenance(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/stubs/batches.stub b/framework-9.50.2/src/Illuminate/Queue/Console/stubs/batches.stub deleted file mode 100644 index c3ff231..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/stubs/batches.stub +++ /dev/null @@ -1,39 +0,0 @@ -string('id')->primary(); - $table->string('name'); - $table->integer('total_jobs'); - $table->integer('pending_jobs'); - $table->integer('failed_jobs'); - $table->longText('failed_job_ids'); - $table->mediumText('options')->nullable(); - $table->integer('cancelled_at')->nullable(); - $table->integer('created_at'); - $table->integer('finished_at')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('{{table}}'); - } -}; diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/stubs/failed_jobs.stub b/framework-9.50.2/src/Illuminate/Queue/Console/stubs/failed_jobs.stub deleted file mode 100644 index c804dd6..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/stubs/failed_jobs.stub +++ /dev/null @@ -1,36 +0,0 @@ -id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('{{table}}'); - } -}; diff --git a/framework-9.50.2/src/Illuminate/Queue/Console/stubs/jobs.stub b/framework-9.50.2/src/Illuminate/Queue/Console/stubs/jobs.stub deleted file mode 100644 index 5ea6d0c..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Console/stubs/jobs.stub +++ /dev/null @@ -1,36 +0,0 @@ -bigIncrements('id'); - $table->string('queue')->index(); - $table->longText('payload'); - $table->unsignedTinyInteger('attempts'); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('{{table}}'); - } -}; diff --git a/framework-9.50.2/src/Illuminate/Queue/DatabaseQueue.php b/framework-9.50.2/src/Illuminate/Queue/DatabaseQueue.php deleted file mode 100644 index bce025c..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/DatabaseQueue.php +++ /dev/null @@ -1,413 +0,0 @@ -table = $table; - $this->default = $default; - $this->database = $database; - $this->retryAfter = $retryAfter; - $this->dispatchAfterCommit = $dispatchAfterCommit; - } - - /** - * Get the size of the queue. - * - * @param string|null $queue - * @return int - */ - public function size($queue = null) - { - return $this->database->table($this->table) - ->where('queue', $this->getQueue($queue)) - ->count(); - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function push($job, $data = '', $queue = null) - { - return $this->enqueueUsing( - $job, - $this->createPayload($job, $this->getQueue($queue), $data), - $queue, - null, - function ($payload, $queue) { - return $this->pushToDatabase($queue, $payload); - } - ); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string|null $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = []) - { - return $this->pushToDatabase($queue, $payload); - } - - /** - * Push a new job onto the queue after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string $job - * @param mixed $data - * @param string|null $queue - * @return void - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->enqueueUsing( - $job, - $this->createPayload($job, $this->getQueue($queue), $data), - $queue, - $delay, - function ($payload, $queue, $delay) { - return $this->pushToDatabase($queue, $payload, $delay); - } - ); - } - - /** - * Push an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function bulk($jobs, $data = '', $queue = null) - { - $queue = $this->getQueue($queue); - - $now = $this->availableAt(); - - return $this->database->table($this->table)->insert(collect((array) $jobs)->map( - function ($job) use ($queue, $data, $now) { - return $this->buildDatabaseRecord( - $queue, - $this->createPayload($job, $this->getQueue($queue), $data), - isset($job->delay) ? $this->availableAt($job->delay) : $now, - ); - } - )->all()); - } - - /** - * Release a reserved job back onto the queue after (n) seconds. - * - * @param string $queue - * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job - * @param int $delay - * @return mixed - */ - public function release($queue, $job, $delay) - { - return $this->pushToDatabase($queue, $job->payload, $delay, $job->attempts); - } - - /** - * Push a raw payload to the database with a given delay of (n) seconds. - * - * @param string|null $queue - * @param string $payload - * @param \DateTimeInterface|\DateInterval|int $delay - * @param int $attempts - * @return mixed - */ - protected function pushToDatabase($queue, $payload, $delay = 0, $attempts = 0) - { - return $this->database->table($this->table)->insertGetId($this->buildDatabaseRecord( - $this->getQueue($queue), $payload, $this->availableAt($delay), $attempts - )); - } - - /** - * Create an array to insert for the given job. - * - * @param string|null $queue - * @param string $payload - * @param int $availableAt - * @param int $attempts - * @return array - */ - protected function buildDatabaseRecord($queue, $payload, $availableAt, $attempts = 0) - { - return [ - 'queue' => $queue, - 'attempts' => $attempts, - 'reserved_at' => null, - 'available_at' => $availableAt, - 'created_at' => $this->currentTime(), - 'payload' => $payload, - ]; - } - - /** - * Pop the next job off of the queue. - * - * @param string|null $queue - * @return \Illuminate\Contracts\Queue\Job|null - * - * @throws \Throwable - */ - public function pop($queue = null) - { - $queue = $this->getQueue($queue); - - return $this->database->transaction(function () use ($queue) { - if ($job = $this->getNextAvailableJob($queue)) { - return $this->marshalJob($queue, $job); - } - }); - } - - /** - * Get the next available job for the queue. - * - * @param string|null $queue - * @return \Illuminate\Queue\Jobs\DatabaseJobRecord|null - */ - protected function getNextAvailableJob($queue) - { - $job = $this->database->table($this->table) - ->lock($this->getLockForPopping()) - ->where('queue', $this->getQueue($queue)) - ->where(function ($query) { - $this->isAvailable($query); - $this->isReservedButExpired($query); - }) - ->orderBy('id', 'asc') - ->first(); - - return $job ? new DatabaseJobRecord((object) $job) : null; - } - - /** - * Get the lock required for popping the next job. - * - * @return string|bool - */ - protected function getLockForPopping() - { - $databaseEngine = $this->database->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME); - $databaseVersion = $this->database->getConfig('version') ?? $this->database->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION); - - if (Str::of($databaseVersion)->contains('MariaDB')) { - $databaseEngine = 'mariadb'; - $databaseVersion = Str::before(Str::after($databaseVersion, '5.5.5-'), '-'); - } elseif (Str::of($databaseVersion)->contains(['vitess', 'PlanetScale'])) { - $databaseEngine = 'vitess'; - $databaseVersion = Str::before($databaseVersion, '-'); - } - - if (($databaseEngine === 'mysql' && version_compare($databaseVersion, '8.0.1', '>=')) || - ($databaseEngine === 'mariadb' && version_compare($databaseVersion, '10.6.0', '>=')) || - ($databaseEngine === 'pgsql' && version_compare($databaseVersion, '9.5', '>='))) { - return 'FOR UPDATE SKIP LOCKED'; - } - - if ($databaseEngine === 'sqlsrv') { - return 'with(rowlock,updlock,readpast)'; - } - - return true; - } - - /** - * Modify the query to check for available jobs. - * - * @param \Illuminate\Database\Query\Builder $query - * @return void - */ - protected function isAvailable($query) - { - $query->where(function ($query) { - $query->whereNull('reserved_at') - ->where('available_at', '<=', $this->currentTime()); - }); - } - - /** - * Modify the query to check for jobs that are reserved but have expired. - * - * @param \Illuminate\Database\Query\Builder $query - * @return void - */ - protected function isReservedButExpired($query) - { - $expiration = Carbon::now()->subSeconds($this->retryAfter)->getTimestamp(); - - $query->orWhere(function ($query) use ($expiration) { - $query->where('reserved_at', '<=', $expiration); - }); - } - - /** - * Marshal the reserved job into a DatabaseJob instance. - * - * @param string $queue - * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job - * @return \Illuminate\Queue\Jobs\DatabaseJob - */ - protected function marshalJob($queue, $job) - { - $job = $this->markJobAsReserved($job); - - return new DatabaseJob( - $this->container, $this, $job, $this->connectionName, $queue - ); - } - - /** - * Mark the given job ID as reserved. - * - * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job - * @return \Illuminate\Queue\Jobs\DatabaseJobRecord - */ - protected function markJobAsReserved($job) - { - $this->database->table($this->table)->where('id', $job->id)->update([ - 'reserved_at' => $job->touch(), - 'attempts' => $job->increment(), - ]); - - return $job; - } - - /** - * Delete a reserved job from the queue. - * - * @param string $queue - * @param string $id - * @return void - * - * @throws \Throwable - */ - public function deleteReserved($queue, $id) - { - $this->database->transaction(function () use ($id) { - if ($this->database->table($this->table)->lockForUpdate()->find($id)) { - $this->database->table($this->table)->where('id', $id)->delete(); - } - }); - } - - /** - * Delete a reserved job from the reserved queue and release it. - * - * @param string $queue - * @param \Illuminate\Queue\Jobs\DatabaseJob $job - * @param int $delay - * @return void - */ - public function deleteAndRelease($queue, $job, $delay) - { - $this->database->transaction(function () use ($queue, $job, $delay) { - if ($this->database->table($this->table)->lockForUpdate()->find($job->getJobId())) { - $this->database->table($this->table)->where('id', $job->getJobId())->delete(); - } - - $this->release($queue, $job->getJobRecord(), $delay); - }); - } - - /** - * Delete all of the jobs from the queue. - * - * @param string $queue - * @return int - */ - public function clear($queue) - { - return $this->database->table($this->table) - ->where('queue', $this->getQueue($queue)) - ->delete(); - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - public function getQueue($queue) - { - return $queue ?: $this->default; - } - - /** - * Get the underlying database instance. - * - * @return \Illuminate\Database\Connection - */ - public function getDatabase() - { - return $this->database; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/JobExceptionOccurred.php b/framework-9.50.2/src/Illuminate/Queue/Events/JobExceptionOccurred.php deleted file mode 100644 index 4bdf392..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/JobExceptionOccurred.php +++ /dev/null @@ -1,42 +0,0 @@ -job = $job; - $this->exception = $exception; - $this->connectionName = $connectionName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/JobFailed.php b/framework-9.50.2/src/Illuminate/Queue/Events/JobFailed.php deleted file mode 100644 index d973a50..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/JobFailed.php +++ /dev/null @@ -1,42 +0,0 @@ -job = $job; - $this->exception = $exception; - $this->connectionName = $connectionName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/JobProcessed.php b/framework-9.50.2/src/Illuminate/Queue/Events/JobProcessed.php deleted file mode 100644 index f8abefb..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/JobProcessed.php +++ /dev/null @@ -1,33 +0,0 @@ -job = $job; - $this->connectionName = $connectionName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/JobProcessing.php b/framework-9.50.2/src/Illuminate/Queue/Events/JobProcessing.php deleted file mode 100644 index 3dd9724..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/JobProcessing.php +++ /dev/null @@ -1,33 +0,0 @@ -job = $job; - $this->connectionName = $connectionName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/JobQueued.php b/framework-9.50.2/src/Illuminate/Queue/Events/JobQueued.php deleted file mode 100644 index c91d140..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/JobQueued.php +++ /dev/null @@ -1,42 +0,0 @@ -connectionName = $connectionName; - $this->id = $id; - $this->job = $job; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/JobReleasedAfterException.php b/framework-9.50.2/src/Illuminate/Queue/Events/JobReleasedAfterException.php deleted file mode 100644 index 4600c0b..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/JobReleasedAfterException.php +++ /dev/null @@ -1,33 +0,0 @@ -job = $job; - $this->connectionName = $connectionName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/JobRetryRequested.php b/framework-9.50.2/src/Illuminate/Queue/Events/JobRetryRequested.php deleted file mode 100644 index 9b9809f..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/JobRetryRequested.php +++ /dev/null @@ -1,45 +0,0 @@ -job = $job; - } - - /** - * The job payload. - * - * @return array - */ - public function payload() - { - if (is_null($this->payload)) { - $this->payload = json_decode($this->job->payload, true); - } - - return $this->payload; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/Looping.php b/framework-9.50.2/src/Illuminate/Queue/Events/Looping.php deleted file mode 100644 index f9538e4..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/Looping.php +++ /dev/null @@ -1,33 +0,0 @@ -queue = $queue; - $this->connectionName = $connectionName; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/QueueBusy.php b/framework-9.50.2/src/Illuminate/Queue/Events/QueueBusy.php deleted file mode 100644 index 684dec4..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/QueueBusy.php +++ /dev/null @@ -1,42 +0,0 @@ -connection = $connection; - $this->queue = $queue; - $this->size = $size; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Events/WorkerStopping.php b/framework-9.50.2/src/Illuminate/Queue/Events/WorkerStopping.php deleted file mode 100644 index ccebb3c..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Events/WorkerStopping.php +++ /dev/null @@ -1,33 +0,0 @@ -status = $status; - $this->workerOptions = $workerOptions; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php b/framework-9.50.2/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php deleted file mode 100644 index 5793c76..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php +++ /dev/null @@ -1,142 +0,0 @@ -table = $table; - $this->resolver = $resolver; - $this->database = $database; - } - - /** - * Log a failed job into storage. - * - * @param string $connection - * @param string $queue - * @param string $payload - * @param \Throwable $exception - * @return int|null - */ - public function log($connection, $queue, $payload, $exception) - { - $failed_at = Date::now(); - - $exception = (string) mb_convert_encoding($exception, 'UTF-8'); - - return $this->getTable()->insertGetId(compact( - 'connection', 'queue', 'payload', 'exception', 'failed_at' - )); - } - - /** - * Get a list of all of the failed jobs. - * - * @return array - */ - public function all() - { - return $this->getTable()->orderBy('id', 'desc')->get()->all(); - } - - /** - * Get a single failed job. - * - * @param mixed $id - * @return object|null - */ - public function find($id) - { - return $this->getTable()->find($id); - } - - /** - * Delete a single failed job from storage. - * - * @param mixed $id - * @return bool - */ - public function forget($id) - { - return $this->getTable()->where('id', $id)->delete() > 0; - } - - /** - * Flush all of the failed jobs from storage. - * - * @param int|null $hours - * @return void - */ - public function flush($hours = null) - { - $this->getTable()->when($hours, function ($query, $hours) { - $query->where('failed_at', '<=', Date::now()->subHours($hours)); - })->delete(); - } - - /** - * Prune all of the entries older than the given date. - * - * @param \DateTimeInterface $before - * @return int - */ - public function prune(DateTimeInterface $before) - { - $query = $this->getTable()->where('failed_at', '<', $before); - - $totalDeleted = 0; - - do { - $deleted = $query->take(1000)->delete(); - - $totalDeleted += $deleted; - } while ($deleted !== 0); - - return $totalDeleted; - } - - /** - * Get a new query builder instance for the table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function getTable() - { - return $this->resolver->connection($this->database)->table($this->table); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Failed/DatabaseUuidFailedJobProvider.php b/framework-9.50.2/src/Illuminate/Queue/Failed/DatabaseUuidFailedJobProvider.php deleted file mode 100644 index c676faa..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Failed/DatabaseUuidFailedJobProvider.php +++ /dev/null @@ -1,155 +0,0 @@ -table = $table; - $this->resolver = $resolver; - $this->database = $database; - } - - /** - * Log a failed job into storage. - * - * @param string $connection - * @param string $queue - * @param string $payload - * @param \Throwable $exception - * @return string|null - */ - public function log($connection, $queue, $payload, $exception) - { - $this->getTable()->insert([ - 'uuid' => $uuid = json_decode($payload, true)['uuid'], - 'connection' => $connection, - 'queue' => $queue, - 'payload' => $payload, - 'exception' => (string) mb_convert_encoding($exception, 'UTF-8'), - 'failed_at' => Date::now(), - ]); - - return $uuid; - } - - /** - * Get a list of all of the failed jobs. - * - * @return array - */ - public function all() - { - return $this->getTable()->orderBy('id', 'desc')->get()->map(function ($record) { - $record->id = $record->uuid; - unset($record->uuid); - - return $record; - })->all(); - } - - /** - * Get a single failed job. - * - * @param mixed $id - * @return object|null - */ - public function find($id) - { - if ($record = $this->getTable()->where('uuid', $id)->first()) { - $record->id = $record->uuid; - unset($record->uuid); - } - - return $record; - } - - /** - * Delete a single failed job from storage. - * - * @param mixed $id - * @return bool - */ - public function forget($id) - { - return $this->getTable()->where('uuid', $id)->delete() > 0; - } - - /** - * Flush all of the failed jobs from storage. - * - * @param int|null $hours - * @return void - */ - public function flush($hours = null) - { - $this->getTable()->when($hours, function ($query, $hours) { - $query->where('failed_at', '<=', Date::now()->subHours($hours)); - })->delete(); - } - - /** - * Prune all of the entries older than the given date. - * - * @param \DateTimeInterface $before - * @return int - */ - public function prune(DateTimeInterface $before) - { - $query = $this->getTable()->where('failed_at', '<', $before); - - $totalDeleted = 0; - - do { - $deleted = $query->take(1000)->delete(); - - $totalDeleted += $deleted; - } while ($deleted !== 0); - - return $totalDeleted; - } - - /** - * Get a new query builder instance for the table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function getTable() - { - return $this->resolver->connection($this->database)->table($this->table); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php b/framework-9.50.2/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php deleted file mode 100644 index 2feeaa9..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php +++ /dev/null @@ -1,177 +0,0 @@ -table = $table; - $this->dynamo = $dynamo; - $this->applicationName = $applicationName; - } - - /** - * Log a failed job into storage. - * - * @param string $connection - * @param string $queue - * @param string $payload - * @param \Throwable $exception - * @return string|int|null - */ - public function log($connection, $queue, $payload, $exception) - { - $id = json_decode($payload, true)['uuid']; - - $failedAt = Date::now(); - - $this->dynamo->putItem([ - 'TableName' => $this->table, - 'Item' => [ - 'application' => ['S' => $this->applicationName], - 'uuid' => ['S' => $id], - 'connection' => ['S' => $connection], - 'queue' => ['S' => $queue], - 'payload' => ['S' => $payload], - 'exception' => ['S' => (string) $exception], - 'failed_at' => ['N' => (string) $failedAt->getTimestamp()], - 'expires_at' => ['N' => (string) $failedAt->addDays(3)->getTimestamp()], - ], - ]); - - return $id; - } - - /** - * Get a list of all of the failed jobs. - * - * @return array - */ - public function all() - { - $results = $this->dynamo->query([ - 'TableName' => $this->table, - 'Select' => 'ALL_ATTRIBUTES', - 'KeyConditionExpression' => 'application = :application', - 'ExpressionAttributeValues' => [ - ':application' => ['S' => $this->applicationName], - ], - 'ScanIndexForward' => false, - ]); - - return collect($results['Items'])->sortByDesc(function ($result) { - return (int) $result['failed_at']['N']; - })->map(function ($result) { - return (object) [ - 'id' => $result['uuid']['S'], - 'connection' => $result['connection']['S'], - 'queue' => $result['queue']['S'], - 'payload' => $result['payload']['S'], - 'exception' => $result['exception']['S'], - 'failed_at' => Carbon::createFromTimestamp( - (int) $result['failed_at']['N'] - )->format(DateTimeInterface::ISO8601), - ]; - })->all(); - } - - /** - * Get a single failed job. - * - * @param mixed $id - * @return object|null - */ - public function find($id) - { - $result = $this->dynamo->getItem([ - 'TableName' => $this->table, - 'Key' => [ - 'application' => ['S' => $this->applicationName], - 'uuid' => ['S' => $id], - ], - ]); - - if (! isset($result['Item'])) { - return; - } - - return (object) [ - 'id' => $result['Item']['uuid']['S'], - 'connection' => $result['Item']['connection']['S'], - 'queue' => $result['Item']['queue']['S'], - 'payload' => $result['Item']['payload']['S'], - 'exception' => $result['Item']['exception']['S'], - 'failed_at' => Carbon::createFromTimestamp( - (int) $result['Item']['failed_at']['N'] - )->format(DateTimeInterface::ISO8601), - ]; - } - - /** - * Delete a single failed job from storage. - * - * @param mixed $id - * @return bool - */ - public function forget($id) - { - $this->dynamo->deleteItem([ - 'TableName' => $this->table, - 'Key' => [ - 'application' => ['S' => $this->applicationName], - 'uuid' => ['S' => $id], - ], - ]); - - return true; - } - - /** - * Flush all of the failed jobs from storage. - * - * @param int|null $hours - * @return void - * - * @throws \Exception - */ - public function flush($hours = null) - { - throw new Exception("DynamoDb failed job storage may not be flushed. Please use DynamoDb's TTL features on your expires_at attribute."); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php b/framework-9.50.2/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php deleted file mode 100644 index 26dd583..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php +++ /dev/null @@ -1,48 +0,0 @@ -job ? $this->job->attempts() : 1; - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - if ($this->job) { - return $this->job->delete(); - } - } - - /** - * Fail the job from the queue. - * - * @param \Throwable|string|null $exception - * @return void - */ - public function fail($exception = null) - { - if (is_string($exception)) { - $exception = new ManuallyFailedException($exception); - } - - if ($exception instanceof Throwable || is_null($exception)) { - if ($this->job) { - return $this->job->fail($exception); - } - } else { - throw new InvalidArgumentException('The fail method requires a string or an instance of Throwable.'); - } - } - - /** - * Release the job back into the queue after (n) seconds. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - if ($this->job) { - return $this->job->release($delay); - } - } - - /** - * Set the base queue job instance. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @return $this - */ - public function setJob(JobContract $job) - { - $this->job = $job; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/InvalidPayloadException.php b/framework-9.50.2/src/Illuminate/Queue/InvalidPayloadException.php deleted file mode 100644 index 788fa66..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/InvalidPayloadException.php +++ /dev/null @@ -1,19 +0,0 @@ -job = $job; - $this->queue = $queue; - $this->container = $container; - $this->pheanstalk = $pheanstalk; - $this->connectionName = $connectionName; - } - - /** - * Release the job back into the queue after (n) seconds. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - $priority = Pheanstalk::DEFAULT_PRIORITY; - - $this->pheanstalk->release($this->job, $priority, $delay); - } - - /** - * Bury the job in the queue. - * - * @return void - */ - public function bury() - { - parent::release(); - - $this->pheanstalk->bury($this->job); - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - $this->pheanstalk->delete($this->job); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - $stats = $this->pheanstalk->statsJob($this->job); - - return (int) $stats->reserves; - } - - /** - * Get the job identifier. - * - * @return int - */ - public function getJobId() - { - return $this->job->getId(); - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job->getData(); - } - - /** - * Get the underlying Pheanstalk instance. - * - * @return \Pheanstalk\Pheanstalk - */ - public function getPheanstalk() - { - return $this->pheanstalk; - } - - /** - * Get the underlying Pheanstalk job. - * - * @return \Pheanstalk\Job - */ - public function getPheanstalkJob() - { - return $this->job; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Jobs/DatabaseJob.php b/framework-9.50.2/src/Illuminate/Queue/Jobs/DatabaseJob.php deleted file mode 100644 index 77f5042..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Jobs/DatabaseJob.php +++ /dev/null @@ -1,108 +0,0 @@ -job = $job; - $this->queue = $queue; - $this->database = $database; - $this->container = $container; - $this->connectionName = $connectionName; - } - - /** - * Release the job back into the queue after (n) seconds. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - $this->database->deleteAndRelease($this->queue, $this, $delay); - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - $this->database->deleteReserved($this->queue, $this->job->id); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return (int) $this->job->attempts; - } - - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return $this->job->id; - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job->payload; - } - - /** - * Get the database job record. - * - * @return \Illuminate\Queue\Jobs\DatabaseJobRecord - */ - public function getJobRecord() - { - return $this->job; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php b/framework-9.50.2/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php deleted file mode 100644 index b4b5725..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php +++ /dev/null @@ -1,63 +0,0 @@ -record = $record; - } - - /** - * Increment the number of times the job has been attempted. - * - * @return int - */ - public function increment() - { - $this->record->attempts++; - - return $this->record->attempts; - } - - /** - * Update the "reserved at" timestamp of the job. - * - * @return int - */ - public function touch() - { - $this->record->reserved_at = $this->currentTime(); - - return $this->record->reserved_at; - } - - /** - * Dynamically access the underlying job information. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->record->{$key}; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Jobs/Job.php b/framework-9.50.2/src/Illuminate/Queue/Jobs/Job.php deleted file mode 100755 index d546494..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Jobs/Job.php +++ /dev/null @@ -1,359 +0,0 @@ -payload()['uuid'] ?? null; - } - - /** - * Fire the job. - * - * @return void - */ - public function fire() - { - $payload = $this->payload(); - - [$class, $method] = JobName::parse($payload['job']); - - ($this->instance = $this->resolve($class))->{$method}($this, $payload['data']); - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - $this->deleted = true; - } - - /** - * Determine if the job has been deleted. - * - * @return bool - */ - public function isDeleted() - { - return $this->deleted; - } - - /** - * Release the job back into the queue after (n) seconds. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - $this->released = true; - } - - /** - * Determine if the job was released back into the queue. - * - * @return bool - */ - public function isReleased() - { - return $this->released; - } - - /** - * Determine if the job has been deleted or released. - * - * @return bool - */ - public function isDeletedOrReleased() - { - return $this->isDeleted() || $this->isReleased(); - } - - /** - * Determine if the job has been marked as a failure. - * - * @return bool - */ - public function hasFailed() - { - return $this->failed; - } - - /** - * Mark the job as "failed". - * - * @return void - */ - public function markAsFailed() - { - $this->failed = true; - } - - /** - * Delete the job, call the "failed" method, and raise the failed job event. - * - * @param \Throwable|null $e - * @return void - */ - public function fail($e = null) - { - $this->markAsFailed(); - - if ($this->isDeleted()) { - return; - } - - try { - // If the job has failed, we will delete it, call the "failed" method and then call - // an event indicating the job has failed so it can be logged if needed. This is - // to allow every developer to better keep monitor of their failed queue jobs. - $this->delete(); - - $this->failed($e); - } finally { - $this->resolve(Dispatcher::class)->dispatch(new JobFailed( - $this->connectionName, $this, $e ?: new ManuallyFailedException - )); - } - } - - /** - * Process an exception that caused the job to fail. - * - * @param \Throwable|null $e - * @return void - */ - protected function failed($e) - { - $payload = $this->payload(); - - [$class, $method] = JobName::parse($payload['job']); - - if (method_exists($this->instance = $this->resolve($class), 'failed')) { - $this->instance->failed($payload['data'], $e, $payload['uuid'] ?? ''); - } - } - - /** - * Resolve the given class. - * - * @param string $class - * @return mixed - */ - protected function resolve($class) - { - return $this->container->make($class); - } - - /** - * Get the resolved job handler instance. - * - * @return mixed - */ - public function getResolvedJob() - { - return $this->instance; - } - - /** - * Get the decoded body of the job. - * - * @return array - */ - public function payload() - { - return json_decode($this->getRawBody(), true); - } - - /** - * Get the number of times to attempt a job. - * - * @return int|null - */ - public function maxTries() - { - return $this->payload()['maxTries'] ?? null; - } - - /** - * Get the number of times to attempt a job after an exception. - * - * @return int|null - */ - public function maxExceptions() - { - return $this->payload()['maxExceptions'] ?? null; - } - - /** - * Determine if the job should fail when it timeouts. - * - * @return bool - */ - public function shouldFailOnTimeout() - { - return $this->payload()['failOnTimeout'] ?? false; - } - - /** - * The number of seconds to wait before retrying a job that encountered an uncaught exception. - * - * @return int|int[]|null - */ - public function backoff() - { - return $this->payload()['backoff'] ?? $this->payload()['delay'] ?? null; - } - - /** - * Get the number of seconds the job can run. - * - * @return int|null - */ - public function timeout() - { - return $this->payload()['timeout'] ?? null; - } - - /** - * Get the timestamp indicating when the job should timeout. - * - * @return int|null - */ - public function retryUntil() - { - return $this->payload()['retryUntil'] ?? null; - } - - /** - * Get the name of the queued job class. - * - * @return string - */ - public function getName() - { - return $this->payload()['job']; - } - - /** - * Get the resolved name of the queued job class. - * - * Resolves the name of "wrapped" jobs such as class-based handlers. - * - * @return string - */ - public function resolveName() - { - return JobName::resolve($this->getName(), $this->payload()); - } - - /** - * Get the name of the connection the job belongs to. - * - * @return string - */ - public function getConnectionName() - { - return $this->connectionName; - } - - /** - * Get the name of the queue the job belongs to. - * - * @return string - */ - public function getQueue() - { - return $this->queue; - } - - /** - * Get the service container instance. - * - * @return \Illuminate\Container\Container - */ - public function getContainer() - { - return $this->container; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Jobs/JobName.php b/framework-9.50.2/src/Illuminate/Queue/Jobs/JobName.php deleted file mode 100644 index 0db53bb..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Jobs/JobName.php +++ /dev/null @@ -1,35 +0,0 @@ -job = $job; - $this->redis = $redis; - $this->queue = $queue; - $this->reserved = $reserved; - $this->container = $container; - $this->connectionName = $connectionName; - - $this->decoded = $this->payload(); - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job; - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - $this->redis->deleteReserved($this->queue, $this); - } - - /** - * Release the job back into the queue after (n) seconds. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - $this->redis->deleteAndRelease($this->queue, $this, $delay); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return ($this->decoded['attempts'] ?? null) + 1; - } - - /** - * Get the job identifier. - * - * @return string|null - */ - public function getJobId() - { - return $this->decoded['id'] ?? null; - } - - /** - * Get the underlying Redis factory implementation. - * - * @return \Illuminate\Queue\RedisQueue - */ - public function getRedisQueue() - { - return $this->redis; - } - - /** - * Get the underlying reserved Redis job. - * - * @return string - */ - public function getReservedJob() - { - return $this->reserved; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Jobs/SqsJob.php b/framework-9.50.2/src/Illuminate/Queue/Jobs/SqsJob.php deleted file mode 100755 index 87b722e..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Jobs/SqsJob.php +++ /dev/null @@ -1,124 +0,0 @@ -sqs = $sqs; - $this->job = $job; - $this->queue = $queue; - $this->container = $container; - $this->connectionName = $connectionName; - } - - /** - * Release the job back into the queue after (n) seconds. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - - $this->sqs->changeMessageVisibility([ - 'QueueUrl' => $this->queue, - 'ReceiptHandle' => $this->job['ReceiptHandle'], - 'VisibilityTimeout' => $delay, - ]); - } - - /** - * Delete the job from the queue. - * - * @return void - */ - public function delete() - { - parent::delete(); - - $this->sqs->deleteMessage([ - 'QueueUrl' => $this->queue, 'ReceiptHandle' => $this->job['ReceiptHandle'], - ]); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return (int) $this->job['Attributes']['ApproximateReceiveCount']; - } - - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return $this->job['MessageId']; - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->job['Body']; - } - - /** - * Get the underlying SQS client instance. - * - * @return \Aws\Sqs\SqsClient - */ - public function getSqs() - { - return $this->sqs; - } - - /** - * Get the underlying raw SQS job. - * - * @return array - */ - public function getSqsJob() - { - return $this->job; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Jobs/SyncJob.php b/framework-9.50.2/src/Illuminate/Queue/Jobs/SyncJob.php deleted file mode 100755 index fc9c703..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Jobs/SyncJob.php +++ /dev/null @@ -1,91 +0,0 @@ -queue = $queue; - $this->payload = $payload; - $this->container = $container; - $this->connectionName = $connectionName; - } - - /** - * Release the job back into the queue after (n) seconds. - * - * @param int $delay - * @return void - */ - public function release($delay = 0) - { - parent::release($delay); - } - - /** - * Get the number of times the job has been attempted. - * - * @return int - */ - public function attempts() - { - return 1; - } - - /** - * Get the job identifier. - * - * @return string - */ - public function getJobId() - { - return ''; - } - - /** - * Get the raw body string for the job. - * - * @return string - */ - public function getRawBody() - { - return $this->payload; - } - - /** - * Get the name of the queue the job belongs to. - * - * @return string - */ - public function getQueue() - { - return 'sync'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/LICENSE.md b/framework-9.50.2/src/Illuminate/Queue/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Queue/Listener.php b/framework-9.50.2/src/Illuminate/Queue/Listener.php deleted file mode 100755 index b552828..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Listener.php +++ /dev/null @@ -1,236 +0,0 @@ -commandPath = $commandPath; - } - - /** - * Get the PHP binary. - * - * @return string - */ - protected function phpBinary() - { - return (new PhpExecutableFinder)->find(false); - } - - /** - * Get the Artisan binary. - * - * @return string - */ - protected function artisanBinary() - { - return defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'; - } - - /** - * Listen to the given queue connection. - * - * @param string $connection - * @param string $queue - * @param \Illuminate\Queue\ListenerOptions $options - * @return void - */ - public function listen($connection, $queue, ListenerOptions $options) - { - $process = $this->makeProcess($connection, $queue, $options); - - while (true) { - $this->runProcess($process, $options->memory); - - if ($options->rest) { - sleep($options->rest); - } - } - } - - /** - * Create a new Symfony process for the worker. - * - * @param string $connection - * @param string $queue - * @param \Illuminate\Queue\ListenerOptions $options - * @return \Symfony\Component\Process\Process - */ - public function makeProcess($connection, $queue, ListenerOptions $options) - { - $command = $this->createCommand( - $connection, - $queue, - $options - ); - - // If the environment is set, we will append it to the command array so the - // workers will run under the specified environment. Otherwise, they will - // just run under the production environment which is not always right. - if (isset($options->environment)) { - $command = $this->addEnvironment($command, $options); - } - - return new Process( - $command, - $this->commandPath, - null, - null, - $options->timeout - ); - } - - /** - * Add the environment option to the given command. - * - * @param array $command - * @param \Illuminate\Queue\ListenerOptions $options - * @return array - */ - protected function addEnvironment($command, ListenerOptions $options) - { - return array_merge($command, ["--env={$options->environment}"]); - } - - /** - * Create the command with the listener options. - * - * @param string $connection - * @param string $queue - * @param \Illuminate\Queue\ListenerOptions $options - * @return array - */ - protected function createCommand($connection, $queue, ListenerOptions $options) - { - return array_filter([ - $this->phpBinary(), - $this->artisanBinary(), - 'queue:work', - $connection, - '--once', - "--name={$options->name}", - "--queue={$queue}", - "--backoff={$options->backoff}", - "--memory={$options->memory}", - "--sleep={$options->sleep}", - "--tries={$options->maxTries}", - $options->force ? '--force' : null, - ], function ($value) { - return ! is_null($value); - }); - } - - /** - * Run the given process. - * - * @param \Symfony\Component\Process\Process $process - * @param int $memory - * @return void - */ - public function runProcess(Process $process, $memory) - { - $process->run(function ($type, $line) { - $this->handleWorkerOutput($type, $line); - }); - - // Once we have run the job we'll go check if the memory limit has been exceeded - // for the script. If it has, we will kill this script so the process manager - // will restart this with a clean slate of memory automatically on exiting. - if ($this->memoryExceeded($memory)) { - $this->stop(); - } - } - - /** - * Handle output from the worker process. - * - * @param int $type - * @param string $line - * @return void - */ - protected function handleWorkerOutput($type, $line) - { - if (isset($this->outputHandler)) { - call_user_func($this->outputHandler, $type, $line); - } - } - - /** - * Determine if the memory limit has been exceeded. - * - * @param int $memoryLimit - * @return bool - */ - public function memoryExceeded($memoryLimit) - { - return (memory_get_usage(true) / 1024 / 1024) >= $memoryLimit; - } - - /** - * Stop listening and bail out of the script. - * - * @return void - */ - public function stop() - { - exit; - } - - /** - * Set the output handler callback. - * - * @param \Closure $outputHandler - * @return void - */ - public function setOutputHandler(Closure $outputHandler) - { - $this->outputHandler = $outputHandler; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/ListenerOptions.php b/framework-9.50.2/src/Illuminate/Queue/ListenerOptions.php deleted file mode 100644 index d71989d..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/ListenerOptions.php +++ /dev/null @@ -1,34 +0,0 @@ -environment = $environment; - - parent::__construct($name, $backoff, $memory, $timeout, $sleep, $maxTries, $force, false, 0, 0, $rest); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/LuaScripts.php b/framework-9.50.2/src/Illuminate/Queue/LuaScripts.php deleted file mode 100644 index 5452c11..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/LuaScripts.php +++ /dev/null @@ -1,148 +0,0 @@ -limiter = Container::getInstance()->make(RateLimiter::class); - - $this->limiterName = $limiterName; - } - - /** - * Process the job. - * - * @param mixed $job - * @param callable $next - * @return mixed - */ - public function handle($job, $next) - { - if (is_null($limiter = $this->limiter->limiter($this->limiterName))) { - return $next($job); - } - - $limiterResponse = $limiter($job); - - if ($limiterResponse instanceof Unlimited) { - return $next($job); - } - - return $this->handleJob( - $job, - $next, - collect(Arr::wrap($limiterResponse))->map(function ($limit) { - return (object) [ - 'key' => md5($this->limiterName.$limit->key), - 'maxAttempts' => $limit->maxAttempts, - 'decayMinutes' => $limit->decayMinutes, - ]; - })->all() - ); - } - - /** - * Handle a rate limited job. - * - * @param mixed $job - * @param callable $next - * @param array $limits - * @return mixed - */ - protected function handleJob($job, $next, array $limits) - { - foreach ($limits as $limit) { - if ($this->limiter->tooManyAttempts($limit->key, $limit->maxAttempts)) { - return $this->shouldRelease - ? $job->release($this->getTimeUntilNextRetry($limit->key)) - : false; - } - - $this->limiter->hit($limit->key, $limit->decayMinutes * 60); - } - - return $next($job); - } - - /** - * Do not release the job back to the queue if the limit is exceeded. - * - * @return $this - */ - public function dontRelease() - { - $this->shouldRelease = false; - - return $this; - } - - /** - * Get the number of seconds that should elapse before the job is retried. - * - * @param string $key - * @return int - */ - protected function getTimeUntilNextRetry($key) - { - return $this->limiter->availableIn($key) + 3; - } - - /** - * Prepare the object for serialization. - * - * @return array - */ - public function __sleep() - { - return [ - 'limiterName', - 'shouldRelease', - ]; - } - - /** - * Prepare the object after unserialization. - * - * @return void - */ - public function __wakeup() - { - $this->limiter = Container::getInstance()->make(RateLimiter::class); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Middleware/RateLimitedWithRedis.php b/framework-9.50.2/src/Illuminate/Queue/Middleware/RateLimitedWithRedis.php deleted file mode 100644 index e919786..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Middleware/RateLimitedWithRedis.php +++ /dev/null @@ -1,103 +0,0 @@ -redis = Container::getInstance()->make(Redis::class); - } - - /** - * Handle a rate limited job. - * - * @param mixed $job - * @param callable $next - * @param array $limits - * @return mixed - */ - protected function handleJob($job, $next, array $limits) - { - foreach ($limits as $limit) { - if ($this->tooManyAttempts($limit->key, $limit->maxAttempts, $limit->decayMinutes)) { - return $this->shouldRelease - ? $job->release($this->getTimeUntilNextRetry($limit->key)) - : false; - } - } - - return $next($job); - } - - /** - * Determine if the given key has been "accessed" too many times. - * - * @param string $key - * @param int $maxAttempts - * @param int $decayMinutes - * @return bool - */ - protected function tooManyAttempts($key, $maxAttempts, $decayMinutes) - { - $limiter = new DurationLimiter( - $this->redis, $key, $maxAttempts, $decayMinutes * 60 - ); - - return tap(! $limiter->acquire(), function () use ($key, $limiter) { - $this->decaysAt[$key] = $limiter->decaysAt; - }); - } - - /** - * Get the number of seconds that should elapse before the job is retried. - * - * @param string $key - * @return int - */ - protected function getTimeUntilNextRetry($key) - { - return ($this->decaysAt[$key] - $this->currentTime()) + 3; - } - - /** - * Prepare the object after unserialization. - * - * @return void - */ - public function __wakeup() - { - parent::__wakeup(); - - $this->redis = Container::getInstance()->make(Redis::class); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Middleware/SkipIfBatchCancelled.php b/framework-9.50.2/src/Illuminate/Queue/Middleware/SkipIfBatchCancelled.php deleted file mode 100644 index 75a3387..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Middleware/SkipIfBatchCancelled.php +++ /dev/null @@ -1,22 +0,0 @@ -batch()?->cancelled()) { - return; - } - - $next($job); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Middleware/ThrottlesExceptions.php b/framework-9.50.2/src/Illuminate/Queue/Middleware/ThrottlesExceptions.php deleted file mode 100644 index 61ddf34..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Middleware/ThrottlesExceptions.php +++ /dev/null @@ -1,201 +0,0 @@ -maxAttempts = $maxAttempts; - $this->decayMinutes = $decayMinutes; - } - - /** - * Process the job. - * - * @param mixed $job - * @param callable $next - * @return mixed - */ - public function handle($job, $next) - { - $this->limiter = Container::getInstance()->make(RateLimiter::class); - - if ($this->limiter->tooManyAttempts($jobKey = $this->getKey($job), $this->maxAttempts)) { - return $job->release($this->getTimeUntilNextRetry($jobKey)); - } - - try { - $next($job); - - $this->limiter->clear($jobKey); - } catch (Throwable $throwable) { - if ($this->whenCallback && ! call_user_func($this->whenCallback, $throwable)) { - throw $throwable; - } - - $this->limiter->hit($jobKey, $this->decayMinutes * 60); - - return $job->release($this->retryAfterMinutes * 60); - } - } - - /** - * Specify a callback that should determine if rate limiting behavior should apply. - * - * @param callable $callback - * @return $this - */ - public function when(callable $callback) - { - $this->whenCallback = $callback; - - return $this; - } - - /** - * Set the prefix of the rate limiter key. - * - * @param string $prefix - * @return $this - */ - public function withPrefix(string $prefix) - { - $this->prefix = $prefix; - - return $this; - } - - /** - * Specify the number of minutes a job should be delayed when it is released (before it has reached its max exceptions). - * - * @param int $backoff - * @return $this - */ - public function backoff($backoff) - { - $this->retryAfterMinutes = $backoff; - - return $this; - } - - /** - * Get the cache key associated for the rate limiter. - * - * @param mixed $job - * @return string - */ - protected function getKey($job) - { - if ($this->key) { - return $this->prefix.$this->key; - } elseif ($this->byJob) { - return $this->prefix.$job->job->uuid(); - } - - return $this->prefix.md5(get_class($job)); - } - - /** - * Set the value that the rate limiter should be keyed by. - * - * @param string $key - * @return $this - */ - public function by($key) - { - $this->key = $key; - - return $this; - } - - /** - * Indicate that the throttle key should use the job's UUID. - * - * @return $this - */ - public function byJob() - { - $this->byJob = true; - - return $this; - } - - /** - * Get the number of seconds that should elapse before the job is retried. - * - * @param string $key - * @return int - */ - protected function getTimeUntilNextRetry($key) - { - return $this->limiter->availableIn($key) + 3; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Middleware/ThrottlesExceptionsWithRedis.php b/framework-9.50.2/src/Illuminate/Queue/Middleware/ThrottlesExceptionsWithRedis.php deleted file mode 100644 index 38790e3..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Middleware/ThrottlesExceptionsWithRedis.php +++ /dev/null @@ -1,62 +0,0 @@ -redis = Container::getInstance()->make(Redis::class); - - $this->limiter = new DurationLimiter( - $this->redis, $this->getKey($job), $this->maxAttempts, $this->decayMinutes * 60 - ); - - if ($this->limiter->tooManyAttempts()) { - return $job->release($this->limiter->decaysAt - $this->currentTime()); - } - - try { - $next($job); - - $this->limiter->clear(); - } catch (Throwable $throwable) { - if ($this->whenCallback && ! call_user_func($this->whenCallback, $throwable)) { - throw $throwable; - } - - $this->limiter->acquire(); - - return $job->release($this->retryAfterMinutes * 60); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Middleware/WithoutOverlapping.php b/framework-9.50.2/src/Illuminate/Queue/Middleware/WithoutOverlapping.php deleted file mode 100644 index 3b773ad..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Middleware/WithoutOverlapping.php +++ /dev/null @@ -1,162 +0,0 @@ -key = $key; - $this->releaseAfter = $releaseAfter; - $this->expiresAfter = $this->secondsUntil($expiresAfter); - } - - /** - * Process the job. - * - * @param mixed $job - * @param callable $next - * @return mixed - */ - public function handle($job, $next) - { - $lock = Container::getInstance()->make(Cache::class)->lock( - $this->getLockKey($job), $this->expiresAfter - ); - - if ($lock->get()) { - try { - $next($job); - } finally { - $lock->release(); - } - } elseif (! is_null($this->releaseAfter)) { - $job->release($this->releaseAfter); - } - } - - /** - * Set the delay (in seconds) to release the job back to the queue. - * - * @param \DateTimeInterface|int $releaseAfter - * @return $this - */ - public function releaseAfter($releaseAfter) - { - $this->releaseAfter = $releaseAfter; - - return $this; - } - - /** - * Do not release the job back to the queue if no lock can be acquired. - * - * @return $this - */ - public function dontRelease() - { - $this->releaseAfter = null; - - return $this; - } - - /** - * Set the maximum number of seconds that can elapse before the lock is released. - * - * @param \DateTimeInterface|\DateInterval|int $expiresAfter - * @return $this - */ - public function expireAfter($expiresAfter) - { - $this->expiresAfter = $this->secondsUntil($expiresAfter); - - return $this; - } - - /** - * Set the prefix of the lock key. - * - * @param string $prefix - * @return $this - */ - public function withPrefix(string $prefix) - { - $this->prefix = $prefix; - - return $this; - } - - /** - * Indicate that the lock key should be shared across job classes. - * - * @return $this - */ - public function shared() - { - $this->shareKey = true; - - return $this; - } - - /** - * Get the lock key for the given job. - * - * @param mixed $job - * @return string - */ - public function getLockKey($job) - { - return $this->shareKey - ? $this->prefix.$this->key - : $this->prefix.get_class($job).':'.$this->key; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/NullQueue.php b/framework-9.50.2/src/Illuminate/Queue/NullQueue.php deleted file mode 100644 index 10493a1..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/NullQueue.php +++ /dev/null @@ -1,70 +0,0 @@ -push($job, $data, $queue); - } - - /** - * Push a new job onto a specific queue after (n) seconds. - * - * @param string $queue - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string $job - * @param mixed $data - * @return mixed - */ - public function laterOn($queue, $delay, $job, $data = '') - { - return $this->later($delay, $job, $data, $queue); - } - - /** - * Push an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string|null $queue - * @return void - */ - public function bulk($jobs, $data = '', $queue = null) - { - foreach ((array) $jobs as $job) { - $this->push($job, $data, $queue); - } - } - - /** - * Create a payload string from the given job and data. - * - * @param \Closure|string|object $job - * @param string $queue - * @param mixed $data - * @return string - * - * @throws \Illuminate\Queue\InvalidPayloadException - */ - protected function createPayload($job, $queue, $data = '') - { - if ($job instanceof Closure) { - $job = CallQueuedClosure::create($job); - } - - $payload = json_encode($this->createPayloadArray($job, $queue, $data), \JSON_UNESCAPED_UNICODE); - - if (json_last_error() !== JSON_ERROR_NONE) { - throw new InvalidPayloadException( - 'Unable to JSON encode payload. Error code: '.json_last_error() - ); - } - - return $payload; - } - - /** - * Create a payload array from the given job and data. - * - * @param string|object $job - * @param string $queue - * @param mixed $data - * @return array - */ - protected function createPayloadArray($job, $queue, $data = '') - { - return is_object($job) - ? $this->createObjectPayload($job, $queue) - : $this->createStringPayload($job, $queue, $data); - } - - /** - * Create a payload for an object-based queue handler. - * - * @param object $job - * @param string $queue - * @return array - */ - protected function createObjectPayload($job, $queue) - { - $payload = $this->withCreatePayloadHooks($queue, [ - 'uuid' => (string) Str::uuid(), - 'displayName' => $this->getDisplayName($job), - 'job' => 'Illuminate\Queue\CallQueuedHandler@call', - 'maxTries' => $job->tries ?? null, - 'maxExceptions' => $job->maxExceptions ?? null, - 'failOnTimeout' => $job->failOnTimeout ?? false, - 'backoff' => $this->getJobBackoff($job), - 'timeout' => $job->timeout ?? null, - 'retryUntil' => $this->getJobExpiration($job), - 'data' => [ - 'commandName' => $job, - 'command' => $job, - ], - ]); - - $command = $this->jobShouldBeEncrypted($job) && $this->container->bound(Encrypter::class) - ? $this->container[Encrypter::class]->encrypt(serialize(clone $job)) - : serialize(clone $job); - - return array_merge($payload, [ - 'data' => array_merge($payload['data'], [ - 'commandName' => get_class($job), - 'command' => $command, - ]), - ]); - } - - /** - * Get the display name for the given job. - * - * @param object $job - * @return string - */ - protected function getDisplayName($job) - { - return method_exists($job, 'displayName') - ? $job->displayName() : get_class($job); - } - - /** - * Get the backoff for an object-based queue handler. - * - * @param mixed $job - * @return mixed - */ - public function getJobBackoff($job) - { - if (! method_exists($job, 'backoff') && ! isset($job->backoff)) { - return; - } - - if (is_null($backoff = $job->backoff ?? $job->backoff())) { - return; - } - - return collect(Arr::wrap($backoff)) - ->map(function ($backoff) { - return $backoff instanceof DateTimeInterface - ? $this->secondsUntil($backoff) : $backoff; - })->implode(','); - } - - /** - * Get the expiration timestamp for an object-based queue handler. - * - * @param mixed $job - * @return mixed - */ - public function getJobExpiration($job) - { - if (! method_exists($job, 'retryUntil') && ! isset($job->retryUntil)) { - return; - } - - $expiration = $job->retryUntil ?? $job->retryUntil(); - - return $expiration instanceof DateTimeInterface - ? $expiration->getTimestamp() : $expiration; - } - - /** - * Determine if the job should be encrypted. - * - * @param object $job - * @return bool - */ - protected function jobShouldBeEncrypted($job) - { - if ($job instanceof ShouldBeEncrypted) { - return true; - } - - return isset($job->shouldBeEncrypted) && $job->shouldBeEncrypted; - } - - /** - * Create a typical, string based queue payload array. - * - * @param string $job - * @param string $queue - * @param mixed $data - * @return array - */ - protected function createStringPayload($job, $queue, $data) - { - return $this->withCreatePayloadHooks($queue, [ - 'uuid' => (string) Str::uuid(), - 'displayName' => is_string($job) ? explode('@', $job)[0] : null, - 'job' => $job, - 'maxTries' => null, - 'maxExceptions' => null, - 'failOnTimeout' => false, - 'backoff' => null, - 'timeout' => null, - 'data' => $data, - ]); - } - - /** - * Register a callback to be executed when creating job payloads. - * - * @param callable|null $callback - * @return void - */ - public static function createPayloadUsing($callback) - { - if (is_null($callback)) { - static::$createPayloadCallbacks = []; - } else { - static::$createPayloadCallbacks[] = $callback; - } - } - - /** - * Create the given payload using any registered payload hooks. - * - * @param string $queue - * @param array $payload - * @return array - */ - protected function withCreatePayloadHooks($queue, array $payload) - { - if (! empty(static::$createPayloadCallbacks)) { - foreach (static::$createPayloadCallbacks as $callback) { - $payload = array_merge($payload, $callback($this->getConnectionName(), $queue, $payload)); - } - } - - return $payload; - } - - /** - * Enqueue a job using the given callback. - * - * @param \Closure|string|object $job - * @param string $payload - * @param string $queue - * @param \DateTimeInterface|\DateInterval|int|null $delay - * @param callable $callback - * @return mixed - */ - protected function enqueueUsing($job, $payload, $queue, $delay, $callback) - { - if ($this->shouldDispatchAfterCommit($job) && - $this->container->bound('db.transactions')) { - return $this->container->make('db.transactions')->addCallback( - function () use ($payload, $queue, $delay, $callback, $job) { - return tap($callback($payload, $queue, $delay), function ($jobId) use ($job) { - $this->raiseJobQueuedEvent($jobId, $job); - }); - } - ); - } - - return tap($callback($payload, $queue, $delay), function ($jobId) use ($job) { - $this->raiseJobQueuedEvent($jobId, $job); - }); - } - - /** - * Determine if the job should be dispatched after all database transactions have committed. - * - * @param \Closure|string|object $job - * @return bool - */ - protected function shouldDispatchAfterCommit($job) - { - if (is_object($job) && isset($job->afterCommit)) { - return $job->afterCommit; - } - - if (isset($this->dispatchAfterCommit)) { - return $this->dispatchAfterCommit; - } - - return false; - } - - /** - * Raise the job queued event. - * - * @param string|int|null $jobId - * @param \Closure|string|object $job - * @return void - */ - protected function raiseJobQueuedEvent($jobId, $job) - { - if ($this->container->bound('events')) { - $this->container['events']->dispatch(new JobQueued($this->connectionName, $jobId, $job)); - } - } - - /** - * Get the connection name for the queue. - * - * @return string - */ - public function getConnectionName() - { - return $this->connectionName; - } - - /** - * Set the connection name for the queue. - * - * @param string $name - * @return $this - */ - public function setConnectionName($name) - { - $this->connectionName = $name; - - return $this; - } - - /** - * Get the container instance being used by the connection. - * - * @return \Illuminate\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/QueueManager.php b/framework-9.50.2/src/Illuminate/Queue/QueueManager.php deleted file mode 100755 index 33f1cd1..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/QueueManager.php +++ /dev/null @@ -1,293 +0,0 @@ -app = $app; - } - - /** - * Register an event listener for the before job event. - * - * @param mixed $callback - * @return void - */ - public function before($callback) - { - $this->app['events']->listen(Events\JobProcessing::class, $callback); - } - - /** - * Register an event listener for the after job event. - * - * @param mixed $callback - * @return void - */ - public function after($callback) - { - $this->app['events']->listen(Events\JobProcessed::class, $callback); - } - - /** - * Register an event listener for the exception occurred job event. - * - * @param mixed $callback - * @return void - */ - public function exceptionOccurred($callback) - { - $this->app['events']->listen(Events\JobExceptionOccurred::class, $callback); - } - - /** - * Register an event listener for the daemon queue loop. - * - * @param mixed $callback - * @return void - */ - public function looping($callback) - { - $this->app['events']->listen(Events\Looping::class, $callback); - } - - /** - * Register an event listener for the failed job event. - * - * @param mixed $callback - * @return void - */ - public function failing($callback) - { - $this->app['events']->listen(Events\JobFailed::class, $callback); - } - - /** - * Register an event listener for the daemon queue stopping. - * - * @param mixed $callback - * @return void - */ - public function stopping($callback) - { - $this->app['events']->listen(Events\WorkerStopping::class, $callback); - } - - /** - * Determine if the driver is connected. - * - * @param string|null $name - * @return bool - */ - public function connected($name = null) - { - return isset($this->connections[$name ?: $this->getDefaultDriver()]); - } - - /** - * Resolve a queue connection instance. - * - * @param string|null $name - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connection($name = null) - { - $name = $name ?: $this->getDefaultDriver(); - - // If the connection has not been resolved yet we will resolve it now as all - // of 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->connections[$name])) { - $this->connections[$name] = $this->resolve($name); - - $this->connections[$name]->setContainer($this->app); - } - - return $this->connections[$name]; - } - - /** - * Resolve a queue connection. - * - * @param string $name - * @return \Illuminate\Contracts\Queue\Queue - * - * @throws \InvalidArgumentException - */ - protected function resolve($name) - { - $config = $this->getConfig($name); - - if (is_null($config)) { - throw new InvalidArgumentException("The [{$name}] queue connection has not been configured."); - } - - return $this->getConnector($config['driver']) - ->connect($config) - ->setConnectionName($name); - } - - /** - * Get the connector for a given driver. - * - * @param string $driver - * @return \Illuminate\Queue\Connectors\ConnectorInterface - * - * @throws \InvalidArgumentException - */ - protected function getConnector($driver) - { - if (! isset($this->connectors[$driver])) { - throw new InvalidArgumentException("No connector for [$driver]."); - } - - return call_user_func($this->connectors[$driver]); - } - - /** - * Add a queue connection resolver. - * - * @param string $driver - * @param \Closure $resolver - * @return void - */ - public function extend($driver, Closure $resolver) - { - return $this->addConnector($driver, $resolver); - } - - /** - * Add a queue connection resolver. - * - * @param string $driver - * @param \Closure $resolver - * @return void - */ - public function addConnector($driver, Closure $resolver) - { - $this->connectors[$driver] = $resolver; - } - - /** - * Get the queue connection configuration. - * - * @param string $name - * @return array|null - */ - protected function getConfig($name) - { - if (! is_null($name) && $name !== 'null') { - return $this->app['config']["queue.connections.{$name}"]; - } - - return ['driver' => 'null']; - } - - /** - * Get the name of the default queue connection. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->app['config']['queue.default']; - } - - /** - * Set the name of the default queue connection. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->app['config']['queue.default'] = $name; - } - - /** - * Get the full name for the given connection. - * - * @param string|null $connection - * @return string - */ - public function getName($connection = null) - { - return $connection ?: $this->getDefaultDriver(); - } - - /** - * Get the application instance used by the manager. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public function getApplication() - { - return $this->app; - } - - /** - * Set the application instance used by the manager. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return $this - */ - public function setApplication($app) - { - $this->app = $app; - - foreach ($this->connections as $connection) { - $connection->setContainer($app); - } - - return $this; - } - - /** - * Dynamically pass calls to the default connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->connection()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/QueueServiceProvider.php b/framework-9.50.2/src/Illuminate/Queue/QueueServiceProvider.php deleted file mode 100755 index 2f39ad6..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/QueueServiceProvider.php +++ /dev/null @@ -1,333 +0,0 @@ -configureSerializableClosureUses(); - - $this->registerManager(); - $this->registerConnection(); - $this->registerWorker(); - $this->registerListener(); - $this->registerFailedJobServices(); - } - - /** - * Configure serializable closures uses. - * - * @return void - */ - protected function configureSerializableClosureUses() - { - SerializableClosure::transformUseVariablesUsing(function ($data) { - foreach ($data as $key => $value) { - $data[$key] = $this->getSerializedPropertyValue($value); - } - - return $data; - }); - - SerializableClosure::resolveUseVariablesUsing(function ($data) { - foreach ($data as $key => $value) { - $data[$key] = $this->getRestoredPropertyValue($value); - } - - return $data; - }); - } - - /** - * Register the queue manager. - * - * @return void - */ - protected function registerManager() - { - $this->app->singleton('queue', function ($app) { - // Once we have an instance of the queue manager, we will register the various - // resolvers for the queue connectors. These connectors are responsible for - // creating the classes that accept queue configs and instantiate queues. - return tap(new QueueManager($app), function ($manager) { - $this->registerConnectors($manager); - }); - }); - } - - /** - * Register the default queue connection binding. - * - * @return void - */ - protected function registerConnection() - { - $this->app->singleton('queue.connection', function ($app) { - return $app['queue']->connection(); - }); - } - - /** - * Register the connectors on the queue manager. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - public function registerConnectors($manager) - { - foreach (['Null', 'Sync', 'Database', 'Redis', 'Beanstalkd', 'Sqs'] as $connector) { - $this->{"register{$connector}Connector"}($manager); - } - } - - /** - * Register the Null queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerNullConnector($manager) - { - $manager->addConnector('null', function () { - return new NullConnector; - }); - } - - /** - * Register the Sync queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerSyncConnector($manager) - { - $manager->addConnector('sync', function () { - return new SyncConnector; - }); - } - - /** - * Register the database queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerDatabaseConnector($manager) - { - $manager->addConnector('database', function () { - return new DatabaseConnector($this->app['db']); - }); - } - - /** - * Register the Redis queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerRedisConnector($manager) - { - $manager->addConnector('redis', function () { - return new RedisConnector($this->app['redis']); - }); - } - - /** - * Register the Beanstalkd queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerBeanstalkdConnector($manager) - { - $manager->addConnector('beanstalkd', function () { - return new BeanstalkdConnector; - }); - } - - /** - * Register the Amazon SQS queue connector. - * - * @param \Illuminate\Queue\QueueManager $manager - * @return void - */ - protected function registerSqsConnector($manager) - { - $manager->addConnector('sqs', function () { - return new SqsConnector; - }); - } - - /** - * Register the queue worker. - * - * @return void - */ - protected function registerWorker() - { - $this->app->singleton('queue.worker', function ($app) { - $isDownForMaintenance = function () { - return $this->app->isDownForMaintenance(); - }; - - $resetScope = function () use ($app) { - if (method_exists($app['log']->driver(), 'withoutContext')) { - $app['log']->withoutContext(); - } - - if (method_exists($app['db'], 'getConnections')) { - foreach ($app['db']->getConnections() as $connection) { - $connection->resetTotalQueryDuration(); - $connection->allowQueryDurationHandlersToRunAgain(); - } - } - - $app->forgetScopedInstances(); - - return Facade::clearResolvedInstances(); - }; - - return new Worker( - $app['queue'], - $app['events'], - $app[ExceptionHandler::class], - $isDownForMaintenance, - $resetScope - ); - }); - } - - /** - * Register the queue listener. - * - * @return void - */ - protected function registerListener() - { - $this->app->singleton('queue.listener', function ($app) { - return new Listener($app->basePath()); - }); - } - - /** - * Register the failed job services. - * - * @return void - */ - protected function registerFailedJobServices() - { - $this->app->singleton('queue.failer', function ($app) { - $config = $app['config']['queue.failed']; - - if (array_key_exists('driver', $config) && - (is_null($config['driver']) || $config['driver'] === 'null')) { - return new NullFailedJobProvider; - } - - if (isset($config['driver']) && $config['driver'] === 'dynamodb') { - return $this->dynamoFailedJobProvider($config); - } elseif (isset($config['driver']) && $config['driver'] === 'database-uuids') { - return $this->databaseUuidFailedJobProvider($config); - } elseif (isset($config['table'])) { - return $this->databaseFailedJobProvider($config); - } else { - return new NullFailedJobProvider; - } - }); - } - - /** - * Create a new database failed job provider. - * - * @param array $config - * @return \Illuminate\Queue\Failed\DatabaseFailedJobProvider - */ - protected function databaseFailedJobProvider($config) - { - return new DatabaseFailedJobProvider( - $this->app['db'], $config['database'], $config['table'] - ); - } - - /** - * Create a new database failed job provider that uses UUIDs as IDs. - * - * @param array $config - * @return \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider - */ - protected function databaseUuidFailedJobProvider($config) - { - return new DatabaseUuidFailedJobProvider( - $this->app['db'], $config['database'], $config['table'] - ); - } - - /** - * Create a new DynamoDb failed job provider. - * - * @param array $config - * @return \Illuminate\Queue\Failed\DynamoDbFailedJobProvider - */ - protected function dynamoFailedJobProvider($config) - { - $dynamoConfig = [ - 'region' => $config['region'], - 'version' => 'latest', - 'endpoint' => $config['endpoint'] ?? null, - ]; - - if (! empty($config['key']) && ! empty($config['secret'])) { - $dynamoConfig['credentials'] = Arr::only( - $config, ['key', 'secret', 'token'] - ); - } - - return new DynamoDbFailedJobProvider( - new DynamoDbClient($dynamoConfig), - $this->app['config']['app.name'], - $config['table'] - ); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'queue', - 'queue.connection', - 'queue.failer', - 'queue.listener', - 'queue.worker', - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/README.md b/framework-9.50.2/src/Illuminate/Queue/README.md deleted file mode 100644 index 1999dd7..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/README.md +++ /dev/null @@ -1,34 +0,0 @@ -## Illuminate Queue - -The Laravel Queue component provides a unified API across a variety of different queue services. Queues allow you to defer the processing of a time consuming task, such as sending an e-mail, until a later time, thus drastically speeding up the web requests to your application. - -### Usage Instructions - -First, create a new Queue `Capsule` manager instance. Similar to the "Capsule" provided for the Eloquent ORM, the queue Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible. - -```PHP -use Illuminate\Queue\Capsule\Manager as Queue; - -$queue = new Queue; - -$queue->addConnection([ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', -]); - -// Make this Capsule instance available globally via static methods... (optional) -$queue->setAsGlobal(); -``` - -Once the Capsule instance has been registered. You may use it like so: - -```PHP -// As an instance... -$queue->push('SendEmail', ['message' => $message]); - -// If setAsGlobal has been called... -Queue::push('SendEmail', ['message' => $message]); -``` - -For further documentation on using the queue, consult the [Laravel framework documentation](https://laravel.com/docs). diff --git a/framework-9.50.2/src/Illuminate/Queue/RedisQueue.php b/framework-9.50.2/src/Illuminate/Queue/RedisQueue.php deleted file mode 100644 index 4c376a8..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/RedisQueue.php +++ /dev/null @@ -1,382 +0,0 @@ -redis = $redis; - $this->default = $default; - $this->blockFor = $blockFor; - $this->connection = $connection; - $this->retryAfter = $retryAfter; - $this->dispatchAfterCommit = $dispatchAfterCommit; - $this->migrationBatchSize = $migrationBatchSize; - } - - /** - * Get the size of the queue. - * - * @param string|null $queue - * @return int - */ - public function size($queue = null) - { - $queue = $this->getQueue($queue); - - return $this->getConnection()->eval( - LuaScripts::size(), 3, $queue, $queue.':delayed', $queue.':reserved' - ); - } - - /** - * Push an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string|null $queue - * @return void - */ - public function bulk($jobs, $data = '', $queue = null) - { - $this->getConnection()->pipeline(function () use ($jobs, $data, $queue) { - $this->getConnection()->transaction(function () use ($jobs, $data, $queue) { - foreach ((array) $jobs as $job) { - if (isset($job->delay)) { - $this->later($job->delay, $job, $data, $queue); - } else { - $this->push($job, $data, $queue); - } - } - }); - }); - } - - /** - * Push a new job onto the queue. - * - * @param object|string $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function push($job, $data = '', $queue = null) - { - return $this->enqueueUsing( - $job, - $this->createPayload($job, $this->getQueue($queue), $data), - $queue, - null, - function ($payload, $queue) { - return $this->pushRaw($payload, $queue); - } - ); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string|null $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = []) - { - $this->getConnection()->eval( - LuaScripts::push(), 2, $this->getQueue($queue), - $this->getQueue($queue).':notify', $payload - ); - - return json_decode($payload, true)['id'] ?? null; - } - - /** - * Push a new job onto the queue after a delay. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param object|string $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->enqueueUsing( - $job, - $this->createPayload($job, $this->getQueue($queue), $data), - $queue, - $delay, - function ($payload, $queue, $delay) { - return $this->laterRaw($delay, $payload, $queue); - } - ); - } - - /** - * Push a raw job onto the queue after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string $payload - * @param string|null $queue - * @return mixed - */ - protected function laterRaw($delay, $payload, $queue = null) - { - $this->getConnection()->zadd( - $this->getQueue($queue).':delayed', $this->availableAt($delay), $payload - ); - - return json_decode($payload, true)['id'] ?? null; - } - - /** - * Create a payload string from the given job and data. - * - * @param string $job - * @param string $queue - * @param mixed $data - * @return array - */ - protected function createPayloadArray($job, $queue, $data = '') - { - return array_merge(parent::createPayloadArray($job, $queue, $data), [ - 'id' => $this->getRandomId(), - 'attempts' => 0, - ]); - } - - /** - * Pop the next job off of the queue. - * - * @param string|null $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - $this->migrate($prefixed = $this->getQueue($queue)); - - [$job, $reserved] = $this->retrieveNextJob($prefixed); - - if ($reserved) { - return new RedisJob( - $this->container, $this, $job, - $reserved, $this->connectionName, $queue ?: $this->default - ); - } - } - - /** - * Migrate any delayed or expired jobs onto the primary queue. - * - * @param string $queue - * @return void - */ - protected function migrate($queue) - { - $this->migrateExpiredJobs($queue.':delayed', $queue); - - if (! is_null($this->retryAfter)) { - $this->migrateExpiredJobs($queue.':reserved', $queue); - } - } - - /** - * Migrate the delayed jobs that are ready to the regular queue. - * - * @param string $from - * @param string $to - * @param int $limit - * @return array - */ - public function migrateExpiredJobs($from, $to) - { - return $this->getConnection()->eval( - LuaScripts::migrateExpiredJobs(), 3, $from, $to, $to.':notify', $this->currentTime(), $this->migrationBatchSize - ); - } - - /** - * Retrieve the next job from the queue. - * - * @param string $queue - * @param bool $block - * @return array - */ - protected function retrieveNextJob($queue, $block = true) - { - $nextJob = $this->getConnection()->eval( - LuaScripts::pop(), 3, $queue, $queue.':reserved', $queue.':notify', - $this->availableAt($this->retryAfter) - ); - - if (empty($nextJob)) { - return [null, null]; - } - - [$job, $reserved] = $nextJob; - - if (! $job && ! is_null($this->blockFor) && $block && - $this->getConnection()->blpop([$queue.':notify'], $this->blockFor)) { - return $this->retrieveNextJob($queue, false); - } - - return [$job, $reserved]; - } - - /** - * Delete a reserved job from the queue. - * - * @param string $queue - * @param \Illuminate\Queue\Jobs\RedisJob $job - * @return void - */ - public function deleteReserved($queue, $job) - { - $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job->getReservedJob()); - } - - /** - * Delete a reserved job from the reserved queue and release it. - * - * @param string $queue - * @param \Illuminate\Queue\Jobs\RedisJob $job - * @param int $delay - * @return void - */ - public function deleteAndRelease($queue, $job, $delay) - { - $queue = $this->getQueue($queue); - - $this->getConnection()->eval( - LuaScripts::release(), 2, $queue.':delayed', $queue.':reserved', - $job->getReservedJob(), $this->availableAt($delay) - ); - } - - /** - * Delete all of the jobs from the queue. - * - * @param string $queue - * @return int - */ - public function clear($queue) - { - $queue = $this->getQueue($queue); - - return $this->getConnection()->eval( - LuaScripts::clear(), 4, $queue, $queue.':delayed', - $queue.':reserved', $queue.':notify' - ); - } - - /** - * Get a random ID string. - * - * @return string - */ - protected function getRandomId() - { - return Str::random(32); - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - public function getQueue($queue) - { - return 'queues:'.($queue ?: $this->default); - } - - /** - * Get the connection for the queue. - * - * @return \Illuminate\Redis\Connections\Connection - */ - public function getConnection() - { - return $this->redis->connection($this->connection); - } - - /** - * Get the underlying Redis instance. - * - * @return \Illuminate\Contracts\Redis\Factory - */ - public function getRedis() - { - return $this->redis; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php b/framework-9.50.2/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php deleted file mode 100644 index 748c345..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php +++ /dev/null @@ -1,122 +0,0 @@ -getQueueableClass(), - $value->getQueueableIds(), - $value->getQueueableRelations(), - $value->getQueueableConnection() - ))->useCollectionClass( - ($collectionClass = get_class($value)) !== EloquentCollection::class - ? $collectionClass - : null - ); - } - - if ($value instanceof QueueableEntity) { - return new ModelIdentifier( - get_class($value), - $value->getQueueableId(), - $value->getQueueableRelations(), - $value->getQueueableConnection() - ); - } - - return $value; - } - - /** - * Get the restored property value after deserialization. - * - * @param mixed $value - * @return mixed - */ - protected function getRestoredPropertyValue($value) - { - if (! $value instanceof ModelIdentifier) { - return $value; - } - - return is_array($value->id) - ? $this->restoreCollection($value) - : $this->restoreModel($value); - } - - /** - * Restore a queueable collection instance. - * - * @param \Illuminate\Contracts\Database\ModelIdentifier $value - * @return \Illuminate\Database\Eloquent\Collection - */ - protected function restoreCollection($value) - { - if (! $value->class || count($value->id) === 0) { - return ! is_null($value->collectionClass ?? null) - ? new $value->collectionClass - : new EloquentCollection; - } - - $collection = $this->getQueryForModelRestoration( - (new $value->class)->setConnection($value->connection), $value->id - )->useWritePdo()->get(); - - if (is_a($value->class, Pivot::class, true) || - in_array(AsPivot::class, class_uses($value->class))) { - return $collection; - } - - $collection = $collection->keyBy->getKey(); - - $collectionClass = get_class($collection); - - return new $collectionClass( - collect($value->id)->map(function ($id) use ($collection) { - return $collection[$id] ?? null; - })->filter() - ); - } - - /** - * Restore the model from the model identifier instance. - * - * @param \Illuminate\Contracts\Database\ModelIdentifier $value - * @return \Illuminate\Database\Eloquent\Model - */ - public function restoreModel($value) - { - return $this->getQueryForModelRestoration( - (new $value->class)->setConnection($value->connection), $value->id - )->useWritePdo()->firstOrFail()->load($value->relations ?? []); - } - - /** - * Get the query for model restoration. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param array|int $ids - * @return \Illuminate\Database\Eloquent\Builder - */ - protected function getQueryForModelRestoration($model, $ids) - { - return $model->newQueryForRestoration($ids); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/SerializesModels.php b/framework-9.50.2/src/Illuminate/Queue/SerializesModels.php deleted file mode 100644 index e5d176d..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/SerializesModels.php +++ /dev/null @@ -1,105 +0,0 @@ -getProperties(); - - $class = get_class($this); - - foreach ($properties as $property) { - if ($property->isStatic()) { - continue; - } - - $property->setAccessible(true); - - if (! $property->isInitialized($this)) { - continue; - } - - $value = $this->getPropertyValue($property); - - if ($property->hasDefaultValue() && $value === $property->getDefaultValue()) { - continue; - } - - $name = $property->getName(); - - if ($property->isPrivate()) { - $name = "\0{$class}\0{$name}"; - } elseif ($property->isProtected()) { - $name = "\0*\0{$name}"; - } - - $values[$name] = $this->getSerializedPropertyValue($value); - } - - return $values; - } - - /** - * Restore the model after serialization. - * - * @param array $values - * @return void - */ - public function __unserialize(array $values) - { - $properties = (new ReflectionClass($this))->getProperties(); - - $class = get_class($this); - - foreach ($properties as $property) { - if ($property->isStatic()) { - continue; - } - - $name = $property->getName(); - - if ($property->isPrivate()) { - $name = "\0{$class}\0{$name}"; - } elseif ($property->isProtected()) { - $name = "\0*\0{$name}"; - } - - if (! array_key_exists($name, $values)) { - continue; - } - - $property->setAccessible(true); - - $property->setValue( - $this, $this->getRestoredPropertyValue($values[$name]) - ); - } - } - - /** - * Get the property value for the given property. - * - * @param \ReflectionProperty $property - * @return mixed - */ - protected function getPropertyValue(ReflectionProperty $property) - { - $property->setAccessible(true); - - return $property->getValue($this); - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/SqsQueue.php b/framework-9.50.2/src/Illuminate/Queue/SqsQueue.php deleted file mode 100755 index 38849f9..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/SqsQueue.php +++ /dev/null @@ -1,241 +0,0 @@ -sqs = $sqs; - $this->prefix = $prefix; - $this->default = $default; - $this->suffix = $suffix; - $this->dispatchAfterCommit = $dispatchAfterCommit; - } - - /** - * Get the size of the queue. - * - * @param string|null $queue - * @return int - */ - public function size($queue = null) - { - $response = $this->sqs->getQueueAttributes([ - 'QueueUrl' => $this->getQueue($queue), - 'AttributeNames' => ['ApproximateNumberOfMessages'], - ]); - - $attributes = $response->get('Attributes'); - - return (int) $attributes['ApproximateNumberOfMessages']; - } - - /** - * Push a new job onto the queue. - * - * @param string $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function push($job, $data = '', $queue = null) - { - return $this->enqueueUsing( - $job, - $this->createPayload($job, $queue ?: $this->default, $data), - $queue, - null, - function ($payload, $queue) { - return $this->pushRaw($payload, $queue); - } - ); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string|null $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = []) - { - return $this->sqs->sendMessage([ - 'QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload, - ])->get('MessageId'); - } - - /** - * Push a new job onto the queue after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->enqueueUsing( - $job, - $this->createPayload($job, $queue ?: $this->default, $data), - $queue, - $delay, - function ($payload, $queue, $delay) { - return $this->sqs->sendMessage([ - 'QueueUrl' => $this->getQueue($queue), - 'MessageBody' => $payload, - 'DelaySeconds' => $this->secondsUntil($delay), - ])->get('MessageId'); - } - ); - } - - /** - * Push an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string|null $queue - * @return void - */ - public function bulk($jobs, $data = '', $queue = null) - { - foreach ((array) $jobs as $job) { - if (isset($job->delay)) { - $this->later($job->delay, $job, $data, $queue); - } else { - $this->push($job, $data, $queue); - } - } - } - - /** - * Pop the next job off of the queue. - * - * @param string|null $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - $response = $this->sqs->receiveMessage([ - 'QueueUrl' => $queue = $this->getQueue($queue), - 'AttributeNames' => ['ApproximateReceiveCount'], - ]); - - if (! is_null($response['Messages']) && count($response['Messages']) > 0) { - return new SqsJob( - $this->container, $this->sqs, $response['Messages'][0], - $this->connectionName, $queue - ); - } - } - - /** - * Delete all of the jobs from the queue. - * - * @param string $queue - * @return int - */ - public function clear($queue) - { - return tap($this->size($queue), function () use ($queue) { - $this->sqs->purgeQueue([ - 'QueueUrl' => $this->getQueue($queue), - ]); - }); - } - - /** - * Get the queue or return the default. - * - * @param string|null $queue - * @return string - */ - public function getQueue($queue) - { - $queue = $queue ?: $this->default; - - return filter_var($queue, FILTER_VALIDATE_URL) === false - ? $this->suffixQueue($queue, $this->suffix) - : $queue; - } - - /** - * Add the given suffix to the given queue name. - * - * @param string $queue - * @param string $suffix - * @return string - */ - protected function suffixQueue($queue, $suffix = '') - { - if (str_ends_with($queue, '.fifo')) { - $queue = Str::beforeLast($queue, '.fifo'); - - return rtrim($this->prefix, '/').'/'.Str::finish($queue, $suffix).'.fifo'; - } - - return rtrim($this->prefix, '/').'/'.Str::finish($queue, $this->suffix); - } - - /** - * Get the underlying SQS instance. - * - * @return \Aws\Sqs\SqsClient - */ - public function getSqs() - { - return $this->sqs; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/SyncQueue.php b/framework-9.50.2/src/Illuminate/Queue/SyncQueue.php deleted file mode 100755 index f416b02..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/SyncQueue.php +++ /dev/null @@ -1,160 +0,0 @@ -resolveJob($this->createPayload($job, $queue, $data), $queue); - - try { - $this->raiseBeforeJobEvent($queueJob); - - $queueJob->fire(); - - $this->raiseAfterJobEvent($queueJob); - } catch (Throwable $e) { - $this->handleException($queueJob, $e); - } - - return 0; - } - - /** - * Resolve a Sync job instance. - * - * @param string $payload - * @param string $queue - * @return \Illuminate\Queue\Jobs\SyncJob - */ - protected function resolveJob($payload, $queue) - { - return new SyncJob($this->container, $payload, $this->connectionName, $queue); - } - - /** - * Raise the before queue job event. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @return void - */ - protected function raiseBeforeJobEvent(Job $job) - { - if ($this->container->bound('events')) { - $this->container['events']->dispatch(new JobProcessing($this->connectionName, $job)); - } - } - - /** - * Raise the after queue job event. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @return void - */ - protected function raiseAfterJobEvent(Job $job) - { - if ($this->container->bound('events')) { - $this->container['events']->dispatch(new JobProcessed($this->connectionName, $job)); - } - } - - /** - * Raise the exception occurred queue job event. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Throwable $e - * @return void - */ - protected function raiseExceptionOccurredJobEvent(Job $job, Throwable $e) - { - if ($this->container->bound('events')) { - $this->container['events']->dispatch(new JobExceptionOccurred($this->connectionName, $job, $e)); - } - } - - /** - * Handle an exception that occurred while processing a job. - * - * @param \Illuminate\Contracts\Queue\Job $queueJob - * @param \Throwable $e - * @return void - * - * @throws \Throwable - */ - protected function handleException(Job $queueJob, Throwable $e) - { - $this->raiseExceptionOccurredJobEvent($queueJob, $e); - - $queueJob->fail($e); - - throw $e; - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string|null $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = []) - { - // - } - - /** - * Push a new job onto the queue after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->push($job, $data, $queue); - } - - /** - * Pop the next job off of the queue. - * - * @param string|null $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - // - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/Worker.php b/framework-9.50.2/src/Illuminate/Queue/Worker.php deleted file mode 100644 index 438e3f4..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/Worker.php +++ /dev/null @@ -1,828 +0,0 @@ -events = $events; - $this->manager = $manager; - $this->exceptions = $exceptions; - $this->isDownForMaintenance = $isDownForMaintenance; - $this->resetScope = $resetScope; - } - - /** - * Listen to the given queue in a loop. - * - * @param string $connectionName - * @param string $queue - * @param \Illuminate\Queue\WorkerOptions $options - * @return int - */ - public function daemon($connectionName, $queue, WorkerOptions $options) - { - if ($supportsAsyncSignals = $this->supportsAsyncSignals()) { - $this->listenForSignals(); - } - - $lastRestart = $this->getTimestampOfLastQueueRestart(); - - [$startTime, $jobsProcessed] = [hrtime(true) / 1e9, 0]; - - while (true) { - // Before reserving any jobs, we will make sure this queue is not paused and - // if it is we will just pause this worker for a given amount of time and - // make sure we do not need to kill this worker process off completely. - if (! $this->daemonShouldRun($options, $connectionName, $queue)) { - $status = $this->pauseWorker($options, $lastRestart); - - if (! is_null($status)) { - return $this->stop($status, $options); - } - - continue; - } - - if (isset($this->resetScope)) { - ($this->resetScope)(); - } - - // First, we will attempt to get the next job off of the queue. We will also - // register the timeout handler and reset the alarm for this job so it is - // not stuck in a frozen state forever. Then, we can fire off this job. - $job = $this->getNextJob( - $this->manager->connection($connectionName), $queue - ); - - if ($supportsAsyncSignals) { - $this->registerTimeoutHandler($job, $options); - } - - // If the daemon should run (not in maintenance mode, etc.), then we can run - // fire off this job for processing. Otherwise, we will need to sleep the - // worker so no more jobs are processed until they should be processed. - if ($job) { - $jobsProcessed++; - - $this->runJob($job, $connectionName, $options); - - if ($options->rest > 0) { - $this->sleep($options->rest); - } - } else { - $this->sleep($options->sleep); - } - - if ($supportsAsyncSignals) { - $this->resetTimeoutHandler(); - } - - // Finally, we will check to see if we have exceeded our memory limits or if - // the queue should restart based on other indications. If so, we'll stop - // this worker and let whatever is "monitoring" it restart the process. - $status = $this->stopIfNecessary( - $options, $lastRestart, $startTime, $jobsProcessed, $job - ); - - if (! is_null($status)) { - return $this->stop($status, $options); - } - } - } - - /** - * Register the worker timeout handler. - * - * @param \Illuminate\Contracts\Queue\Job|null $job - * @param \Illuminate\Queue\WorkerOptions $options - * @return void - */ - protected function registerTimeoutHandler($job, WorkerOptions $options) - { - // We will register a signal handler for the alarm signal so that we can kill this - // process if it is running too long because it has frozen. This uses the async - // signals supported in recent versions of PHP to accomplish it conveniently. - pcntl_signal(SIGALRM, function () use ($job, $options) { - if ($job) { - $this->markJobAsFailedIfWillExceedMaxAttempts( - $job->getConnectionName(), $job, (int) $options->maxTries, $e = $this->maxAttemptsExceededException($job) - ); - - $this->markJobAsFailedIfWillExceedMaxExceptions( - $job->getConnectionName(), $job, $e - ); - - $this->markJobAsFailedIfItShouldFailOnTimeout( - $job->getConnectionName(), $job, $e - ); - } - - $this->kill(static::EXIT_ERROR, $options); - }, true); - - pcntl_alarm( - max($this->timeoutForJob($job, $options), 0) - ); - } - - /** - * Reset the worker timeout handler. - * - * @return void - */ - protected function resetTimeoutHandler() - { - pcntl_alarm(0); - } - - /** - * Get the appropriate timeout for the given job. - * - * @param \Illuminate\Contracts\Queue\Job|null $job - * @param \Illuminate\Queue\WorkerOptions $options - * @return int - */ - protected function timeoutForJob($job, WorkerOptions $options) - { - return $job && ! is_null($job->timeout()) ? $job->timeout() : $options->timeout; - } - - /** - * Determine if the daemon should process on this iteration. - * - * @param \Illuminate\Queue\WorkerOptions $options - * @param string $connectionName - * @param string $queue - * @return bool - */ - protected function daemonShouldRun(WorkerOptions $options, $connectionName, $queue) - { - return ! ((($this->isDownForMaintenance)() && ! $options->force) || - $this->paused || - $this->events->until(new Looping($connectionName, $queue)) === false); - } - - /** - * Pause the worker for the current loop. - * - * @param \Illuminate\Queue\WorkerOptions $options - * @param int $lastRestart - * @return int|null - */ - protected function pauseWorker(WorkerOptions $options, $lastRestart) - { - $this->sleep($options->sleep > 0 ? $options->sleep : 1); - - return $this->stopIfNecessary($options, $lastRestart); - } - - /** - * Determine the exit code to stop the process if necessary. - * - * @param \Illuminate\Queue\WorkerOptions $options - * @param int $lastRestart - * @param int $startTime - * @param int $jobsProcessed - * @param mixed $job - * @return int|null - */ - protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startTime = 0, $jobsProcessed = 0, $job = null) - { - return match (true) { - $this->shouldQuit => static::EXIT_SUCCESS, - $this->memoryExceeded($options->memory) => static::EXIT_MEMORY_LIMIT, - $this->queueShouldRestart($lastRestart) => static::EXIT_SUCCESS, - $options->stopWhenEmpty && is_null($job) => static::EXIT_SUCCESS, - $options->maxTime && hrtime(true) / 1e9 - $startTime >= $options->maxTime => static::EXIT_SUCCESS, - $options->maxJobs && $jobsProcessed >= $options->maxJobs => static::EXIT_SUCCESS, - default => null - }; - } - - /** - * Process the next job on the queue. - * - * @param string $connectionName - * @param string $queue - * @param \Illuminate\Queue\WorkerOptions $options - * @return void - */ - public function runNextJob($connectionName, $queue, WorkerOptions $options) - { - $job = $this->getNextJob( - $this->manager->connection($connectionName), $queue - ); - - // If we're able to pull a job off of the stack, we will process it and then return - // from this method. If there is no job on the queue, we will "sleep" the worker - // for the specified number of seconds, then keep processing jobs after sleep. - if ($job) { - return $this->runJob($job, $connectionName, $options); - } - - $this->sleep($options->sleep); - } - - /** - * Get the next job from the queue connection. - * - * @param \Illuminate\Contracts\Queue\Queue $connection - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - protected function getNextJob($connection, $queue) - { - $popJobCallback = function ($queue) use ($connection) { - return $connection->pop($queue); - }; - - try { - if (isset(static::$popCallbacks[$this->name])) { - return (static::$popCallbacks[$this->name])($popJobCallback, $queue); - } - - foreach (explode(',', $queue) as $queue) { - if (! is_null($job = $popJobCallback($queue))) { - return $job; - } - } - } catch (Throwable $e) { - $this->exceptions->report($e); - - $this->stopWorkerIfLostConnection($e); - - $this->sleep(1); - } - } - - /** - * Process the given job. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param string $connectionName - * @param \Illuminate\Queue\WorkerOptions $options - * @return void - */ - protected function runJob($job, $connectionName, WorkerOptions $options) - { - try { - return $this->process($connectionName, $job, $options); - } catch (Throwable $e) { - $this->exceptions->report($e); - - $this->stopWorkerIfLostConnection($e); - } - } - - /** - * Stop the worker if we have lost connection to a database. - * - * @param \Throwable $e - * @return void - */ - protected function stopWorkerIfLostConnection($e) - { - if ($this->causedByLostConnection($e)) { - $this->shouldQuit = true; - } - } - - /** - * Process the given job from the queue. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Illuminate\Queue\WorkerOptions $options - * @return void - * - * @throws \Throwable - */ - public function process($connectionName, $job, WorkerOptions $options) - { - try { - // First we will raise the before job event and determine if the job has already run - // over its maximum attempt limits, which could primarily happen when this job is - // continually timing out and not actually throwing any exceptions from itself. - $this->raiseBeforeJobEvent($connectionName, $job); - - $this->markJobAsFailedIfAlreadyExceedsMaxAttempts( - $connectionName, $job, (int) $options->maxTries - ); - - if ($job->isDeleted()) { - return $this->raiseAfterJobEvent($connectionName, $job); - } - - // Here we will fire off the job and let it process. We will catch any exceptions, so - // they can be reported to the developer's logs, etc. Once the job is finished the - // proper events will be fired to let any listeners know this job has completed. - $job->fire(); - - $this->raiseAfterJobEvent($connectionName, $job); - } catch (Throwable $e) { - $this->handleJobException($connectionName, $job, $options, $e); - } - } - - /** - * Handle an exception that occurred while the job was running. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Illuminate\Queue\WorkerOptions $options - * @param \Throwable $e - * @return void - * - * @throws \Throwable - */ - protected function handleJobException($connectionName, $job, WorkerOptions $options, Throwable $e) - { - try { - // First, we will go ahead and mark the job as failed if it will exceed the maximum - // attempts it is allowed to run the next time we process it. If so we will just - // go ahead and mark it as failed now so we do not have to release this again. - if (! $job->hasFailed()) { - $this->markJobAsFailedIfWillExceedMaxAttempts( - $connectionName, $job, (int) $options->maxTries, $e - ); - - $this->markJobAsFailedIfWillExceedMaxExceptions( - $connectionName, $job, $e - ); - } - - $this->raiseExceptionOccurredJobEvent( - $connectionName, $job, $e - ); - } finally { - // If we catch an exception, we will attempt to release the job back onto the queue - // so it is not lost entirely. This'll let the job be retried at a later time by - // another listener (or this same one). We will re-throw this exception after. - if (! $job->isDeleted() && ! $job->isReleased() && ! $job->hasFailed()) { - $job->release($this->calculateBackoff($job, $options)); - - $this->events->dispatch(new JobReleasedAfterException( - $connectionName, $job - )); - } - } - - throw $e; - } - - /** - * Mark the given job as failed if it has exceeded the maximum allowed attempts. - * - * This will likely be because the job previously exceeded a timeout. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @param int $maxTries - * @return void - * - * @throws \Throwable - */ - protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $job, $maxTries) - { - $maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries; - - $retryUntil = $job->retryUntil(); - - if ($retryUntil && Carbon::now()->getTimestamp() <= $retryUntil) { - return; - } - - if (! $retryUntil && ($maxTries === 0 || $job->attempts() <= $maxTries)) { - return; - } - - $this->failJob($job, $e = $this->maxAttemptsExceededException($job)); - - throw $e; - } - - /** - * Mark the given job as failed if it has exceeded the maximum allowed attempts. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @param int $maxTries - * @param \Throwable $e - * @return void - */ - protected function markJobAsFailedIfWillExceedMaxAttempts($connectionName, $job, $maxTries, Throwable $e) - { - $maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries; - - if ($job->retryUntil() && $job->retryUntil() <= Carbon::now()->getTimestamp()) { - $this->failJob($job, $e); - } - - if (! $job->retryUntil() && $maxTries > 0 && $job->attempts() >= $maxTries) { - $this->failJob($job, $e); - } - } - - /** - * Mark the given job as failed if it has exceeded the maximum allowed attempts. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Throwable $e - * @return void - */ - protected function markJobAsFailedIfWillExceedMaxExceptions($connectionName, $job, Throwable $e) - { - if (! $this->cache || is_null($uuid = $job->uuid()) || - is_null($maxExceptions = $job->maxExceptions())) { - return; - } - - if (! $this->cache->get('job-exceptions:'.$uuid)) { - $this->cache->put('job-exceptions:'.$uuid, 0, Carbon::now()->addDay()); - } - - if ($maxExceptions <= $this->cache->increment('job-exceptions:'.$uuid)) { - $this->cache->forget('job-exceptions:'.$uuid); - - $this->failJob($job, $e); - } - } - - /** - * Mark the given job as failed if it should fail on timeouts. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Throwable $e - * @return void - */ - protected function markJobAsFailedIfItShouldFailOnTimeout($connectionName, $job, Throwable $e) - { - if (method_exists($job, 'shouldFailOnTimeout') ? $job->shouldFailOnTimeout() : false) { - $this->failJob($job, $e); - } - } - - /** - * Mark the given job as failed and raise the relevant event. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Throwable $e - * @return void - */ - protected function failJob($job, Throwable $e) - { - $job->fail($e); - } - - /** - * Calculate the backoff for the given job. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Illuminate\Queue\WorkerOptions $options - * @return int - */ - protected function calculateBackoff($job, WorkerOptions $options) - { - $backoff = explode( - ',', - method_exists($job, 'backoff') && ! is_null($job->backoff()) - ? $job->backoff() - : $options->backoff - ); - - return (int) ($backoff[$job->attempts() - 1] ?? last($backoff)); - } - - /** - * Raise the before queue job event. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @return void - */ - protected function raiseBeforeJobEvent($connectionName, $job) - { - $this->events->dispatch(new JobProcessing( - $connectionName, $job - )); - } - - /** - * Raise the after queue job event. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @return void - */ - protected function raiseAfterJobEvent($connectionName, $job) - { - $this->events->dispatch(new JobProcessed( - $connectionName, $job - )); - } - - /** - * Raise the exception occurred queue job event. - * - * @param string $connectionName - * @param \Illuminate\Contracts\Queue\Job $job - * @param \Throwable $e - * @return void - */ - protected function raiseExceptionOccurredJobEvent($connectionName, $job, Throwable $e) - { - $this->events->dispatch(new JobExceptionOccurred( - $connectionName, $job, $e - )); - } - - /** - * Determine if the queue worker should restart. - * - * @param int|null $lastRestart - * @return bool - */ - protected function queueShouldRestart($lastRestart) - { - return $this->getTimestampOfLastQueueRestart() != $lastRestart; - } - - /** - * Get the last queue restart timestamp, or null. - * - * @return int|null - */ - protected function getTimestampOfLastQueueRestart() - { - if ($this->cache) { - return $this->cache->get('illuminate:queue:restart'); - } - } - - /** - * Enable async signals for the process. - * - * @return void - */ - protected function listenForSignals() - { - pcntl_async_signals(true); - - pcntl_signal(SIGQUIT, fn () => $this->shouldQuit = true); - pcntl_signal(SIGTERM, fn () => $this->shouldQuit = true); - pcntl_signal(SIGUSR2, fn () => $this->paused = true); - pcntl_signal(SIGCONT, fn () => $this->paused = false); - } - - /** - * Determine if "async" signals are supported. - * - * @return bool - */ - protected function supportsAsyncSignals() - { - return extension_loaded('pcntl'); - } - - /** - * Determine if the memory limit has been exceeded. - * - * @param int $memoryLimit - * @return bool - */ - public function memoryExceeded($memoryLimit) - { - return (memory_get_usage(true) / 1024 / 1024) >= $memoryLimit; - } - - /** - * Stop listening and bail out of the script. - * - * @param int $status - * @param WorkerOptions|null $options - * @return int - */ - public function stop($status = 0, $options = null) - { - $this->events->dispatch(new WorkerStopping($status, $options)); - - return $status; - } - - /** - * Kill the process. - * - * @param int $status - * @param \Illuminate\Queue\WorkerOptions|null $options - * @return never - */ - public function kill($status = 0, $options = null) - { - $this->events->dispatch(new WorkerStopping($status, $options)); - - if (extension_loaded('posix')) { - posix_kill(getmypid(), SIGKILL); - } - - exit($status); - } - - /** - * Create an instance of MaxAttemptsExceededException. - * - * @param \Illuminate\Contracts\Queue\Job $job - * @return \Illuminate\Queue\MaxAttemptsExceededException - */ - protected function maxAttemptsExceededException($job) - { - return new MaxAttemptsExceededException( - $job->resolveName().' has been attempted too many times or run too long. The job may have previously timed out.' - ); - } - - /** - * Sleep the script for a given number of seconds. - * - * @param int|float $seconds - * @return void - */ - public function sleep($seconds) - { - if ($seconds < 1) { - usleep($seconds * 1000000); - } else { - sleep($seconds); - } - } - - /** - * Set the cache repository implementation. - * - * @param \Illuminate\Contracts\Cache\Repository $cache - * @return $this - */ - public function setCache(CacheContract $cache) - { - $this->cache = $cache; - - return $this; - } - - /** - * Set the name of the worker. - * - * @param string $name - * @return $this - */ - public function setName($name) - { - $this->name = $name; - - return $this; - } - - /** - * Register a callback to be executed to pick jobs. - * - * @param string $workerName - * @param callable $callback - * @return void - */ - public static function popUsing($workerName, $callback) - { - if (is_null($callback)) { - unset(static::$popCallbacks[$workerName]); - } else { - static::$popCallbacks[$workerName] = $callback; - } - } - - /** - * Get the queue manager instance. - * - * @return \Illuminate\Contracts\Queue\Factory - */ - public function getManager() - { - return $this->manager; - } - - /** - * Set the queue manager instance. - * - * @param \Illuminate\Contracts\Queue\Factory $manager - * @return void - */ - public function setManager(QueueManager $manager) - { - $this->manager = $manager; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/WorkerOptions.php b/framework-9.50.2/src/Illuminate/Queue/WorkerOptions.php deleted file mode 100644 index 0fbb03e..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/WorkerOptions.php +++ /dev/null @@ -1,115 +0,0 @@ -name = $name; - $this->backoff = $backoff; - $this->sleep = $sleep; - $this->rest = $rest; - $this->force = $force; - $this->memory = $memory; - $this->timeout = $timeout; - $this->maxTries = $maxTries; - $this->stopWhenEmpty = $stopWhenEmpty; - $this->maxJobs = $maxJobs; - $this->maxTime = $maxTime; - } -} diff --git a/framework-9.50.2/src/Illuminate/Queue/composer.json b/framework-9.50.2/src/Illuminate/Queue/composer.json deleted file mode 100644 index f968173..0000000 --- a/framework-9.50.2/src/Illuminate/Queue/composer.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "illuminate/queue", - "description": "The Illuminate Queue package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "illuminate/collections": "^9.0", - "illuminate/console": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/database": "^9.0", - "illuminate/filesystem": "^9.0", - "illuminate/pipeline": "^9.0", - "illuminate/support": "^9.0", - "laravel/serializable-closure": "^1.2.2", - "ramsey/uuid": "^4.7", - "symfony/process": "^6.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Queue\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "ext-pcntl": "Required to use all features of the queue worker.", - "ext-posix": "Required to use all features of the queue worker.", - "aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.235.5).", - "illuminate/redis": "Required to use the Redis queue driver (^9.0).", - "pda/pheanstalk": "Required to use the Beanstalk queue driver (^4.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Connections/Connection.php b/framework-9.50.2/src/Illuminate/Redis/Connections/Connection.php deleted file mode 100644 index e3e55e9..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Connections/Connection.php +++ /dev/null @@ -1,218 +0,0 @@ -client; - } - - /** - * Subscribe to a set of given channels for messages. - * - * @param array|string $channels - * @param \Closure $callback - * @return void - */ - public function subscribe($channels, Closure $callback) - { - return $this->createSubscription($channels, $callback, __FUNCTION__); - } - - /** - * Subscribe to a set of given channels with wildcards. - * - * @param array|string $channels - * @param \Closure $callback - * @return void - */ - public function psubscribe($channels, Closure $callback) - { - return $this->createSubscription($channels, $callback, __FUNCTION__); - } - - /** - * Run a command against the Redis database. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function command($method, array $parameters = []) - { - $start = microtime(true); - - $result = $this->client->{$method}(...$parameters); - - $time = round((microtime(true) - $start) * 1000, 2); - - if (isset($this->events)) { - $this->event(new CommandExecuted($method, $parameters, $time, $this)); - } - - return $result; - } - - /** - * Fire the given event if possible. - * - * @param mixed $event - * @return void - */ - protected function event($event) - { - $this->events?->dispatch($event); - } - - /** - * Register a Redis command listener with the connection. - * - * @param \Closure $callback - * @return void - */ - public function listen(Closure $callback) - { - $this->events?->listen(CommandExecuted::class, $callback); - } - - /** - * Get the connection name. - * - * @return string|null - */ - public function getName() - { - return $this->name; - } - - /** - * Set the connections name. - * - * @param string $name - * @return $this - */ - public function setName($name) - { - $this->name = $name; - - return $this; - } - - /** - * Get the event dispatcher used by the connection. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getEventDispatcher() - { - return $this->events; - } - - /** - * Set the event dispatcher instance on the connection. - * - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void - */ - public function setEventDispatcher(Dispatcher $events) - { - $this->events = $events; - } - - /** - * Unset the event dispatcher instance on the connection. - * - * @return void - */ - public function unsetEventDispatcher() - { - $this->events = null; - } - - /** - * Pass other method calls down to the underlying client. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - return $this->command($method, $parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Connections/PacksPhpRedisValues.php b/framework-9.50.2/src/Illuminate/Redis/Connections/PacksPhpRedisValues.php deleted file mode 100644 index 4d27ff5..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Connections/PacksPhpRedisValues.php +++ /dev/null @@ -1,183 +0,0 @@ - $values - * @return array - */ - public function pack(array $values): array - { - if (empty($values)) { - return $values; - } - - if ($this->supportsPacking()) { - return array_map([$this->client, '_pack'], $values); - } - - if ($this->compressed()) { - if ($this->supportsLzf() && $this->lzfCompressed()) { - if (! function_exists('lzf_compress')) { - throw new RuntimeException("'lzf' extension required to call 'lzf_compress'."); - } - - $processor = function ($value) { - return \lzf_compress($this->client->_serialize($value)); - }; - } elseif ($this->supportsZstd() && $this->zstdCompressed()) { - if (! function_exists('zstd_compress')) { - throw new RuntimeException("'zstd' extension required to call 'zstd_compress'."); - } - - $compressionLevel = $this->client->getOption(Redis::OPT_COMPRESSION_LEVEL); - - $processor = function ($value) use ($compressionLevel) { - return \zstd_compress( - $this->client->_serialize($value), - $compressionLevel === 0 ? Redis::COMPRESSION_ZSTD_DEFAULT : $compressionLevel - ); - }; - } else { - throw new UnexpectedValueException(sprintf( - 'Unsupported phpredis compression in use [%d].', - $this->client->getOption(Redis::OPT_COMPRESSION) - )); - } - } else { - $processor = function ($value) { - return $this->client->_serialize($value); - }; - } - - return array_map($processor, $values); - } - - /** - * Determine if compression is enabled. - * - * @return bool - */ - public function compressed(): bool - { - return defined('Redis::OPT_COMPRESSION') && - $this->client->getOption(Redis::OPT_COMPRESSION) !== Redis::COMPRESSION_NONE; - } - - /** - * Determine if LZF compression is enabled. - * - * @return bool - */ - public function lzfCompressed(): bool - { - return defined('Redis::COMPRESSION_LZF') && - $this->client->getOption(Redis::OPT_COMPRESSION) === Redis::COMPRESSION_LZF; - } - - /** - * Determine if ZSTD compression is enabled. - * - * @return bool - */ - public function zstdCompressed(): bool - { - return defined('Redis::COMPRESSION_ZSTD') && - $this->client->getOption(Redis::OPT_COMPRESSION) === Redis::COMPRESSION_ZSTD; - } - - /** - * Determine if LZ4 compression is enabled. - * - * @return bool - */ - public function lz4Compressed(): bool - { - return defined('Redis::COMPRESSION_LZ4') && - $this->client->getOption(Redis::OPT_COMPRESSION) === Redis::COMPRESSION_LZ4; - } - - /** - * Determine if the current PhpRedis extension version supports packing. - * - * @return bool - */ - protected function supportsPacking(): bool - { - if ($this->supportsPacking === null) { - $this->supportsPacking = $this->phpRedisVersionAtLeast('5.3.5'); - } - - return $this->supportsPacking; - } - - /** - * Determine if the current PhpRedis extension version supports LZF compression. - * - * @return bool - */ - protected function supportsLzf(): bool - { - if ($this->supportsLzf === null) { - $this->supportsLzf = $this->phpRedisVersionAtLeast('4.3.0'); - } - - return $this->supportsLzf; - } - - /** - * Determine if the current PhpRedis extension version supports Zstd compression. - * - * @return bool - */ - protected function supportsZstd(): bool - { - if ($this->supportsZstd === null) { - $this->supportsZstd = $this->phpRedisVersionAtLeast('5.1.0'); - } - - return $this->supportsZstd; - } - - /** - * Determine if the PhpRedis extension version is at least the given version. - * - * @param string $version - * @return bool - */ - protected function phpRedisVersionAtLeast(string $version): bool - { - $phpredisVersion = phpversion('redis'); - - return $phpredisVersion !== false && version_compare($phpredisVersion, $version, '>='); - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php b/framework-9.50.2/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php deleted file mode 100644 index bf4816a..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php +++ /dev/null @@ -1,24 +0,0 @@ -client->_masters() as $master) { - $async - ? $this->command('rawCommand', [$master, 'flushdb', 'async']) - : $this->command('flushdb', [$master]); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Connections/PhpRedisConnection.php b/framework-9.50.2/src/Illuminate/Redis/Connections/PhpRedisConnection.php deleted file mode 100644 index 0f39ae9..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Connections/PhpRedisConnection.php +++ /dev/null @@ -1,567 +0,0 @@ -client = $client; - $this->config = $config; - $this->connector = $connector; - } - - /** - * Returns the value of the given key. - * - * @param string $key - * @return string|null - */ - public function get($key) - { - $result = $this->command('get', [$key]); - - return $result !== false ? $result : null; - } - - /** - * Get the values of all the given keys. - * - * @param array $keys - * @return array - */ - public function mget(array $keys) - { - return array_map(function ($value) { - return $value !== false ? $value : null; - }, $this->command('mget', [$keys])); - } - - /** - * Set the string value in the argument as the value of the key. - * - * @param string $key - * @param mixed $value - * @param string|null $expireResolution - * @param int|null $expireTTL - * @param string|null $flag - * @return bool - */ - public function set($key, $value, $expireResolution = null, $expireTTL = null, $flag = null) - { - return $this->command('set', [ - $key, - $value, - $expireResolution ? [$flag, $expireResolution => $expireTTL] : null, - ]); - } - - /** - * Set the given key if it doesn't exist. - * - * @param string $key - * @param string $value - * @return int - */ - public function setnx($key, $value) - { - return (int) $this->command('setnx', [$key, $value]); - } - - /** - * Get the value of the given hash fields. - * - * @param string $key - * @param mixed ...$dictionary - * @return array - */ - public function hmget($key, ...$dictionary) - { - if (count($dictionary) === 1) { - $dictionary = $dictionary[0]; - } - - return array_values($this->command('hmget', [$key, $dictionary])); - } - - /** - * Set the given hash fields to their respective values. - * - * @param string $key - * @param mixed ...$dictionary - * @return int - */ - public function hmset($key, ...$dictionary) - { - if (count($dictionary) === 1) { - $dictionary = $dictionary[0]; - } else { - $input = collect($dictionary); - - $dictionary = $input->nth(2)->combine($input->nth(2, 1))->toArray(); - } - - return $this->command('hmset', [$key, $dictionary]); - } - - /** - * Set the given hash field if it doesn't exist. - * - * @param string $hash - * @param string $key - * @param string $value - * @return int - */ - public function hsetnx($hash, $key, $value) - { - return (int) $this->command('hsetnx', [$hash, $key, $value]); - } - - /** - * Removes the first count occurrences of the value element from the list. - * - * @param string $key - * @param int $count - * @param mixed $value - * @return int|false - */ - public function lrem($key, $count, $value) - { - return $this->command('lrem', [$key, $value, $count]); - } - - /** - * Removes and returns the first element of the list stored at key. - * - * @param mixed ...$arguments - * @return array|null - */ - public function blpop(...$arguments) - { - $result = $this->command('blpop', $arguments); - - return empty($result) ? null : $result; - } - - /** - * Removes and returns the last element of the list stored at key. - * - * @param mixed ...$arguments - * @return array|null - */ - public function brpop(...$arguments) - { - $result = $this->command('brpop', $arguments); - - return empty($result) ? null : $result; - } - - /** - * Removes and returns a random element from the set value at key. - * - * @param string $key - * @param int|null $count - * @return mixed|false - */ - public function spop($key, $count = 1) - { - return $this->command('spop', func_get_args()); - } - - /** - * Add one or more members to a sorted set or update its score if it already exists. - * - * @param string $key - * @param mixed ...$dictionary - * @return int - */ - public function zadd($key, ...$dictionary) - { - if (is_array(end($dictionary))) { - foreach (array_pop($dictionary) as $member => $score) { - $dictionary[] = $score; - $dictionary[] = $member; - } - } - - $options = []; - - foreach (array_slice($dictionary, 0, 3) as $i => $value) { - if (in_array($value, ['nx', 'xx', 'ch', 'incr', 'gt', 'lt', 'NX', 'XX', 'CH', 'INCR', 'GT', 'LT'], true)) { - $options[] = $value; - - unset($dictionary[$i]); - } - } - - return $this->command('zadd', array_merge([$key], [$options], array_values($dictionary))); - } - - /** - * Return elements with score between $min and $max. - * - * @param string $key - * @param mixed $min - * @param mixed $max - * @param array $options - * @return array - */ - public function zrangebyscore($key, $min, $max, $options = []) - { - if (isset($options['limit']) && Arr::isAssoc($options['limit'])) { - $options['limit'] = [ - $options['limit']['offset'], - $options['limit']['count'], - ]; - } - - return $this->command('zRangeByScore', [$key, $min, $max, $options]); - } - - /** - * Return elements with score between $min and $max. - * - * @param string $key - * @param mixed $min - * @param mixed $max - * @param array $options - * @return array - */ - public function zrevrangebyscore($key, $min, $max, $options = []) - { - if (isset($options['limit']) && Arr::isAssoc($options['limit'])) { - $options['limit'] = [ - $options['limit']['offset'], - $options['limit']['count'], - ]; - } - - return $this->command('zRevRangeByScore', [$key, $min, $max, $options]); - } - - /** - * Find the intersection between sets and store in a new set. - * - * @param string $output - * @param array $keys - * @param array $options - * @return int - */ - public function zinterstore($output, $keys, $options = []) - { - return $this->command('zinterstore', [$output, $keys, - $options['weights'] ?? null, - $options['aggregate'] ?? 'sum', - ]); - } - - /** - * Find the union between sets and store in a new set. - * - * @param string $output - * @param array $keys - * @param array $options - * @return int - */ - public function zunionstore($output, $keys, $options = []) - { - return $this->command('zunionstore', [$output, $keys, - $options['weights'] ?? null, - $options['aggregate'] ?? 'sum', - ]); - } - - /** - * Scans all keys based on options. - * - * @param mixed $cursor - * @param array $options - * @return mixed - */ - public function scan($cursor, $options = []) - { - $result = $this->client->scan($cursor, - $options['match'] ?? '*', - $options['count'] ?? 10 - ); - - if ($result === false) { - $result = []; - } - - return $cursor === 0 && empty($result) ? false : [$cursor, $result]; - } - - /** - * Scans the given set for all values based on options. - * - * @param string $key - * @param mixed $cursor - * @param array $options - * @return mixed - */ - public function zscan($key, $cursor, $options = []) - { - $result = $this->client->zscan($key, $cursor, - $options['match'] ?? '*', - $options['count'] ?? 10 - ); - - if ($result === false) { - $result = []; - } - - return $cursor === 0 && empty($result) ? false : [$cursor, $result]; - } - - /** - * Scans the given hash for all values based on options. - * - * @param string $key - * @param mixed $cursor - * @param array $options - * @return mixed - */ - public function hscan($key, $cursor, $options = []) - { - $result = $this->client->hscan($key, $cursor, - $options['match'] ?? '*', - $options['count'] ?? 10 - ); - - if ($result === false) { - $result = []; - } - - return $cursor === 0 && empty($result) ? false : [$cursor, $result]; - } - - /** - * Scans the given set for all values based on options. - * - * @param string $key - * @param mixed $cursor - * @param array $options - * @return mixed - */ - public function sscan($key, $cursor, $options = []) - { - $result = $this->client->sscan($key, $cursor, - $options['match'] ?? '*', - $options['count'] ?? 10 - ); - - if ($result === false) { - $result = []; - } - - return $cursor === 0 && empty($result) ? false : [$cursor, $result]; - } - - /** - * Execute commands in a pipeline. - * - * @param callable|null $callback - * @return \Redis|array - */ - public function pipeline(callable $callback = null) - { - $pipeline = $this->client()->pipeline(); - - return is_null($callback) - ? $pipeline - : tap($pipeline, $callback)->exec(); - } - - /** - * Execute commands in a transaction. - * - * @param callable|null $callback - * @return \Redis|array - */ - public function transaction(callable $callback = null) - { - $transaction = $this->client()->multi(); - - return is_null($callback) - ? $transaction - : tap($transaction, $callback)->exec(); - } - - /** - * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. - * - * @param string $script - * @param int $numkeys - * @param mixed ...$arguments - * @return mixed - */ - public function evalsha($script, $numkeys, ...$arguments) - { - return $this->command('evalsha', [ - $this->script('load', $script), $arguments, $numkeys, - ]); - } - - /** - * Evaluate a script and return its result. - * - * @param string $script - * @param int $numberOfKeys - * @param dynamic ...$arguments - * @return mixed - */ - public function eval($script, $numberOfKeys, ...$arguments) - { - return $this->command('eval', [$script, $arguments, $numberOfKeys]); - } - - /** - * Subscribe to a set of given channels for messages. - * - * @param array|string $channels - * @param \Closure $callback - * @return void - */ - public function subscribe($channels, Closure $callback) - { - $this->client->subscribe((array) $channels, function ($redis, $channel, $message) use ($callback) { - $callback($message, $channel); - }); - } - - /** - * Subscribe to a set of given channels with wildcards. - * - * @param array|string $channels - * @param \Closure $callback - * @return void - */ - public function psubscribe($channels, Closure $callback) - { - $this->client->psubscribe((array) $channels, function ($redis, $pattern, $channel, $message) use ($callback) { - $callback($message, $channel); - }); - } - - /** - * Subscribe to a set of given channels for messages. - * - * @param array|string $channels - * @param \Closure $callback - * @param string $method - * @return void - */ - public function createSubscription($channels, Closure $callback, $method = 'subscribe') - { - // - } - - /** - * Flush the selected Redis database. - * - * @return mixed - */ - public function flushdb() - { - $arguments = func_get_args(); - - if (strtoupper((string) ($arguments[0] ?? null)) === 'ASYNC') { - return $this->command('flushdb', [true]); - } - - return $this->command('flushdb'); - } - - /** - * Execute a raw command. - * - * @param array $parameters - * @return mixed - */ - public function executeRaw(array $parameters) - { - return $this->command('rawCommand', $parameters); - } - - /** - * Run a command against the Redis database. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \RedisException - */ - public function command($method, array $parameters = []) - { - try { - return parent::command($method, $parameters); - } catch (RedisException $e) { - foreach (['went away', 'socket', 'read error on connection'] as $errorMessage) { - if (str_contains($e->getMessage(), $errorMessage)) { - $this->client = $this->connector ? call_user_func($this->connector) : $this->client; - - break; - } - } - - throw $e; - } - } - - /** - * Disconnects from the Redis instance. - * - * @return void - */ - public function disconnect() - { - $this->client->close(); - } - - /** - * Pass other method calls down to the underlying client. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return parent::__call(strtolower($method), $parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Connections/PredisClusterConnection.php b/framework-9.50.2/src/Illuminate/Redis/Connections/PredisClusterConnection.php deleted file mode 100644 index dbf91dc..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Connections/PredisClusterConnection.php +++ /dev/null @@ -1,25 +0,0 @@ -client as $node) { - $node->executeCommand(tap(new $command)->setArguments(func_get_args())); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Connections/PredisConnection.php b/framework-9.50.2/src/Illuminate/Redis/Connections/PredisConnection.php deleted file mode 100644 index f642dd6..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Connections/PredisConnection.php +++ /dev/null @@ -1,53 +0,0 @@ -client = $client; - } - - /** - * Subscribe to a set of given channels for messages. - * - * @param array|string $channels - * @param \Closure $callback - * @param string $method - * @return void - */ - public function createSubscription($channels, Closure $callback, $method = 'subscribe') - { - $loop = $this->pubSubLoop(); - - $loop->{$method}(...array_values((array) $channels)); - - foreach ($loop as $message) { - if ($message->kind === 'message' || $message->kind === 'pmessage') { - $callback($message->payload, $message->channel); - } - } - - unset($loop); - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Connectors/PhpRedisConnector.php b/framework-9.50.2/src/Illuminate/Redis/Connectors/PhpRedisConnector.php deleted file mode 100644 index 8953c5f..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Connectors/PhpRedisConnector.php +++ /dev/null @@ -1,234 +0,0 @@ -createClient(array_merge( - $config, $options, $formattedOptions - )); - }; - - return new PhpRedisConnection($connector(), $connector, $config); - } - - /** - * Create a new clustered PhpRedis connection. - * - * @param array $config - * @param array $clusterOptions - * @param array $options - * @return \Illuminate\Redis\Connections\PhpRedisClusterConnection - */ - public function connectToCluster(array $config, array $clusterOptions, array $options) - { - $options = array_merge($options, $clusterOptions, Arr::pull($config, 'options', [])); - - return new PhpRedisClusterConnection($this->createRedisClusterInstance( - array_map([$this, 'buildClusterConnectionString'], $config), $options - )); - } - - /** - * Build a single cluster seed string from an array. - * - * @param array $server - * @return string - */ - protected function buildClusterConnectionString(array $server) - { - return $this->formatHost($server).':'.$server['port'].'?'.Arr::query(Arr::only($server, [ - 'database', 'password', 'prefix', 'read_timeout', - ])); - } - - /** - * Create the Redis client instance. - * - * @param array $config - * @return \Redis - * - * @throws \LogicException - */ - protected function createClient(array $config) - { - return tap(new Redis, function ($client) use ($config) { - if ($client instanceof RedisFacade) { - throw new LogicException( - extension_loaded('redis') - ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.' - : 'Please make sure the PHP Redis extension is installed and enabled.' - ); - } - - $this->establishConnection($client, $config); - - if (! empty($config['password'])) { - if (isset($config['username']) && $config['username'] !== '' && is_string($config['password'])) { - $client->auth([$config['username'], $config['password']]); - } else { - $client->auth($config['password']); - } - } - - if (isset($config['database'])) { - $client->select((int) $config['database']); - } - - if (! empty($config['prefix'])) { - $client->setOption(Redis::OPT_PREFIX, $config['prefix']); - } - - if (! empty($config['read_timeout'])) { - $client->setOption(Redis::OPT_READ_TIMEOUT, $config['read_timeout']); - } - - if (! empty($config['scan'])) { - $client->setOption(Redis::OPT_SCAN, $config['scan']); - } - - if (! empty($config['name'])) { - $client->client('SETNAME', $config['name']); - } - - if (array_key_exists('serializer', $config)) { - $client->setOption(Redis::OPT_SERIALIZER, $config['serializer']); - } - - if (array_key_exists('compression', $config)) { - $client->setOption(Redis::OPT_COMPRESSION, $config['compression']); - } - - if (array_key_exists('compression_level', $config)) { - $client->setOption(Redis::OPT_COMPRESSION_LEVEL, $config['compression_level']); - } - }); - } - - /** - * Establish a connection with the Redis host. - * - * @param \Redis $client - * @param array $config - * @return void - */ - protected function establishConnection($client, array $config) - { - $persistent = $config['persistent'] ?? false; - - $parameters = [ - $this->formatHost($config), - $config['port'], - Arr::get($config, 'timeout', 0.0), - $persistent ? Arr::get($config, 'persistent_id', null) : null, - Arr::get($config, 'retry_interval', 0), - ]; - - if (version_compare(phpversion('redis'), '3.1.3', '>=')) { - $parameters[] = Arr::get($config, 'read_timeout', 0.0); - } - - if (version_compare(phpversion('redis'), '5.3.0', '>=') && ! is_null($context = Arr::get($config, 'context'))) { - $parameters[] = $context; - } - - $client->{$persistent ? 'pconnect' : 'connect'}(...$parameters); - } - - /** - * Create a new redis cluster instance. - * - * @param array $servers - * @param array $options - * @return \RedisCluster - */ - protected function createRedisClusterInstance(array $servers, array $options) - { - $parameters = [ - null, - array_values($servers), - $options['timeout'] ?? 0, - $options['read_timeout'] ?? 0, - isset($options['persistent']) && $options['persistent'], - ]; - - if (version_compare(phpversion('redis'), '4.3.0', '>=')) { - $parameters[] = $options['password'] ?? null; - } - - if (version_compare(phpversion('redis'), '5.3.2', '>=') && ! is_null($context = Arr::get($options, 'context'))) { - $parameters[] = $context; - } - - return tap(new RedisCluster(...$parameters), function ($client) use ($options) { - if (! empty($options['prefix'])) { - $client->setOption(RedisCluster::OPT_PREFIX, $options['prefix']); - } - - if (! empty($options['scan'])) { - $client->setOption(RedisCluster::OPT_SCAN, $options['scan']); - } - - if (! empty($options['failover'])) { - $client->setOption(RedisCluster::OPT_SLAVE_FAILOVER, $options['failover']); - } - - if (! empty($options['name'])) { - $client->client('SETNAME', $options['name']); - } - - if (array_key_exists('serializer', $options)) { - $client->setOption(RedisCluster::OPT_SERIALIZER, $options['serializer']); - } - - if (array_key_exists('compression', $options)) { - $client->setOption(RedisCluster::OPT_COMPRESSION, $options['compression']); - } - - if (array_key_exists('compression_level', $options)) { - $client->setOption(RedisCluster::OPT_COMPRESSION_LEVEL, $options['compression_level']); - } - }); - } - - /** - * Format the host using the scheme if available. - * - * @param array $options - * @return string - */ - protected function formatHost(array $options) - { - if (isset($options['scheme'])) { - return Str::start($options['host'], "{$options['scheme']}://"); - } - - return $options['host']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Connectors/PredisConnector.php b/framework-9.50.2/src/Illuminate/Redis/Connectors/PredisConnector.php deleted file mode 100644 index 6222a4b..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Connectors/PredisConnector.php +++ /dev/null @@ -1,53 +0,0 @@ - 10.0], $options, Arr::pull($config, 'options', []) - ); - - if (isset($config['prefix'])) { - $formattedOptions['prefix'] = $config['prefix']; - } - - return new PredisConnection(new Client($config, $formattedOptions)); - } - - /** - * Create a new clustered Predis connection. - * - * @param array $config - * @param array $clusterOptions - * @param array $options - * @return \Illuminate\Redis\Connections\PredisClusterConnection - */ - public function connectToCluster(array $config, array $clusterOptions, array $options) - { - $clusterSpecificOptions = Arr::pull($config, 'options', []); - - if (isset($config['prefix'])) { - $clusterSpecificOptions['prefix'] = $config['prefix']; - } - - return new PredisClusterConnection(new Client(array_values($config), array_merge( - $options, $clusterOptions, $clusterSpecificOptions - ))); - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Events/CommandExecuted.php b/framework-9.50.2/src/Illuminate/Redis/Events/CommandExecuted.php deleted file mode 100644 index fa65719..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Events/CommandExecuted.php +++ /dev/null @@ -1,59 +0,0 @@ -time = $time; - $this->command = $command; - $this->parameters = $parameters; - $this->connection = $connection; - $this->connectionName = $connection->getName(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/LICENSE.md b/framework-9.50.2/src/Illuminate/Redis/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php b/framework-9.50.2/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php deleted file mode 100644 index e249053..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php +++ /dev/null @@ -1,167 +0,0 @@ -name = $name; - $this->redis = $redis; - $this->maxLocks = $maxLocks; - $this->releaseAfter = $releaseAfter; - } - - /** - * Attempt to acquire the lock for the given number of seconds. - * - * @param int $timeout - * @param callable|null $callback - * @param int $sleep - * @return mixed - * - * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException - * @throws \Throwable - */ - public function block($timeout, $callback = null, $sleep = 250) - { - $starting = time(); - - $id = Str::random(20); - - while (! $slot = $this->acquire($id)) { - if (time() - $timeout >= $starting) { - throw new LimiterTimeoutException; - } - - usleep($sleep * 1000); - } - - if (is_callable($callback)) { - try { - return tap($callback(), function () use ($slot, $id) { - $this->release($slot, $id); - }); - } catch (Throwable $exception) { - $this->release($slot, $id); - - throw $exception; - } - } - - return true; - } - - /** - * Attempt to acquire the lock. - * - * @param string $id A unique identifier for this lock - * @return mixed - */ - protected function acquire($id) - { - $slots = array_map(function ($i) { - return $this->name.$i; - }, range(1, $this->maxLocks)); - - return $this->redis->eval(...array_merge( - [$this->lockScript(), count($slots)], - array_merge($slots, [$this->name, $this->releaseAfter, $id]) - )); - } - - /** - * Get the Lua script for acquiring a lock. - * - * KEYS - The keys that represent available slots - * ARGV[1] - The limiter name - * ARGV[2] - The number of seconds the slot should be reserved - * ARGV[3] - The unique identifier for this lock - * - * @return string - */ - protected function lockScript() - { - return <<<'LUA' -for index, value in pairs(redis.call('mget', unpack(KEYS))) do - if not value then - redis.call('set', KEYS[index], ARGV[3], "EX", ARGV[2]) - return ARGV[1]..index - end -end -LUA; - } - - /** - * Release the lock. - * - * @param string $key - * @param string $id - * @return void - */ - protected function release($key, $id) - { - $this->redis->eval($this->releaseScript(), 1, $key, $id); - } - - /** - * Get the Lua script to atomically release a lock. - * - * KEYS[1] - The name of the lock - * ARGV[1] - The unique identifier for this lock - * - * @return string - */ - protected function releaseScript() - { - return <<<'LUA' -if redis.call('get', KEYS[1]) == ARGV[1] -then - return redis.call('del', KEYS[1]) -else - return 0 -end -LUA; - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php b/framework-9.50.2/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php deleted file mode 100644 index fd2bf12..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php +++ /dev/null @@ -1,142 +0,0 @@ -name = $name; - $this->connection = $connection; - } - - /** - * Set the maximum number of locks that can be obtained per time window. - * - * @param int $maxLocks - * @return $this - */ - public function limit($maxLocks) - { - $this->maxLocks = $maxLocks; - - return $this; - } - - /** - * Set the number of seconds until the lock will be released. - * - * @param int $releaseAfter - * @return $this - */ - public function releaseAfter($releaseAfter) - { - $this->releaseAfter = $this->secondsUntil($releaseAfter); - - return $this; - } - - /** - * Set the amount of time to block until a lock is available. - * - * @param int $timeout - * @return $this - */ - public function block($timeout) - { - $this->timeout = $timeout; - - return $this; - } - - /** - * The number of milliseconds to wait between lock acquisition attempts. - * - * @param int $sleep - * @return $this - */ - public function sleep($sleep) - { - $this->sleep = $sleep; - - return $this; - } - - /** - * Execute the given callback if a lock is obtained, otherwise call the failure callback. - * - * @param callable $callback - * @param callable|null $failure - * @return mixed - * - * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException - */ - public function then(callable $callback, callable $failure = null) - { - try { - return (new ConcurrencyLimiter( - $this->connection, $this->name, $this->maxLocks, $this->releaseAfter - ))->block($this->timeout, $callback, $this->sleep); - } catch (LimiterTimeoutException $e) { - if ($failure) { - return $failure($e); - } - - throw $e; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Limiters/DurationLimiter.php b/framework-9.50.2/src/Illuminate/Redis/Limiters/DurationLimiter.php deleted file mode 100644 index 65297ff..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Limiters/DurationLimiter.php +++ /dev/null @@ -1,203 +0,0 @@ -name = $name; - $this->decay = $decay; - $this->redis = $redis; - $this->maxLocks = $maxLocks; - } - - /** - * Attempt to acquire the lock for the given number of seconds. - * - * @param int $timeout - * @param callable|null $callback - * @param int $sleep - * @return mixed - * - * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException - */ - public function block($timeout, $callback = null, $sleep = 750) - { - $starting = time(); - - while (! $this->acquire()) { - if (time() - $timeout >= $starting) { - throw new LimiterTimeoutException; - } - - usleep($sleep * 1000); - } - - if (is_callable($callback)) { - return $callback(); - } - - return true; - } - - /** - * Attempt to acquire the lock. - * - * @return bool - */ - public function acquire() - { - $results = $this->redis->eval( - $this->luaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks - ); - - $this->decaysAt = $results[1]; - - $this->remaining = max(0, $results[2]); - - return (bool) $results[0]; - } - - /** - * Determine if the key has been "accessed" too many times. - * - * @return bool - */ - public function tooManyAttempts() - { - [$this->decaysAt, $this->remaining] = $this->redis->eval( - $this->tooManyAttemptsLuaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks - ); - - return $this->remaining <= 0; - } - - /** - * Clear the limiter. - * - * @return void - */ - public function clear() - { - $this->redis->del($this->name); - } - - /** - * Get the Lua script for acquiring a lock. - * - * KEYS[1] - The limiter name - * ARGV[1] - Current time in microseconds - * ARGV[2] - Current time in seconds - * ARGV[3] - Duration of the bucket - * ARGV[4] - Allowed number of tasks - * - * @return string - */ - protected function luaScript() - { - return <<<'LUA' -local function reset() - redis.call('HMSET', KEYS[1], 'start', ARGV[2], 'end', ARGV[2] + ARGV[3], 'count', 1) - return redis.call('EXPIRE', KEYS[1], ARGV[3] * 2) -end - -if redis.call('EXISTS', KEYS[1]) == 0 then - return {reset(), ARGV[2] + ARGV[3], ARGV[4] - 1} -end - -if ARGV[1] >= redis.call('HGET', KEYS[1], 'start') and ARGV[1] <= redis.call('HGET', KEYS[1], 'end') then - return { - tonumber(redis.call('HINCRBY', KEYS[1], 'count', 1)) <= tonumber(ARGV[4]), - redis.call('HGET', KEYS[1], 'end'), - ARGV[4] - redis.call('HGET', KEYS[1], 'count') - } -end - -return {reset(), ARGV[2] + ARGV[3], ARGV[4] - 1} -LUA; - } - - /** - * Get the Lua script to determine if the key has been "accessed" too many times. - * - * KEYS[1] - The limiter name - * ARGV[1] - Current time in microseconds - * ARGV[2] - Current time in seconds - * ARGV[3] - Duration of the bucket - * ARGV[4] - Allowed number of tasks - * - * @return string - */ - protected function tooManyAttemptsLuaScript() - { - return <<<'LUA' - -if redis.call('EXISTS', KEYS[1]) == 0 then - return {0, ARGV[2] + ARGV[3]} -end - -if ARGV[1] >= redis.call('HGET', KEYS[1], 'start') and ARGV[1] <= redis.call('HGET', KEYS[1], 'end') then - return { - redis.call('HGET', KEYS[1], 'end'), - ARGV[4] - redis.call('HGET', KEYS[1], 'count') - } -end - -return {0, ARGV[2] + ARGV[3]} -LUA; - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php b/framework-9.50.2/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php deleted file mode 100644 index ddb3218..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php +++ /dev/null @@ -1,142 +0,0 @@ -name = $name; - $this->connection = $connection; - } - - /** - * Set the maximum number of locks that can be obtained per time window. - * - * @param int $maxLocks - * @return $this - */ - public function allow($maxLocks) - { - $this->maxLocks = $maxLocks; - - return $this; - } - - /** - * Set the amount of time the lock window is maintained. - * - * @param \DateTimeInterface|\DateInterval|int $decay - * @return $this - */ - public function every($decay) - { - $this->decay = $this->secondsUntil($decay); - - return $this; - } - - /** - * Set the amount of time to block until a lock is available. - * - * @param int $timeout - * @return $this - */ - public function block($timeout) - { - $this->timeout = $timeout; - - return $this; - } - - /** - * The number of milliseconds to wait between lock acquisition attempts. - * - * @param int $sleep - * @return $this - */ - public function sleep($sleep) - { - $this->sleep = $sleep; - - return $this; - } - - /** - * Execute the given callback if a lock is obtained, otherwise call the failure callback. - * - * @param callable $callback - * @param callable|null $failure - * @return mixed - * - * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException - */ - public function then(callable $callback, callable $failure = null) - { - try { - return (new DurationLimiter( - $this->connection, $this->name, $this->maxLocks, $this->decay - ))->block($this->timeout, $callback, $this->sleep); - } catch (LimiterTimeoutException $e) { - if ($failure) { - return $failure($e); - } - - throw $e; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/RedisManager.php b/framework-9.50.2/src/Illuminate/Redis/RedisManager.php deleted file mode 100644 index e869741..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/RedisManager.php +++ /dev/null @@ -1,278 +0,0 @@ -app = $app; - $this->driver = $driver; - $this->config = $config; - } - - /** - * Get a Redis connection by name. - * - * @param string|null $name - * @return \Illuminate\Redis\Connections\Connection - */ - public function connection($name = null) - { - $name = $name ?: 'default'; - - if (isset($this->connections[$name])) { - return $this->connections[$name]; - } - - return $this->connections[$name] = $this->configure( - $this->resolve($name), $name - ); - } - - /** - * Resolve the given connection by name. - * - * @param string|null $name - * @return \Illuminate\Redis\Connections\Connection - * - * @throws \InvalidArgumentException - */ - public function resolve($name = null) - { - $name = $name ?: 'default'; - - $options = $this->config['options'] ?? []; - - if (isset($this->config[$name])) { - return $this->connector()->connect( - $this->parseConnectionConfiguration($this->config[$name]), - array_merge(Arr::except($options, 'parameters'), ['parameters' => Arr::get($options, 'parameters.'.$name, Arr::get($options, 'parameters', []))]) - ); - } - - if (isset($this->config['clusters'][$name])) { - return $this->resolveCluster($name); - } - - throw new InvalidArgumentException("Redis connection [{$name}] not configured."); - } - - /** - * Resolve the given cluster connection by name. - * - * @param string $name - * @return \Illuminate\Redis\Connections\Connection - */ - protected function resolveCluster($name) - { - return $this->connector()->connectToCluster( - array_map(function ($config) { - return $this->parseConnectionConfiguration($config); - }, $this->config['clusters'][$name]), - $this->config['clusters']['options'] ?? [], - $this->config['options'] ?? [] - ); - } - - /** - * Configure the given connection to prepare it for commands. - * - * @param \Illuminate\Redis\Connections\Connection $connection - * @param string $name - * @return \Illuminate\Redis\Connections\Connection - */ - protected function configure(Connection $connection, $name) - { - $connection->setName($name); - - if ($this->events && $this->app->bound('events')) { - $connection->setEventDispatcher($this->app->make('events')); - } - - return $connection; - } - - /** - * Get the connector instance for the current driver. - * - * @return \Illuminate\Contracts\Redis\Connector|null - */ - protected function connector() - { - $customCreator = $this->customCreators[$this->driver] ?? null; - - if ($customCreator) { - return $customCreator(); - } - - return match ($this->driver) { - 'predis' => new PredisConnector, - 'phpredis' => new PhpRedisConnector, - default => null, - }; - } - - /** - * Parse the Redis connection configuration. - * - * @param mixed $config - * @return array - */ - protected function parseConnectionConfiguration($config) - { - $parsed = (new ConfigurationUrlParser)->parseConfiguration($config); - - $driver = strtolower($parsed['driver'] ?? ''); - - if (in_array($driver, ['tcp', 'tls'])) { - $parsed['scheme'] = $driver; - } - - return array_filter($parsed, function ($key) { - return ! in_array($key, ['driver'], true); - }, ARRAY_FILTER_USE_KEY); - } - - /** - * Return all of the created connections. - * - * @return array - */ - public function connections() - { - return $this->connections; - } - - /** - * Enable the firing of Redis command events. - * - * @return void - */ - public function enableEvents() - { - $this->events = true; - } - - /** - * Disable the firing of Redis command events. - * - * @return void - */ - public function disableEvents() - { - $this->events = false; - } - - /** - * Set the default driver. - * - * @param string $driver - * @return void - */ - public function setDriver($driver) - { - $this->driver = $driver; - } - - /** - * Disconnect the given connection and remove from local cache. - * - * @param string|null $name - * @return void - */ - public function purge($name = null) - { - $name = $name ?: 'default'; - - unset($this->connections[$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->bindTo($this, $this); - - return $this; - } - - /** - * Pass methods onto the default Redis connection. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->connection()->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/RedisServiceProvider.php b/framework-9.50.2/src/Illuminate/Redis/RedisServiceProvider.php deleted file mode 100755 index 66282e5..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/RedisServiceProvider.php +++ /dev/null @@ -1,38 +0,0 @@ -app->singleton('redis', function ($app) { - $config = $app->make('config')->get('database.redis', []); - - return new RedisManager($app, Arr::pull($config, 'client', 'phpredis'), $config); - }); - - $this->app->bind('redis.connection', function ($app) { - return $app['redis']->connection(); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['redis', 'redis.connection']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Redis/composer.json b/framework-9.50.2/src/Illuminate/Redis/composer.json deleted file mode 100755 index 93fe330..0000000 --- a/framework-9.50.2/src/Illuminate/Redis/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "illuminate/redis", - "description": "The Illuminate Redis package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Redis\\": "" - } - }, - "suggest": { - "ext-redis": "Required to use the phpredis connector (^4.0|^5.0).", - "predis/predis": "Required to use the predis connector (^1.1.9|^2.0.2)." - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Routing/AbstractRouteCollection.php b/framework-9.50.2/src/Illuminate/Routing/AbstractRouteCollection.php deleted file mode 100644 index d87441e..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/AbstractRouteCollection.php +++ /dev/null @@ -1,284 +0,0 @@ -bind($request); - } - - // If no route was found we will now check if a matching route is specified by - // another HTTP verb. If it is we will need to throw a MethodNotAllowed and - // inform the user agent of which HTTP verb it should use for this route. - $others = $this->checkForAlternateVerbs($request); - - if (count($others) > 0) { - return $this->getRouteForMethods($request, $others); - } - - throw new NotFoundHttpException(sprintf( - 'The route %s could not be found.', - $request->path() - )); - } - - /** - * Determine if any routes match on another HTTP verb. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - protected function checkForAlternateVerbs($request) - { - $methods = array_diff(Router::$verbs, [$request->getMethod()]); - - // Here we will spin through all verbs except for the current request verb and - // check to see if any routes respond to them. If they do, we will return a - // proper error response with the correct headers on the response string. - return array_values(array_filter( - $methods, - function ($method) use ($request) { - return ! is_null($this->matchAgainstRoutes($this->get($method), $request, false)); - } - )); - } - - /** - * Determine if a route in the array matches the request. - * - * @param \Illuminate\Routing\Route[] $routes - * @param \Illuminate\Http\Request $request - * @param bool $includingMethod - * @return \Illuminate\Routing\Route|null - */ - protected function matchAgainstRoutes(array $routes, $request, $includingMethod = true) - { - [$fallbacks, $routes] = collect($routes)->partition(function ($route) { - return $route->isFallback; - }); - - return $routes->merge($fallbacks)->first( - fn (Route $route) => $route->matches($request, $includingMethod) - ); - } - - /** - * Get a route (if necessary) that responds when other available methods are present. - * - * @param \Illuminate\Http\Request $request - * @param string[] $methods - * @return \Illuminate\Routing\Route - * - * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException - */ - protected function getRouteForMethods($request, array $methods) - { - if ($request->isMethod('OPTIONS')) { - return (new Route('OPTIONS', $request->path(), function () use ($methods) { - return new Response('', 200, ['Allow' => implode(',', $methods)]); - }))->bind($request); - } - - $this->requestMethodNotAllowed($request, $methods, $request->method()); - } - - /** - * Throw a method not allowed HTTP exception. - * - * @param \Illuminate\Http\Request $request - * @param array $others - * @param string $method - * @return void - * - * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException - */ - protected function requestMethodNotAllowed($request, array $others, $method) - { - throw new MethodNotAllowedHttpException( - $others, - sprintf( - 'The %s method is not supported for route %s. Supported methods: %s.', - $method, - $request->path(), - implode(', ', $others) - ) - ); - } - - /** - * Throw a method not allowed HTTP exception. - * - * @param array $others - * @param string $method - * @return void - * - * @deprecated use requestMethodNotAllowed - * - * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException - */ - protected function methodNotAllowed(array $others, $method) - { - throw new MethodNotAllowedHttpException( - $others, - sprintf( - 'The %s method is not supported for this route. Supported methods: %s.', - $method, - implode(', ', $others) - ) - ); - } - - /** - * Compile the routes for caching. - * - * @return array - */ - public function compile() - { - $compiled = $this->dumper()->getCompiledRoutes(); - - $attributes = []; - - foreach ($this->getRoutes() as $route) { - $attributes[$route->getName()] = [ - 'methods' => $route->methods(), - 'uri' => $route->uri(), - 'action' => $route->getAction(), - 'fallback' => $route->isFallback, - 'defaults' => $route->defaults, - 'wheres' => $route->wheres, - 'bindingFields' => $route->bindingFields(), - 'lockSeconds' => $route->locksFor(), - 'waitSeconds' => $route->waitsFor(), - 'withTrashed' => $route->allowsTrashedBindings(), - ]; - } - - return compact('compiled', 'attributes'); - } - - /** - * Return the CompiledUrlMatcherDumper instance for the route collection. - * - * @return \Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper - */ - public function dumper() - { - return new CompiledUrlMatcherDumper($this->toSymfonyRouteCollection()); - } - - /** - * Convert the collection to a Symfony RouteCollection instance. - * - * @return \Symfony\Component\Routing\RouteCollection - */ - public function toSymfonyRouteCollection() - { - $symfonyRoutes = new SymfonyRouteCollection; - - $routes = $this->getRoutes(); - - foreach ($routes as $route) { - if (! $route->isFallback) { - $symfonyRoutes = $this->addToSymfonyRoutesCollection($symfonyRoutes, $route); - } - } - - foreach ($routes as $route) { - if ($route->isFallback) { - $symfonyRoutes = $this->addToSymfonyRoutesCollection($symfonyRoutes, $route); - } - } - - return $symfonyRoutes; - } - - /** - * Add a route to the SymfonyRouteCollection instance. - * - * @param \Symfony\Component\Routing\RouteCollection $symfonyRoutes - * @param \Illuminate\Routing\Route $route - * @return \Symfony\Component\Routing\RouteCollection - * - * @throws \LogicException - */ - protected function addToSymfonyRoutesCollection(SymfonyRouteCollection $symfonyRoutes, Route $route) - { - $name = $route->getName(); - - if ( - ! is_null($name) - && str_ends_with($name, '.') - && ! is_null($symfonyRoutes->get($name)) - ) { - $name = null; - } - - if (! $name) { - $route->name($this->generateRouteName()); - - $this->add($route); - } elseif (! is_null($symfonyRoutes->get($name))) { - throw new LogicException("Unable to prepare route [{$route->uri}] for serialization. Another route has already been assigned name [{$name}]."); - } - - $symfonyRoutes->add($route->getName(), $route->toSymfonyRoute()); - - return $symfonyRoutes; - } - - /** - * Get a randomly generated route name. - * - * @return string - */ - protected function generateRouteName() - { - return 'generated::'.Str::random(); - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->getRoutes()); - } - - /** - * Count the number of items in the collection. - * - * @return int - */ - public function count(): int - { - return count($this->getRoutes()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/CallableDispatcher.php b/framework-9.50.2/src/Illuminate/Routing/CallableDispatcher.php deleted file mode 100644 index e85ee04..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/CallableDispatcher.php +++ /dev/null @@ -1,54 +0,0 @@ -container = $container; - } - - /** - * Dispatch a request to a given callable. - * - * @param \Illuminate\Routing\Route $route - * @param callable $callable - * @return mixed - */ - public function dispatch(Route $route, $callable) - { - return $callable(...array_values($this->resolveParameters($route, $callable))); - } - - /** - * Resolve the parameters for the callable. - * - * @param \Illuminate\Routing\Route $route - * @param callable $callable - * @return array - */ - protected function resolveParameters(Route $route, $callable) - { - return $this->resolveMethodDependencies($route->parametersWithoutNulls(), new ReflectionFunction($callable)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/CompiledRouteCollection.php b/framework-9.50.2/src/Illuminate/Routing/CompiledRouteCollection.php deleted file mode 100644 index 2b693f8..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/CompiledRouteCollection.php +++ /dev/null @@ -1,330 +0,0 @@ -compiled = $compiled; - $this->attributes = $attributes; - $this->routes = new RouteCollection; - } - - /** - * Add a Route instance to the collection. - * - * @param \Illuminate\Routing\Route $route - * @return \Illuminate\Routing\Route - */ - public function add(Route $route) - { - return $this->routes->add($route); - } - - /** - * Refresh the name look-up table. - * - * This is done in case any names are fluently defined or if routes are overwritten. - * - * @return void - */ - public function refreshNameLookups() - { - // - } - - /** - * Refresh the action look-up table. - * - * This is done in case any actions are overwritten with new controllers. - * - * @return void - */ - public function refreshActionLookups() - { - // - } - - /** - * Find the first route matching a given request. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Routing\Route - * - * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - public function match(Request $request) - { - $matcher = new CompiledUrlMatcher( - $this->compiled, (new RequestContext)->fromRequest( - $trimmedRequest = $this->requestWithoutTrailingSlash($request) - ) - ); - - $route = null; - - try { - if ($result = $matcher->matchRequest($trimmedRequest)) { - $route = $this->getByName($result['_route']); - } - } catch (ResourceNotFoundException|MethodNotAllowedException $e) { - try { - return $this->routes->match($request); - } catch (NotFoundHttpException $e) { - // - } - } - - if ($route && $route->isFallback) { - try { - $dynamicRoute = $this->routes->match($request); - - if (! $dynamicRoute->isFallback) { - $route = $dynamicRoute; - } - } catch (NotFoundHttpException|MethodNotAllowedHttpException $e) { - // - } - } - - return $this->handleMatchedRoute($request, $route); - } - - /** - * Get a cloned instance of the given request without any trailing slash on the URI. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Request - */ - protected function requestWithoutTrailingSlash(Request $request) - { - $trimmedRequest = $request->duplicate(); - - $parts = explode('?', $request->server->get('REQUEST_URI'), 2); - - $trimmedRequest->server->set( - 'REQUEST_URI', rtrim($parts[0], '/').(isset($parts[1]) ? '?'.$parts[1] : '') - ); - - return $trimmedRequest; - } - - /** - * Get routes from the collection by method. - * - * @param string|null $method - * @return \Illuminate\Routing\Route[] - */ - public function get($method = null) - { - return $this->getRoutesByMethod()[$method] ?? []; - } - - /** - * Determine if the route collection contains a given named route. - * - * @param string $name - * @return bool - */ - public function hasNamedRoute($name) - { - return isset($this->attributes[$name]) || $this->routes->hasNamedRoute($name); - } - - /** - * Get a route instance by its name. - * - * @param string $name - * @return \Illuminate\Routing\Route|null - */ - public function getByName($name) - { - if (isset($this->attributes[$name])) { - return $this->newRoute($this->attributes[$name]); - } - - return $this->routes->getByName($name); - } - - /** - * Get a route instance by its controller action. - * - * @param string $action - * @return \Illuminate\Routing\Route|null - */ - public function getByAction($action) - { - $attributes = collect($this->attributes)->first(function (array $attributes) use ($action) { - if (isset($attributes['action']['controller'])) { - return trim($attributes['action']['controller'], '\\') === $action; - } - - return $attributes['action']['uses'] === $action; - }); - - if ($attributes) { - return $this->newRoute($attributes); - } - - return $this->routes->getByAction($action); - } - - /** - * Get all of the routes in the collection. - * - * @return \Illuminate\Routing\Route[] - */ - public function getRoutes() - { - return collect($this->attributes) - ->map(function (array $attributes) { - return $this->newRoute($attributes); - }) - ->merge($this->routes->getRoutes()) - ->values() - ->all(); - } - - /** - * Get all of the routes keyed by their HTTP verb / method. - * - * @return array - */ - public function getRoutesByMethod() - { - return collect($this->getRoutes()) - ->groupBy(function (Route $route) { - return $route->methods(); - }) - ->map(function (Collection $routes) { - return $routes->mapWithKeys(function (Route $route) { - return [$route->getDomain().$route->uri => $route]; - })->all(); - }) - ->all(); - } - - /** - * Get all of the routes keyed by their name. - * - * @return \Illuminate\Routing\Route[] - */ - public function getRoutesByName() - { - return collect($this->getRoutes()) - ->keyBy(function (Route $route) { - return $route->getName(); - }) - ->all(); - } - - /** - * Resolve an array of attributes to a Route instance. - * - * @param array $attributes - * @return \Illuminate\Routing\Route - */ - protected function newRoute(array $attributes) - { - if (empty($attributes['action']['prefix'] ?? '')) { - $baseUri = $attributes['uri']; - } else { - $prefix = trim($attributes['action']['prefix'], '/'); - - $baseUri = trim(implode( - '/', array_slice( - explode('/', trim($attributes['uri'], '/')), - count($prefix !== '' ? explode('/', $prefix) : []) - ) - ), '/'); - } - - return $this->router->newRoute($attributes['methods'], $baseUri === '' ? '/' : $baseUri, $attributes['action']) - ->setFallback($attributes['fallback']) - ->setDefaults($attributes['defaults']) - ->setWheres($attributes['wheres']) - ->setBindingFields($attributes['bindingFields']) - ->block($attributes['lockSeconds'] ?? null, $attributes['waitSeconds'] ?? null) - ->withTrashed($attributes['withTrashed'] ?? false); - } - - /** - * Set the router instance on the route. - * - * @param \Illuminate\Routing\Router $router - * @return $this - */ - public function setRouter(Router $router) - { - $this->router = $router; - - return $this; - } - - /** - * Set the container instance on the route. - * - * @param \Illuminate\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Console/ControllerMakeCommand.php b/framework-9.50.2/src/Illuminate/Routing/Console/ControllerMakeCommand.php deleted file mode 100755 index 13e6250..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Console/ControllerMakeCommand.php +++ /dev/null @@ -1,340 +0,0 @@ -option('type')) { - $stub = "/stubs/controller.{$type}.stub"; - } elseif ($this->option('parent')) { - $stub = $this->option('singleton') - ? '/stubs/controller.nested.singleton.stub' - : '/stubs/controller.nested.stub'; - } elseif ($this->option('model')) { - $stub = '/stubs/controller.model.stub'; - } elseif ($this->option('invokable')) { - $stub = '/stubs/controller.invokable.stub'; - } elseif ($this->option('singleton')) { - $stub = '/stubs/controller.singleton.stub'; - } elseif ($this->option('resource')) { - $stub = '/stubs/controller.stub'; - } - - if ($this->option('api') && is_null($stub)) { - $stub = '/stubs/controller.api.stub'; - } elseif ($this->option('api') && ! is_null($stub) && ! $this->option('invokable')) { - $stub = str_replace('.stub', '.api.stub', $stub); - } - - $stub ??= '/stubs/controller.plain.stub'; - - return $this->resolveStubPath($stub); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Http\Controllers'; - } - - /** - * Build the class with the given name. - * - * Remove the base controller import if we are already in the base namespace. - * - * @param string $name - * @return string - */ - protected function buildClass($name) - { - $controllerNamespace = $this->getNamespace($name); - - $replace = []; - - if ($this->option('parent')) { - $replace = $this->buildParentReplacements(); - } - - if ($this->option('model')) { - $replace = $this->buildModelReplacements($replace); - } - - if ($this->option('creatable')) { - $replace['abort(404);'] = '//'; - } - - $replace["use {$controllerNamespace}\Controller;\n"] = ''; - - return str_replace( - array_keys($replace), array_values($replace), parent::buildClass($name) - ); - } - - /** - * Build the replacements for a parent controller. - * - * @return array - */ - protected function buildParentReplacements() - { - $parentModelClass = $this->parseModel($this->option('parent')); - - if (! class_exists($parentModelClass) && - $this->components->confirm("A {$parentModelClass} model does not exist. Do you want to generate it?", true)) { - $this->call('make:model', ['name' => $parentModelClass]); - } - - return [ - 'ParentDummyFullModelClass' => $parentModelClass, - '{{ namespacedParentModel }}' => $parentModelClass, - '{{namespacedParentModel}}' => $parentModelClass, - 'ParentDummyModelClass' => class_basename($parentModelClass), - '{{ parentModel }}' => class_basename($parentModelClass), - '{{parentModel}}' => class_basename($parentModelClass), - 'ParentDummyModelVariable' => lcfirst(class_basename($parentModelClass)), - '{{ parentModelVariable }}' => lcfirst(class_basename($parentModelClass)), - '{{parentModelVariable}}' => lcfirst(class_basename($parentModelClass)), - ]; - } - - /** - * Build the model replacement values. - * - * @param array $replace - * @return array - */ - protected function buildModelReplacements(array $replace) - { - $modelClass = $this->parseModel($this->option('model')); - - if (! class_exists($modelClass) && $this->components->confirm("A {$modelClass} model does not exist. Do you want to generate it?", true)) { - $this->call('make:model', ['name' => $modelClass]); - } - - $replace = $this->buildFormRequestReplacements($replace, $modelClass); - - return array_merge($replace, [ - 'DummyFullModelClass' => $modelClass, - '{{ namespacedModel }}' => $modelClass, - '{{namespacedModel}}' => $modelClass, - 'DummyModelClass' => class_basename($modelClass), - '{{ model }}' => class_basename($modelClass), - '{{model}}' => class_basename($modelClass), - 'DummyModelVariable' => lcfirst(class_basename($modelClass)), - '{{ modelVariable }}' => lcfirst(class_basename($modelClass)), - '{{modelVariable}}' => lcfirst(class_basename($modelClass)), - ]); - } - - /** - * Get the fully-qualified model class name. - * - * @param string $model - * @return string - * - * @throws \InvalidArgumentException - */ - protected function parseModel($model) - { - if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) { - throw new InvalidArgumentException('Model name contains invalid characters.'); - } - - return $this->qualifyModel($model); - } - - /** - * Build the model replacement values. - * - * @param array $replace - * @param string $modelClass - * @return array - */ - protected function buildFormRequestReplacements(array $replace, $modelClass) - { - [$namespace, $storeRequestClass, $updateRequestClass] = [ - 'Illuminate\\Http', 'Request', 'Request', - ]; - - if ($this->option('requests')) { - $namespace = 'App\\Http\\Requests'; - - [$storeRequestClass, $updateRequestClass] = $this->generateFormRequests( - $modelClass, $storeRequestClass, $updateRequestClass - ); - } - - $namespacedRequests = $namespace.'\\'.$storeRequestClass.';'; - - if ($storeRequestClass !== $updateRequestClass) { - $namespacedRequests .= PHP_EOL.'use '.$namespace.'\\'.$updateRequestClass.';'; - } - - return array_merge($replace, [ - '{{ storeRequest }}' => $storeRequestClass, - '{{storeRequest}}' => $storeRequestClass, - '{{ updateRequest }}' => $updateRequestClass, - '{{updateRequest}}' => $updateRequestClass, - '{{ namespacedStoreRequest }}' => $namespace.'\\'.$storeRequestClass, - '{{namespacedStoreRequest}}' => $namespace.'\\'.$storeRequestClass, - '{{ namespacedUpdateRequest }}' => $namespace.'\\'.$updateRequestClass, - '{{namespacedUpdateRequest}}' => $namespace.'\\'.$updateRequestClass, - '{{ namespacedRequests }}' => $namespacedRequests, - '{{namespacedRequests}}' => $namespacedRequests, - ]); - } - - /** - * Generate the form requests for the given model and classes. - * - * @param string $modelClass - * @param string $storeRequestClass - * @param string $updateRequestClass - * @return array - */ - protected function generateFormRequests($modelClass, $storeRequestClass, $updateRequestClass) - { - $storeRequestClass = 'Store'.class_basename($modelClass).'Request'; - - $this->call('make:request', [ - 'name' => $storeRequestClass, - ]); - - $updateRequestClass = 'Update'.class_basename($modelClass).'Request'; - - $this->call('make:request', [ - 'name' => $updateRequestClass, - ]); - - return [$storeRequestClass, $updateRequestClass]; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller'], - ['type', null, InputOption::VALUE_REQUIRED, 'Manually specify the controller stub file to use'], - ['force', null, InputOption::VALUE_NONE, 'Create the class even if the controller already exists'], - ['invokable', 'i', InputOption::VALUE_NONE, 'Generate a single method, invokable controller class'], - ['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model'], - ['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class'], - ['resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class'], - ['requests', 'R', InputOption::VALUE_NONE, 'Generate FormRequest classes for store and update'], - ['singleton', 's', InputOption::VALUE_NONE, 'Generate a singleton resource controller class'], - ['creatable', null, InputOption::VALUE_NONE, 'Indicate that a singleton resource should be creatable'], - ]; - } - - /** - * Interact further with the user if they were prompted for missing arguments. - * - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return void - */ - protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output) - { - if ($this->didReceiveOptions($input)) { - return; - } - - $type = $this->components->choice('Which type of controller would you like', [ - 'empty', - 'api', - 'invokable', - 'resource', - 'singleton', - ], default: 0); - - if ($type !== 'empty') { - $input->setOption($type, true); - } - - if (in_array($type, ['api', 'resource', 'singleton'])) { - $model = $this->components->askWithCompletion( - "What model should this $type controller be for?", - $this->possibleModels(), - 'none' - ); - - if ($model && $model !== 'none') { - $input->setOption('model', $model); - } - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php b/framework-9.50.2/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php deleted file mode 100644 index 11bec0e..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php +++ /dev/null @@ -1,79 +0,0 @@ -resolveStubPath('/stubs/middleware.stub'); - } - - /** - * Resolve the fully-qualified path to the stub. - * - * @param string $stub - * @return string - */ - protected function resolveStubPath($stub) - { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__.$stub; - } - - /** - * Get the default namespace for the class. - * - * @param string $rootNamespace - * @return string - */ - protected function getDefaultNamespace($rootNamespace) - { - return $rootNamespace.'\Http\Middleware'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.api.stub b/framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.api.stub deleted file mode 100644 index 381a9c8..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Console/stubs/controller.api.stub +++ /dev/null @@ -1,64 +0,0 @@ -middleware[] = [ - 'middleware' => $m, - 'options' => &$options, - ]; - } - - return new ControllerMiddlewareOptions($options); - } - - /** - * Get the middleware assigned to the controller. - * - * @return array - */ - public function getMiddleware() - { - return $this->middleware; - } - - /** - * Execute an action on the controller. - * - * @param string $method - * @param array $parameters - * @return \Symfony\Component\HttpFoundation\Response - */ - public function callAction($method, $parameters) - { - return $this->{$method}(...array_values($parameters)); - } - - /** - * Handle calls to missing methods on the controller. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - throw new BadMethodCallException(sprintf( - 'Method %s::%s does not exist.', static::class, $method - )); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/ControllerDispatcher.php b/framework-9.50.2/src/Illuminate/Routing/ControllerDispatcher.php deleted file mode 100644 index d3b0bc8..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/ControllerDispatcher.php +++ /dev/null @@ -1,94 +0,0 @@ -container = $container; - } - - /** - * Dispatch a request to a given controller and method. - * - * @param \Illuminate\Routing\Route $route - * @param mixed $controller - * @param string $method - * @return mixed - */ - public function dispatch(Route $route, $controller, $method) - { - $parameters = $this->resolveParameters($route, $controller, $method); - - if (method_exists($controller, 'callAction')) { - return $controller->callAction($method, $parameters); - } - - return $controller->{$method}(...array_values($parameters)); - } - - /** - * Resolve the parameters for the controller. - * - * @param \Illuminate\Routing\Route $route - * @param mixed $controller - * @param string $method - * @return array - */ - protected function resolveParameters(Route $route, $controller, $method) - { - return $this->resolveClassMethodDependencies( - $route->parametersWithoutNulls(), $controller, $method - ); - } - - /** - * Get the middleware for the controller instance. - * - * @param \Illuminate\Routing\Controller $controller - * @param string $method - * @return array - */ - public function getMiddleware($controller, $method) - { - if (! method_exists($controller, 'getMiddleware')) { - return []; - } - - return collect($controller->getMiddleware())->reject(function ($data) use ($method) { - return static::methodExcludedByOptions($method, $data['options']); - })->pluck('middleware')->all(); - } - - /** - * Determine if the given options exclude a particular method. - * - * @param string $method - * @param array $options - * @return bool - */ - public static function methodExcludedByOptions($method, array $options) - { - return (isset($options['only']) && ! in_array($method, (array) $options['only'])) || - (! empty($options['except']) && in_array($method, (array) $options['except'])); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/ControllerMiddlewareOptions.php b/framework-9.50.2/src/Illuminate/Routing/ControllerMiddlewareOptions.php deleted file mode 100644 index 13ef189..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/ControllerMiddlewareOptions.php +++ /dev/null @@ -1,50 +0,0 @@ -options = &$options; - } - - /** - * Set the controller methods the middleware should apply to. - * - * @param array|string|dynamic $methods - * @return $this - */ - public function only($methods) - { - $this->options['only'] = is_array($methods) ? $methods : func_get_args(); - - return $this; - } - - /** - * Set the controller methods the middleware should exclude. - * - * @param array|string|dynamic $methods - * @return $this - */ - public function except($methods) - { - $this->options['except'] = is_array($methods) ? $methods : func_get_args(); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Controllers/HasMiddleware.php b/framework-9.50.2/src/Illuminate/Routing/Controllers/HasMiddleware.php deleted file mode 100644 index 3d4b262..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Controllers/HasMiddleware.php +++ /dev/null @@ -1,13 +0,0 @@ -middleware = $middleware; - } - - /** - * Specify the only controller methods the middleware should apply to. - * - * @param array|string $only - * @return $this - */ - public function only(array|string $only) - { - $this->only = Arr::wrap($only); - - return $this; - } - - /** - * Specify the controller methods the middleware should not apply to. - * - * @param array|string $only - * @return $this - */ - public function except(array|string $except) - { - $this->except = Arr::wrap($except); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php b/framework-9.50.2/src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php deleted file mode 100644 index e170451..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php +++ /dev/null @@ -1,89 +0,0 @@ -assignExpressionToParameters($parameters, '[a-zA-Z]+'); - } - - /** - * Specify that the given route parameters must be alphanumeric. - * - * @param array|string $parameters - * @return $this - */ - public function whereAlphaNumeric($parameters) - { - return $this->assignExpressionToParameters($parameters, '[a-zA-Z0-9]+'); - } - - /** - * Specify that the given route parameters must be numeric. - * - * @param array|string $parameters - * @return $this - */ - public function whereNumber($parameters) - { - return $this->assignExpressionToParameters($parameters, '[0-9]+'); - } - - /** - * Specify that the given route parameters must be ULIDs. - * - * @param array|string $parameters - * @return $this - */ - public function whereUlid($parameters) - { - return $this->assignExpressionToParameters($parameters, '[0-7][0-9a-hjkmnp-tv-zA-HJKMNP-TV-Z]{25}'); - } - - /** - * Specify that the given route parameters must be UUIDs. - * - * @param array|string $parameters - * @return $this - */ - public function whereUuid($parameters) - { - return $this->assignExpressionToParameters($parameters, '[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}'); - } - - /** - * Specify that the given route parameters must be one of the given values. - * - * @param array|string $parameters - * @param array $values - * @return $this - */ - public function whereIn($parameters, array $values) - { - return $this->assignExpressionToParameters($parameters, implode('|', $values)); - } - - /** - * Apply the given regular expression to the given parameters. - * - * @param array|string $parameters - * @param string $expression - * @return $this - */ - protected function assignExpressionToParameters($parameters, $expression) - { - return $this->where(collect(Arr::wrap($parameters)) - ->mapWithKeys(fn ($parameter) => [$parameter => $expression]) - ->all()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Events/RouteMatched.php b/framework-9.50.2/src/Illuminate/Routing/Events/RouteMatched.php deleted file mode 100644 index c848607..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Events/RouteMatched.php +++ /dev/null @@ -1,33 +0,0 @@ -route = $route; - $this->request = $request; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Events/Routing.php b/framework-9.50.2/src/Illuminate/Routing/Events/Routing.php deleted file mode 100644 index af1bb48..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Events/Routing.php +++ /dev/null @@ -1,24 +0,0 @@ -request = $request; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Exceptions/BackedEnumCaseNotFoundException.php b/framework-9.50.2/src/Illuminate/Routing/Exceptions/BackedEnumCaseNotFoundException.php deleted file mode 100644 index 468583d..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Exceptions/BackedEnumCaseNotFoundException.php +++ /dev/null @@ -1,20 +0,0 @@ -originalException = $originalException; - - parent::__construct($originalException->getMessage()); - } - - /** - * Render the exception. - * - * @return \Illuminate\Http\Response - */ - public function render() - { - return new Response(''); - } - - /** - * Get the actual exception thrown during the stream. - * - * @return \Throwable - */ - public function getInnerException() - { - return $this->originalException; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Exceptions/UrlGenerationException.php b/framework-9.50.2/src/Illuminate/Routing/Exceptions/UrlGenerationException.php deleted file mode 100644 index eadda80..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Exceptions/UrlGenerationException.php +++ /dev/null @@ -1,37 +0,0 @@ -getName(), - $route->uri() - ); - - if (count($parameters) > 0) { - $message .= sprintf(' [Missing %s: %s]', $parameterLabel, implode(', ', $parameters)); - } - - $message .= '.'; - - return new static($message); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/ImplicitRouteBinding.php b/framework-9.50.2/src/Illuminate/Routing/ImplicitRouteBinding.php deleted file mode 100644 index d9978af..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/ImplicitRouteBinding.php +++ /dev/null @@ -1,118 +0,0 @@ - - * @throws \Illuminate\Routing\Exceptions\BackedEnumCaseNotFoundException - */ - public static function resolveForRoute($container, $route) - { - $parameters = $route->parameters(); - - $route = static::resolveBackedEnumsForRoute($route, $parameters); - - foreach ($route->signatureParameters(['subClass' => UrlRoutable::class]) as $parameter) { - if (! $parameterName = static::getParameterName($parameter->getName(), $parameters)) { - continue; - } - - $parameterValue = $parameters[$parameterName]; - - if ($parameterValue instanceof UrlRoutable) { - continue; - } - - $instance = $container->make(Reflector::getParameterClassName($parameter)); - - $parent = $route->parentOfParameter($parameterName); - - $routeBindingMethod = $route->allowsTrashedBindings() && in_array(SoftDeletes::class, class_uses_recursive($instance)) - ? 'resolveSoftDeletableRouteBinding' - : 'resolveRouteBinding'; - - if ($parent instanceof UrlRoutable && - ! $route->preventsScopedBindings() && - ($route->enforcesScopedBindings() || array_key_exists($parameterName, $route->bindingFields()))) { - $childRouteBindingMethod = $route->allowsTrashedBindings() && in_array(SoftDeletes::class, class_uses_recursive($instance)) - ? 'resolveSoftDeletableChildRouteBinding' - : 'resolveChildRouteBinding'; - - if (! $model = $parent->{$childRouteBindingMethod}( - $parameterName, $parameterValue, $route->bindingFieldFor($parameterName) - )) { - throw (new ModelNotFoundException)->setModel(get_class($instance), [$parameterValue]); - } - } elseif (! $model = $instance->{$routeBindingMethod}($parameterValue, $route->bindingFieldFor($parameterName))) { - throw (new ModelNotFoundException)->setModel(get_class($instance), [$parameterValue]); - } - - $route->setParameter($parameterName, $model); - } - } - - /** - * Resolve the Backed Enums route bindings for the route. - * - * @param \Illuminate\Routing\Route $route - * @param array $parameters - * @return \Illuminate\Routing\Route - * - * @throws \Illuminate\Routing\Exceptions\BackedEnumCaseNotFoundException - */ - protected static function resolveBackedEnumsForRoute($route, $parameters) - { - foreach ($route->signatureParameters(['backedEnum' => true]) as $parameter) { - if (! $parameterName = static::getParameterName($parameter->getName(), $parameters)) { - continue; - } - - $parameterValue = $parameters[$parameterName]; - - $backedEnumClass = (string) $parameter->getType(); - - $backedEnum = $backedEnumClass::tryFrom((string) $parameterValue); - - if (is_null($backedEnum)) { - throw new BackedEnumCaseNotFoundException($backedEnumClass, $parameterValue); - } - - $route->setParameter($parameterName, $backedEnum); - } - - return $route; - } - - /** - * Return the parameter name if it exists in the given parameters. - * - * @param string $name - * @param array $parameters - * @return string|null - */ - protected static function getParameterName($name, $parameters) - { - if (array_key_exists($name, $parameters)) { - return $name; - } - - if (array_key_exists($snakedName = Str::snake($name), $parameters)) { - return $snakedName; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/LICENSE.md b/framework-9.50.2/src/Illuminate/Routing/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Routing/Matching/HostValidator.php b/framework-9.50.2/src/Illuminate/Routing/Matching/HostValidator.php deleted file mode 100644 index a0ea721..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Matching/HostValidator.php +++ /dev/null @@ -1,27 +0,0 @@ -getCompiled()->getHostRegex(); - - if (is_null($hostRegex)) { - return true; - } - - return preg_match($hostRegex, $request->getHost()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Matching/MethodValidator.php b/framework-9.50.2/src/Illuminate/Routing/Matching/MethodValidator.php deleted file mode 100644 index f9cf155..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Matching/MethodValidator.php +++ /dev/null @@ -1,21 +0,0 @@ -getMethod(), $route->methods()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Matching/SchemeValidator.php b/framework-9.50.2/src/Illuminate/Routing/Matching/SchemeValidator.php deleted file mode 100644 index fd5d5af..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Matching/SchemeValidator.php +++ /dev/null @@ -1,27 +0,0 @@ -httpOnly()) { - return ! $request->secure(); - } elseif ($route->secure()) { - return $request->secure(); - } - - return true; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Matching/UriValidator.php b/framework-9.50.2/src/Illuminate/Routing/Matching/UriValidator.php deleted file mode 100644 index 4dcc2cf..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Matching/UriValidator.php +++ /dev/null @@ -1,23 +0,0 @@ -getPathInfo(), '/') ?: '/'; - - return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Matching/ValidatorInterface.php b/framework-9.50.2/src/Illuminate/Routing/Matching/ValidatorInterface.php deleted file mode 100644 index 0f178f1..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Matching/ValidatorInterface.php +++ /dev/null @@ -1,18 +0,0 @@ -router = $router; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - try { - $this->router->substituteBindings($route = $request->route()); - - $this->router->substituteImplicitBindings($route); - } catch (ModelNotFoundException $exception) { - if ($route->getMissing()) { - return $route->getMissing()($request, $exception); - } - - throw $exception; - } - - return $next($request); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Middleware/ThrottleRequests.php b/framework-9.50.2/src/Illuminate/Routing/Middleware/ThrottleRequests.php deleted file mode 100644 index 0967525..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Middleware/ThrottleRequests.php +++ /dev/null @@ -1,276 +0,0 @@ -limiter = $limiter; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param int|string $maxAttempts - * @param float|int $decayMinutes - * @param string $prefix - * @return \Symfony\Component\HttpFoundation\Response - * - * @throws \Illuminate\Http\Exceptions\ThrottleRequestsException - */ - public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes = 1, $prefix = '') - { - if (is_string($maxAttempts) - && func_num_args() === 3 - && ! is_null($limiter = $this->limiter->limiter($maxAttempts))) { - return $this->handleRequestUsingNamedLimiter($request, $next, $maxAttempts, $limiter); - } - - return $this->handleRequest( - $request, - $next, - [ - (object) [ - 'key' => $prefix.$this->resolveRequestSignature($request), - 'maxAttempts' => $this->resolveMaxAttempts($request, $maxAttempts), - 'decayMinutes' => $decayMinutes, - 'responseCallback' => null, - ], - ] - ); - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string $limiterName - * @param \Closure $limiter - * @return \Symfony\Component\HttpFoundation\Response - * - * @throws \Illuminate\Http\Exceptions\ThrottleRequestsException - */ - protected function handleRequestUsingNamedLimiter($request, Closure $next, $limiterName, Closure $limiter) - { - $limiterResponse = $limiter($request); - - if ($limiterResponse instanceof Response) { - return $limiterResponse; - } elseif ($limiterResponse instanceof Unlimited) { - return $next($request); - } - - return $this->handleRequest( - $request, - $next, - collect(Arr::wrap($limiterResponse))->map(function ($limit) use ($limiterName) { - return (object) [ - 'key' => md5($limiterName.$limit->key), - 'maxAttempts' => $limit->maxAttempts, - 'decayMinutes' => $limit->decayMinutes, - 'responseCallback' => $limit->responseCallback, - ]; - })->all() - ); - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param array $limits - * @return \Symfony\Component\HttpFoundation\Response - * - * @throws \Illuminate\Http\Exceptions\ThrottleRequestsException - */ - protected function handleRequest($request, Closure $next, array $limits) - { - foreach ($limits as $limit) { - if ($this->limiter->tooManyAttempts($limit->key, $limit->maxAttempts)) { - throw $this->buildException($request, $limit->key, $limit->maxAttempts, $limit->responseCallback); - } - - $this->limiter->hit($limit->key, $limit->decayMinutes * 60); - } - - $response = $next($request); - - foreach ($limits as $limit) { - $response = $this->addHeaders( - $response, - $limit->maxAttempts, - $this->calculateRemainingAttempts($limit->key, $limit->maxAttempts) - ); - } - - return $response; - } - - /** - * Resolve the number of attempts if the user is authenticated or not. - * - * @param \Illuminate\Http\Request $request - * @param int|string $maxAttempts - * @return int - */ - protected function resolveMaxAttempts($request, $maxAttempts) - { - if (str_contains($maxAttempts, '|')) { - $maxAttempts = explode('|', $maxAttempts, 2)[$request->user() ? 1 : 0]; - } - - if (! is_numeric($maxAttempts) && $request->user()) { - $maxAttempts = $request->user()->{$maxAttempts}; - } - - return (int) $maxAttempts; - } - - /** - * Resolve request signature. - * - * @param \Illuminate\Http\Request $request - * @return string - * - * @throws \RuntimeException - */ - protected function resolveRequestSignature($request) - { - if ($user = $request->user()) { - return sha1($user->getAuthIdentifier()); - } elseif ($route = $request->route()) { - return sha1($route->getDomain().'|'.$request->ip()); - } - - throw new RuntimeException('Unable to generate the request signature. Route unavailable.'); - } - - /** - * Create a 'too many attempts' exception. - * - * @param \Illuminate\Http\Request $request - * @param string $key - * @param int $maxAttempts - * @param callable|null $responseCallback - * @return \Illuminate\Http\Exceptions\ThrottleRequestsException - */ - protected function buildException($request, $key, $maxAttempts, $responseCallback = null) - { - $retryAfter = $this->getTimeUntilNextRetry($key); - - $headers = $this->getHeaders( - $maxAttempts, - $this->calculateRemainingAttempts($key, $maxAttempts, $retryAfter), - $retryAfter - ); - - return is_callable($responseCallback) - ? new HttpResponseException($responseCallback($request, $headers)) - : new ThrottleRequestsException('Too Many Attempts.', null, $headers); - } - - /** - * Get the number of seconds until the next retry. - * - * @param string $key - * @return int - */ - protected function getTimeUntilNextRetry($key) - { - return $this->limiter->availableIn($key); - } - - /** - * Add the limit header information to the given response. - * - * @param \Symfony\Component\HttpFoundation\Response $response - * @param int $maxAttempts - * @param int $remainingAttempts - * @param int|null $retryAfter - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function addHeaders(Response $response, $maxAttempts, $remainingAttempts, $retryAfter = null) - { - $response->headers->add( - $this->getHeaders($maxAttempts, $remainingAttempts, $retryAfter, $response) - ); - - return $response; - } - - /** - * Get the limit headers information. - * - * @param int $maxAttempts - * @param int $remainingAttempts - * @param int|null $retryAfter - * @param \Symfony\Component\HttpFoundation\Response|null $response - * @return array - */ - protected function getHeaders($maxAttempts, - $remainingAttempts, - $retryAfter = null, - ?Response $response = null) - { - if ($response && - ! is_null($response->headers->get('X-RateLimit-Remaining')) && - (int) $response->headers->get('X-RateLimit-Remaining') <= (int) $remainingAttempts) { - return []; - } - - $headers = [ - 'X-RateLimit-Limit' => $maxAttempts, - 'X-RateLimit-Remaining' => $remainingAttempts, - ]; - - if (! is_null($retryAfter)) { - $headers['Retry-After'] = $retryAfter; - $headers['X-RateLimit-Reset'] = $this->availableAt($retryAfter); - } - - return $headers; - } - - /** - * Calculate the number of remaining attempts. - * - * @param string $key - * @param int $maxAttempts - * @param int|null $retryAfter - * @return int - */ - protected function calculateRemainingAttempts($key, $maxAttempts, $retryAfter = null) - { - return is_null($retryAfter) ? $this->limiter->retriesLeft($key, $maxAttempts) : 0; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php b/framework-9.50.2/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php deleted file mode 100644 index 777f30c..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php +++ /dev/null @@ -1,122 +0,0 @@ -redis = $redis; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param array $limits - * @return \Symfony\Component\HttpFoundation\Response - * - * @throws \Illuminate\Http\Exceptions\ThrottleRequestsException - */ - protected function handleRequest($request, Closure $next, array $limits) - { - foreach ($limits as $limit) { - if ($this->tooManyAttempts($limit->key, $limit->maxAttempts, $limit->decayMinutes)) { - throw $this->buildException($request, $limit->key, $limit->maxAttempts, $limit->responseCallback); - } - } - - $response = $next($request); - - foreach ($limits as $limit) { - $response = $this->addHeaders( - $response, - $limit->maxAttempts, - $this->calculateRemainingAttempts($limit->key, $limit->maxAttempts) - ); - } - - return $response; - } - - /** - * Determine if the given key has been "accessed" too many times. - * - * @param string $key - * @param int $maxAttempts - * @param int $decayMinutes - * @return mixed - */ - protected function tooManyAttempts($key, $maxAttempts, $decayMinutes) - { - $limiter = new DurationLimiter( - $this->redis, $key, $maxAttempts, $decayMinutes * 60 - ); - - return tap(! $limiter->acquire(), function () use ($key, $limiter) { - [$this->decaysAt[$key], $this->remaining[$key]] = [ - $limiter->decaysAt, $limiter->remaining, - ]; - }); - } - - /** - * Calculate the number of remaining attempts. - * - * @param string $key - * @param int $maxAttempts - * @param int|null $retryAfter - * @return int - */ - protected function calculateRemainingAttempts($key, $maxAttempts, $retryAfter = null) - { - return is_null($retryAfter) ? $this->remaining[$key] : 0; - } - - /** - * Get the number of seconds until the lock is released. - * - * @param string $key - * @return int - */ - protected function getTimeUntilNextRetry($key) - { - return $this->decaysAt[$key] - $this->currentTime(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Middleware/ValidateSignature.php b/framework-9.50.2/src/Illuminate/Routing/Middleware/ValidateSignature.php deleted file mode 100644 index 63841b2..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Middleware/ValidateSignature.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ - protected $ignore = [ - // - ]; - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $relative - * @return \Illuminate\Http\Response - * - * @throws \Illuminate\Routing\Exceptions\InvalidSignatureException - */ - public function handle($request, Closure $next, $relative = null) - { - $ignore = property_exists($this, 'except') ? $this->except : $this->ignore; - - if ($request->hasValidSignatureWhileIgnoring($ignore, $relative !== 'relative')) { - return $next($request); - } - - throw new InvalidSignatureException; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/MiddlewareNameResolver.php b/framework-9.50.2/src/Illuminate/Routing/MiddlewareNameResolver.php deleted file mode 100644 index 87ab42d..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/MiddlewareNameResolver.php +++ /dev/null @@ -1,85 +0,0 @@ -name = $name; - $this->options = $options; - $this->registrar = $registrar; - $this->controller = $controller; - } - - /** - * Set the methods the controller should apply to. - * - * @param array|string|dynamic $methods - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function only($methods) - { - $this->options['only'] = is_array($methods) ? $methods : func_get_args(); - - return $this; - } - - /** - * Set the methods the controller should exclude. - * - * @param array|string|dynamic $methods - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function except($methods) - { - $this->options['except'] = is_array($methods) ? $methods : func_get_args(); - - return $this; - } - - /** - * Set the route names for controller actions. - * - * @param array|string $names - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function names($names) - { - $this->options['names'] = $names; - - return $this; - } - - /** - * Set the route name for a controller action. - * - * @param string $method - * @param string $name - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function name($method, $name) - { - $this->options['names'][$method] = $name; - - return $this; - } - - /** - * Override the route parameter names. - * - * @param array|string $parameters - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function parameters($parameters) - { - $this->options['parameters'] = $parameters; - - return $this; - } - - /** - * Override a route parameter's name. - * - * @param string $previous - * @param string $new - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function parameter($previous, $new) - { - $this->options['parameters'][$previous] = $new; - - return $this; - } - - /** - * Add middleware to the resource routes. - * - * @param mixed $middleware - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function middleware($middleware) - { - $middleware = Arr::wrap($middleware); - - foreach ($middleware as $key => $value) { - $middleware[$key] = (string) $value; - } - - $this->options['middleware'] = $middleware; - - return $this; - } - - /** - * Specify middleware that should be removed from the resource routes. - * - * @param array|string $middleware - * @return $this|array - */ - public function withoutMiddleware($middleware) - { - $this->options['excluded_middleware'] = array_merge( - (array) ($this->options['excluded_middleware'] ?? []), Arr::wrap($middleware) - ); - - return $this; - } - - /** - * Add "where" constraints to the resource routes. - * - * @param mixed $wheres - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function where($wheres) - { - $this->options['wheres'] = $wheres; - - return $this; - } - - /** - * Indicate that the resource routes should have "shallow" nesting. - * - * @param bool $shallow - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function shallow($shallow = true) - { - $this->options['shallow'] = $shallow; - - return $this; - } - - /** - * Define the callable that should be invoked on a missing model exception. - * - * @param callable $callback - * @return $this - */ - public function missing($callback) - { - $this->options['missing'] = $callback; - - return $this; - } - - /** - * Indicate that the resource routes should be scoped using the given binding fields. - * - * @param array $fields - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function scoped(array $fields = []) - { - $this->options['bindingFields'] = $fields; - - return $this; - } - - /** - * Define which routes should allow "trashed" models to be retrieved when resolving implicit model bindings. - * - * @param array $methods - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function withTrashed(array $methods = []) - { - $this->options['trashed'] = $methods; - - return $this; - } - - /** - * Register the resource route. - * - * @return \Illuminate\Routing\RouteCollection - */ - public function register() - { - $this->registered = true; - - return $this->registrar->register( - $this->name, $this->controller, $this->options - ); - } - - /** - * Handle the object's destruction. - * - * @return void - */ - public function __destruct() - { - if (! $this->registered) { - $this->register(); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/PendingSingletonResourceRegistration.php b/framework-9.50.2/src/Illuminate/Routing/PendingSingletonResourceRegistration.php deleted file mode 100644 index 32ed4d7..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/PendingSingletonResourceRegistration.php +++ /dev/null @@ -1,242 +0,0 @@ -name = $name; - $this->options = $options; - $this->registrar = $registrar; - $this->controller = $controller; - } - - /** - * Set the methods the controller should apply to. - * - * @param array|string|dynamic $methods - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function only($methods) - { - $this->options['only'] = is_array($methods) ? $methods : func_get_args(); - - return $this; - } - - /** - * Set the methods the controller should exclude. - * - * @param array|string|dynamic $methods - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function except($methods) - { - $this->options['except'] = is_array($methods) ? $methods : func_get_args(); - - return $this; - } - - /** - * Indicate that the resource should have creation and storage routes. - * - * @param bool $creatable - * @return $this - */ - public function creatable($creatable = true) - { - $this->options['creatable'] = $creatable; - - return $this; - } - - /** - * Indicate that the resource should have a deletion route. - * - * @param bool $destroyable - * @return $this - */ - public function destroyable($destroyable = true) - { - $this->options['destroyable'] = $destroyable; - - return $this; - } - - /** - * Set the route names for controller actions. - * - * @param array|string $names - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function names($names) - { - $this->options['names'] = $names; - - return $this; - } - - /** - * Set the route name for a controller action. - * - * @param string $method - * @param string $name - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function name($method, $name) - { - $this->options['names'][$method] = $name; - - return $this; - } - - /** - * Override the route parameter names. - * - * @param array|string $parameters - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function parameters($parameters) - { - $this->options['parameters'] = $parameters; - - return $this; - } - - /** - * Override a route parameter's name. - * - * @param string $previous - * @param string $new - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function parameter($previous, $new) - { - $this->options['parameters'][$previous] = $new; - - return $this; - } - - /** - * Add middleware to the resource routes. - * - * @param mixed $middleware - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function middleware($middleware) - { - $middleware = Arr::wrap($middleware); - - foreach ($middleware as $key => $value) { - $middleware[$key] = (string) $value; - } - - $this->options['middleware'] = $middleware; - - return $this; - } - - /** - * Specify middleware that should be removed from the resource routes. - * - * @param array|string $middleware - * @return $this|array - */ - public function withoutMiddleware($middleware) - { - $this->options['excluded_middleware'] = array_merge( - (array) ($this->options['excluded_middleware'] ?? []), Arr::wrap($middleware) - ); - - return $this; - } - - /** - * Add "where" constraints to the resource routes. - * - * @param mixed $wheres - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function where($wheres) - { - $this->options['wheres'] = $wheres; - - return $this; - } - - /** - * Register the singleton resource route. - * - * @return \Illuminate\Routing\RouteCollection - */ - public function register() - { - $this->registered = true; - - return $this->registrar->singleton( - $this->name, $this->controller, $this->options - ); - } - - /** - * Handle the object's destruction. - * - * @return void - */ - public function __destruct() - { - if (! $this->registered) { - $this->register(); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Pipeline.php b/framework-9.50.2/src/Illuminate/Routing/Pipeline.php deleted file mode 100644 index 8ffa2a8..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Pipeline.php +++ /dev/null @@ -1,59 +0,0 @@ -toResponse($this->getContainer()->make(Request::class)) - : $carry; - } - - /** - * Handle the given exception. - * - * @param mixed $passable - * @param \Throwable $e - * @return mixed - * - * @throws \Throwable - */ - protected function handleException($passable, Throwable $e) - { - if (! $this->container->bound(ExceptionHandler::class) || - ! $passable instanceof Request) { - throw $e; - } - - $handler = $this->container->make(ExceptionHandler::class); - - $handler->report($e); - - $response = $handler->render($passable, $e); - - if (is_object($response) && method_exists($response, 'withException')) { - $response->withException($e); - } - - return $this->handleCarry($response); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RedirectController.php b/framework-9.50.2/src/Illuminate/Routing/RedirectController.php deleted file mode 100644 index 3dd2489..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RedirectController.php +++ /dev/null @@ -1,44 +0,0 @@ -route()->parameters()); - - $status = $parameters->get('status'); - - $destination = $parameters->get('destination'); - - $parameters->forget('status')->forget('destination'); - - $route = (new Route('GET', $destination, [ - 'as' => 'laravel_route_redirect_destination', - ]))->bind($request); - - $parameters = $parameters->only( - $route->getCompiled()->getPathVariables() - )->toArray(); - - $url = $url->toRoute($route, $parameters, false); - - if (! str_starts_with($destination, '/') && str_starts_with($url, '/')) { - $url = Str::after($url, '/'); - } - - return new RedirectResponse($url, $status); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Redirector.php b/framework-9.50.2/src/Illuminate/Routing/Redirector.php deleted file mode 100755 index 362e288..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Redirector.php +++ /dev/null @@ -1,276 +0,0 @@ -generator = $generator; - } - - /** - * Create a new redirect response to the "home" route. - * - * @param int $status - * @return \Illuminate\Http\RedirectResponse - * - * @deprecated Will be removed in a future Laravel version. - */ - public function home($status = 302) - { - return $this->to($this->generator->route('home'), $status); - } - - /** - * Create a new redirect response to the previous location. - * - * @param int $status - * @param array $headers - * @param mixed $fallback - * @return \Illuminate\Http\RedirectResponse - */ - public function back($status = 302, $headers = [], $fallback = false) - { - return $this->createRedirect($this->generator->previous($fallback), $status, $headers); - } - - /** - * Create a new redirect response to the current URI. - * - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function refresh($status = 302, $headers = []) - { - return $this->to($this->generator->getRequest()->path(), $status, $headers); - } - - /** - * Create a new redirect response, while putting the current URL in the session. - * - * @param string $path - * @param int $status - * @param array $headers - * @param bool|null $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function guest($path, $status = 302, $headers = [], $secure = null) - { - $request = $this->generator->getRequest(); - - $intended = $request->isMethod('GET') && $request->route() && ! $request->expectsJson() - ? $this->generator->full() - : $this->generator->previous(); - - if ($intended) { - $this->setIntendedUrl($intended); - } - - return $this->to($path, $status, $headers, $secure); - } - - /** - * Create a new redirect response to the previously intended location. - * - * @param mixed $default - * @param int $status - * @param array $headers - * @param bool|null $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function intended($default = '/', $status = 302, $headers = [], $secure = null) - { - $path = $this->session->pull('url.intended', $default); - - return $this->to($path, $status, $headers, $secure); - } - - /** - * Create a new redirect response to the given path. - * - * @param string $path - * @param int $status - * @param array $headers - * @param bool|null $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function to($path, $status = 302, $headers = [], $secure = null) - { - return $this->createRedirect($this->generator->to($path, [], $secure), $status, $headers); - } - - /** - * Create a new redirect response to an external URL (no validation). - * - * @param string $path - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function away($path, $status = 302, $headers = []) - { - return $this->createRedirect($path, $status, $headers); - } - - /** - * Create a new redirect response to the given HTTPS path. - * - * @param string $path - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function secure($path, $status = 302, $headers = []) - { - return $this->to($path, $status, $headers, true); - } - - /** - * Create a new redirect response to a named route. - * - * @param string $route - * @param mixed $parameters - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function route($route, $parameters = [], $status = 302, $headers = []) - { - return $this->to($this->generator->route($route, $parameters), $status, $headers); - } - - /** - * Create a new redirect response to a signed named route. - * - * @param string $route - * @param mixed $parameters - * @param \DateTimeInterface|\DateInterval|int|null $expiration - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function signedRoute($route, $parameters = [], $expiration = null, $status = 302, $headers = []) - { - return $this->to($this->generator->signedRoute($route, $parameters, $expiration), $status, $headers); - } - - /** - * Create a new redirect response to a signed named route. - * - * @param string $route - * @param \DateTimeInterface|\DateInterval|int|null $expiration - * @param mixed $parameters - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function temporarySignedRoute($route, $expiration, $parameters = [], $status = 302, $headers = []) - { - return $this->to($this->generator->temporarySignedRoute($route, $expiration, $parameters), $status, $headers); - } - - /** - * Create a new redirect response to a controller action. - * - * @param string|array $action - * @param mixed $parameters - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function action($action, $parameters = [], $status = 302, $headers = []) - { - return $this->to($this->generator->action($action, $parameters), $status, $headers); - } - - /** - * Create a new redirect response. - * - * @param string $path - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - protected function createRedirect($path, $status, $headers) - { - return tap(new RedirectResponse($path, $status, $headers), function ($redirect) { - if (isset($this->session)) { - $redirect->setSession($this->session); - } - - $redirect->setRequest($this->generator->getRequest()); - }); - } - - /** - * Get the URL generator instance. - * - * @return \Illuminate\Routing\UrlGenerator - */ - public function getUrlGenerator() - { - return $this->generator; - } - - /** - * Set the active session store. - * - * @param \Illuminate\Session\Store $session - * @return void - */ - public function setSession(SessionStore $session) - { - $this->session = $session; - } - - /** - * Get the "intended" URL from the session. - * - * @return string|null - */ - public function getIntendedUrl() - { - return $this->session->get('url.intended'); - } - - /** - * Set the "intended" URL in the session. - * - * @param string $url - * @return $this - */ - public function setIntendedUrl($url) - { - $this->session->put('url.intended', $url); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/ResourceRegistrar.php b/framework-9.50.2/src/Illuminate/Routing/ResourceRegistrar.php deleted file mode 100644 index 39a5418..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/ResourceRegistrar.php +++ /dev/null @@ -1,728 +0,0 @@ - 'create', - 'edit' => 'edit', - ]; - - /** - * Create a new resource registrar instance. - * - * @param \Illuminate\Routing\Router $router - * @return void - */ - public function __construct(Router $router) - { - $this->router = $router; - } - - /** - * Route a resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\RouteCollection - */ - public function register($name, $controller, array $options = []) - { - if (isset($options['parameters']) && ! isset($this->parameters)) { - $this->parameters = $options['parameters']; - } - - // If the resource name contains a slash, we will assume the developer wishes to - // register these resource routes with a prefix so we will set that up out of - // the box so they don't have to mess with it. Otherwise, we will continue. - if (str_contains($name, '/')) { - $this->prefixedResource($name, $controller, $options); - - return; - } - - // We need to extract the base resource from the resource name. Nested resources - // are supported in the framework, but we need to know what name to use for a - // place-holder on the route parameters, which should be the base resources. - $base = $this->getResourceWildcard(last(explode('.', $name))); - - $defaults = $this->resourceDefaults; - - $collection = new RouteCollection; - - $resourceMethods = $this->getResourceMethods($defaults, $options); - - foreach ($resourceMethods as $m) { - $route = $this->{'addResource'.ucfirst($m)}( - $name, $base, $controller, $options - ); - - if (isset($options['bindingFields'])) { - $this->setResourceBindingFields($route, $options['bindingFields']); - } - - if (isset($options['trashed']) && - in_array($m, ! empty($options['trashed']) ? $options['trashed'] : array_intersect($resourceMethods, ['show', 'edit', 'update']))) { - $route->withTrashed(); - } - - $collection->add($route); - } - - return $collection; - } - - /** - * Route a singleton resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\RouteCollection - */ - public function singleton($name, $controller, array $options = []) - { - if (isset($options['parameters']) && ! isset($this->parameters)) { - $this->parameters = $options['parameters']; - } - - // If the resource name contains a slash, we will assume the developer wishes to - // register these singleton routes with a prefix so we will set that up out of - // the box so they don't have to mess with it. Otherwise, we will continue. - if (str_contains($name, '/')) { - $this->prefixedSingleton($name, $controller, $options); - - return; - } - - $defaults = $this->singletonResourceDefaults; - - $collection = new RouteCollection; - - $resourceMethods = $this->getResourceMethods($defaults, $options); - - foreach ($resourceMethods as $m) { - $route = $this->{'addSingleton'.ucfirst($m)}( - $name, $controller, $options - ); - - if (isset($options['bindingFields'])) { - $this->setResourceBindingFields($route, $options['bindingFields']); - } - - $collection->add($route); - } - - return $collection; - } - - /** - * Build a set of prefixed resource routes. - * - * @param string $name - * @param string $controller - * @param array $options - * @return void - */ - protected function prefixedResource($name, $controller, array $options) - { - [$name, $prefix] = $this->getResourcePrefix($name); - - // We need to extract the base resource from the resource name. Nested resources - // are supported in the framework, but we need to know what name to use for a - // place-holder on the route parameters, which should be the base resources. - $callback = function ($me) use ($name, $controller, $options) { - $me->resource($name, $controller, $options); - }; - - return $this->router->group(compact('prefix'), $callback); - } - - /** - * Build a set of prefixed singleton routes. - * - * @param string $name - * @param string $controller - * @param array $options - * @return void - */ - protected function prefixedSingleton($name, $controller, array $options) - { - [$name, $prefix] = $this->getResourcePrefix($name); - - // We need to extract the base resource from the resource name. Nested resources - // are supported in the framework, but we need to know what name to use for a - // place-holder on the route parameters, which should be the base resources. - $callback = function ($me) use ($name, $controller, $options) { - $me->singleton($name, $controller, $options); - }; - - return $this->router->group(compact('prefix'), $callback); - } - - /** - * Extract the resource and prefix from a resource name. - * - * @param string $name - * @return array - */ - protected function getResourcePrefix($name) - { - $segments = explode('/', $name); - - // To get the prefix, we will take all of the name segments and implode them on - // a slash. This will generate a proper URI prefix for us. Then we take this - // last segment, which will be considered the final resources name we use. - $prefix = implode('/', array_slice($segments, 0, -1)); - - return [end($segments), $prefix]; - } - - /** - * Get the applicable resource methods. - * - * @param array $defaults - * @param array $options - * @return array - */ - protected function getResourceMethods($defaults, $options) - { - $methods = $defaults; - - if (isset($options['only'])) { - $methods = array_intersect($methods, (array) $options['only']); - } - - if (isset($options['except'])) { - $methods = array_diff($methods, (array) $options['except']); - } - - if (isset($options['creatable'])) { - $methods = isset($options['apiSingleton']) - ? array_merge(['store', 'destroy'], $methods) - : array_merge(['create', 'store', 'destroy'], $methods); - - return $this->getResourceMethods( - $methods, array_values(Arr::except($options, ['creatable'])) - ); - } - - if (isset($options['destroyable'])) { - $methods = array_merge(['destroy'], $methods); - - return $this->getResourceMethods( - $methods, array_values(Arr::except($options, ['destroyable'])) - ); - } - - return $methods; - } - - /** - * Add the index method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceIndex($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name); - - unset($options['missing']); - - $action = $this->getResourceAction($name, $controller, 'index', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the create method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceCreate($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name).'/'.static::$verbs['create']; - - unset($options['missing']); - - $action = $this->getResourceAction($name, $controller, 'create', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the store method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceStore($name, $base, $controller, $options) - { - $uri = $this->getResourceUri($name); - - unset($options['missing']); - - $action = $this->getResourceAction($name, $controller, 'store', $options); - - return $this->router->post($uri, $action); - } - - /** - * Add the show method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceShow($name, $base, $controller, $options) - { - $name = $this->getShallowName($name, $options); - - $uri = $this->getResourceUri($name).'/{'.$base.'}'; - - $action = $this->getResourceAction($name, $controller, 'show', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the edit method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceEdit($name, $base, $controller, $options) - { - $name = $this->getShallowName($name, $options); - - $uri = $this->getResourceUri($name).'/{'.$base.'}/'.static::$verbs['edit']; - - $action = $this->getResourceAction($name, $controller, 'edit', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the update method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceUpdate($name, $base, $controller, $options) - { - $name = $this->getShallowName($name, $options); - - $uri = $this->getResourceUri($name).'/{'.$base.'}'; - - $action = $this->getResourceAction($name, $controller, 'update', $options); - - return $this->router->match(['PUT', 'PATCH'], $uri, $action); - } - - /** - * Add the destroy method for a resourceful route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addResourceDestroy($name, $base, $controller, $options) - { - $name = $this->getShallowName($name, $options); - - $uri = $this->getResourceUri($name).'/{'.$base.'}'; - - $action = $this->getResourceAction($name, $controller, 'destroy', $options); - - return $this->router->delete($uri, $action); - } - - /** - * Add the create method for a singleton route. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addSingletonCreate($name, $controller, $options) - { - $uri = $this->getResourceUri($name).'/'.static::$verbs['create']; - - unset($options['missing']); - - $action = $this->getResourceAction($name, $controller, 'create', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the store method for a singleton route. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addSingletonStore($name, $controller, $options) - { - $uri = $this->getResourceUri($name); - - unset($options['missing']); - - $action = $this->getResourceAction($name, $controller, 'store', $options); - - return $this->router->post($uri, $action); - } - - /** - * Add the show method for a singleton route. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addSingletonShow($name, $controller, $options) - { - $uri = $this->getResourceUri($name); - - unset($options['missing']); - - $action = $this->getResourceAction($name, $controller, 'show', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the edit method for a singleton route. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addSingletonEdit($name, $controller, $options) - { - $name = $this->getShallowName($name, $options); - - $uri = $this->getResourceUri($name).'/'.static::$verbs['edit']; - - $action = $this->getResourceAction($name, $controller, 'edit', $options); - - return $this->router->get($uri, $action); - } - - /** - * Add the update method for a singleton route. - * - * @param string $name - * @param string $base - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addSingletonUpdate($name, $controller, $options) - { - $name = $this->getShallowName($name, $options); - - $uri = $this->getResourceUri($name); - - $action = $this->getResourceAction($name, $controller, 'update', $options); - - return $this->router->match(['PUT', 'PATCH'], $uri, $action); - } - - /** - * Add the destroy method for a singleton route. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\Route - */ - protected function addSingletonDestroy($name, $controller, $options) - { - $name = $this->getShallowName($name, $options); - - $uri = $this->getResourceUri($name); - - $action = $this->getResourceAction($name, $controller, 'destroy', $options); - - return $this->router->delete($uri, $action); - } - - /** - * Get the name for a given resource with shallowness applied when applicable. - * - * @param string $name - * @param array $options - * @return string - */ - protected function getShallowName($name, $options) - { - return isset($options['shallow']) && $options['shallow'] - ? last(explode('.', $name)) - : $name; - } - - /** - * Set the route's binding fields if the resource is scoped. - * - * @param \Illuminate\Routing\Route $route - * @param array $bindingFields - * @return void - */ - protected function setResourceBindingFields($route, $bindingFields) - { - preg_match_all('/(?<={).*?(?=})/', $route->uri, $matches); - - $fields = array_fill_keys($matches[0], null); - - $route->setBindingFields(array_replace( - $fields, array_intersect_key($bindingFields, $fields) - )); - } - - /** - * Get the base resource URI for a given resource. - * - * @param string $resource - * @return string - */ - public function getResourceUri($resource) - { - if (! str_contains($resource, '.')) { - return $resource; - } - - // Once we have built the base URI, we'll remove the parameter holder for this - // base resource name so that the individual route adders can suffix these - // paths however they need to, as some do not have any parameters at all. - $segments = explode('.', $resource); - - $uri = $this->getNestedResourceUri($segments); - - return str_replace('/{'.$this->getResourceWildcard(end($segments)).'}', '', $uri); - } - - /** - * Get the URI for a nested resource segment array. - * - * @param array $segments - * @return string - */ - protected function getNestedResourceUri(array $segments) - { - // We will spin through the segments and create a place-holder for each of the - // resource segments, as well as the resource itself. Then we should get an - // entire string for the resource URI that contains all nested resources. - return implode('/', array_map(function ($s) { - return $s.'/{'.$this->getResourceWildcard($s).'}'; - }, $segments)); - } - - /** - * Format a resource parameter for usage. - * - * @param string $value - * @return string - */ - public function getResourceWildcard($value) - { - if (isset($this->parameters[$value])) { - $value = $this->parameters[$value]; - } elseif (isset(static::$parameterMap[$value])) { - $value = static::$parameterMap[$value]; - } elseif ($this->parameters === 'singular' || static::$singularParameters) { - $value = Str::singular($value); - } - - return str_replace('-', '_', $value); - } - - /** - * Get the action array for a resource route. - * - * @param string $resource - * @param string $controller - * @param string $method - * @param array $options - * @return array - */ - protected function getResourceAction($resource, $controller, $method, $options) - { - $name = $this->getResourceRouteName($resource, $method, $options); - - $action = ['as' => $name, 'uses' => $controller.'@'.$method]; - - if (isset($options['middleware'])) { - $action['middleware'] = $options['middleware']; - } - - if (isset($options['excluded_middleware'])) { - $action['excluded_middleware'] = $options['excluded_middleware']; - } - - if (isset($options['wheres'])) { - $action['where'] = $options['wheres']; - } - - if (isset($options['missing'])) { - $action['missing'] = $options['missing']; - } - - return $action; - } - - /** - * Get the name for a given resource. - * - * @param string $resource - * @param string $method - * @param array $options - * @return string - */ - protected function getResourceRouteName($resource, $method, $options) - { - $name = $resource; - - // If the names array has been provided to us we will check for an entry in the - // array first. We will also check for the specific method within this array - // so the names may be specified on a more "granular" level using methods. - if (isset($options['names'])) { - if (is_string($options['names'])) { - $name = $options['names']; - } elseif (isset($options['names'][$method])) { - return $options['names'][$method]; - } - } - - // If a global prefix has been assigned to all names for this resource, we will - // grab that so we can prepend it onto the name when we create this name for - // the resource action. Otherwise we'll just use an empty string for here. - $prefix = isset($options['as']) ? $options['as'].'.' : ''; - - return trim(sprintf('%s%s.%s', $prefix, $name, $method), '.'); - } - - /** - * Set or unset the unmapped global parameters to singular. - * - * @param bool $singular - * @return void - */ - public static function singularParameters($singular = true) - { - static::$singularParameters = (bool) $singular; - } - - /** - * Get the global parameter map. - * - * @return array - */ - public static function getParameters() - { - return static::$parameterMap; - } - - /** - * Set the global parameter mapping. - * - * @param array $parameters - * @return void - */ - public static function setParameters(array $parameters = []) - { - static::$parameterMap = $parameters; - } - - /** - * Get or set the action verbs used in the resource URIs. - * - * @param array $verbs - * @return array - */ - public static function verbs(array $verbs = []) - { - if (empty($verbs)) { - return static::$verbs; - } else { - static::$verbs = array_merge(static::$verbs, $verbs); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/ResponseFactory.php b/framework-9.50.2/src/Illuminate/Routing/ResponseFactory.php deleted file mode 100644 index 33ea06f..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/ResponseFactory.php +++ /dev/null @@ -1,276 +0,0 @@ -view = $view; - $this->redirector = $redirector; - } - - /** - * Create a new response instance. - * - * @param mixed $content - * @param int $status - * @param array $headers - * @return \Illuminate\Http\Response - */ - public function make($content = '', $status = 200, array $headers = []) - { - return new Response($content, $status, $headers); - } - - /** - * Create a new "no content" response. - * - * @param int $status - * @param array $headers - * @return \Illuminate\Http\Response - */ - public function noContent($status = 204, array $headers = []) - { - return $this->make('', $status, $headers); - } - - /** - * Create a new response for a given view. - * - * @param string|array $view - * @param array $data - * @param int $status - * @param array $headers - * @return \Illuminate\Http\Response - */ - public function view($view, $data = [], $status = 200, array $headers = []) - { - if (is_array($view)) { - return $this->make($this->view->first($view, $data), $status, $headers); - } - - return $this->make($this->view->make($view, $data), $status, $headers); - } - - /** - * Create a new JSON response instance. - * - * @param mixed $data - * @param int $status - * @param array $headers - * @param int $options - * @return \Illuminate\Http\JsonResponse - */ - public function json($data = [], $status = 200, array $headers = [], $options = 0) - { - return new JsonResponse($data, $status, $headers, $options); - } - - /** - * Create a new JSONP response instance. - * - * @param string $callback - * @param mixed $data - * @param int $status - * @param array $headers - * @param int $options - * @return \Illuminate\Http\JsonResponse - */ - public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0) - { - return $this->json($data, $status, $headers, $options)->setCallback($callback); - } - - /** - * Create a new streamed response instance. - * - * @param callable $callback - * @param int $status - * @param array $headers - * @return \Symfony\Component\HttpFoundation\StreamedResponse - */ - public function stream($callback, $status = 200, array $headers = []) - { - return new StreamedResponse($callback, $status, $headers); - } - - /** - * Create a new streamed response instance as a file download. - * - * @param callable $callback - * @param string|null $name - * @param array $headers - * @param string|null $disposition - * @return \Symfony\Component\HttpFoundation\StreamedResponse - */ - public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment') - { - $withWrappedException = function () use ($callback) { - try { - $callback(); - } catch (Throwable $e) { - throw new StreamedResponseException($e); - } - }; - - $response = new StreamedResponse($withWrappedException, 200, $headers); - - if (! is_null($name)) { - $response->headers->set('Content-Disposition', $response->headers->makeDisposition( - $disposition, - $name, - $this->fallbackName($name) - )); - } - - return $response; - } - - /** - * Create a new file download response. - * - * @param \SplFileInfo|string $file - * @param string|null $name - * @param array $headers - * @param string|null $disposition - * @return \Symfony\Component\HttpFoundation\BinaryFileResponse - */ - public function download($file, $name = null, array $headers = [], $disposition = 'attachment') - { - $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); - - if (! is_null($name)) { - return $response->setContentDisposition($disposition, $name, $this->fallbackName($name)); - } - - return $response; - } - - /** - * Convert the string to ASCII characters that are equivalent to the given name. - * - * @param string $name - * @return string - */ - protected function fallbackName($name) - { - return str_replace('%', '', Str::ascii($name)); - } - - /** - * Return the raw contents of a binary file. - * - * @param \SplFileInfo|string $file - * @param array $headers - * @return \Symfony\Component\HttpFoundation\BinaryFileResponse - */ - public function file($file, array $headers = []) - { - return new BinaryFileResponse($file, 200, $headers); - } - - /** - * Create a new redirect response to the given path. - * - * @param string $path - * @param int $status - * @param array $headers - * @param bool|null $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function redirectTo($path, $status = 302, $headers = [], $secure = null) - { - return $this->redirector->to($path, $status, $headers, $secure); - } - - /** - * Create a new redirect response to a named route. - * - * @param string $route - * @param mixed $parameters - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []) - { - return $this->redirector->route($route, $parameters, $status, $headers); - } - - /** - * Create a new redirect response to a controller action. - * - * @param string $action - * @param mixed $parameters - * @param int $status - * @param array $headers - * @return \Illuminate\Http\RedirectResponse - */ - public function redirectToAction($action, $parameters = [], $status = 302, $headers = []) - { - return $this->redirector->action($action, $parameters, $status, $headers); - } - - /** - * Create a new redirect response, while putting the current URL in the session. - * - * @param string $path - * @param int $status - * @param array $headers - * @param bool|null $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function redirectGuest($path, $status = 302, $headers = [], $secure = null) - { - return $this->redirector->guest($path, $status, $headers, $secure); - } - - /** - * Create a new redirect response to the previously intended location. - * - * @param string $default - * @param int $status - * @param array $headers - * @param bool|null $secure - * @return \Illuminate\Http\RedirectResponse - */ - public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null) - { - return $this->redirector->intended($default, $status, $headers, $secure); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Route.php b/framework-9.50.2/src/Illuminate/Routing/Route.php deleted file mode 100755 index f14f769..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Route.php +++ /dev/null @@ -1,1368 +0,0 @@ -uri = $uri; - $this->methods = (array) $methods; - $this->action = Arr::except($this->parseAction($action), ['prefix']); - - if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods)) { - $this->methods[] = 'HEAD'; - } - - $this->prefix(is_array($action) ? Arr::get($action, 'prefix') : ''); - } - - /** - * Parse the route action into a standard array. - * - * @param callable|array|null $action - * @return array - * - * @throws \UnexpectedValueException - */ - protected function parseAction($action) - { - return RouteAction::parse($this->uri, $action); - } - - /** - * Run the route action and return the response. - * - * @return mixed - */ - public function run() - { - $this->container = $this->container ?: new Container; - - try { - if ($this->isControllerAction()) { - return $this->runController(); - } - - return $this->runCallable(); - } catch (HttpResponseException $e) { - return $e->getResponse(); - } - } - - /** - * Checks whether the route's action is a controller. - * - * @return bool - */ - protected function isControllerAction() - { - return is_string($this->action['uses']) && ! $this->isSerializedClosure(); - } - - /** - * Run the route action and return the response. - * - * @return mixed - */ - protected function runCallable() - { - $callable = $this->action['uses']; - - if ($this->isSerializedClosure()) { - $callable = unserialize($this->action['uses'])->getClosure(); - } - - return $this->container[CallableDispatcher::class]->dispatch($this, $callable); - } - - /** - * Determine if the route action is a serialized Closure. - * - * @return bool - */ - protected function isSerializedClosure() - { - return RouteAction::containsSerializedClosure($this->action); - } - - /** - * Run the route action and return the response. - * - * @return mixed - * - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - protected function runController() - { - return $this->controllerDispatcher()->dispatch( - $this, $this->getController(), $this->getControllerMethod() - ); - } - - /** - * Get the controller instance for the route. - * - * @return mixed - */ - public function getController() - { - if (! $this->controller) { - $class = $this->getControllerClass(); - - $this->controller = $this->container->make(ltrim($class, '\\')); - } - - return $this->controller; - } - - /** - * Get the controller class used for the route. - * - * @return string - */ - public function getControllerClass() - { - return $this->parseControllerCallback()[0]; - } - - /** - * Get the controller method used for the route. - * - * @return string - */ - protected function getControllerMethod() - { - return $this->parseControllerCallback()[1]; - } - - /** - * Parse the controller. - * - * @return array - */ - protected function parseControllerCallback() - { - return Str::parseCallback($this->action['uses']); - } - - /** - * Flush the cached container instance on the route. - * - * @return void - */ - public function flushController() - { - $this->computedMiddleware = null; - $this->controller = null; - } - - /** - * Determine if the route matches a given request. - * - * @param \Illuminate\Http\Request $request - * @param bool $includingMethod - * @return bool - */ - public function matches(Request $request, $includingMethod = true) - { - $this->compileRoute(); - - foreach (self::getValidators() as $validator) { - if (! $includingMethod && $validator instanceof MethodValidator) { - continue; - } - - if (! $validator->matches($this, $request)) { - return false; - } - } - - return true; - } - - /** - * Compile the route into a Symfony CompiledRoute instance. - * - * @return \Symfony\Component\Routing\CompiledRoute - */ - protected function compileRoute() - { - if (! $this->compiled) { - $this->compiled = $this->toSymfonyRoute()->compile(); - } - - return $this->compiled; - } - - /** - * Bind the route to a given request for execution. - * - * @param \Illuminate\Http\Request $request - * @return $this - */ - public function bind(Request $request) - { - $this->compileRoute(); - - $this->parameters = (new RouteParameterBinder($this)) - ->parameters($request); - - $this->originalParameters = $this->parameters; - - return $this; - } - - /** - * Determine if the route has parameters. - * - * @return bool - */ - public function hasParameters() - { - return isset($this->parameters); - } - - /** - * Determine a given parameter exists from the route. - * - * @param string $name - * @return bool - */ - public function hasParameter($name) - { - if ($this->hasParameters()) { - return array_key_exists($name, $this->parameters()); - } - - return false; - } - - /** - * Get a given parameter from the route. - * - * @param string $name - * @param string|object|null $default - * @return string|object|null - */ - public function parameter($name, $default = null) - { - return Arr::get($this->parameters(), $name, $default); - } - - /** - * Get original value of a given parameter from the route. - * - * @param string $name - * @param string|null $default - * @return string|null - */ - public function originalParameter($name, $default = null) - { - return Arr::get($this->originalParameters(), $name, $default); - } - - /** - * Set a parameter to the given value. - * - * @param string $name - * @param string|object|null $value - * @return void - */ - public function setParameter($name, $value) - { - $this->parameters(); - - $this->parameters[$name] = $value; - } - - /** - * Unset a parameter on the route if it is set. - * - * @param string $name - * @return void - */ - public function forgetParameter($name) - { - $this->parameters(); - - unset($this->parameters[$name]); - } - - /** - * Get the key / value list of parameters for the route. - * - * @return array - * - * @throws \LogicException - */ - public function parameters() - { - if (isset($this->parameters)) { - return $this->parameters; - } - - throw new LogicException('Route is not bound.'); - } - - /** - * Get the key / value list of original parameters for the route. - * - * @return array - * - * @throws \LogicException - */ - public function originalParameters() - { - if (isset($this->originalParameters)) { - return $this->originalParameters; - } - - throw new LogicException('Route is not bound.'); - } - - /** - * Get the key / value list of parameters without null values. - * - * @return array - */ - public function parametersWithoutNulls() - { - return array_filter($this->parameters(), fn ($p) => ! is_null($p)); - } - - /** - * Get all of the parameter names for the route. - * - * @return array - */ - public function parameterNames() - { - if (isset($this->parameterNames)) { - return $this->parameterNames; - } - - return $this->parameterNames = $this->compileParameterNames(); - } - - /** - * Get the parameter names for the route. - * - * @return array - */ - protected function compileParameterNames() - { - preg_match_all('/\{(.*?)\}/', $this->getDomain().$this->uri, $matches); - - return array_map(fn ($m) => trim($m, '?'), $matches[1]); - } - - /** - * Get the parameters that are listed in the route / controller signature. - * - * @param array $conditions - * @return array - */ - public function signatureParameters($conditions = []) - { - if (is_string($conditions)) { - $conditions = ['subClass' => $conditions]; - } - - return RouteSignatureParameters::fromAction($this->action, $conditions); - } - - /** - * Get the binding field for the given parameter. - * - * @param string|int $parameter - * @return string|null - */ - public function bindingFieldFor($parameter) - { - $fields = is_int($parameter) ? array_values($this->bindingFields) : $this->bindingFields; - - return $fields[$parameter] ?? null; - } - - /** - * Get the binding fields for the route. - * - * @return array - */ - public function bindingFields() - { - return $this->bindingFields ?? []; - } - - /** - * Set the binding fields for the route. - * - * @param array $bindingFields - * @return $this - */ - public function setBindingFields(array $bindingFields) - { - $this->bindingFields = $bindingFields; - - return $this; - } - - /** - * Get the parent parameter of the given parameter. - * - * @param string $parameter - * @return string - */ - public function parentOfParameter($parameter) - { - $key = array_search($parameter, array_keys($this->parameters)); - - if ($key === 0) { - return; - } - - return array_values($this->parameters)[$key - 1]; - } - - /** - * Allow "trashed" models to be retrieved when resolving implicit model bindings for this route. - * - * @param bool $withTrashed - * @return $this - */ - public function withTrashed($withTrashed = true) - { - $this->withTrashedBindings = $withTrashed; - - return $this; - } - - /** - * Determines if the route allows "trashed" models to be retrieved when resolving implicit model bindings. - * - * @return bool - */ - public function allowsTrashedBindings() - { - return $this->withTrashedBindings; - } - - /** - * Set a default value for the route. - * - * @param string $key - * @param mixed $value - * @return $this - */ - public function defaults($key, $value) - { - $this->defaults[$key] = $value; - - return $this; - } - - /** - * Set the default values for the route. - * - * @param array $defaults - * @return $this - */ - public function setDefaults(array $defaults) - { - $this->defaults = $defaults; - - return $this; - } - - /** - * Set a regular expression requirement on the route. - * - * @param array|string $name - * @param string|null $expression - * @return $this - */ - public function where($name, $expression = null) - { - foreach ($this->parseWhere($name, $expression) as $name => $expression) { - $this->wheres[$name] = $expression; - } - - return $this; - } - - /** - * Parse arguments to the where method into an array. - * - * @param array|string $name - * @param string $expression - * @return array - */ - protected function parseWhere($name, $expression) - { - return is_array($name) ? $name : [$name => $expression]; - } - - /** - * Set a list of regular expression requirements on the route. - * - * @param array $wheres - * @return $this - */ - public function setWheres(array $wheres) - { - foreach ($wheres as $name => $expression) { - $this->where($name, $expression); - } - - return $this; - } - - /** - * Mark this route as a fallback route. - * - * @return $this - */ - public function fallback() - { - $this->isFallback = true; - - return $this; - } - - /** - * Set the fallback value. - * - * @param bool $isFallback - * @return $this - */ - public function setFallback($isFallback) - { - $this->isFallback = $isFallback; - - return $this; - } - - /** - * Get the HTTP verbs the route responds to. - * - * @return array - */ - public function methods() - { - return $this->methods; - } - - /** - * Determine if the route only responds to HTTP requests. - * - * @return bool - */ - public function httpOnly() - { - return in_array('http', $this->action, true); - } - - /** - * Determine if the route only responds to HTTPS requests. - * - * @return bool - */ - public function httpsOnly() - { - return $this->secure(); - } - - /** - * Determine if the route only responds to HTTPS requests. - * - * @return bool - */ - public function secure() - { - return in_array('https', $this->action, true); - } - - /** - * Get or set the domain for the route. - * - * @param string|null $domain - * @return $this|string|null - */ - public function domain($domain = null) - { - if (is_null($domain)) { - return $this->getDomain(); - } - - $parsed = RouteUri::parse($domain); - - $this->action['domain'] = $parsed->uri; - - $this->bindingFields = array_merge( - $this->bindingFields, $parsed->bindingFields - ); - - return $this; - } - - /** - * Get the domain defined for the route. - * - * @return string|null - */ - public function getDomain() - { - return isset($this->action['domain']) - ? str_replace(['http://', 'https://'], '', $this->action['domain']) : null; - } - - /** - * Get the prefix of the route instance. - * - * @return string|null - */ - public function getPrefix() - { - return $this->action['prefix'] ?? null; - } - - /** - * Add a prefix to the route URI. - * - * @param string $prefix - * @return $this - */ - public function prefix($prefix) - { - $prefix ??= ''; - - $this->updatePrefixOnAction($prefix); - - $uri = rtrim($prefix, '/').'/'.ltrim($this->uri, '/'); - - return $this->setUri($uri !== '/' ? trim($uri, '/') : $uri); - } - - /** - * Update the "prefix" attribute on the action array. - * - * @param string $prefix - * @return void - */ - protected function updatePrefixOnAction($prefix) - { - if (! empty($newPrefix = trim(rtrim($prefix, '/').'/'.ltrim($this->action['prefix'] ?? '', '/'), '/'))) { - $this->action['prefix'] = $newPrefix; - } - } - - /** - * Get the URI associated with the route. - * - * @return string - */ - public function uri() - { - return $this->uri; - } - - /** - * Set the URI that the route responds to. - * - * @param string $uri - * @return $this - */ - public function setUri($uri) - { - $this->uri = $this->parseUri($uri); - - return $this; - } - - /** - * Parse the route URI and normalize / store any implicit binding fields. - * - * @param string $uri - * @return string - */ - protected function parseUri($uri) - { - $this->bindingFields = []; - - return tap(RouteUri::parse($uri), function ($uri) { - $this->bindingFields = $uri->bindingFields; - })->uri; - } - - /** - * Get the name of the route instance. - * - * @return string|null - */ - public function getName() - { - return $this->action['as'] ?? null; - } - - /** - * Add or change the route name. - * - * @param string $name - * @return $this - */ - public function name($name) - { - $this->action['as'] = isset($this->action['as']) ? $this->action['as'].$name : $name; - - return $this; - } - - /** - * Determine whether the route's name matches the given patterns. - * - * @param mixed ...$patterns - * @return bool - */ - public function named(...$patterns) - { - if (is_null($routeName = $this->getName())) { - return false; - } - - foreach ($patterns as $pattern) { - if (Str::is($pattern, $routeName)) { - return true; - } - } - - return false; - } - - /** - * Set the handler for the route. - * - * @param \Closure|array|string $action - * @return $this - */ - public function uses($action) - { - if (is_array($action)) { - $action = $action[0].'@'.$action[1]; - } - - $action = is_string($action) ? $this->addGroupNamespaceToStringUses($action) : $action; - - return $this->setAction(array_merge($this->action, $this->parseAction([ - 'uses' => $action, - 'controller' => $action, - ]))); - } - - /** - * Parse a string based action for the "uses" fluent method. - * - * @param string $action - * @return string - */ - protected function addGroupNamespaceToStringUses($action) - { - $groupStack = last($this->router->getGroupStack()); - - if (isset($groupStack['namespace']) && ! str_starts_with($action, '\\')) { - return $groupStack['namespace'].'\\'.$action; - } - - return $action; - } - - /** - * Get the action name for the route. - * - * @return string - */ - public function getActionName() - { - return $this->action['controller'] ?? 'Closure'; - } - - /** - * Get the method name of the route action. - * - * @return string - */ - public function getActionMethod() - { - return Arr::last(explode('@', $this->getActionName())); - } - - /** - * Get the action array or one of its properties for the route. - * - * @param string|null $key - * @return mixed - */ - public function getAction($key = null) - { - return Arr::get($this->action, $key); - } - - /** - * Set the action array for the route. - * - * @param array $action - * @return $this - */ - public function setAction(array $action) - { - $this->action = $action; - - if (isset($this->action['domain'])) { - $this->domain($this->action['domain']); - } - - return $this; - } - - /** - * Get the value of the action that should be taken on a missing model exception. - * - * @return \Closure|null - */ - public function getMissing() - { - $missing = $this->action['missing'] ?? null; - - return is_string($missing) && - Str::startsWith($missing, [ - 'O:47:"Laravel\\SerializableClosure\\SerializableClosure', - ]) ? unserialize($missing) : $missing; - } - - /** - * Define the callable that should be invoked on a missing model exception. - * - * @param \Closure $missing - * @return $this - */ - public function missing($missing) - { - $this->action['missing'] = $missing; - - return $this; - } - - /** - * Get all middleware, including the ones from the controller. - * - * @return array - */ - public function gatherMiddleware() - { - if (! is_null($this->computedMiddleware)) { - return $this->computedMiddleware; - } - - $this->computedMiddleware = []; - - return $this->computedMiddleware = Router::uniqueMiddleware(array_merge( - $this->middleware(), $this->controllerMiddleware() - )); - } - - /** - * Get or set the middlewares attached to the route. - * - * @param array|string|null $middleware - * @return $this|array - */ - public function middleware($middleware = null) - { - if (is_null($middleware)) { - return (array) ($this->action['middleware'] ?? []); - } - - if (! is_array($middleware)) { - $middleware = func_get_args(); - } - - foreach ($middleware as $index => $value) { - $middleware[$index] = (string) $value; - } - - $this->action['middleware'] = array_merge( - (array) ($this->action['middleware'] ?? []), $middleware - ); - - return $this; - } - - /** - * Specify that the "Authorize" / "can" middleware should be applied to the route with the given options. - * - * @param string $ability - * @param array|string $models - * @return $this - */ - public function can($ability, $models = []) - { - return empty($models) - ? $this->middleware(['can:'.$ability]) - : $this->middleware(['can:'.$ability.','.implode(',', Arr::wrap($models))]); - } - - /** - * Get the middleware for the route's controller. - * - * @return array - */ - public function controllerMiddleware() - { - if (! $this->isControllerAction()) { - return []; - } - - [$controllerClass, $controllerMethod] = [ - $this->getControllerClass(), - $this->getControllerMethod(), - ]; - - if (is_a($controllerClass, HasMiddleware::class, true)) { - return $this->staticallyProvidedControllerMiddleware( - $controllerClass, $controllerMethod - ); - } - - if (method_exists($controllerClass, 'getMiddleware')) { - return $this->controllerDispatcher()->getMiddleware( - $this->getController(), $controllerMethod - ); - } - - return []; - } - - /** - * Get the statically provided controller middleware for the given class and method. - * - * @param string $class - * @param string $method - * @return array - */ - protected function staticallyProvidedControllerMiddleware(string $class, string $method) - { - return collect($class::middleware())->reject(function ($middleware) use ($method) { - return $this->controllerDispatcher()::methodExcludedByOptions( - $method, ['only' => $middleware->only, 'except' => $middleware->except] - ); - })->map->middleware->values()->all(); - } - - /** - * Specify middleware that should be removed from the given route. - * - * @param array|string $middleware - * @return $this - */ - public function withoutMiddleware($middleware) - { - $this->action['excluded_middleware'] = array_merge( - (array) ($this->action['excluded_middleware'] ?? []), Arr::wrap($middleware) - ); - - return $this; - } - - /** - * Get the middleware should be removed from the route. - * - * @return array - */ - public function excludedMiddleware() - { - return (array) ($this->action['excluded_middleware'] ?? []); - } - - /** - * Indicate that the route should enforce scoping of multiple implicit Eloquent bindings. - * - * @return $this - */ - public function scopeBindings() - { - $this->action['scope_bindings'] = true; - - return $this; - } - - /** - * Indicate that the route should not enforce scoping of multiple implicit Eloquent bindings. - * - * @return $this - */ - public function withoutScopedBindings() - { - $this->action['scope_bindings'] = false; - - return $this; - } - - /** - * Determine if the route should enforce scoping of multiple implicit Eloquent bindings. - * - * @return bool - */ - public function enforcesScopedBindings() - { - return (bool) ($this->action['scope_bindings'] ?? false); - } - - /** - * Determine if the route should prevent scoping of multiple implicit Eloquent bindings. - * - * @return bool - */ - public function preventsScopedBindings() - { - return isset($this->action['scope_bindings']) && $this->action['scope_bindings'] === false; - } - - /** - * Specify that the route should not allow concurrent requests from the same session. - * - * @param int|null $lockSeconds - * @param int|null $waitSeconds - * @return $this - */ - public function block($lockSeconds = 10, $waitSeconds = 10) - { - $this->lockSeconds = $lockSeconds; - $this->waitSeconds = $waitSeconds; - - return $this; - } - - /** - * Specify that the route should allow concurrent requests from the same session. - * - * @return $this - */ - public function withoutBlocking() - { - return $this->block(null, null); - } - - /** - * Get the maximum number of seconds the route's session lock should be held for. - * - * @return int|null - */ - public function locksFor() - { - return $this->lockSeconds; - } - - /** - * Get the maximum number of seconds to wait while attempting to acquire a session lock. - * - * @return int|null - */ - public function waitsFor() - { - return $this->waitSeconds; - } - - /** - * Get the dispatcher for the route's controller. - * - * @return \Illuminate\Routing\Contracts\ControllerDispatcher - */ - public function controllerDispatcher() - { - if ($this->container->bound(ControllerDispatcherContract::class)) { - return $this->container->make(ControllerDispatcherContract::class); - } - - return new ControllerDispatcher($this->container); - } - - /** - * Get the route validators for the instance. - * - * @return array - */ - public static function getValidators() - { - if (isset(static::$validators)) { - return static::$validators; - } - - // To match the route, we will use a chain of responsibility pattern with the - // validator implementations. We will spin through each one making sure it - // passes and then we will know if the route as a whole matches request. - return static::$validators = [ - new UriValidator, new MethodValidator, - new SchemeValidator, new HostValidator, - ]; - } - - /** - * Convert the route to a Symfony route. - * - * @return \Symfony\Component\Routing\Route - */ - public function toSymfonyRoute() - { - return new SymfonyRoute( - preg_replace('/\{(\w+?)\?\}/', '{$1}', $this->uri()), $this->getOptionalParameterNames(), - $this->wheres, ['utf8' => true], - $this->getDomain() ?: '', [], $this->methods - ); - } - - /** - * Get the optional parameter names for the route. - * - * @return array - */ - protected function getOptionalParameterNames() - { - preg_match_all('/\{(\w+?)\?\}/', $this->uri(), $matches); - - return isset($matches[1]) ? array_fill_keys($matches[1], null) : []; - } - - /** - * Get the compiled version of the route. - * - * @return \Symfony\Component\Routing\CompiledRoute - */ - public function getCompiled() - { - return $this->compiled; - } - - /** - * Set the router instance on the route. - * - * @param \Illuminate\Routing\Router $router - * @return $this - */ - public function setRouter(Router $router) - { - $this->router = $router; - - return $this; - } - - /** - * Set the container instance on the route. - * - * @param \Illuminate\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } - - /** - * Prepare the route instance for serialization. - * - * @return void - * - * @throws \LogicException - */ - public function prepareForSerialization() - { - if ($this->action['uses'] instanceof Closure) { - $this->action['uses'] = serialize( - new SerializableClosure($this->action['uses']) - ); - } - - if (isset($this->action['missing']) && $this->action['missing'] instanceof Closure) { - $this->action['missing'] = serialize( - new SerializableClosure($this->action['missing']) - ); - } - - $this->compileRoute(); - - unset($this->router, $this->container); - } - - /** - * Dynamically access route parameters. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->parameter($key); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteAction.php b/framework-9.50.2/src/Illuminate/Routing/RouteAction.php deleted file mode 100644 index ad47a87..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteAction.php +++ /dev/null @@ -1,110 +0,0 @@ - $action] : [ - 'uses' => $action[0].'@'.$action[1], - 'controller' => $action[0].'@'.$action[1], - ]; - } - - // If no "uses" property has been set, we will dig through the array to find a - // Closure instance within this list. We will set the first Closure we come - // across into the "uses" property that will get fired off by this route. - elseif (! isset($action['uses'])) { - $action['uses'] = static::findCallable($action); - } - - if (! static::containsSerializedClosure($action) && is_string($action['uses']) && ! str_contains($action['uses'], '@')) { - $action['uses'] = static::makeInvokable($action['uses']); - } - - return $action; - } - - /** - * Get an action for a route that has no action. - * - * @param string $uri - * @return array - * - * @throws \LogicException - */ - protected static function missingAction($uri) - { - return ['uses' => function () use ($uri) { - throw new LogicException("Route for [{$uri}] has no action."); - }]; - } - - /** - * Find the callable in an action array. - * - * @param array $action - * @return callable - */ - protected static function findCallable(array $action) - { - return Arr::first($action, function ($value, $key) { - return Reflector::isCallable($value) && is_numeric($key); - }); - } - - /** - * Make an action for an invokable controller. - * - * @param string $action - * @return string - * - * @throws \UnexpectedValueException - */ - protected static function makeInvokable($action) - { - if (! method_exists($action, '__invoke')) { - throw new UnexpectedValueException("Invalid route action: [{$action}]."); - } - - return $action.'@__invoke'; - } - - /** - * Determine if the given array actions contain a serialized Closure. - * - * @param array $action - * @return bool - */ - public static function containsSerializedClosure(array $action) - { - return is_string($action['uses']) && Str::startsWith($action['uses'], [ - 'O:47:"Laravel\\SerializableClosure\\SerializableClosure', - ]) !== false; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteBinding.php b/framework-9.50.2/src/Illuminate/Routing/RouteBinding.php deleted file mode 100644 index 36fdc4f..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteBinding.php +++ /dev/null @@ -1,84 +0,0 @@ -make($class), $method]; - - return $callable($value, $route); - }; - } - - /** - * Create a Route model binding for a model. - * - * @param \Illuminate\Container\Container $container - * @param string $class - * @param \Closure|null $callback - * @return \Closure - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - public static function forModel($container, $class, $callback = null) - { - return function ($value) use ($container, $class, $callback) { - if (is_null($value)) { - return; - } - - // For model binders, we will attempt to retrieve the models using the first - // method on the model instance. If we cannot retrieve the models we'll - // throw a not found exception otherwise we will return the instance. - $instance = $container->make($class); - - if ($model = $instance->resolveRouteBinding($value)) { - return $model; - } - - // If a callback was supplied to the method we will call that to determine - // what we should do when the model is not found. This just gives these - // developer a little greater flexibility to decide what will happen. - if ($callback instanceof Closure) { - return $callback($value); - } - - throw (new ModelNotFoundException)->setModel($class); - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteCollection.php b/framework-9.50.2/src/Illuminate/Routing/RouteCollection.php deleted file mode 100644 index 7e6f98b..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteCollection.php +++ /dev/null @@ -1,268 +0,0 @@ -addToCollections($route); - - $this->addLookups($route); - - return $route; - } - - /** - * Add the given route to the arrays of routes. - * - * @param \Illuminate\Routing\Route $route - * @return void - */ - protected function addToCollections($route) - { - $domainAndUri = $route->getDomain().$route->uri(); - - foreach ($route->methods() as $method) { - $this->routes[$method][$domainAndUri] = $route; - } - - $this->allRoutes[$method.$domainAndUri] = $route; - } - - /** - * Add the route to any look-up tables if necessary. - * - * @param \Illuminate\Routing\Route $route - * @return void - */ - protected function addLookups($route) - { - // If the route has a name, we will add it to the name look-up table so that we - // will quickly be able to find any route associate with a name and not have - // to iterate through every route every time we need to perform a look-up. - if ($name = $route->getName()) { - $this->nameList[$name] = $route; - } - - // When the route is routing to a controller we will also store the action that - // is used by the route. This will let us reverse route to controllers while - // processing a request and easily generate URLs to the given controllers. - $action = $route->getAction(); - - if (isset($action['controller'])) { - $this->addToActionList($action, $route); - } - } - - /** - * Add a route to the controller action dictionary. - * - * @param array $action - * @param \Illuminate\Routing\Route $route - * @return void - */ - protected function addToActionList($action, $route) - { - $this->actionList[trim($action['controller'], '\\')] = $route; - } - - /** - * Refresh the name look-up table. - * - * This is done in case any names are fluently defined or if routes are overwritten. - * - * @return void - */ - public function refreshNameLookups() - { - $this->nameList = []; - - foreach ($this->allRoutes as $route) { - if ($route->getName()) { - $this->nameList[$route->getName()] = $route; - } - } - } - - /** - * Refresh the action look-up table. - * - * This is done in case any actions are overwritten with new controllers. - * - * @return void - */ - public function refreshActionLookups() - { - $this->actionList = []; - - foreach ($this->allRoutes as $route) { - if (isset($route->getAction()['controller'])) { - $this->addToActionList($route->getAction(), $route); - } - } - } - - /** - * Find the first route matching a given request. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Routing\Route - * - * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - public function match(Request $request) - { - $routes = $this->get($request->getMethod()); - - // First, we will see if we can find a matching route for this current request - // method. If we can, great, we can just return it so that it can be called - // by the consumer. Otherwise we will check for routes with another verb. - $route = $this->matchAgainstRoutes($routes, $request); - - return $this->handleMatchedRoute($request, $route); - } - - /** - * Get routes from the collection by method. - * - * @param string|null $method - * @return \Illuminate\Routing\Route[] - */ - public function get($method = null) - { - return is_null($method) ? $this->getRoutes() : Arr::get($this->routes, $method, []); - } - - /** - * Determine if the route collection contains a given named route. - * - * @param string $name - * @return bool - */ - public function hasNamedRoute($name) - { - return ! is_null($this->getByName($name)); - } - - /** - * Get a route instance by its name. - * - * @param string $name - * @return \Illuminate\Routing\Route|null - */ - public function getByName($name) - { - return $this->nameList[$name] ?? null; - } - - /** - * Get a route instance by its controller action. - * - * @param string $action - * @return \Illuminate\Routing\Route|null - */ - public function getByAction($action) - { - return $this->actionList[$action] ?? null; - } - - /** - * Get all of the routes in the collection. - * - * @return \Illuminate\Routing\Route[] - */ - public function getRoutes() - { - return array_values($this->allRoutes); - } - - /** - * Get all of the routes keyed by their HTTP verb / method. - * - * @return array - */ - public function getRoutesByMethod() - { - return $this->routes; - } - - /** - * Get all of the routes keyed by their name. - * - * @return \Illuminate\Routing\Route[] - */ - public function getRoutesByName() - { - return $this->nameList; - } - - /** - * Convert the collection to a Symfony RouteCollection instance. - * - * @return \Symfony\Component\Routing\RouteCollection - */ - public function toSymfonyRouteCollection() - { - $symfonyRoutes = parent::toSymfonyRouteCollection(); - - $this->refreshNameLookups(); - - return $symfonyRoutes; - } - - /** - * Convert the collection to a CompiledRouteCollection instance. - * - * @param \Illuminate\Routing\Router $router - * @param \Illuminate\Container\Container $container - * @return \Illuminate\Routing\CompiledRouteCollection - */ - public function toCompiledRouteCollection(Router $router, Container $container) - { - ['compiled' => $compiled, 'attributes' => $attributes] = $this->compile(); - - return (new CompiledRouteCollection($compiled, $attributes)) - ->setRouter($router) - ->setContainer($container); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteCollectionInterface.php b/framework-9.50.2/src/Illuminate/Routing/RouteCollectionInterface.php deleted file mode 100644 index 8e25d0f..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteCollectionInterface.php +++ /dev/null @@ -1,98 +0,0 @@ -resolveMethodDependencies( - $parameters, new ReflectionMethod($instance, $method) - ); - } - - /** - * Resolve the given method's type-hinted dependencies. - * - * @param array $parameters - * @param \ReflectionFunctionAbstract $reflector - * @return array - */ - public function resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector) - { - $instanceCount = 0; - - $values = array_values($parameters); - - $skippableValue = new stdClass; - - foreach ($reflector->getParameters() as $key => $parameter) { - $instance = $this->transformDependency($parameter, $parameters, $skippableValue); - - if ($instance !== $skippableValue) { - $instanceCount++; - - $this->spliceIntoParameters($parameters, $key, $instance); - } elseif (! isset($values[$key - $instanceCount]) && - $parameter->isDefaultValueAvailable()) { - $this->spliceIntoParameters($parameters, $key, $parameter->getDefaultValue()); - } - } - - return $parameters; - } - - /** - * Attempt to transform the given parameter into a class instance. - * - * @param \ReflectionParameter $parameter - * @param array $parameters - * @param object $skippableValue - * @return mixed - */ - protected function transformDependency(ReflectionParameter $parameter, $parameters, $skippableValue) - { - $className = Reflector::getParameterClassName($parameter); - - // If the parameter has a type-hinted class, we will check to see if it is already in - // the list of parameters. If it is we will just skip it as it is probably a model - // binding and we do not want to mess with those; otherwise, we resolve it here. - if ($className && ! $this->alreadyInParameters($className, $parameters)) { - $isEnum = method_exists(ReflectionClass::class, 'isEnum') && (new ReflectionClass($className))->isEnum(); - - return $parameter->isDefaultValueAvailable() - ? ($isEnum ? $parameter->getDefaultValue() : null) - : $this->container->make($className); - } - - return $skippableValue; - } - - /** - * Determine if an object of the given class is in a list of parameters. - * - * @param string $class - * @param array $parameters - * @return bool - */ - protected function alreadyInParameters($class, array $parameters) - { - return ! is_null(Arr::first($parameters, fn ($value) => $value instanceof $class)); - } - - /** - * Splice the given value into the parameter list. - * - * @param array $parameters - * @param string $offset - * @param mixed $value - * @return void - */ - protected function spliceIntoParameters(array &$parameters, $offset, $value) - { - array_splice( - $parameters, $offset, 0, [$value] - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteFileRegistrar.php b/framework-9.50.2/src/Illuminate/Routing/RouteFileRegistrar.php deleted file mode 100644 index 7670b10..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteFileRegistrar.php +++ /dev/null @@ -1,37 +0,0 @@ -router = $router; - } - - /** - * Require the given routes file. - * - * @param string $routes - * @return void - */ - public function register($routes) - { - $router = $this->router; - - require $routes; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteGroup.php b/framework-9.50.2/src/Illuminate/Routing/RouteGroup.php deleted file mode 100644 index 28e05d5..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteGroup.php +++ /dev/null @@ -1,105 +0,0 @@ - static::formatNamespace($new, $old), - 'prefix' => static::formatPrefix($new, $old, $prependExistingPrefix), - 'where' => static::formatWhere($new, $old), - ]); - - return array_merge_recursive(Arr::except( - $old, ['namespace', 'prefix', 'where', 'as'] - ), $new); - } - - /** - * Format the namespace for the new group attributes. - * - * @param array $new - * @param array $old - * @return string|null - */ - protected static function formatNamespace($new, $old) - { - if (isset($new['namespace'])) { - return isset($old['namespace']) && ! str_starts_with($new['namespace'], '\\') - ? trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\') - : trim($new['namespace'], '\\'); - } - - return $old['namespace'] ?? null; - } - - /** - * Format the prefix for the new group attributes. - * - * @param array $new - * @param array $old - * @param bool $prependExistingPrefix - * @return string|null - */ - protected static function formatPrefix($new, $old, $prependExistingPrefix = true) - { - $old = $old['prefix'] ?? ''; - - if ($prependExistingPrefix) { - return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old; - } else { - return isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old; - } - } - - /** - * Format the "wheres" for the new group attributes. - * - * @param array $new - * @param array $old - * @return array - */ - protected static function formatWhere($new, $old) - { - return array_merge( - $old['where'] ?? [], - $new['where'] ?? [] - ); - } - - /** - * Format the "as" clause of the new group attributes. - * - * @param array $new - * @param array $old - * @return array - */ - protected static function formatAs($new, $old) - { - if (isset($old['as'])) { - $new['as'] = $old['as'].($new['as'] ?? ''); - } - - return $new; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteParameterBinder.php b/framework-9.50.2/src/Illuminate/Routing/RouteParameterBinder.php deleted file mode 100644 index 8c3968e..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteParameterBinder.php +++ /dev/null @@ -1,117 +0,0 @@ -route = $route; - } - - /** - * Get the parameters for the route. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - public function parameters($request) - { - $parameters = $this->bindPathParameters($request); - - // If the route has a regular expression for the host part of the URI, we will - // compile that and get the parameter matches for this domain. We will then - // merge them into this parameters array so that this array is completed. - if (! is_null($this->route->compiled->getHostRegex())) { - $parameters = $this->bindHostParameters( - $request, $parameters - ); - } - - return $this->replaceDefaults($parameters); - } - - /** - * Get the parameter matches for the path portion of the URI. - * - * @param \Illuminate\Http\Request $request - * @return array - */ - protected function bindPathParameters($request) - { - $path = '/'.ltrim($request->decodedPath(), '/'); - - preg_match($this->route->compiled->getRegex(), $path, $matches); - - return $this->matchToKeys(array_slice($matches, 1)); - } - - /** - * Extract the parameter list from the host part of the request. - * - * @param \Illuminate\Http\Request $request - * @param array $parameters - * @return array - */ - protected function bindHostParameters($request, $parameters) - { - preg_match($this->route->compiled->getHostRegex(), $request->getHost(), $matches); - - return array_merge($this->matchToKeys(array_slice($matches, 1)), $parameters); - } - - /** - * Combine a set of parameter matches with the route's keys. - * - * @param array $matches - * @return array - */ - protected function matchToKeys(array $matches) - { - if (empty($parameterNames = $this->route->parameterNames())) { - return []; - } - - $parameters = array_intersect_key($matches, array_flip($parameterNames)); - - return array_filter($parameters, function ($value) { - return is_string($value) && strlen($value) > 0; - }); - } - - /** - * Replace null parameters with their defaults. - * - * @param array $parameters - * @return array - */ - protected function replaceDefaults(array $parameters) - { - foreach ($parameters as $key => $value) { - $parameters[$key] = $value ?? Arr::get($this->route->defaults, $key); - } - - foreach ($this->route->defaults as $key => $value) { - if (! isset($parameters[$key])) { - $parameters[$key] = $value; - } - } - - return $parameters; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteRegistrar.php b/framework-9.50.2/src/Illuminate/Routing/RouteRegistrar.php deleted file mode 100644 index 65d454c..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteRegistrar.php +++ /dev/null @@ -1,285 +0,0 @@ - 'as', - 'scopeBindings' => 'scope_bindings', - 'withoutMiddleware' => 'excluded_middleware', - ]; - - /** - * Create a new route registrar instance. - * - * @param \Illuminate\Routing\Router $router - * @return void - */ - public function __construct(Router $router) - { - $this->router = $router; - } - - /** - * Set the value for a given attribute. - * - * @param string $key - * @param mixed $value - * @return $this - * - * @throws \InvalidArgumentException - */ - public function attribute($key, $value) - { - if (! in_array($key, $this->allowedAttributes)) { - throw new InvalidArgumentException("Attribute [{$key}] does not exist."); - } - - if ($key === 'middleware') { - foreach ($value as $index => $middleware) { - $value[$index] = (string) $middleware; - } - } - - $attributeKey = Arr::get($this->aliases, $key, $key); - - if ($key === 'withoutMiddleware') { - $value = array_merge( - (array) ($this->attributes[$attributeKey] ?? []), Arr::wrap($value) - ); - } - - $this->attributes[$attributeKey] = $value; - - return $this; - } - - /** - * Route a resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function resource($name, $controller, array $options = []) - { - return $this->router->resource($name, $controller, $this->attributes + $options); - } - - /** - * Route an API resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function apiResource($name, $controller, array $options = []) - { - return $this->router->apiResource($name, $controller, $this->attributes + $options); - } - - /** - * Route a singleton resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function singleton($name, $controller, array $options = []) - { - return $this->router->singleton($name, $controller, $this->attributes + $options); - } - - /** - * Route an API singleton resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function apiSingleton($name, $controller, array $options = []) - { - return $this->router->apiSingleton($name, $controller, $this->attributes + $options); - } - - /** - * Create a route group with shared attributes. - * - * @param \Closure|array|string $callback - * @return $this - */ - public function group($callback) - { - $this->router->group($this->attributes, $callback); - - return $this; - } - - /** - * Register a new route with the given verbs. - * - * @param array|string $methods - * @param string $uri - * @param \Closure|array|string|null $action - * @return \Illuminate\Routing\Route - */ - public function match($methods, $uri, $action = null) - { - return $this->router->match($methods, $uri, $this->compileAction($action)); - } - - /** - * Register a new route with the router. - * - * @param string $method - * @param string $uri - * @param \Closure|array|string|null $action - * @return \Illuminate\Routing\Route - */ - protected function registerRoute($method, $uri, $action = null) - { - if (! is_array($action)) { - $action = array_merge($this->attributes, $action ? ['uses' => $action] : []); - } - - return $this->router->{$method}($uri, $this->compileAction($action)); - } - - /** - * Compile the action into an array including the attributes. - * - * @param \Closure|array|string|null $action - * @return array - */ - protected function compileAction($action) - { - if (is_null($action)) { - return $this->attributes; - } - - if (is_string($action) || $action instanceof Closure) { - $action = ['uses' => $action]; - } - - if (is_array($action) && - ! Arr::isAssoc($action) && - Reflector::isCallable($action)) { - if (strncmp($action[0], '\\', 1)) { - $action[0] = '\\'.$action[0]; - } - $action = [ - 'uses' => $action[0].'@'.$action[1], - 'controller' => $action[0].'@'.$action[1], - ]; - } - - return array_merge($this->attributes, $action); - } - - /** - * Dynamically handle calls into the route registrar. - * - * @param string $method - * @param array $parameters - * @return \Illuminate\Routing\Route|$this - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (in_array($method, $this->passthru)) { - return $this->registerRoute($method, ...$parameters); - } - - if (in_array($method, $this->allowedAttributes)) { - if ($method === 'middleware') { - return $this->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters); - } - - return $this->attribute($method, array_key_exists(0, $parameters) ? $parameters[0] : true); - } - - throw new BadMethodCallException(sprintf( - 'Method %s::%s does not exist.', static::class, $method - )); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteSignatureParameters.php b/framework-9.50.2/src/Illuminate/Routing/RouteSignatureParameters.php deleted file mode 100644 index 7a4b6da..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteSignatureParameters.php +++ /dev/null @@ -1,52 +0,0 @@ -getClosure() - : $action['uses']; - - $parameters = is_string($callback) - ? static::fromClassMethodString($callback) - : (new ReflectionFunction($callback))->getParameters(); - - return match (true) { - ! empty($conditions['subClass']) => array_filter($parameters, fn ($p) => Reflector::isParameterSubclassOf($p, $conditions['subClass'])), - ! empty($conditions['backedEnum']) => array_filter($parameters, fn ($p) => Reflector::isParameterBackedEnumWithStringBackingType($p)), - default => $parameters, - }; - } - - /** - * Get the parameters for the given class / method by string. - * - * @param string $uses - * @return array - */ - protected static function fromClassMethodString($uses) - { - [$class, $method] = Str::parseCallback($uses); - - if (! method_exists($class, $method) && Reflector::isCallable($class, $method)) { - return []; - } - - return (new ReflectionMethod($class, $method))->getParameters(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteUri.php b/framework-9.50.2/src/Illuminate/Routing/RouteUri.php deleted file mode 100644 index 3237177..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteUri.php +++ /dev/null @@ -1,62 +0,0 @@ -uri = $uri; - $this->bindingFields = $bindingFields; - } - - /** - * Parse the given URI. - * - * @param string $uri - * @return static - */ - public static function parse($uri) - { - preg_match_all('/\{([\w\:]+?)\??\}/', $uri, $matches); - - $bindingFields = []; - - foreach ($matches[0] as $match) { - if (! str_contains($match, ':')) { - continue; - } - - $segments = explode(':', trim($match, '{}?')); - - $bindingFields[$segments[0]] = $segments[1]; - - $uri = str_contains($match, '?') - ? str_replace($match, '{'.$segments[0].'?}', $uri) - : str_replace($match, '{'.$segments[0].'}', $uri); - } - - return new static($uri, $bindingFields); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RouteUrlGenerator.php b/framework-9.50.2/src/Illuminate/Routing/RouteUrlGenerator.php deleted file mode 100644 index a0e5cf6..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RouteUrlGenerator.php +++ /dev/null @@ -1,320 +0,0 @@ - '/', - '%40' => '@', - '%3A' => ':', - '%3B' => ';', - '%2C' => ',', - '%3D' => '=', - '%2B' => '+', - '%21' => '!', - '%2A' => '*', - '%7C' => '|', - '%3F' => '?', - '%26' => '&', - '%23' => '#', - '%25' => '%', - ]; - - /** - * Create a new Route URL generator. - * - * @param \Illuminate\Routing\UrlGenerator $url - * @param \Illuminate\Http\Request $request - * @return void - */ - public function __construct($url, $request) - { - $this->url = $url; - $this->request = $request; - } - - /** - * Generate a URL for the given route. - * - * @param \Illuminate\Routing\Route $route - * @param array $parameters - * @param bool $absolute - * @return string - * - * @throws \Illuminate\Routing\Exceptions\UrlGenerationException - */ - public function to($route, $parameters = [], $absolute = false) - { - $domain = $this->getRouteDomain($route, $parameters); - - // First we will construct the entire URI including the root and query string. Once it - // has been constructed, we'll make sure we don't have any missing parameters or we - // will need to throw the exception to let the developers know one was not given. - $uri = $this->addQueryString($this->url->format( - $root = $this->replaceRootParameters($route, $domain, $parameters), - $this->replaceRouteParameters($route->uri(), $parameters), - $route - ), $parameters); - - if (preg_match_all('/{(.*?)}/', $uri, $matchedMissingParameters)) { - throw UrlGenerationException::forMissingParameters($route, $matchedMissingParameters[1]); - } - - // Once we have ensured that there are no missing parameters in the URI we will encode - // the URI and prepare it for returning to the developer. If the URI is supposed to - // be absolute, we will return it as-is. Otherwise we will remove the URL's root. - $uri = strtr(rawurlencode($uri), $this->dontEncode); - - if (! $absolute) { - $uri = preg_replace('#^(//|[^/?])+#', '', $uri); - - if ($base = $this->request->getBaseUrl()) { - $uri = preg_replace('#^'.$base.'#i', '', $uri); - } - - return '/'.ltrim($uri, '/'); - } - - return $uri; - } - - /** - * Get the formatted domain for a given route. - * - * @param \Illuminate\Routing\Route $route - * @param array $parameters - * @return string - */ - protected function getRouteDomain($route, &$parameters) - { - return $route->getDomain() ? $this->formatDomain($route, $parameters) : null; - } - - /** - * Format the domain and port for the route and request. - * - * @param \Illuminate\Routing\Route $route - * @param array $parameters - * @return string - */ - protected function formatDomain($route, &$parameters) - { - return $this->addPortToDomain( - $this->getRouteScheme($route).$route->getDomain() - ); - } - - /** - * Get the scheme for the given route. - * - * @param \Illuminate\Routing\Route $route - * @return string - */ - protected function getRouteScheme($route) - { - if ($route->httpOnly()) { - return 'http://'; - } elseif ($route->httpsOnly()) { - return 'https://'; - } - - return $this->url->formatScheme(); - } - - /** - * Add the port to the domain if necessary. - * - * @param string $domain - * @return string - */ - protected function addPortToDomain($domain) - { - $secure = $this->request->isSecure(); - - $port = (int) $this->request->getPort(); - - return ($secure && $port === 443) || (! $secure && $port === 80) - ? $domain : $domain.':'.$port; - } - - /** - * Replace the parameters on the root path. - * - * @param \Illuminate\Routing\Route $route - * @param string $domain - * @param array $parameters - * @return string - */ - protected function replaceRootParameters($route, $domain, &$parameters) - { - $scheme = $this->getRouteScheme($route); - - return $this->replaceRouteParameters( - $this->url->formatRoot($scheme, $domain), $parameters - ); - } - - /** - * Replace all of the wildcard parameters for a route path. - * - * @param string $path - * @param array $parameters - * @return string - */ - protected function replaceRouteParameters($path, array &$parameters) - { - $path = $this->replaceNamedParameters($path, $parameters); - - $path = preg_replace_callback('/\{.*?\}/', function ($match) use (&$parameters) { - // Reset only the numeric keys... - $parameters = array_merge($parameters); - - return (! isset($parameters[0]) && ! str_ends_with($match[0], '?}')) - ? $match[0] - : Arr::pull($parameters, 0); - }, $path); - - return trim(preg_replace('/\{.*?\?\}/', '', $path), '/'); - } - - /** - * Replace all of the named parameters in the path. - * - * @param string $path - * @param array $parameters - * @return string - */ - protected function replaceNamedParameters($path, &$parameters) - { - return preg_replace_callback('/\{(.*?)(\?)?\}/', function ($m) use (&$parameters) { - if (isset($parameters[$m[1]]) && $parameters[$m[1]] !== '') { - return Arr::pull($parameters, $m[1]); - } elseif (isset($this->defaultParameters[$m[1]])) { - return $this->defaultParameters[$m[1]]; - } elseif (isset($parameters[$m[1]])) { - Arr::pull($parameters, $m[1]); - } - - return $m[0]; - }, $path); - } - - /** - * Add a query string to the URI. - * - * @param string $uri - * @param array $parameters - * @return mixed|string - */ - protected function addQueryString($uri, array $parameters) - { - // If the URI has a fragment we will move it to the end of this URI since it will - // need to come after any query string that may be added to the URL else it is - // not going to be available. We will remove it then append it back on here. - if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { - $uri = preg_replace('/#.*/', '', $uri); - } - - $uri .= $this->getRouteQueryString($parameters); - - return is_null($fragment) ? $uri : $uri."#{$fragment}"; - } - - /** - * Get the query string for a given route. - * - * @param array $parameters - * @return string - */ - protected function getRouteQueryString(array $parameters) - { - // First we will get all of the string parameters that are remaining after we - // have replaced the route wildcards. We'll then build a query string from - // these string parameters then use it as a starting point for the rest. - if (count($parameters) === 0) { - return ''; - } - - $query = Arr::query( - $keyed = $this->getStringParameters($parameters) - ); - - // Lastly, if there are still parameters remaining, we will fetch the numeric - // parameters that are in the array and add them to the query string or we - // will make the initial query string if it wasn't started with strings. - if (count($keyed) < count($parameters)) { - $query .= '&'.implode( - '&', $this->getNumericParameters($parameters) - ); - } - - $query = trim($query, '&'); - - return $query === '' ? '' : "?{$query}"; - } - - /** - * Get the string parameters from a given list. - * - * @param array $parameters - * @return array - */ - protected function getStringParameters(array $parameters) - { - return array_filter($parameters, 'is_string', ARRAY_FILTER_USE_KEY); - } - - /** - * Get the numeric parameters from a given list. - * - * @param array $parameters - * @return array - */ - protected function getNumericParameters(array $parameters) - { - return array_filter($parameters, 'is_numeric', ARRAY_FILTER_USE_KEY); - } - - /** - * Set the default named parameters used by the URL generator. - * - * @param array $defaults - * @return void - */ - public function defaults(array $defaults) - { - $this->defaultParameters = array_merge( - $this->defaultParameters, $defaults - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/Router.php b/framework-9.50.2/src/Illuminate/Routing/Router.php deleted file mode 100644 index e2fb742..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/Router.php +++ /dev/null @@ -1,1475 +0,0 @@ -events = $events; - $this->routes = new RouteCollection; - $this->container = $container ?: new Container; - } - - /** - * Register a new GET route with the router. - * - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function get($uri, $action = null) - { - return $this->addRoute(['GET', 'HEAD'], $uri, $action); - } - - /** - * Register a new POST route with the router. - * - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function post($uri, $action = null) - { - return $this->addRoute('POST', $uri, $action); - } - - /** - * Register a new PUT route with the router. - * - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function put($uri, $action = null) - { - return $this->addRoute('PUT', $uri, $action); - } - - /** - * Register a new PATCH route with the router. - * - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function patch($uri, $action = null) - { - return $this->addRoute('PATCH', $uri, $action); - } - - /** - * Register a new DELETE route with the router. - * - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function delete($uri, $action = null) - { - return $this->addRoute('DELETE', $uri, $action); - } - - /** - * Register a new OPTIONS route with the router. - * - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function options($uri, $action = null) - { - return $this->addRoute('OPTIONS', $uri, $action); - } - - /** - * Register a new route responding to all verbs. - * - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function any($uri, $action = null) - { - return $this->addRoute(self::$verbs, $uri, $action); - } - - /** - * Register a new Fallback route with the router. - * - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function fallback($action) - { - $placeholder = 'fallbackPlaceholder'; - - return $this->addRoute( - 'GET', "{{$placeholder}}", $action - )->where($placeholder, '.*')->fallback(); - } - - /** - * Create a redirect from one URI to another. - * - * @param string $uri - * @param string $destination - * @param int $status - * @return \Illuminate\Routing\Route - */ - public function redirect($uri, $destination, $status = 302) - { - return $this->any($uri, '\Illuminate\Routing\RedirectController') - ->defaults('destination', $destination) - ->defaults('status', $status); - } - - /** - * Create a permanent redirect from one URI to another. - * - * @param string $uri - * @param string $destination - * @return \Illuminate\Routing\Route - */ - public function permanentRedirect($uri, $destination) - { - return $this->redirect($uri, $destination, 301); - } - - /** - * Register a new route that returns a view. - * - * @param string $uri - * @param string $view - * @param array $data - * @param int|array $status - * @param array $headers - * @return \Illuminate\Routing\Route - */ - public function view($uri, $view, $data = [], $status = 200, array $headers = []) - { - return $this->match(['GET', 'HEAD'], $uri, '\Illuminate\Routing\ViewController') - ->setDefaults([ - 'view' => $view, - 'data' => $data, - 'status' => is_array($status) ? 200 : $status, - 'headers' => is_array($status) ? $status : $headers, - ]); - } - - /** - * Register a new route with the given verbs. - * - * @param array|string $methods - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function match($methods, $uri, $action = null) - { - return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action); - } - - /** - * Register an array of resource controllers. - * - * @param array $resources - * @param array $options - * @return void - */ - public function resources(array $resources, array $options = []) - { - foreach ($resources as $name => $controller) { - $this->resource($name, $controller, $options); - } - } - - /** - * Route a resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function resource($name, $controller, array $options = []) - { - if ($this->container && $this->container->bound(ResourceRegistrar::class)) { - $registrar = $this->container->make(ResourceRegistrar::class); - } else { - $registrar = new ResourceRegistrar($this); - } - - return new PendingResourceRegistration( - $registrar, $name, $controller, $options - ); - } - - /** - * Register an array of API resource controllers. - * - * @param array $resources - * @param array $options - * @return void - */ - public function apiResources(array $resources, array $options = []) - { - foreach ($resources as $name => $controller) { - $this->apiResource($name, $controller, $options); - } - } - - /** - * Route an API resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\PendingResourceRegistration - */ - public function apiResource($name, $controller, array $options = []) - { - $only = ['index', 'show', 'store', 'update', 'destroy']; - - if (isset($options['except'])) { - $only = array_diff($only, (array) $options['except']); - } - - return $this->resource($name, $controller, array_merge([ - 'only' => $only, - ], $options)); - } - - /** - * Register an array of singleton resource controllers. - * - * @param array $singletons - * @param array $options - * @return void - */ - public function singletons(array $singletons, array $options = []) - { - foreach ($singletons as $name => $controller) { - $this->singleton($name, $controller, $options); - } - } - - /** - * Route a singleton resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function singleton($name, $controller, array $options = []) - { - if ($this->container && $this->container->bound(ResourceRegistrar::class)) { - $registrar = $this->container->make(ResourceRegistrar::class); - } else { - $registrar = new ResourceRegistrar($this); - } - - return new PendingSingletonResourceRegistration( - $registrar, $name, $controller, $options - ); - } - - /** - * Register an array of API singleton resource controllers. - * - * @param array $singletons - * @param array $options - * @return void - */ - public function apiSingletons(array $singletons, array $options = []) - { - foreach ($singletons as $name => $controller) { - $this->apiSingleton($name, $controller, $options); - } - } - - /** - * Route an API singleton resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return \Illuminate\Routing\PendingSingletonResourceRegistration - */ - public function apiSingleton($name, $controller, array $options = []) - { - $only = ['show', 'update', 'destroy']; - - if (isset($options['except'])) { - $only = array_diff($only, (array) $options['except']); - } - - return $this->singleton($name, $controller, array_merge([ - 'only' => $only, - 'apiSingleton' => true, - ], $options)); - } - - /** - * Create a route group with shared attributes. - * - * @param array $attributes - * @param \Closure|array|string $routes - * @return $this - */ - public function group(array $attributes, $routes) - { - foreach (Arr::wrap($routes) as $groupRoutes) { - $this->updateGroupStack($attributes); - - // Once we have updated the group stack, we'll load the provided routes and - // merge in the group's attributes when the routes are created. After we - // have created the routes, we will pop the attributes off the stack. - $this->loadRoutes($groupRoutes); - - array_pop($this->groupStack); - } - - return $this; - } - - /** - * Update the group stack with the given attributes. - * - * @param array $attributes - * @return void - */ - protected function updateGroupStack(array $attributes) - { - if ($this->hasGroupStack()) { - $attributes = $this->mergeWithLastGroup($attributes); - } - - $this->groupStack[] = $attributes; - } - - /** - * Merge the given array with the last group stack. - * - * @param array $new - * @param bool $prependExistingPrefix - * @return array - */ - public function mergeWithLastGroup($new, $prependExistingPrefix = true) - { - return RouteGroup::merge($new, end($this->groupStack), $prependExistingPrefix); - } - - /** - * Load the provided routes. - * - * @param \Closure|string $routes - * @return void - */ - protected function loadRoutes($routes) - { - if ($routes instanceof Closure) { - $routes($this); - } else { - (new RouteFileRegistrar($this))->register($routes); - } - } - - /** - * Get the prefix from the last group on the stack. - * - * @return string - */ - public function getLastGroupPrefix() - { - if ($this->hasGroupStack()) { - $last = end($this->groupStack); - - return $last['prefix'] ?? ''; - } - - return ''; - } - - /** - * Add a route to the underlying route collection. - * - * @param array|string $methods - * @param string $uri - * @param array|string|callable|null $action - * @return \Illuminate\Routing\Route - */ - public function addRoute($methods, $uri, $action) - { - return $this->routes->add($this->createRoute($methods, $uri, $action)); - } - - /** - * Create a new route instance. - * - * @param array|string $methods - * @param string $uri - * @param mixed $action - * @return \Illuminate\Routing\Route - */ - protected function createRoute($methods, $uri, $action) - { - // If the route is routing to a controller we will parse the route action into - // an acceptable array format before registering it and creating this route - // instance itself. We need to build the Closure that will call this out. - if ($this->actionReferencesController($action)) { - $action = $this->convertToControllerAction($action); - } - - $route = $this->newRoute( - $methods, $this->prefix($uri), $action - ); - - // If we have groups that need to be merged, we will merge them now after this - // route has already been created and is ready to go. After we're done with - // the merge we will be ready to return the route back out to the caller. - if ($this->hasGroupStack()) { - $this->mergeGroupAttributesIntoRoute($route); - } - - $this->addWhereClausesToRoute($route); - - return $route; - } - - /** - * Determine if the action is routing to a controller. - * - * @param mixed $action - * @return bool - */ - protected function actionReferencesController($action) - { - if (! $action instanceof Closure) { - return is_string($action) || (isset($action['uses']) && is_string($action['uses'])); - } - - return false; - } - - /** - * Add a controller based route action to the action array. - * - * @param array|string $action - * @return array - */ - protected function convertToControllerAction($action) - { - if (is_string($action)) { - $action = ['uses' => $action]; - } - - // Here we'll merge any group "controller" and "uses" statements if necessary so that - // the action has the proper clause for this property. Then, we can simply set the - // name of this controller on the action plus return the action array for usage. - if ($this->hasGroupStack()) { - $action['uses'] = $this->prependGroupController($action['uses']); - $action['uses'] = $this->prependGroupNamespace($action['uses']); - } - - // Here we will set this controller name on the action array just so we always - // have a copy of it for reference if we need it. This can be used while we - // search for a controller name or do some other type of fetch operation. - $action['controller'] = $action['uses']; - - return $action; - } - - /** - * Prepend the last group namespace onto the use clause. - * - * @param string $class - * @return string - */ - protected function prependGroupNamespace($class) - { - $group = end($this->groupStack); - - return isset($group['namespace']) && ! str_starts_with($class, '\\') && ! str_starts_with($class, $group['namespace']) - ? $group['namespace'].'\\'.$class : $class; - } - - /** - * Prepend the last group controller onto the use clause. - * - * @param string $class - * @return string - */ - protected function prependGroupController($class) - { - $group = end($this->groupStack); - - if (! isset($group['controller'])) { - return $class; - } - - if (class_exists($class)) { - return $class; - } - - if (str_contains($class, '@')) { - return $class; - } - - return $group['controller'].'@'.$class; - } - - /** - * Create a new Route object. - * - * @param array|string $methods - * @param string $uri - * @param mixed $action - * @return \Illuminate\Routing\Route - */ - public function newRoute($methods, $uri, $action) - { - return (new Route($methods, $uri, $action)) - ->setRouter($this) - ->setContainer($this->container); - } - - /** - * Prefix the given URI with the last prefix. - * - * @param string $uri - * @return string - */ - protected function prefix($uri) - { - return trim(trim($this->getLastGroupPrefix(), '/').'/'.trim($uri, '/'), '/') ?: '/'; - } - - /** - * Add the necessary where clauses to the route based on its initial registration. - * - * @param \Illuminate\Routing\Route $route - * @return \Illuminate\Routing\Route - */ - protected function addWhereClausesToRoute($route) - { - $route->where(array_merge( - $this->patterns, $route->getAction()['where'] ?? [] - )); - - return $route; - } - - /** - * Merge the group stack with the controller action. - * - * @param \Illuminate\Routing\Route $route - * @return void - */ - protected function mergeGroupAttributesIntoRoute($route) - { - $route->setAction($this->mergeWithLastGroup( - $route->getAction(), - $prependExistingPrefix = false - )); - } - - /** - * Return the response returned by the given route. - * - * @param string $name - * @return \Symfony\Component\HttpFoundation\Response - */ - public function respondWithRoute($name) - { - $route = tap($this->routes->getByName($name))->bind($this->currentRequest); - - return $this->runRoute($this->currentRequest, $route); - } - - /** - * Dispatch the request to the application. - * - * @param \Illuminate\Http\Request $request - * @return \Symfony\Component\HttpFoundation\Response - */ - public function dispatch(Request $request) - { - $this->currentRequest = $request; - - return $this->dispatchToRoute($request); - } - - /** - * Dispatch the request to a route and return the response. - * - * @param \Illuminate\Http\Request $request - * @return \Symfony\Component\HttpFoundation\Response - */ - public function dispatchToRoute(Request $request) - { - return $this->runRoute($request, $this->findRoute($request)); - } - - /** - * Find the route matching a given request. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Routing\Route - */ - protected function findRoute($request) - { - $this->events->dispatch(new Routing($request)); - - $this->current = $route = $this->routes->match($request); - - $route->setContainer($this->container); - - $this->container->instance(Route::class, $route); - - return $route; - } - - /** - * Return the response for the given route. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Routing\Route $route - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function runRoute(Request $request, Route $route) - { - $request->setRouteResolver(fn () => $route); - - $this->events->dispatch(new RouteMatched($route, $request)); - - return $this->prepareResponse($request, - $this->runRouteWithinStack($route, $request) - ); - } - - /** - * Run the given route within a Stack "onion" instance. - * - * @param \Illuminate\Routing\Route $route - * @param \Illuminate\Http\Request $request - * @return mixed - */ - protected function runRouteWithinStack(Route $route, Request $request) - { - $shouldSkipMiddleware = $this->container->bound('middleware.disable') && - $this->container->make('middleware.disable') === true; - - $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); - - return (new Pipeline($this->container)) - ->send($request) - ->through($middleware) - ->then(fn ($request) => $this->prepareResponse( - $request, $route->run() - )); - } - - /** - * Gather the middleware for the given route with resolved class names. - * - * @param \Illuminate\Routing\Route $route - * @return array - */ - public function gatherRouteMiddleware(Route $route) - { - return $this->resolveMiddleware($route->gatherMiddleware(), $route->excludedMiddleware()); - } - - /** - * Resolve a flat array of middleware classes from the provided array. - * - * @param array $middleware - * @param array $excluded - * @return array - */ - public function resolveMiddleware(array $middleware, array $excluded = []) - { - $excluded = collect($excluded)->map(function ($name) { - return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups); - })->flatten()->values()->all(); - - $middleware = collect($middleware)->map(function ($name) { - return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups); - })->flatten()->reject(function ($name) use ($excluded) { - if (empty($excluded)) { - return false; - } - - if ($name instanceof Closure) { - return false; - } - - if (in_array($name, $excluded, true)) { - return true; - } - - if (! class_exists($name)) { - return false; - } - - $reflection = new ReflectionClass($name); - - return collect($excluded)->contains( - fn ($exclude) => class_exists($exclude) && $reflection->isSubclassOf($exclude) - ); - })->values(); - - return $this->sortMiddleware($middleware); - } - - /** - * Sort the given middleware by priority. - * - * @param \Illuminate\Support\Collection $middlewares - * @return array - */ - protected function sortMiddleware(Collection $middlewares) - { - return (new SortedMiddleware($this->middlewarePriority, $middlewares))->all(); - } - - /** - * Create a response instance from the given value. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param mixed $response - * @return \Symfony\Component\HttpFoundation\Response - */ - public function prepareResponse($request, $response) - { - return static::toResponse($request, $response); - } - - /** - * Static version of prepareResponse. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param mixed $response - * @return \Symfony\Component\HttpFoundation\Response - */ - public static function toResponse($request, $response) - { - if ($response instanceof Responsable) { - $response = $response->toResponse($request); - } - - if ($response instanceof PsrResponseInterface) { - $response = (new HttpFoundationFactory)->createResponse($response); - } elseif ($response instanceof Model && $response->wasRecentlyCreated) { - $response = new JsonResponse($response, 201); - } elseif ($response instanceof Stringable) { - $response = new Response($response->__toString(), 200, ['Content-Type' => 'text/html']); - } elseif (! $response instanceof SymfonyResponse && - ($response instanceof Arrayable || - $response instanceof Jsonable || - $response instanceof ArrayObject || - $response instanceof JsonSerializable || - $response instanceof stdClass || - is_array($response))) { - $response = new JsonResponse($response); - } elseif (! $response instanceof SymfonyResponse) { - $response = new Response($response, 200, ['Content-Type' => 'text/html']); - } - - if ($response->getStatusCode() === Response::HTTP_NOT_MODIFIED) { - $response->setNotModified(); - } - - return $response->prepare($request); - } - - /** - * Substitute the route bindings onto the route. - * - * @param \Illuminate\Routing\Route $route - * @return \Illuminate\Routing\Route - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - * @throws \Illuminate\Routing\Exceptions\BackedEnumCaseNotFoundException - */ - public function substituteBindings($route) - { - foreach ($route->parameters() as $key => $value) { - if (isset($this->binders[$key])) { - $route->setParameter($key, $this->performBinding($key, $value, $route)); - } - } - - return $route; - } - - /** - * Substitute the implicit route bindings for the given route. - * - * @param \Illuminate\Routing\Route $route - * @return void - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - * @throws \Illuminate\Routing\Exceptions\BackedEnumCaseNotFoundException - */ - public function substituteImplicitBindings($route) - { - ImplicitRouteBinding::resolveForRoute($this->container, $route); - } - - /** - * Call the binding callback for the given key. - * - * @param string $key - * @param string $value - * @param \Illuminate\Routing\Route $route - * @return mixed - * - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> - */ - protected function performBinding($key, $value, $route) - { - return call_user_func($this->binders[$key], $value, $route); - } - - /** - * Register a route matched event listener. - * - * @param string|callable $callback - * @return void - */ - public function matched($callback) - { - $this->events->listen(Events\RouteMatched::class, $callback); - } - - /** - * Get all of the defined middleware short-hand names. - * - * @return array - */ - public function getMiddleware() - { - return $this->middleware; - } - - /** - * Register a short-hand name for a middleware. - * - * @param string $name - * @param string $class - * @return $this - */ - public function aliasMiddleware($name, $class) - { - $this->middleware[$name] = $class; - - return $this; - } - - /** - * Check if a middlewareGroup with the given name exists. - * - * @param string $name - * @return bool - */ - public function hasMiddlewareGroup($name) - { - return array_key_exists($name, $this->middlewareGroups); - } - - /** - * Get all of the defined middleware groups. - * - * @return array - */ - public function getMiddlewareGroups() - { - return $this->middlewareGroups; - } - - /** - * Register a group of middleware. - * - * @param string $name - * @param array $middleware - * @return $this - */ - public function middlewareGroup($name, array $middleware) - { - $this->middlewareGroups[$name] = $middleware; - - return $this; - } - - /** - * Add a middleware to the beginning of a middleware group. - * - * If the middleware is already in the group, it will not be added again. - * - * @param string $group - * @param string $middleware - * @return $this - */ - public function prependMiddlewareToGroup($group, $middleware) - { - if (isset($this->middlewareGroups[$group]) && ! in_array($middleware, $this->middlewareGroups[$group])) { - array_unshift($this->middlewareGroups[$group], $middleware); - } - - return $this; - } - - /** - * Add a middleware to the end of a middleware group. - * - * If the middleware is already in the group, it will not be added again. - * - * @param string $group - * @param string $middleware - * @return $this - */ - public function pushMiddlewareToGroup($group, $middleware) - { - if (! array_key_exists($group, $this->middlewareGroups)) { - $this->middlewareGroups[$group] = []; - } - - if (! in_array($middleware, $this->middlewareGroups[$group])) { - $this->middlewareGroups[$group][] = $middleware; - } - - return $this; - } - - /** - * Remove the given middleware from the specified group. - * - * @param string $group - * @param string $middleware - * @return $this - */ - public function removeMiddlewareFromGroup($group, $middleware) - { - if (! $this->hasMiddlewareGroup($group)) { - return $this; - } - - $reversedMiddlewaresArray = array_flip($this->middlewareGroups[$group]); - - if (! array_key_exists($middleware, $reversedMiddlewaresArray)) { - return $this; - } - - $middlewareKey = $reversedMiddlewaresArray[$middleware]; - - unset($this->middlewareGroups[$group][$middlewareKey]); - - return $this; - } - - /** - * Flush the router's middleware groups. - * - * @return $this - */ - public function flushMiddlewareGroups() - { - $this->middlewareGroups = []; - - return $this; - } - - /** - * Add a new route parameter binder. - * - * @param string $key - * @param string|callable $binder - * @return void - */ - public function bind($key, $binder) - { - $this->binders[str_replace('-', '_', $key)] = RouteBinding::forCallback( - $this->container, $binder - ); - } - - /** - * Register a model binder for a wildcard. - * - * @param string $key - * @param string $class - * @param \Closure|null $callback - * @return void - */ - public function model($key, $class, Closure $callback = null) - { - $this->bind($key, RouteBinding::forModel($this->container, $class, $callback)); - } - - /** - * Get the binding callback for a given binding. - * - * @param string $key - * @return \Closure|null - */ - public function getBindingCallback($key) - { - if (isset($this->binders[$key = str_replace('-', '_', $key)])) { - return $this->binders[$key]; - } - } - - /** - * Get the global "where" patterns. - * - * @return array - */ - public function getPatterns() - { - return $this->patterns; - } - - /** - * Set a global where pattern on all routes. - * - * @param string $key - * @param string $pattern - * @return void - */ - public function pattern($key, $pattern) - { - $this->patterns[$key] = $pattern; - } - - /** - * Set a group of global where patterns on all routes. - * - * @param array $patterns - * @return void - */ - public function patterns($patterns) - { - foreach ($patterns as $key => $pattern) { - $this->pattern($key, $pattern); - } - } - - /** - * Determine if the router currently has a group stack. - * - * @return bool - */ - public function hasGroupStack() - { - return ! empty($this->groupStack); - } - - /** - * Get the current group stack for the router. - * - * @return array - */ - public function getGroupStack() - { - return $this->groupStack; - } - - /** - * Get a route parameter for the current route. - * - * @param string $key - * @param string|null $default - * @return mixed - */ - public function input($key, $default = null) - { - return $this->current()->parameter($key, $default); - } - - /** - * Get the request currently being dispatched. - * - * @return \Illuminate\Http\Request - */ - public function getCurrentRequest() - { - return $this->currentRequest; - } - - /** - * Get the currently dispatched route instance. - * - * @return \Illuminate\Routing\Route|null - */ - public function getCurrentRoute() - { - return $this->current(); - } - - /** - * Get the currently dispatched route instance. - * - * @return \Illuminate\Routing\Route|null - */ - public function current() - { - return $this->current; - } - - /** - * Check if a route with the given name exists. - * - * @param string|array $name - * @return bool - */ - public function has($name) - { - $names = is_array($name) ? $name : func_get_args(); - - foreach ($names as $value) { - if (! $this->routes->hasNamedRoute($value)) { - return false; - } - } - - return true; - } - - /** - * Get the current route name. - * - * @return string|null - */ - public function currentRouteName() - { - return $this->current() ? $this->current()->getName() : null; - } - - /** - * Alias for the "currentRouteNamed" method. - * - * @param mixed ...$patterns - * @return bool - */ - public function is(...$patterns) - { - return $this->currentRouteNamed(...$patterns); - } - - /** - * Determine if the current route matches a pattern. - * - * @param mixed ...$patterns - * @return bool - */ - public function currentRouteNamed(...$patterns) - { - return $this->current() && $this->current()->named(...$patterns); - } - - /** - * Get the current route action. - * - * @return string|null - */ - public function currentRouteAction() - { - if ($this->current()) { - return $this->current()->getAction()['controller'] ?? null; - } - } - - /** - * Alias for the "currentRouteUses" method. - * - * @param array ...$patterns - * @return bool - */ - public function uses(...$patterns) - { - foreach ($patterns as $pattern) { - if (Str::is($pattern, $this->currentRouteAction())) { - return true; - } - } - - return false; - } - - /** - * Determine if the current route action matches a given action. - * - * @param string $action - * @return bool - */ - public function currentRouteUses($action) - { - return $this->currentRouteAction() == $action; - } - - /** - * Set the unmapped global resource parameters to singular. - * - * @param bool $singular - * @return void - */ - public function singularResourceParameters($singular = true) - { - ResourceRegistrar::singularParameters($singular); - } - - /** - * Set the global resource parameter mapping. - * - * @param array $parameters - * @return void - */ - public function resourceParameters(array $parameters = []) - { - ResourceRegistrar::setParameters($parameters); - } - - /** - * Get or set the verbs used in the resource URIs. - * - * @param array $verbs - * @return array|null - */ - public function resourceVerbs(array $verbs = []) - { - return ResourceRegistrar::verbs($verbs); - } - - /** - * Get the underlying route collection. - * - * @return \Illuminate\Routing\RouteCollectionInterface - */ - public function getRoutes() - { - return $this->routes; - } - - /** - * Set the route collection instance. - * - * @param \Illuminate\Routing\RouteCollection $routes - * @return void - */ - public function setRoutes(RouteCollection $routes) - { - foreach ($routes as $route) { - $route->setRouter($this)->setContainer($this->container); - } - - $this->routes = $routes; - - $this->container->instance('routes', $this->routes); - } - - /** - * Set the compiled route collection instance. - * - * @param array $routes - * @return void - */ - public function setCompiledRoutes(array $routes) - { - $this->routes = (new CompiledRouteCollection($routes['compiled'], $routes['attributes'])) - ->setRouter($this) - ->setContainer($this->container); - - $this->container->instance('routes', $this->routes); - } - - /** - * Remove any duplicate middleware from the given array. - * - * @param array $middleware - * @return array - */ - public static function uniqueMiddleware(array $middleware) - { - $seen = []; - $result = []; - - foreach ($middleware as $value) { - $key = \is_object($value) ? \spl_object_id($value) : $value; - - if (! isset($seen[$key])) { - $seen[$key] = true; - $result[] = $value; - } - } - - return $result; - } - - /** - * Set the container instance used by the router. - * - * @param \Illuminate\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } - - /** - * Dynamically handle calls into the router instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - if ($method === 'middleware') { - return (new RouteRegistrar($this))->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters); - } - - if ($method !== 'where' && Str::startsWith($method, 'where')) { - return (new RouteRegistrar($this))->{$method}(...$parameters); - } - - return (new RouteRegistrar($this))->attribute($method, array_key_exists(0, $parameters) ? $parameters[0] : true); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/RoutingServiceProvider.php b/framework-9.50.2/src/Illuminate/Routing/RoutingServiceProvider.php deleted file mode 100755 index 696e4ca..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/RoutingServiceProvider.php +++ /dev/null @@ -1,201 +0,0 @@ -registerRouter(); - $this->registerUrlGenerator(); - $this->registerRedirector(); - $this->registerPsrRequest(); - $this->registerPsrResponse(); - $this->registerResponseFactory(); - $this->registerCallableDispatcher(); - $this->registerControllerDispatcher(); - } - - /** - * Register the router instance. - * - * @return void - */ - protected function registerRouter() - { - $this->app->singleton('router', function ($app) { - return new Router($app['events'], $app); - }); - } - - /** - * Register the URL generator service. - * - * @return void - */ - protected function registerUrlGenerator() - { - $this->app->singleton('url', function ($app) { - $routes = $app['router']->getRoutes(); - - // The URL generator needs the route collection that exists on the router. - // Keep in mind this is an object, so we're passing by references here - // and all the registered routes will be available to the generator. - $app->instance('routes', $routes); - - return new UrlGenerator( - $routes, $app->rebinding( - 'request', $this->requestRebinder() - ), $app['config']['app.asset_url'] - ); - }); - - $this->app->extend('url', function (UrlGeneratorContract $url, $app) { - // Next we will set a few service resolvers on the URL generator so it can - // get the information it needs to function. This just provides some of - // the convenience features to this URL generator like "signed" URLs. - $url->setSessionResolver(function () { - return $this->app['session'] ?? null; - }); - - $url->setKeyResolver(function () { - return $this->app->make('config')->get('app.key'); - }); - - // If the route collection is "rebound", for example, when the routes stay - // cached for the application, we will need to rebind the routes on the - // URL generator instance so it has the latest version of the routes. - $app->rebinding('routes', function ($app, $routes) { - $app['url']->setRoutes($routes); - }); - - return $url; - }); - } - - /** - * Get the URL generator request rebinder. - * - * @return \Closure - */ - protected function requestRebinder() - { - return function ($app, $request) { - $app['url']->setRequest($request); - }; - } - - /** - * Register the Redirector service. - * - * @return void - */ - protected function registerRedirector() - { - $this->app->singleton('redirect', function ($app) { - $redirector = new Redirector($app['url']); - - // If the session is set on the application instance, we'll inject it into - // the redirector instance. This allows the redirect responses to allow - // for the quite convenient "with" methods that flash to the session. - if (isset($app['session.store'])) { - $redirector->setSession($app['session.store']); - } - - return $redirector; - }); - } - - /** - * Register a binding for the PSR-7 request implementation. - * - * @return void - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected function registerPsrRequest() - { - $this->app->bind(ServerRequestInterface::class, function ($app) { - if (class_exists(Psr17Factory::class) && class_exists(PsrHttpFactory::class)) { - $psr17Factory = new Psr17Factory; - - return (new PsrHttpFactory($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory)) - ->createRequest($app->make('request')); - } - - throw new BindingResolutionException('Unable to resolve PSR request. Please install the symfony/psr-http-message-bridge and nyholm/psr7 packages.'); - }); - } - - /** - * Register a binding for the PSR-7 response implementation. - * - * @return void - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException - */ - protected function registerPsrResponse() - { - $this->app->bind(ResponseInterface::class, function () { - if (class_exists(PsrResponse::class)) { - return new PsrResponse; - } - - throw new BindingResolutionException('Unable to resolve PSR response. Please install the nyholm/psr7 package.'); - }); - } - - /** - * Register the response factory implementation. - * - * @return void - */ - protected function registerResponseFactory() - { - $this->app->singleton(ResponseFactoryContract::class, function ($app) { - return new ResponseFactory($app[ViewFactoryContract::class], $app['redirect']); - }); - } - - /** - * Register the callable dispatcher. - * - * @return void - */ - protected function registerCallableDispatcher() - { - $this->app->singleton(CallableDispatcherContract::class, function ($app) { - return new CallableDispatcher($app); - }); - } - - /** - * Register the controller dispatcher. - * - * @return void - */ - protected function registerControllerDispatcher() - { - $this->app->singleton(ControllerDispatcherContract::class, function ($app) { - return new ControllerDispatcher($app); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/SortedMiddleware.php b/framework-9.50.2/src/Illuminate/Routing/SortedMiddleware.php deleted file mode 100644 index 853378c..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/SortedMiddleware.php +++ /dev/null @@ -1,122 +0,0 @@ -all(); - } - - $this->items = $this->sortMiddleware($priorityMap, $middlewares); - } - - /** - * Sort the middlewares by the given priority map. - * - * Each call to this method makes one discrete middleware movement if necessary. - * - * @param array $priorityMap - * @param array $middlewares - * @return array - */ - protected function sortMiddleware($priorityMap, $middlewares) - { - $lastIndex = 0; - - foreach ($middlewares as $index => $middleware) { - if (! is_string($middleware)) { - continue; - } - - $priorityIndex = $this->priorityMapIndex($priorityMap, $middleware); - - if (! is_null($priorityIndex)) { - // This middleware is in the priority map. If we have encountered another middleware - // that was also in the priority map and was at a lower priority than the current - // middleware, we will move this middleware to be above the previous encounter. - if (isset($lastPriorityIndex) && $priorityIndex < $lastPriorityIndex) { - return $this->sortMiddleware( - $priorityMap, array_values($this->moveMiddleware($middlewares, $index, $lastIndex)) - ); - } - - // This middleware is in the priority map; but, this is the first middleware we have - // encountered from the map thus far. We'll save its current index plus its index - // from the priority map so we can compare against them on the next iterations. - $lastIndex = $index; - - $lastPriorityIndex = $priorityIndex; - } - } - - return Router::uniqueMiddleware($middlewares); - } - - /** - * Calculate the priority map index of the middleware. - * - * @param array $priorityMap - * @param string $middleware - * @return int|null - */ - protected function priorityMapIndex($priorityMap, $middleware) - { - foreach ($this->middlewareNames($middleware) as $name) { - $priorityIndex = array_search($name, $priorityMap); - - if ($priorityIndex !== false) { - return $priorityIndex; - } - } - } - - /** - * Resolve the middleware names to look for in the priority array. - * - * @param string $middleware - * @return \Generator - */ - protected function middlewareNames($middleware) - { - $stripped = head(explode(':', $middleware)); - - yield $stripped; - - $interfaces = @class_implements($stripped); - - if ($interfaces !== false) { - foreach ($interfaces as $interface) { - yield $interface; - } - } - } - - /** - * Splice a middleware into a new position and remove the old entry. - * - * @param array $middlewares - * @param int $from - * @param int $to - * @return array - */ - protected function moveMiddleware($middlewares, $from, $to) - { - array_splice($middlewares, $to, 0, $middlewares[$from]); - - unset($middlewares[$from + 1]); - - return $middlewares; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/UrlGenerator.php b/framework-9.50.2/src/Illuminate/Routing/UrlGenerator.php deleted file mode 100755 index 56a116d..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/UrlGenerator.php +++ /dev/null @@ -1,847 +0,0 @@ -routes = $routes; - $this->assetRoot = $assetRoot; - - $this->setRequest($request); - } - - /** - * Get the full URL for the current request. - * - * @return string - */ - public function full() - { - return $this->request->fullUrl(); - } - - /** - * Get the current URL for the request. - * - * @return string - */ - public function current() - { - return $this->to($this->request->getPathInfo()); - } - - /** - * Get the URL for the previous request. - * - * @param mixed $fallback - * @return string - */ - public function previous($fallback = false) - { - $referrer = $this->request->headers->get('referer'); - - $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession(); - - if ($url) { - return $url; - } elseif ($fallback) { - return $this->to($fallback); - } - - return $this->to('/'); - } - - /** - * Get the previous path info for the request. - * - * @param mixed $fallback - * @return string - */ - public function previousPath($fallback = false) - { - $previousPath = str_replace($this->to('/'), '', rtrim(preg_replace('/\?.*/', '', $this->previous($fallback)), '/')); - - return $previousPath === '' ? '/' : $previousPath; - } - - /** - * Get the previous URL from the session if possible. - * - * @return string|null - */ - protected function getPreviousUrlFromSession() - { - $session = $this->getSession(); - - return $session ? $session->previousUrl() : null; - } - - /** - * Generate an absolute URL to the given path. - * - * @param string $path - * @param mixed $extra - * @param bool|null $secure - * @return string - */ - public function to($path, $extra = [], $secure = null) - { - // First we will check if the URL is already a valid URL. If it is we will not - // try to generate a new one but will simply return the URL as is, which is - // convenient since developers do not always have to check if it's valid. - if ($this->isValidUrl($path)) { - return $path; - } - - $tail = implode('/', array_map( - 'rawurlencode', (array) $this->formatParameters($extra)) - ); - - // Once we have the scheme we will compile the "tail" by collapsing the values - // into a single string delimited by slashes. This just makes it convenient - // for passing the array of parameters to this URL as a list of segments. - $root = $this->formatRoot($this->formatScheme($secure)); - - [$path, $query] = $this->extractQueryString($path); - - return $this->format( - $root, '/'.trim($path.'/'.$tail, '/') - ).$query; - } - - /** - * Generate a secure, absolute URL to the given path. - * - * @param string $path - * @param array $parameters - * @return string - */ - public function secure($path, $parameters = []) - { - return $this->to($path, $parameters, true); - } - - /** - * Generate the URL to an application asset. - * - * @param string $path - * @param bool|null $secure - * @return string - */ - public function asset($path, $secure = null) - { - if ($this->isValidUrl($path)) { - return $path; - } - - // Once we get the root URL, we will check to see if it contains an index.php - // file in the paths. If it does, we will remove it since it is not needed - // for asset paths, but only for routes to endpoints in the application. - $root = $this->assetRoot ?: $this->formatRoot($this->formatScheme($secure)); - - return $this->removeIndex($root).'/'.trim($path, '/'); - } - - /** - * Generate the URL to a secure asset. - * - * @param string $path - * @return string - */ - public function secureAsset($path) - { - return $this->asset($path, true); - } - - /** - * Generate the URL to an asset from a custom root domain such as CDN, etc. - * - * @param string $root - * @param string $path - * @param bool|null $secure - * @return string - */ - public function assetFrom($root, $path, $secure = null) - { - // Once we get the root URL, we will check to see if it contains an index.php - // file in the paths. If it does, we will remove it since it is not needed - // for asset paths, but only for routes to endpoints in the application. - $root = $this->formatRoot($this->formatScheme($secure), $root); - - return $this->removeIndex($root).'/'.trim($path, '/'); - } - - /** - * Remove the index.php file from a path. - * - * @param string $root - * @return string - */ - protected function removeIndex($root) - { - $i = 'index.php'; - - return str_contains($root, $i) ? str_replace('/'.$i, '', $root) : $root; - } - - /** - * Get the default scheme for a raw URL. - * - * @param bool|null $secure - * @return string - */ - public function formatScheme($secure = null) - { - if (! is_null($secure)) { - return $secure ? 'https://' : 'http://'; - } - - if (is_null($this->cachedScheme)) { - $this->cachedScheme = $this->forceScheme ?: $this->request->getScheme().'://'; - } - - return $this->cachedScheme; - } - - /** - * Create a signed route URL for a named route. - * - * @param string $name - * @param mixed $parameters - * @param \DateTimeInterface|\DateInterval|int|null $expiration - * @param bool $absolute - * @return string - * - * @throws \InvalidArgumentException - */ - public function signedRoute($name, $parameters = [], $expiration = null, $absolute = true) - { - $this->ensureSignedRouteParametersAreNotReserved( - $parameters = Arr::wrap($parameters) - ); - - if ($expiration) { - $parameters = $parameters + ['expires' => $this->availableAt($expiration)]; - } - - ksort($parameters); - - $key = call_user_func($this->keyResolver); - - return $this->route($name, $parameters + [ - 'signature' => hash_hmac('sha256', $this->route($name, $parameters, $absolute), $key), - ], $absolute); - } - - /** - * Ensure the given signed route parameters are not reserved. - * - * @param mixed $parameters - * @return void - */ - protected function ensureSignedRouteParametersAreNotReserved($parameters) - { - if (array_key_exists('signature', $parameters)) { - throw new InvalidArgumentException( - '"Signature" is a reserved parameter when generating signed routes. Please rename your route parameter.' - ); - } - - if (array_key_exists('expires', $parameters)) { - throw new InvalidArgumentException( - '"Expires" is a reserved parameter when generating signed routes. Please rename your route parameter.' - ); - } - } - - /** - * Create a temporary signed route URL for a named route. - * - * @param string $name - * @param \DateTimeInterface|\DateInterval|int $expiration - * @param array $parameters - * @param bool $absolute - * @return string - */ - public function temporarySignedRoute($name, $expiration, $parameters = [], $absolute = true) - { - return $this->signedRoute($name, $parameters, $expiration, $absolute); - } - - /** - * Determine if the given request has a valid signature. - * - * @param \Illuminate\Http\Request $request - * @param bool $absolute - * @param array $ignoreQuery - * @return bool - */ - public function hasValidSignature(Request $request, $absolute = true, array $ignoreQuery = []) - { - return $this->hasCorrectSignature($request, $absolute, $ignoreQuery) - && $this->signatureHasNotExpired($request); - } - - /** - * Determine if the given request has a valid signature for a relative URL. - * - * @param \Illuminate\Http\Request $request - * @param array $ignoreQuery - * @return bool - */ - public function hasValidRelativeSignature(Request $request, array $ignoreQuery = []) - { - return $this->hasValidSignature($request, false, $ignoreQuery); - } - - /** - * Determine if the signature from the given request matches the URL. - * - * @param \Illuminate\Http\Request $request - * @param bool $absolute - * @param array $ignoreQuery - * @return bool - */ - public function hasCorrectSignature(Request $request, $absolute = true, array $ignoreQuery = []) - { - $ignoreQuery[] = 'signature'; - - $url = $absolute ? $request->url() : '/'.$request->path(); - - $queryString = collect(explode('&', (string) $request->server->get('QUERY_STRING'))) - ->reject(fn ($parameter) => in_array(Str::before($parameter, '='), $ignoreQuery)) - ->join('&'); - - $original = rtrim($url.'?'.$queryString, '?'); - - $signature = hash_hmac('sha256', $original, call_user_func($this->keyResolver)); - - return hash_equals($signature, (string) $request->query('signature', '')); - } - - /** - * Determine if the expires timestamp from the given request is not from the past. - * - * @param \Illuminate\Http\Request $request - * @return bool - */ - public function signatureHasNotExpired(Request $request) - { - $expires = $request->query('expires'); - - return ! ($expires && Carbon::now()->getTimestamp() > $expires); - } - - /** - * Get the URL to a named route. - * - * @param string $name - * @param mixed $parameters - * @param bool $absolute - * @return string - * - * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException - */ - public function route($name, $parameters = [], $absolute = true) - { - if (! is_null($route = $this->routes->getByName($name))) { - return $this->toRoute($route, $parameters, $absolute); - } - - throw new RouteNotFoundException("Route [{$name}] not defined."); - } - - /** - * Get the URL for a given route instance. - * - * @param \Illuminate\Routing\Route $route - * @param mixed $parameters - * @param bool $absolute - * @return string - * - * @throws \Illuminate\Routing\Exceptions\UrlGenerationException - */ - public function toRoute($route, $parameters, $absolute) - { - $parameters = collect(Arr::wrap($parameters))->map(function ($value, $key) use ($route) { - $value = $value instanceof UrlRoutable && $route->bindingFieldFor($key) - ? $value->{$route->bindingFieldFor($key)} - : $value; - - return function_exists('enum_exists') && $value instanceof BackedEnum - ? $value->value - : $value; - })->all(); - - return $this->routeUrl()->to( - $route, $this->formatParameters($parameters), $absolute - ); - } - - /** - * Get the URL to a controller action. - * - * @param string|array $action - * @param mixed $parameters - * @param bool $absolute - * @return string - * - * @throws \InvalidArgumentException - */ - public function action($action, $parameters = [], $absolute = true) - { - if (is_null($route = $this->routes->getByAction($action = $this->formatAction($action)))) { - throw new InvalidArgumentException("Action {$action} not defined."); - } - - return $this->toRoute($route, $parameters, $absolute); - } - - /** - * Format the given controller action. - * - * @param string|array $action - * @return string - */ - protected function formatAction($action) - { - if (is_array($action)) { - $action = '\\'.implode('@', $action); - } - - if ($this->rootNamespace && ! str_starts_with($action, '\\')) { - return $this->rootNamespace.'\\'.$action; - } else { - return trim($action, '\\'); - } - } - - /** - * Format the array of URL parameters. - * - * @param mixed|array $parameters - * @return array - */ - public function formatParameters($parameters) - { - $parameters = Arr::wrap($parameters); - - foreach ($parameters as $key => $parameter) { - if ($parameter instanceof UrlRoutable) { - $parameters[$key] = $parameter->getRouteKey(); - } - } - - return $parameters; - } - - /** - * Extract the query string from the given path. - * - * @param string $path - * @return array - */ - protected function extractQueryString($path) - { - if (($queryPosition = strpos($path, '?')) !== false) { - return [ - substr($path, 0, $queryPosition), - substr($path, $queryPosition), - ]; - } - - return [$path, '']; - } - - /** - * Get the base URL for the request. - * - * @param string $scheme - * @param string|null $root - * @return string - */ - public function formatRoot($scheme, $root = null) - { - if (is_null($root)) { - if (is_null($this->cachedRoot)) { - $this->cachedRoot = $this->forcedRoot ?: $this->request->root(); - } - - $root = $this->cachedRoot; - } - - $start = str_starts_with($root, 'http://') ? 'http://' : 'https://'; - - return preg_replace('~'.$start.'~', $scheme, $root, 1); - } - - /** - * Format the given URL segments into a single URL. - * - * @param string $root - * @param string $path - * @param \Illuminate\Routing\Route|null $route - * @return string - */ - public function format($root, $path, $route = null) - { - $path = '/'.trim($path, '/'); - - if ($this->formatHostUsing) { - $root = call_user_func($this->formatHostUsing, $root, $route); - } - - if ($this->formatPathUsing) { - $path = call_user_func($this->formatPathUsing, $path, $route); - } - - return trim($root.$path, '/'); - } - - /** - * Determine if the given path is a valid URL. - * - * @param string $path - * @return bool - */ - public function isValidUrl($path) - { - if (! preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) { - return filter_var($path, FILTER_VALIDATE_URL) !== false; - } - - return true; - } - - /** - * Get the Route URL generator instance. - * - * @return \Illuminate\Routing\RouteUrlGenerator - */ - protected function routeUrl() - { - if (! $this->routeGenerator) { - $this->routeGenerator = new RouteUrlGenerator($this, $this->request); - } - - return $this->routeGenerator; - } - - /** - * Set the default named parameters used by the URL generator. - * - * @param array $defaults - * @return void - */ - public function defaults(array $defaults) - { - $this->routeUrl()->defaults($defaults); - } - - /** - * Get the default named parameters used by the URL generator. - * - * @return array - */ - public function getDefaultParameters() - { - return $this->routeUrl()->defaultParameters; - } - - /** - * Force the scheme for URLs. - * - * @param string|null $scheme - * @return void - */ - public function forceScheme($scheme) - { - $this->cachedScheme = null; - - $this->forceScheme = $scheme ? $scheme.'://' : null; - } - - /** - * Set the forced root URL. - * - * @param string|null $root - * @return void - */ - public function forceRootUrl($root) - { - $this->forcedRoot = $root ? rtrim($root, '/') : null; - - $this->cachedRoot = null; - } - - /** - * Set a callback to be used to format the host of generated URLs. - * - * @param \Closure $callback - * @return $this - */ - public function formatHostUsing(Closure $callback) - { - $this->formatHostUsing = $callback; - - return $this; - } - - /** - * Set a callback to be used to format the path of generated URLs. - * - * @param \Closure $callback - * @return $this - */ - public function formatPathUsing(Closure $callback) - { - $this->formatPathUsing = $callback; - - return $this; - } - - /** - * Get the path formatter being used by the URL generator. - * - * @return \Closure - */ - public function pathFormatter() - { - return $this->formatPathUsing ?: function ($path) { - return $path; - }; - } - - /** - * Get the request instance. - * - * @return \Illuminate\Http\Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Set the current request instance. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - public function setRequest(Request $request) - { - $this->request = $request; - - $this->cachedRoot = null; - $this->cachedScheme = null; - - tap(optional($this->routeGenerator)->defaultParameters ?: [], function ($defaults) { - $this->routeGenerator = null; - - if (! empty($defaults)) { - $this->defaults($defaults); - } - }); - } - - /** - * Set the route collection. - * - * @param \Illuminate\Routing\RouteCollectionInterface $routes - * @return $this - */ - public function setRoutes(RouteCollectionInterface $routes) - { - $this->routes = $routes; - - return $this; - } - - /** - * Get the session implementation from the resolver. - * - * @return \Illuminate\Session\Store|null - */ - protected function getSession() - { - if ($this->sessionResolver) { - return call_user_func($this->sessionResolver); - } - } - - /** - * Set the session resolver for the generator. - * - * @param callable $sessionResolver - * @return $this - */ - public function setSessionResolver(callable $sessionResolver) - { - $this->sessionResolver = $sessionResolver; - - return $this; - } - - /** - * Set the encryption key resolver. - * - * @param callable $keyResolver - * @return $this - */ - public function setKeyResolver(callable $keyResolver) - { - $this->keyResolver = $keyResolver; - - return $this; - } - - /** - * Clone a new instance of the URL generator with a different encryption key resolver. - * - * @param callable $keyResolver - * @return \Illuminate\Routing\UrlGenerator - */ - public function withKeyResolver(callable $keyResolver) - { - return (clone $this)->setKeyResolver($keyResolver); - } - - /** - * Get the root controller namespace. - * - * @return string - */ - public function getRootControllerNamespace() - { - return $this->rootNamespace; - } - - /** - * Set the root controller namespace. - * - * @param string $rootNamespace - * @return $this - */ - public function setRootControllerNamespace($rootNamespace) - { - $this->rootNamespace = $rootNamespace; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/ViewController.php b/framework-9.50.2/src/Illuminate/Routing/ViewController.php deleted file mode 100644 index bd03c5f..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/ViewController.php +++ /dev/null @@ -1,60 +0,0 @@ -response = $response; - } - - /** - * Invoke the controller method. - * - * @param array ...$args - * @return \Illuminate\Http\Response - */ - public function __invoke(...$args) - { - $routeParameters = array_filter($args, function ($key) { - return ! in_array($key, ['view', 'data', 'status', 'headers']); - }, ARRAY_FILTER_USE_KEY); - - $args['data'] = array_merge($args['data'], $routeParameters); - - return $this->response->view( - $args['view'], - $args['data'], - $args['status'], - $args['headers'] - ); - } - - /** - * Execute an action on the controller. - * - * @param string $method - * @param array $parameters - * @return \Symfony\Component\HttpFoundation\Response - */ - public function callAction($method, $parameters) - { - return $this->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Routing/composer.json b/framework-9.50.2/src/Illuminate/Routing/composer.json deleted file mode 100644 index 2b3aa1a..0000000 --- a/framework-9.50.2/src/Illuminate/Routing/composer.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "illuminate/routing", - "description": "The Illuminate Routing package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "illuminate/collections": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/http": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/pipeline": "^9.0", - "illuminate/session": "^9.0", - "illuminate/support": "^9.0", - "symfony/http-foundation": "^6.0", - "symfony/http-kernel": "^6.0", - "symfony/routing": "^6.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Routing\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "illuminate/console": "Required to use the make commands (^9.0).", - "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", - "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Session/ArraySessionHandler.php b/framework-9.50.2/src/Illuminate/Session/ArraySessionHandler.php deleted file mode 100644 index 44d50da..0000000 --- a/framework-9.50.2/src/Illuminate/Session/ArraySessionHandler.php +++ /dev/null @@ -1,139 +0,0 @@ -minutes = $minutes; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function open($savePath, $sessionName): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function close(): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return string|false - */ - public function read($sessionId): string|false - { - if (! isset($this->storage[$sessionId])) { - return ''; - } - - $session = $this->storage[$sessionId]; - - $expiration = $this->calculateExpiration($this->minutes * 60); - - if (isset($session['time']) && $session['time'] >= $expiration) { - return $session['data']; - } - - return ''; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function write($sessionId, $data): bool - { - $this->storage[$sessionId] = [ - 'data' => $data, - 'time' => $this->currentTime(), - ]; - - return true; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function destroy($sessionId): bool - { - if (isset($this->storage[$sessionId])) { - unset($this->storage[$sessionId]); - } - - return true; - } - - /** - * {@inheritdoc} - * - * @return int - */ - public function gc($lifetime): int - { - $expiration = $this->calculateExpiration($lifetime); - - $deletedSessions = 0; - - foreach ($this->storage as $sessionId => $session) { - if ($session['time'] < $expiration) { - unset($this->storage[$sessionId]); - $deletedSessions++; - } - } - - return $deletedSessions; - } - - /** - * Get the expiration time of the session. - * - * @param int $seconds - * @return int - */ - protected function calculateExpiration($seconds) - { - return $this->currentTime() - $seconds; - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/CacheBasedSessionHandler.php b/framework-9.50.2/src/Illuminate/Session/CacheBasedSessionHandler.php deleted file mode 100755 index 0cccdf2..0000000 --- a/framework-9.50.2/src/Illuminate/Session/CacheBasedSessionHandler.php +++ /dev/null @@ -1,106 +0,0 @@ -cache = $cache; - $this->minutes = $minutes; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function open($savePath, $sessionName): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function close(): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function read($sessionId): string - { - return $this->cache->get($sessionId, ''); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function write($sessionId, $data): bool - { - return $this->cache->put($sessionId, $data, $this->minutes * 60); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function destroy($sessionId): bool - { - return $this->cache->forget($sessionId); - } - - /** - * {@inheritdoc} - * - * @return int - */ - public function gc($lifetime): int - { - return 0; - } - - /** - * Get the underlying cache repository. - * - * @return \Illuminate\Contracts\Cache\Repository - */ - public function getCache() - { - return $this->cache; - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/Console/SessionTableCommand.php b/framework-9.50.2/src/Illuminate/Session/Console/SessionTableCommand.php deleted file mode 100644 index e44b2da..0000000 --- a/framework-9.50.2/src/Illuminate/Session/Console/SessionTableCommand.php +++ /dev/null @@ -1,94 +0,0 @@ -files = $files; - $this->composer = $composer; - } - - /** - * Execute the console command. - * - * @return void - */ - public function handle() - { - $fullPath = $this->createBaseMigration(); - - $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/database.stub')); - - $this->components->info('Migration created successfully.'); - - $this->composer->dumpAutoloads(); - } - - /** - * Create a base migration file for the session. - * - * @return string - */ - protected function createBaseMigration() - { - $name = 'create_sessions_table'; - - $path = $this->laravel->databasePath().'/migrations'; - - return $this->laravel['migration.creator']->create($name, $path); - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/Console/stubs/database.stub b/framework-9.50.2/src/Illuminate/Session/Console/stubs/database.stub deleted file mode 100755 index 06c3e45..0000000 --- a/framework-9.50.2/src/Illuminate/Session/Console/stubs/database.stub +++ /dev/null @@ -1,35 +0,0 @@ -string('id')->primary(); - $table->foreignId('user_id')->nullable()->index(); - $table->string('ip_address', 45)->nullable(); - $table->text('user_agent')->nullable(); - $table->longText('payload'); - $table->integer('last_activity')->index(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('sessions'); - } -}; diff --git a/framework-9.50.2/src/Illuminate/Session/CookieSessionHandler.php b/framework-9.50.2/src/Illuminate/Session/CookieSessionHandler.php deleted file mode 100755 index 213b5cb..0000000 --- a/framework-9.50.2/src/Illuminate/Session/CookieSessionHandler.php +++ /dev/null @@ -1,132 +0,0 @@ -cookie = $cookie; - $this->minutes = $minutes; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function open($savePath, $sessionName): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function close(): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return string|false - */ - public function read($sessionId): string|false - { - $value = $this->request->cookies->get($sessionId) ?: ''; - - if (! is_null($decoded = json_decode($value, true)) && is_array($decoded) && - isset($decoded['expires']) && $this->currentTime() <= $decoded['expires']) { - return $decoded['data']; - } - - return ''; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function write($sessionId, $data): bool - { - $this->cookie->queue($sessionId, json_encode([ - 'data' => $data, - 'expires' => $this->availableAt($this->minutes * 60), - ]), $this->minutes); - - return true; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function destroy($sessionId): bool - { - $this->cookie->queue($this->cookie->forget($sessionId)); - - return true; - } - - /** - * {@inheritdoc} - * - * @return int - */ - public function gc($lifetime): int - { - return 0; - } - - /** - * Set the request instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return void - */ - public function setRequest(Request $request) - { - $this->request = $request; - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/DatabaseSessionHandler.php b/framework-9.50.2/src/Illuminate/Session/DatabaseSessionHandler.php deleted file mode 100644 index 7e64f46..0000000 --- a/framework-9.50.2/src/Illuminate/Session/DatabaseSessionHandler.php +++ /dev/null @@ -1,319 +0,0 @@ -table = $table; - $this->minutes = $minutes; - $this->container = $container; - $this->connection = $connection; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function open($savePath, $sessionName): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function close(): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return string|false - */ - public function read($sessionId): string|false - { - $session = (object) $this->getQuery()->find($sessionId); - - if ($this->expired($session)) { - $this->exists = true; - - return ''; - } - - if (isset($session->payload)) { - $this->exists = true; - - return base64_decode($session->payload); - } - - return ''; - } - - /** - * Determine if the session is expired. - * - * @param \stdClass $session - * @return bool - */ - protected function expired($session) - { - return isset($session->last_activity) && - $session->last_activity < Carbon::now()->subMinutes($this->minutes)->getTimestamp(); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function write($sessionId, $data): bool - { - $payload = $this->getDefaultPayload($data); - - if (! $this->exists) { - $this->read($sessionId); - } - - if ($this->exists) { - $this->performUpdate($sessionId, $payload); - } else { - $this->performInsert($sessionId, $payload); - } - - return $this->exists = true; - } - - /** - * Perform an insert operation on the session ID. - * - * @param string $sessionId - * @param array $payload - * @return bool|null - */ - protected function performInsert($sessionId, $payload) - { - try { - return $this->getQuery()->insert(Arr::set($payload, 'id', $sessionId)); - } catch (QueryException $e) { - $this->performUpdate($sessionId, $payload); - } - } - - /** - * Perform an update operation on the session ID. - * - * @param string $sessionId - * @param array $payload - * @return int - */ - protected function performUpdate($sessionId, $payload) - { - return $this->getQuery()->where('id', $sessionId)->update($payload); - } - - /** - * Get the default payload for the session. - * - * @param string $data - * @return array - */ - protected function getDefaultPayload($data) - { - $payload = [ - 'payload' => base64_encode($data), - 'last_activity' => $this->currentTime(), - ]; - - if (! $this->container) { - return $payload; - } - - return tap($payload, function (&$payload) { - $this->addUserInformation($payload) - ->addRequestInformation($payload); - }); - } - - /** - * Add the user information to the session payload. - * - * @param array $payload - * @return $this - */ - protected function addUserInformation(&$payload) - { - if ($this->container->bound(Guard::class)) { - $payload['user_id'] = $this->userId(); - } - - return $this; - } - - /** - * Get the currently authenticated user's ID. - * - * @return mixed - */ - protected function userId() - { - return $this->container->make(Guard::class)->id(); - } - - /** - * Add the request information to the session payload. - * - * @param array $payload - * @return $this - */ - protected function addRequestInformation(&$payload) - { - if ($this->container->bound('request')) { - $payload = array_merge($payload, [ - 'ip_address' => $this->ipAddress(), - 'user_agent' => $this->userAgent(), - ]); - } - - return $this; - } - - /** - * Get the IP address for the current request. - * - * @return string|null - */ - protected function ipAddress() - { - return $this->container->make('request')->ip(); - } - - /** - * Get the user agent for the current request. - * - * @return string - */ - protected function userAgent() - { - return substr((string) $this->container->make('request')->header('User-Agent'), 0, 500); - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function destroy($sessionId): bool - { - $this->getQuery()->where('id', $sessionId)->delete(); - - return true; - } - - /** - * {@inheritdoc} - * - * @return int - */ - public function gc($lifetime): int - { - return $this->getQuery()->where('last_activity', '<=', $this->currentTime() - $lifetime)->delete(); - } - - /** - * Get a fresh query builder instance for the table. - * - * @return \Illuminate\Database\Query\Builder - */ - protected function getQuery() - { - return $this->connection->table($this->table); - } - - /** - * Set the application instance used by the handler. - * - * @param \Illuminate\Contracts\Foundation\Application $container - * @return $this - */ - public function setContainer($container) - { - $this->container = $container; - - return $this; - } - - /** - * Set the existence state for the session. - * - * @param bool $value - * @return $this - */ - public function setExists($value) - { - $this->exists = $value; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/EncryptedStore.php b/framework-9.50.2/src/Illuminate/Session/EncryptedStore.php deleted file mode 100644 index b8ae8cf..0000000 --- a/framework-9.50.2/src/Illuminate/Session/EncryptedStore.php +++ /dev/null @@ -1,70 +0,0 @@ -encrypter = $encrypter; - - parent::__construct($name, $handler, $id, $serialization); - } - - /** - * Prepare the raw string data from the session for unserialization. - * - * @param string $data - * @return string - */ - protected function prepareForUnserialize($data) - { - try { - return $this->encrypter->decrypt($data); - } catch (DecryptException $e) { - return $this->serialization === 'json' ? json_encode([]) : serialize([]); - } - } - - /** - * Prepare the serialized session data for storage. - * - * @param string $data - * @return string - */ - protected function prepareForStorage($data) - { - return $this->encrypter->encrypt($data); - } - - /** - * Get the encrypter instance. - * - * @return \Illuminate\Contracts\Encryption\Encrypter - */ - public function getEncrypter() - { - return $this->encrypter; - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/ExistenceAwareInterface.php b/framework-9.50.2/src/Illuminate/Session/ExistenceAwareInterface.php deleted file mode 100644 index 4a6bd98..0000000 --- a/framework-9.50.2/src/Illuminate/Session/ExistenceAwareInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -path = $path; - $this->files = $files; - $this->minutes = $minutes; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function open($savePath, $sessionName): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function close(): bool - { - return true; - } - - /** - * {@inheritdoc} - * - * @return string|false - */ - public function read($sessionId): string|false - { - if ($this->files->isFile($path = $this->path.'/'.$sessionId) && - $this->files->lastModified($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) { - return $this->files->sharedGet($path); - } - - return ''; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function write($sessionId, $data): bool - { - $this->files->put($this->path.'/'.$sessionId, $data, true); - - return true; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function destroy($sessionId): bool - { - $this->files->delete($this->path.'/'.$sessionId); - - return true; - } - - /** - * {@inheritdoc} - * - * @return int - */ - public function gc($lifetime): int - { - $files = Finder::create() - ->in($this->path) - ->files() - ->ignoreDotFiles(true) - ->date('<= now - '.$lifetime.' seconds'); - - $deletedSessions = 0; - - foreach ($files as $file) { - $this->files->delete($file->getRealPath()); - $deletedSessions++; - } - - return $deletedSessions; - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/LICENSE.md b/framework-9.50.2/src/Illuminate/Session/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Session/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Session/Middleware/AuthenticateSession.php b/framework-9.50.2/src/Illuminate/Session/Middleware/AuthenticateSession.php deleted file mode 100644 index 1b3cee3..0000000 --- a/framework-9.50.2/src/Illuminate/Session/Middleware/AuthenticateSession.php +++ /dev/null @@ -1,109 +0,0 @@ -auth = $auth; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - if (! $request->hasSession() || ! $request->user()) { - return $next($request); - } - - if ($this->guard()->viaRemember()) { - $passwordHash = explode('|', $request->cookies->get($this->guard()->getRecallerName()))[2] ?? null; - - if (! $passwordHash || $passwordHash != $request->user()->getAuthPassword()) { - $this->logout($request); - } - } - - if (! $request->session()->has('password_hash_'.$this->auth->getDefaultDriver())) { - $this->storePasswordHashInSession($request); - } - - if ($request->session()->get('password_hash_'.$this->auth->getDefaultDriver()) !== $request->user()->getAuthPassword()) { - $this->logout($request); - } - - return tap($next($request), function () use ($request) { - if (! is_null($this->guard()->user())) { - $this->storePasswordHashInSession($request); - } - }); - } - - /** - * Store the user's current password hash in the session. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - protected function storePasswordHashInSession($request) - { - if (! $request->user()) { - return; - } - - $request->session()->put([ - 'password_hash_'.$this->auth->getDefaultDriver() => $request->user()->getAuthPassword(), - ]); - } - - /** - * Log the user out of the application. - * - * @param \Illuminate\Http\Request $request - * @return void - * - * @throws \Illuminate\Auth\AuthenticationException - */ - protected function logout($request) - { - $this->guard()->logoutCurrentDevice(); - - $request->session()->flush(); - - throw new AuthenticationException('Unauthenticated.', [$this->auth->getDefaultDriver()]); - } - - /** - * Get the guard instance that should be used by the middleware. - * - * @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard - */ - protected function guard() - { - return $this->auth; - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/Middleware/StartSession.php b/framework-9.50.2/src/Illuminate/Session/Middleware/StartSession.php deleted file mode 100644 index 8079ab9..0000000 --- a/framework-9.50.2/src/Illuminate/Session/Middleware/StartSession.php +++ /dev/null @@ -1,299 +0,0 @@ -manager = $manager; - $this->cacheFactoryResolver = $cacheFactoryResolver; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - if (! $this->sessionConfigured()) { - return $next($request); - } - - $session = $this->getSession($request); - - if ($this->manager->shouldBlock() || - ($request->route() instanceof Route && $request->route()->locksFor())) { - return $this->handleRequestWhileBlocking($request, $session, $next); - } - - return $this->handleStatefulRequest($request, $session, $next); - } - - /** - * Handle the given request within session state. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Contracts\Session\Session $session - * @param \Closure $next - * @return mixed - */ - protected function handleRequestWhileBlocking(Request $request, $session, Closure $next) - { - if (! $request->route() instanceof Route) { - return; - } - - $lockFor = $request->route() && $request->route()->locksFor() - ? $request->route()->locksFor() - : 10; - - $lock = $this->cache($this->manager->blockDriver()) - ->lock('session:'.$session->getId(), $lockFor) - ->betweenBlockedAttemptsSleepFor(50); - - try { - $lock->block( - ! is_null($request->route()->waitsFor()) - ? $request->route()->waitsFor() - : 10 - ); - - return $this->handleStatefulRequest($request, $session, $next); - } finally { - $lock?->release(); - } - } - - /** - * Handle the given request within session state. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Contracts\Session\Session $session - * @param \Closure $next - * @return mixed - */ - protected function handleStatefulRequest(Request $request, $session, Closure $next) - { - // If a session driver has been configured, we will need to start the session here - // so that the data is ready for an application. Note that the Laravel sessions - // do not make use of PHP "native" sessions in any way since they are crappy. - $request->setLaravelSession( - $this->startSession($request, $session) - ); - - $this->collectGarbage($session); - - $response = $next($request); - - $this->storeCurrentUrl($request, $session); - - $this->addCookieToResponse($response, $session); - - // Again, if the session has been configured we will need to close out the session - // so that the attributes may be persisted to some storage medium. We will also - // add the session identifier cookie to the application response headers now. - $this->saveSession($request); - - return $response; - } - - /** - * Start the session for the given request. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Contracts\Session\Session $session - * @return \Illuminate\Contracts\Session\Session - */ - protected function startSession(Request $request, $session) - { - return tap($session, function ($session) use ($request) { - $session->setRequestOnHandler($request); - - $session->start(); - }); - } - - /** - * Get the session implementation from the manager. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Contracts\Session\Session - */ - public function getSession(Request $request) - { - return tap($this->manager->driver(), function ($session) use ($request) { - $session->setId($request->cookies->get($session->getName())); - }); - } - - /** - * Remove the garbage from the session if necessary. - * - * @param \Illuminate\Contracts\Session\Session $session - * @return void - */ - protected function collectGarbage(Session $session) - { - $config = $this->manager->getSessionConfig(); - - // Here we will see if this request hits the garbage collection lottery by hitting - // the odds needed to perform garbage collection on any given request. If we do - // hit it, we'll call this handler to let it delete all the expired sessions. - if ($this->configHitsLottery($config)) { - $session->getHandler()->gc($this->getSessionLifetimeInSeconds()); - } - } - - /** - * Determine if the configuration odds hit the lottery. - * - * @param array $config - * @return bool - */ - protected function configHitsLottery(array $config) - { - return random_int(1, $config['lottery'][1]) <= $config['lottery'][0]; - } - - /** - * Store the current URL for the request if necessary. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Contracts\Session\Session $session - * @return void - */ - protected function storeCurrentUrl(Request $request, $session) - { - if ($request->isMethod('GET') && - $request->route() instanceof Route && - ! $request->ajax() && - ! $request->prefetch() && - ! $request->isPrecognitive()) { - $session->setPreviousUrl($request->fullUrl()); - } - } - - /** - * Add the session cookie to the application response. - * - * @param \Symfony\Component\HttpFoundation\Response $response - * @param \Illuminate\Contracts\Session\Session $session - * @return void - */ - protected function addCookieToResponse(Response $response, Session $session) - { - if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) { - $response->headers->setCookie(new Cookie( - $session->getName(), $session->getId(), $this->getCookieExpirationDate(), - $config['path'], $config['domain'], $config['secure'] ?? false, - $config['http_only'] ?? true, false, $config['same_site'] ?? null - )); - } - } - - /** - * Save the session data to storage. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - protected function saveSession($request) - { - if (! $request->isPrecognitive()) { - $this->manager->driver()->save(); - } - } - - /** - * Get the session lifetime in seconds. - * - * @return int - */ - protected function getSessionLifetimeInSeconds() - { - return ($this->manager->getSessionConfig()['lifetime'] ?? null) * 60; - } - - /** - * Get the cookie lifetime in seconds. - * - * @return \DateTimeInterface|int - */ - protected function getCookieExpirationDate() - { - $config = $this->manager->getSessionConfig(); - - return $config['expire_on_close'] ? 0 : Date::instance( - Carbon::now()->addRealMinutes($config['lifetime']) - ); - } - - /** - * Determine if a session driver has been configured. - * - * @return bool - */ - protected function sessionConfigured() - { - return ! is_null($this->manager->getSessionConfig()['driver'] ?? null); - } - - /** - * Determine if the configured session driver is persistent. - * - * @param array|null $config - * @return bool - */ - protected function sessionIsPersistent(array $config = null) - { - $config = $config ?: $this->manager->getSessionConfig(); - - return ! is_null($config['driver'] ?? null); - } - - /** - * Resolve the given cache driver. - * - * @param string $driver - * @return \Illuminate\Cache\Store - */ - protected function cache($driver) - { - return call_user_func($this->cacheFactoryResolver)->driver($driver); - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/NullSessionHandler.php b/framework-9.50.2/src/Illuminate/Session/NullSessionHandler.php deleted file mode 100644 index fbebd5d..0000000 --- a/framework-9.50.2/src/Illuminate/Session/NullSessionHandler.php +++ /dev/null @@ -1,68 +0,0 @@ -buildSession(parent::callCustomCreator($driver)); - } - - /** - * Create an instance of the "null" session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createNullDriver() - { - return $this->buildSession(new NullSessionHandler); - } - - /** - * Create an instance of the "array" session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createArrayDriver() - { - return $this->buildSession(new ArraySessionHandler( - $this->config->get('session.lifetime') - )); - } - - /** - * Create an instance of the "cookie" session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createCookieDriver() - { - return $this->buildSession(new CookieSessionHandler( - $this->container->make('cookie'), $this->config->get('session.lifetime') - )); - } - - /** - * Create an instance of the file session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createFileDriver() - { - return $this->createNativeDriver(); - } - - /** - * Create an instance of the file session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createNativeDriver() - { - $lifetime = $this->config->get('session.lifetime'); - - return $this->buildSession(new FileSessionHandler( - $this->container->make('files'), $this->config->get('session.files'), $lifetime - )); - } - - /** - * Create an instance of the database session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createDatabaseDriver() - { - $table = $this->config->get('session.table'); - - $lifetime = $this->config->get('session.lifetime'); - - return $this->buildSession(new DatabaseSessionHandler( - $this->getDatabaseConnection(), $table, $lifetime, $this->container - )); - } - - /** - * Get the database connection for the database driver. - * - * @return \Illuminate\Database\Connection - */ - protected function getDatabaseConnection() - { - $connection = $this->config->get('session.connection'); - - return $this->container->make('db')->connection($connection); - } - - /** - * Create an instance of the APC session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createApcDriver() - { - return $this->createCacheBased('apc'); - } - - /** - * Create an instance of the Memcached session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createMemcachedDriver() - { - return $this->createCacheBased('memcached'); - } - - /** - * Create an instance of the Redis session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createRedisDriver() - { - $handler = $this->createCacheHandler('redis'); - - $handler->getCache()->getStore()->setConnection( - $this->config->get('session.connection') - ); - - return $this->buildSession($handler); - } - - /** - * Create an instance of the DynamoDB session driver. - * - * @return \Illuminate\Session\Store - */ - protected function createDynamodbDriver() - { - return $this->createCacheBased('dynamodb'); - } - - /** - * Create an instance of a cache driven driver. - * - * @param string $driver - * @return \Illuminate\Session\Store - */ - protected function createCacheBased($driver) - { - return $this->buildSession($this->createCacheHandler($driver)); - } - - /** - * Create the cache based session handler instance. - * - * @param string $driver - * @return \Illuminate\Session\CacheBasedSessionHandler - */ - protected function createCacheHandler($driver) - { - $store = $this->config->get('session.store') ?: $driver; - - return new CacheBasedSessionHandler( - clone $this->container->make('cache')->store($store), - $this->config->get('session.lifetime') - ); - } - - /** - * Build the session instance. - * - * @param \SessionHandlerInterface $handler - * @return \Illuminate\Session\Store - */ - protected function buildSession($handler) - { - return $this->config->get('session.encrypt') - ? $this->buildEncryptedSession($handler) - : new Store( - $this->config->get('session.cookie'), - $handler, - $id = null, - $this->config->get('session.serialization', 'php') - ); - } - - /** - * Build the encrypted session instance. - * - * @param \SessionHandlerInterface $handler - * @return \Illuminate\Session\EncryptedStore - */ - protected function buildEncryptedSession($handler) - { - return new EncryptedStore( - $this->config->get('session.cookie'), - $handler, - $this->container['encrypter'], - $id = null, - $this->config->get('session.serialization', 'php'), - ); - } - - /** - * Determine if requests for the same session should wait for each to finish before executing. - * - * @return bool - */ - public function shouldBlock() - { - return $this->config->get('session.block', false); - } - - /** - * Get the name of the cache store / driver that should be used to acquire session locks. - * - * @return string|null - */ - public function blockDriver() - { - return $this->config->get('session.block_store'); - } - - /** - * Get the session configuration. - * - * @return array - */ - public function getSessionConfig() - { - return $this->config->get('session'); - } - - /** - * Get the default session driver name. - * - * @return string - */ - public function getDefaultDriver() - { - return $this->config->get('session.driver'); - } - - /** - * Set the default session driver name. - * - * @param string $name - * @return void - */ - public function setDefaultDriver($name) - { - $this->config->set('session.driver', $name); - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/SessionServiceProvider.php b/framework-9.50.2/src/Illuminate/Session/SessionServiceProvider.php deleted file mode 100755 index d1108e3..0000000 --- a/framework-9.50.2/src/Illuminate/Session/SessionServiceProvider.php +++ /dev/null @@ -1,55 +0,0 @@ -registerSessionManager(); - - $this->registerSessionDriver(); - - $this->app->singleton(StartSession::class, function ($app) { - return new StartSession($app->make(SessionManager::class), function () use ($app) { - return $app->make(CacheFactory::class); - }); - }); - } - - /** - * Register the session manager instance. - * - * @return void - */ - protected function registerSessionManager() - { - $this->app->singleton('session', function ($app) { - return new SessionManager($app); - }); - } - - /** - * Register the session driver instance. - * - * @return void - */ - protected function registerSessionDriver() - { - $this->app->singleton('session.store', function ($app) { - // First, we will create the session manager which is responsible for the - // creation of the various session drivers when they are needed by the - // application instance, and will resolve them on a lazy load basis. - return $app->make('session')->driver(); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/Store.php b/framework-9.50.2/src/Illuminate/Session/Store.php deleted file mode 100755 index 10184de..0000000 --- a/framework-9.50.2/src/Illuminate/Session/Store.php +++ /dev/null @@ -1,771 +0,0 @@ -setId($id); - $this->name = $name; - $this->handler = $handler; - $this->serialization = $serialization; - } - - /** - * Start the session, reading the data from a handler. - * - * @return bool - */ - public function start() - { - $this->loadSession(); - - if (! $this->has('_token')) { - $this->regenerateToken(); - } - - return $this->started = true; - } - - /** - * Load the session data from the handler. - * - * @return void - */ - protected function loadSession() - { - $this->attributes = array_merge($this->attributes, $this->readFromHandler()); - - $this->marshalErrorBag(); - } - - /** - * Read the session data from the handler. - * - * @return array - */ - protected function readFromHandler() - { - if ($data = $this->handler->read($this->getId())) { - if ($this->serialization === 'json') { - $data = json_decode($this->prepareForUnserialize($data), true); - } else { - $data = @unserialize($this->prepareForUnserialize($data)); - } - - if ($data !== false && is_array($data)) { - return $data; - } - } - - return []; - } - - /** - * Prepare the raw string data from the session for unserialization. - * - * @param string $data - * @return string - */ - protected function prepareForUnserialize($data) - { - return $data; - } - - /** - * Marshal the ViewErrorBag when using JSON serialization for sessions. - * - * @return void - */ - protected function marshalErrorBag() - { - if ($this->serialization !== 'json' || $this->missing('errors')) { - return; - } - - $errorBag = new ViewErrorBag; - - foreach ($this->get('errors') as $key => $value) { - $messageBag = new MessageBag($value['messages']); - - $errorBag->put($key, $messageBag->setFormat($value['format'])); - } - - $this->put('errors', $errorBag); - } - - /** - * Save the session data to storage. - * - * @return void - */ - public function save() - { - $this->ageFlashData(); - - $this->prepareErrorBagForSerialization(); - - $this->handler->write($this->getId(), $this->prepareForStorage( - $this->serialization === 'json' ? json_encode($this->attributes) : serialize($this->attributes) - )); - - $this->started = false; - } - - /** - * Prepare the ViewErrorBag instance for JSON serialization. - * - * @return void - */ - protected function prepareErrorBagForSerialization() - { - if ($this->serialization !== 'json' || $this->missing('errors')) { - return; - } - - $errors = []; - - foreach ($this->attributes['errors']->getBags() as $key => $value) { - $errors[$key] = [ - 'format' => $value->getFormat(), - 'messages' => $value->getMessages(), - ]; - } - - $this->attributes['errors'] = $errors; - } - - /** - * Prepare the serialized session data for storage. - * - * @param string $data - * @return string - */ - protected function prepareForStorage($data) - { - return $data; - } - - /** - * Age the flash data for the session. - * - * @return void - */ - public function ageFlashData() - { - $this->forget($this->get('_flash.old', [])); - - $this->put('_flash.old', $this->get('_flash.new', [])); - - $this->put('_flash.new', []); - } - - /** - * Get all of the session data. - * - * @return array - */ - public function all() - { - return $this->attributes; - } - - /** - * Get a subset of the session data. - * - * @param array $keys - * @return array - */ - public function only(array $keys) - { - return Arr::only($this->attributes, $keys); - } - - /** - * Checks if a key exists. - * - * @param string|array $key - * @return bool - */ - public function exists($key) - { - $placeholder = new stdClass; - - return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) use ($placeholder) { - return $this->get($key, $placeholder) === $placeholder; - }); - } - - /** - * Determine if the given key is missing from the session data. - * - * @param string|array $key - * @return bool - */ - public function missing($key) - { - return ! $this->exists($key); - } - - /** - * Checks if a key is present and not null. - * - * @param string|array $key - * @return bool - */ - public function has($key) - { - return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) { - return is_null($this->get($key)); - }); - } - - /** - * Get an item from the session. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null) - { - return Arr::get($this->attributes, $key, $default); - } - - /** - * Get the value of a given key and then forget it. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function pull($key, $default = null) - { - return Arr::pull($this->attributes, $key, $default); - } - - /** - * Determine if the session contains old input. - * - * @param string|null $key - * @return bool - */ - public function hasOldInput($key = null) - { - $old = $this->getOldInput($key); - - return is_null($key) ? count($old) > 0 : ! is_null($old); - } - - /** - * Get the requested item from the flashed input array. - * - * @param string|null $key - * @param mixed $default - * @return mixed - */ - public function getOldInput($key = null, $default = null) - { - return Arr::get($this->get('_old_input', []), $key, $default); - } - - /** - * Replace the given session attributes entirely. - * - * @param array $attributes - * @return void - */ - public function replace(array $attributes) - { - $this->put($attributes); - } - - /** - * Put a key / value pair or array of key / value pairs in the session. - * - * @param string|array $key - * @param mixed $value - * @return void - */ - public function put($key, $value = null) - { - if (! is_array($key)) { - $key = [$key => $value]; - } - - foreach ($key as $arrayKey => $arrayValue) { - Arr::set($this->attributes, $arrayKey, $arrayValue); - } - } - - /** - * Get an item from the session, or store the default value. - * - * @param string $key - * @param \Closure $callback - * @return mixed - */ - public function remember($key, Closure $callback) - { - if (! is_null($value = $this->get($key))) { - return $value; - } - - return tap($callback(), function ($value) use ($key) { - $this->put($key, $value); - }); - } - - /** - * Push a value onto a session array. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function push($key, $value) - { - $array = $this->get($key, []); - - $array[] = $value; - - $this->put($key, $array); - } - - /** - * Increment the value of an item in the session. - * - * @param string $key - * @param int $amount - * @return mixed - */ - public function increment($key, $amount = 1) - { - $this->put($key, $value = $this->get($key, 0) + $amount); - - return $value; - } - - /** - * Decrement the value of an item in the session. - * - * @param string $key - * @param int $amount - * @return int - */ - public function decrement($key, $amount = 1) - { - return $this->increment($key, $amount * -1); - } - - /** - * Flash a key / value pair to the session. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function flash(string $key, $value = true) - { - $this->put($key, $value); - - $this->push('_flash.new', $key); - - $this->removeFromOldFlashData([$key]); - } - - /** - * Flash a key / value pair to the session for immediate use. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function now($key, $value) - { - $this->put($key, $value); - - $this->push('_flash.old', $key); - } - - /** - * Reflash all of the session flash data. - * - * @return void - */ - public function reflash() - { - $this->mergeNewFlashes($this->get('_flash.old', [])); - - $this->put('_flash.old', []); - } - - /** - * Reflash a subset of the current flash data. - * - * @param array|mixed $keys - * @return void - */ - public function keep($keys = null) - { - $this->mergeNewFlashes($keys = is_array($keys) ? $keys : func_get_args()); - - $this->removeFromOldFlashData($keys); - } - - /** - * Merge new flash keys into the new flash array. - * - * @param array $keys - * @return void - */ - protected function mergeNewFlashes(array $keys) - { - $values = array_unique(array_merge($this->get('_flash.new', []), $keys)); - - $this->put('_flash.new', $values); - } - - /** - * Remove the given keys from the old flash data. - * - * @param array $keys - * @return void - */ - protected function removeFromOldFlashData(array $keys) - { - $this->put('_flash.old', array_diff($this->get('_flash.old', []), $keys)); - } - - /** - * Flash an input array to the session. - * - * @param array $value - * @return void - */ - public function flashInput(array $value) - { - $this->flash('_old_input', $value); - } - - /** - * Remove an item from the session, returning its value. - * - * @param string $key - * @return mixed - */ - public function remove($key) - { - return Arr::pull($this->attributes, $key); - } - - /** - * Remove one or many items from the session. - * - * @param string|array $keys - * @return void - */ - public function forget($keys) - { - Arr::forget($this->attributes, $keys); - } - - /** - * Remove all of the items from the session. - * - * @return void - */ - public function flush() - { - $this->attributes = []; - } - - /** - * Flush the session data and regenerate the ID. - * - * @return bool - */ - public function invalidate() - { - $this->flush(); - - return $this->migrate(true); - } - - /** - * Generate a new session identifier. - * - * @param bool $destroy - * @return bool - */ - public function regenerate($destroy = false) - { - return tap($this->migrate($destroy), function () { - $this->regenerateToken(); - }); - } - - /** - * Generate a new session ID for the session. - * - * @param bool $destroy - * @return bool - */ - public function migrate($destroy = false) - { - if ($destroy) { - $this->handler->destroy($this->getId()); - } - - $this->setExists(false); - - $this->setId($this->generateSessionId()); - - return true; - } - - /** - * Determine if the session has been started. - * - * @return bool - */ - public function isStarted() - { - return $this->started; - } - - /** - * Get the name of the session. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Set the name of the session. - * - * @param string $name - * @return void - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Get the current session ID. - * - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * Set the session ID. - * - * @param string|null $id - * @return void - */ - public function setId($id) - { - $this->id = $this->isValidId($id) ? $id : $this->generateSessionId(); - } - - /** - * Determine if this is a valid session ID. - * - * @param string|null $id - * @return bool - */ - public function isValidId($id) - { - return is_string($id) && ctype_alnum($id) && strlen($id) === 40; - } - - /** - * Get a new, random session ID. - * - * @return string - */ - protected function generateSessionId() - { - return Str::random(40); - } - - /** - * Set the existence of the session on the handler if applicable. - * - * @param bool $value - * @return void - */ - public function setExists($value) - { - if ($this->handler instanceof ExistenceAwareInterface) { - $this->handler->setExists($value); - } - } - - /** - * Get the CSRF token value. - * - * @return string - */ - public function token() - { - return $this->get('_token'); - } - - /** - * Regenerate the CSRF token value. - * - * @return void - */ - public function regenerateToken() - { - $this->put('_token', Str::random(40)); - } - - /** - * Get the previous URL from the session. - * - * @return string|null - */ - public function previousUrl() - { - return $this->get('_previous.url'); - } - - /** - * Set the "previous" URL in the session. - * - * @param string $url - * @return void - */ - public function setPreviousUrl($url) - { - $this->put('_previous.url', $url); - } - - /** - * Specify that the user has confirmed their password. - * - * @return void - */ - public function passwordConfirmed() - { - $this->put('auth.password_confirmed_at', time()); - } - - /** - * Get the underlying session handler implementation. - * - * @return \SessionHandlerInterface - */ - public function getHandler() - { - return $this->handler; - } - - /** - * Set the underlying session handler implementation. - * - * @param \SessionHandlerInterface $handler - * @return \SessionHandlerInterface - */ - public function setHandler(SessionHandlerInterface $handler) - { - return $this->handler = $handler; - } - - /** - * Determine if the session handler needs a request. - * - * @return bool - */ - public function handlerNeedsRequest() - { - return $this->handler instanceof CookieSessionHandler; - } - - /** - * Set the request on the handler instance. - * - * @param \Illuminate\Http\Request $request - * @return void - */ - public function setRequestOnHandler($request) - { - if ($this->handlerNeedsRequest()) { - $this->handler->setRequest($request); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/SymfonySessionDecorator.php b/framework-9.50.2/src/Illuminate/Session/SymfonySessionDecorator.php deleted file mode 100644 index 889560b..0000000 --- a/framework-9.50.2/src/Illuminate/Session/SymfonySessionDecorator.php +++ /dev/null @@ -1,186 +0,0 @@ -store = $store; - } - - /** - * {@inheritdoc} - */ - public function start(): bool - { - return $this->store->start(); - } - - /** - * {@inheritdoc} - */ - public function getId(): string - { - return $this->store->getId(); - } - - /** - * {@inheritdoc} - */ - public function setId(string $id) - { - $this->store->setId($id); - } - - /** - * {@inheritdoc} - */ - public function getName(): string - { - return $this->store->getName(); - } - - /** - * {@inheritdoc} - */ - public function setName(string $name) - { - $this->store->setName($name); - } - - /** - * {@inheritdoc} - */ - public function invalidate(int $lifetime = null): bool - { - $this->store->invalidate(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function migrate(bool $destroy = false, int $lifetime = null): bool - { - $this->store->migrate($destroy); - - return true; - } - - /** - * {@inheritdoc} - */ - public function save() - { - $this->store->save(); - } - - /** - * {@inheritdoc} - */ - public function has(string $name): bool - { - return $this->store->has($name); - } - - /** - * {@inheritdoc} - */ - public function get(string $name, mixed $default = null): mixed - { - return $this->store->get($name, $default); - } - - /** - * {@inheritdoc} - */ - public function set(string $name, mixed $value) - { - $this->store->put($name, $value); - } - - /** - * {@inheritdoc} - */ - public function all(): array - { - return $this->store->all(); - } - - /** - * {@inheritdoc} - */ - public function replace(array $attributes) - { - $this->store->replace($attributes); - } - - /** - * {@inheritdoc} - */ - public function remove(string $name): mixed - { - return $this->store->remove($name); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $this->store->flush(); - } - - /** - * {@inheritdoc} - */ - public function isStarted(): bool - { - return $this->store->isStarted(); - } - - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) - { - throw new BadMethodCallException('Method not implemented by Laravel.'); - } - - /** - * {@inheritdoc} - */ - public function getBag(string $name): SessionBagInterface - { - throw new BadMethodCallException('Method not implemented by Laravel.'); - } - - /** - * {@inheritdoc} - */ - public function getMetadataBag(): MetadataBag - { - throw new BadMethodCallException('Method not implemented by Laravel.'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Session/TokenMismatchException.php b/framework-9.50.2/src/Illuminate/Session/TokenMismatchException.php deleted file mode 100755 index 98d99a1..0000000 --- a/framework-9.50.2/src/Illuminate/Session/TokenMismatchException.php +++ /dev/null @@ -1,10 +0,0 @@ -instances = []; - - foreach ($this->providers as $provider) { - $this->instances[] = $this->app->register($provider); - } - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - $provides = []; - - foreach ($this->providers as $provider) { - $instance = $this->app->resolveProvider($provider); - - $provides = array_merge($provides, $instance->provides()); - } - - return $provides; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Benchmark.php b/framework-9.50.2/src/Illuminate/Support/Benchmark.php deleted file mode 100644 index 3a09d59..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Benchmark.php +++ /dev/null @@ -1,50 +0,0 @@ -map(function ($callback) use ($iterations) { - return collect(range(1, $iterations))->map(function () use ($callback) { - gc_collect_cycles(); - - $start = hrtime(true); - - $callback(); - - return (hrtime(true) - $start) / 1000000; - })->average(); - })->when( - $benchmarkables instanceof Closure, - fn ($c) => $c->first(), - fn ($c) => $c->all(), - ); - } - - /** - * Measure a callable or array of callables over the given number of iterations, then dump and die. - * - * @param \Closure|array $benchmarkables - * @param int $iterations - * @return never - */ - public static function dd(Closure|array $benchmarkables, int $iterations = 1): void - { - $result = collect(static::measure(Arr::wrap($benchmarkables), $iterations)) - ->map(fn ($average) => number_format($average, 3).'ms') - ->when($benchmarkables instanceof Closure, fn ($c) => $c->first(), fn ($c) => $c->all()); - - dd($result); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Carbon.php b/framework-9.50.2/src/Illuminate/Support/Carbon.php deleted file mode 100644 index 972d7eb..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Carbon.php +++ /dev/null @@ -1,21 +0,0 @@ -files = $files; - $this->workingPath = $workingPath; - } - - /** - * Regenerate the Composer autoloader files. - * - * @param string|array $extra - * @return int - */ - public function dumpAutoloads($extra = '') - { - $extra = $extra ? (array) $extra : []; - - $command = array_merge($this->findComposer(), ['dump-autoload'], $extra); - - return $this->getProcess($command)->run(); - } - - /** - * Regenerate the optimized Composer autoloader files. - * - * @return int - */ - public function dumpOptimized() - { - return $this->dumpAutoloads('--optimize'); - } - - /** - * Get the composer command for the environment. - * - * @return array - */ - public function findComposer() - { - if ($this->files->exists($this->workingPath.'/composer.phar')) { - return [$this->phpBinary(), 'composer.phar']; - } - - return ['composer']; - } - - /** - * Get the PHP binary. - * - * @return string - */ - protected function phpBinary() - { - return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); - } - - /** - * Get a new Symfony process instance. - * - * @param array $command - * @return \Symfony\Component\Process\Process - */ - protected function getProcess(array $command) - { - return (new Process($command, $this->workingPath))->setTimeout(null); - } - - /** - * Set the working path used by the class. - * - * @param string $path - * @return $this - */ - public function setWorkingPath($path) - { - $this->workingPath = realpath($path); - - return $this; - } - - /** - * Get the version of Composer. - * - * @return string|null - */ - public function getVersion() - { - $command = array_merge($this->findComposer(), ['-V', '--no-ansi']); - - $process = $this->getProcess($command); - - $process->run(); - - $output = $process->getOutput(); - - if (preg_match('/(\d+(\.\d+){2})/', $output, $version)) { - return $version[1]; - } - - return explode(' ', $output)[2] ?? null; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/ConfigurationUrlParser.php b/framework-9.50.2/src/Illuminate/Support/ConfigurationUrlParser.php deleted file mode 100644 index a1b9337..0000000 --- a/framework-9.50.2/src/Illuminate/Support/ConfigurationUrlParser.php +++ /dev/null @@ -1,191 +0,0 @@ - 'sqlsrv', - 'mysql2' => 'mysql', // RDS - 'postgres' => 'pgsql', - 'postgresql' => 'pgsql', - 'sqlite3' => 'sqlite', - 'redis' => 'tcp', - 'rediss' => 'tls', - ]; - - /** - * Parse the database configuration, hydrating options using a database configuration URL if possible. - * - * @param array|string $config - * @return array - */ - public function parseConfiguration($config) - { - if (is_string($config)) { - $config = ['url' => $config]; - } - - $url = Arr::pull($config, 'url'); - - if (! $url) { - return $config; - } - - $rawComponents = $this->parseUrl($url); - - $decodedComponents = $this->parseStringsToNativeTypes( - array_map('rawurldecode', $rawComponents) - ); - - return array_merge( - $config, - $this->getPrimaryOptions($decodedComponents), - $this->getQueryOptions($rawComponents) - ); - } - - /** - * Get the primary database connection options. - * - * @param array $url - * @return array - */ - protected function getPrimaryOptions($url) - { - return array_filter([ - 'driver' => $this->getDriver($url), - 'database' => $this->getDatabase($url), - 'host' => $url['host'] ?? null, - 'port' => $url['port'] ?? null, - 'username' => $url['user'] ?? null, - 'password' => $url['pass'] ?? null, - ], fn ($value) => ! is_null($value)); - } - - /** - * Get the database driver from the URL. - * - * @param array $url - * @return string|null - */ - protected function getDriver($url) - { - $alias = $url['scheme'] ?? null; - - if (! $alias) { - return; - } - - return static::$driverAliases[$alias] ?? $alias; - } - - /** - * Get the database name from the URL. - * - * @param array $url - * @return string|null - */ - protected function getDatabase($url) - { - $path = $url['path'] ?? null; - - return $path && $path !== '/' ? substr($path, 1) : null; - } - - /** - * Get all of the additional database options from the query string. - * - * @param array $url - * @return array - */ - protected function getQueryOptions($url) - { - $queryString = $url['query'] ?? null; - - if (! $queryString) { - return []; - } - - $query = []; - - parse_str($queryString, $query); - - return $this->parseStringsToNativeTypes($query); - } - - /** - * Parse the string URL to an array of components. - * - * @param string $url - * @return array - * - * @throws \InvalidArgumentException - */ - protected function parseUrl($url) - { - $url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url); - - $parsedUrl = parse_url($url); - - if ($parsedUrl === false) { - throw new InvalidArgumentException('The database configuration URL is malformed.'); - } - - return $parsedUrl; - } - - /** - * Convert string casted values to their native types. - * - * @param mixed $value - * @return mixed - */ - protected function parseStringsToNativeTypes($value) - { - if (is_array($value)) { - return array_map([$this, 'parseStringsToNativeTypes'], $value); - } - - if (! is_string($value)) { - return $value; - } - - $parsedValue = json_decode($value, true); - - if (json_last_error() === JSON_ERROR_NONE) { - return $parsedValue; - } - - return $value; - } - - /** - * Get all of the current drivers' aliases. - * - * @return array - */ - public static function getDriverAliases() - { - return static::$driverAliases; - } - - /** - * Add the given driver alias to the driver aliases array. - * - * @param string $alias - * @param string $driver - * @return void - */ - public static function addDriverAlias($alias, $driver) - { - static::$driverAliases[$alias] = $driver; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/DateFactory.php b/framework-9.50.2/src/Illuminate/Support/DateFactory.php deleted file mode 100644 index 3d0cd04..0000000 --- a/framework-9.50.2/src/Illuminate/Support/DateFactory.php +++ /dev/null @@ -1,231 +0,0 @@ -$method(...$parameters); - } - - $dateClass = static::$dateClass ?: $defaultClassName; - - // Check if the date can be created using the public class method... - if (method_exists($dateClass, $method) || - method_exists($dateClass, 'hasMacro') && $dateClass::hasMacro($method)) { - return $dateClass::$method(...$parameters); - } - - // If that fails, create the date with the default class... - $date = $defaultClassName::$method(...$parameters); - - // If the configured class has an "instance" method, we'll try to pass our date into there... - if (method_exists($dateClass, 'instance')) { - return $dateClass::instance($date); - } - - // Otherwise, assume the configured class has a DateTime compatible constructor... - return new $dateClass($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Env.php b/framework-9.50.2/src/Illuminate/Support/Env.php deleted file mode 100644 index 4d5747a..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Env.php +++ /dev/null @@ -1,101 +0,0 @@ -addAdapter(PutenvAdapter::class); - } - - static::$repository = $builder->immutable()->make(); - } - - return static::$repository; - } - - /** - * Gets the value of an environment variable. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public static function get($key, $default = null) - { - return Option::fromValue(static::getRepository()->get($key)) - ->map(function ($value) { - switch (strtolower($value)) { - case 'true': - case '(true)': - return true; - case 'false': - case '(false)': - return false; - case 'empty': - case '(empty)': - return ''; - case 'null': - case '(null)': - return; - } - - if (preg_match('/\A([\'"])(.*)\1\z/', $value, $matches)) { - return $matches[2]; - } - - return $value; - }) - ->getOrCall(fn () => value($default)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Exceptions/MathException.php b/framework-9.50.2/src/Illuminate/Support/Exceptions/MathException.php deleted file mode 100644 index 6f9158d..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Exceptions/MathException.php +++ /dev/null @@ -1,10 +0,0 @@ -providerIsLoaded(UiServiceProvider::class)) { - throw new RuntimeException('In order to use the Auth::routes() method, please install the laravel/ui package.'); - } - - static::$app->make('router')->auth($options); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Facades/Blade.php b/framework-9.50.2/src/Illuminate/Support/Facades/Blade.php deleted file mode 100755 index a58b214..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Facades/Blade.php +++ /dev/null @@ -1,60 +0,0 @@ -dispatch(); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return BusDispatcherContract::class; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Facades/Cache.php b/framework-9.50.2/src/Illuminate/Support/Facades/Cache.php deleted file mode 100755 index e49c1eb..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Facades/Cache.php +++ /dev/null @@ -1,67 +0,0 @@ -cookie($key, null)); - } - - /** - * Retrieve a cookie from the request. - * - * @param string|null $key - * @param mixed $default - * @return string|array|null - */ - public static function get($key = null, $default = null) - { - return static::$app['request']->cookie($key, $default); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return 'cookie'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Facades/Crypt.php b/framework-9.50.2/src/Illuminate/Support/Facades/Crypt.php deleted file mode 100755 index 20f269d..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Facades/Crypt.php +++ /dev/null @@ -1,27 +0,0 @@ -resolved($accessor) === true) { - $callback(static::getFacadeRoot()); - } - - static::$app->afterResolving($accessor, function ($service) use ($callback) { - $callback($service); - }); - } - - /** - * Convert the facade into a Mockery spy. - * - * @return \Mockery\MockInterface - */ - public static function spy() - { - if (! static::isMock()) { - $class = static::getMockableClass(); - - return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) { - static::swap($spy); - }); - } - } - - /** - * Initiate a partial mock on the facade. - * - * @return \Mockery\MockInterface - */ - public static function partialMock() - { - $name = static::getFacadeAccessor(); - - $mock = static::isMock() - ? static::$resolvedInstance[$name] - : static::createFreshMockInstance(); - - return $mock->makePartial(); - } - - /** - * Initiate a mock expectation on the facade. - * - * @return \Mockery\Expectation - */ - public static function shouldReceive() - { - $name = static::getFacadeAccessor(); - - $mock = static::isMock() - ? static::$resolvedInstance[$name] - : static::createFreshMockInstance(); - - return $mock->shouldReceive(...func_get_args()); - } - - /** - * Initiate a mock expectation on the facade. - * - * @return \Mockery\Expectation - */ - public static function expects() - { - $name = static::getFacadeAccessor(); - - $mock = static::isMock() - ? static::$resolvedInstance[$name] - : static::createFreshMockInstance(); - - return $mock->expects(...func_get_args()); - } - - /** - * Create a fresh mock instance for the given class. - * - * @return \Mockery\MockInterface - */ - protected static function createFreshMockInstance() - { - return tap(static::createMock(), function ($mock) { - static::swap($mock); - - $mock->shouldAllowMockingProtectedMethods(); - }); - } - - /** - * Create a fresh mock instance for the given class. - * - * @return \Mockery\MockInterface - */ - protected static function createMock() - { - $class = static::getMockableClass(); - - return $class ? Mockery::mock($class) : Mockery::mock(); - } - - /** - * Determines whether a mock is set as the instance of the facade. - * - * @return bool - */ - protected static function isMock() - { - $name = static::getFacadeAccessor(); - - return isset(static::$resolvedInstance[$name]) && - static::$resolvedInstance[$name] instanceof LegacyMockInterface; - } - - /** - * Get the mockable class for the bound instance. - * - * @return string|null - */ - protected static function getMockableClass() - { - if ($root = static::getFacadeRoot()) { - return get_class($root); - } - } - - /** - * Hotswap the underlying instance behind the facade. - * - * @param mixed $instance - * @return void - */ - public static function swap($instance) - { - static::$resolvedInstance[static::getFacadeAccessor()] = $instance; - - if (isset(static::$app)) { - static::$app->instance(static::getFacadeAccessor(), $instance); - } - } - - /** - * Get the root object behind the facade. - * - * @return mixed - */ - public static function getFacadeRoot() - { - return static::resolveFacadeInstance(static::getFacadeAccessor()); - } - - /** - * Get the registered name of the component. - * - * @return string - * - * @throws \RuntimeException - */ - protected static function getFacadeAccessor() - { - throw new RuntimeException('Facade does not implement getFacadeAccessor method.'); - } - - /** - * Resolve the facade root instance from the container. - * - * @param string $name - * @return mixed - */ - protected static function resolveFacadeInstance($name) - { - if (isset(static::$resolvedInstance[$name])) { - return static::$resolvedInstance[$name]; - } - - if (static::$app) { - if (static::$cached) { - return static::$resolvedInstance[$name] = static::$app[$name]; - } - - return static::$app[$name]; - } - } - - /** - * Clear a resolved facade instance. - * - * @param string $name - * @return void - */ - public static function clearResolvedInstance($name) - { - unset(static::$resolvedInstance[$name]); - } - - /** - * Clear all of the resolved instances. - * - * @return void - */ - public static function clearResolvedInstances() - { - static::$resolvedInstance = []; - } - - /** - * Get the application default aliases. - * - * @return \Illuminate\Support\Collection - */ - public static function defaultAliases() - { - return collect([ - 'App' => App::class, - 'Arr' => Arr::class, - 'Artisan' => Artisan::class, - 'Auth' => Auth::class, - 'Blade' => Blade::class, - 'Broadcast' => Broadcast::class, - 'Bus' => Bus::class, - 'Cache' => Cache::class, - 'Config' => Config::class, - 'Cookie' => Cookie::class, - 'Crypt' => Crypt::class, - 'Date' => Date::class, - 'DB' => DB::class, - 'Eloquent' => Model::class, - 'Event' => Event::class, - 'File' => File::class, - 'Gate' => Gate::class, - 'Hash' => Hash::class, - 'Http' => Http::class, - 'Js' => Js::class, - 'Lang' => Lang::class, - 'Log' => Log::class, - 'Mail' => Mail::class, - 'Notification' => Notification::class, - 'Password' => Password::class, - 'Queue' => Queue::class, - 'RateLimiter' => RateLimiter::class, - 'Redirect' => Redirect::class, - 'Request' => Request::class, - 'Response' => Response::class, - 'Route' => Route::class, - 'Schema' => Schema::class, - 'Session' => Session::class, - 'Storage' => Storage::class, - 'Str' => Str::class, - 'URL' => URL::class, - 'Validator' => Validator::class, - 'View' => View::class, - 'Vite' => Vite::class, - ]); - } - - /** - * Get the application instance behind the facade. - * - * @return \Illuminate\Contracts\Foundation\Application - */ - public static function getFacadeApplication() - { - return static::$app; - } - - /** - * Set the application instance. - * - * @param \Illuminate\Contracts\Foundation\Application $app - * @return void - */ - public static function setFacadeApplication($app) - { - static::$app = $app; - } - - /** - * Handle dynamic, static calls to the object. - * - * @param string $method - * @param array $args - * @return mixed - * - * @throws \RuntimeException - */ - public static function __callStatic($method, $args) - { - $instance = static::getFacadeRoot(); - - if (! $instance) { - throw new RuntimeException('A facade root has not been set.'); - } - - return $instance->$method(...$args); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Facades/File.php b/framework-9.50.2/src/Illuminate/Support/Facades/File.php deleted file mode 100755 index 7063fef..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Facades/File.php +++ /dev/null @@ -1,71 +0,0 @@ -fake($callback)); - }); - } - - /** - * Register a response sequence for the given URL pattern. - * - * @param string $urlPattern - * @return \Illuminate\Http\Client\ResponseSequence - */ - public static function fakeSequence(string $urlPattern = '*') - { - $fake = tap(static::getFacadeRoot(), function ($fake) { - static::swap($fake); - }); - - return $fake->fakeSequence($urlPattern); - } - - /** - * Indicate that an exception should be thrown if any request is not faked. - * - * @return \Illuminate\Http\Client\Factory - */ - public static function preventStrayRequests() - { - return tap(static::getFacadeRoot(), function ($fake) { - static::swap($fake->preventStrayRequests()); - }); - } - - /** - * Stub the given URL using the given callback. - * - * @param string $url - * @param \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface|callable $callback - * @return \Illuminate\Http\Client\Factory - */ - public static function stubUrl($url, $callback) - { - return tap(static::getFacadeRoot(), function ($fake) use ($url, $callback) { - static::swap($fake->stubUrl($url, $callback)); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Facades/Lang.php b/framework-9.50.2/src/Illuminate/Support/Facades/Lang.php deleted file mode 100755 index 992282c..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Facades/Lang.php +++ /dev/null @@ -1,46 +0,0 @@ -route($channel, $route); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return ChannelManager::class; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Facades/ParallelTesting.php b/framework-9.50.2/src/Illuminate/Support/Facades/ParallelTesting.php deleted file mode 100644 index d91558c..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Facades/ParallelTesting.php +++ /dev/null @@ -1,34 +0,0 @@ -connection($name)->getSchemaBuilder(); - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return 'db.schema'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Facades/Session.php b/framework-9.50.2/src/Illuminate/Support/Facades/Session.php deleted file mode 100755 index e1ea753..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Facades/Session.php +++ /dev/null @@ -1,80 +0,0 @@ -get('filesystems.default'); - - $root = storage_path('framework/testing/disks/'.$disk); - - if ($token = ParallelTesting::token()) { - $root = "{$root}_test_{$token}"; - } - - (new Filesystem)->cleanDirectory($root); - - static::set($disk, $fake = static::createLocalDriver(array_merge($config, [ - 'root' => $root, - ]))); - - return tap($fake)->buildTemporaryUrlsUsing(function ($path, $expiration) { - return URL::to($path.'?expiration='.$expiration->getTimestamp()); - }); - } - - /** - * Replace the given disk with a persistent local testing disk. - * - * @param string|null $disk - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Filesystem - */ - public static function persistentFake($disk = null, array $config = []) - { - $disk = $disk ?: static::$app['config']->get('filesystems.default'); - - static::set($disk, $fake = static::createLocalDriver(array_merge($config, [ - 'root' => storage_path('framework/testing/disks/'.$disk), - ]))); - - return $fake; - } - - /** - * Get the registered name of the component. - * - * @return string - */ - protected static function getFacadeAccessor() - { - return 'filesystem'; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Facades/URL.php b/framework-9.50.2/src/Illuminate/Support/Facades/URL.php deleted file mode 100755 index 8da96f4..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Facades/URL.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @implements \ArrayAccess - */ -class Fluent implements Arrayable, ArrayAccess, Jsonable, JsonSerializable -{ - /** - * All of the attributes set on the fluent instance. - * - * @var array - */ - protected $attributes = []; - - /** - * Create a new fluent instance. - * - * @param iterable $attributes - * @return void - */ - public function __construct($attributes = []) - { - foreach ($attributes as $key => $value) { - $this->attributes[$key] = $value; - } - } - - /** - * Get an attribute from the fluent instance. - * - * @template TGetDefault - * - * @param TKey $key - * @param TGetDefault|(\Closure(): TGetDefault) $default - * @return TValue|TGetDefault - */ - public function get($key, $default = null) - { - if (array_key_exists($key, $this->attributes)) { - return $this->attributes[$key]; - } - - return value($default); - } - - /** - * Get the attributes from the fluent instance. - * - * @return array - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * Convert the fluent instance to an array. - * - * @return array - */ - public function toArray() - { - return $this->attributes; - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->toArray(); - } - - /** - * Convert the fluent instance to JSON. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->jsonSerialize(), $options); - } - - /** - * Determine if the given offset exists. - * - * @param TKey $offset - * @return bool - */ - public function offsetExists($offset): bool - { - return isset($this->attributes[$offset]); - } - - /** - * Get the value for a given offset. - * - * @param TKey $offset - * @return TValue|null - */ - public function offsetGet($offset): mixed - { - return $this->get($offset); - } - - /** - * Set the value at the given offset. - * - * @param TKey $offset - * @param TValue $value - * @return void - */ - public function offsetSet($offset, $value): void - { - $this->attributes[$offset] = $value; - } - - /** - * Unset the value at the given offset. - * - * @param TKey $offset - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->attributes[$offset]); - } - - /** - * Handle dynamic calls to the fluent instance to set attributes. - * - * @param TKey $method - * @param array{0: ?TValue} $parameters - * @return $this - */ - public function __call($method, $parameters) - { - $this->attributes[$method] = count($parameters) > 0 ? reset($parameters) : true; - - return $this; - } - - /** - * Dynamically retrieve the value of an attribute. - * - * @param TKey $key - * @return TValue|null - */ - public function __get($key) - { - return $this->get($key); - } - - /** - * Dynamically set the value of an attribute. - * - * @param TKey $key - * @param TValue $value - * @return void - */ - public function __set($key, $value) - { - $this->offsetSet($key, $value); - } - - /** - * Dynamically check if an attribute is set. - * - * @param TKey $key - * @return bool - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Dynamically unset an attribute. - * - * @param TKey $key - * @return void - */ - public function __unset($key) - { - $this->offsetUnset($key); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/HigherOrderTapProxy.php b/framework-9.50.2/src/Illuminate/Support/HigherOrderTapProxy.php deleted file mode 100644 index bbf9b2e..0000000 --- a/framework-9.50.2/src/Illuminate/Support/HigherOrderTapProxy.php +++ /dev/null @@ -1,38 +0,0 @@ -target = $target; - } - - /** - * Dynamically pass method calls to the target. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - $this->target->{$method}(...$parameters); - - return $this->target; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/HtmlString.php b/framework-9.50.2/src/Illuminate/Support/HtmlString.php deleted file mode 100644 index d6b71d4..0000000 --- a/framework-9.50.2/src/Illuminate/Support/HtmlString.php +++ /dev/null @@ -1,66 +0,0 @@ -html = $html; - } - - /** - * Get the HTML string. - * - * @return string - */ - public function toHtml() - { - return $this->html; - } - - /** - * Determine if the given HTML string is empty. - * - * @return bool - */ - public function isEmpty() - { - return $this->html === ''; - } - - /** - * Determine if the given HTML string is not empty. - * - * @return bool - */ - public function isNotEmpty() - { - return ! $this->isEmpty(); - } - - /** - * Get the HTML string. - * - * @return string - */ - public function __toString() - { - return $this->toHtml(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/InteractsWithTime.php b/framework-9.50.2/src/Illuminate/Support/InteractsWithTime.php deleted file mode 100644 index 2b617c3..0000000 --- a/framework-9.50.2/src/Illuminate/Support/InteractsWithTime.php +++ /dev/null @@ -1,64 +0,0 @@ -parseDateInterval($delay); - - return $delay instanceof DateTimeInterface - ? max(0, $delay->getTimestamp() - $this->currentTime()) - : (int) $delay; - } - - /** - * Get the "available at" UNIX timestamp. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @return int - */ - protected function availableAt($delay = 0) - { - $delay = $this->parseDateInterval($delay); - - return $delay instanceof DateTimeInterface - ? $delay->getTimestamp() - : Carbon::now()->addRealSeconds($delay)->getTimestamp(); - } - - /** - * If the given value is an interval, convert it to a DateTime instance. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @return \DateTimeInterface|int - */ - protected function parseDateInterval($delay) - { - if ($delay instanceof DateInterval) { - $delay = Carbon::now()->add($delay); - } - - return $delay; - } - - /** - * Get the current system time as a UNIX timestamp. - * - * @return int - */ - protected function currentTime() - { - return Carbon::now()->getTimestamp(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Js.php b/framework-9.50.2/src/Illuminate/Support/Js.php deleted file mode 100644 index 69e9a76..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Js.php +++ /dev/null @@ -1,150 +0,0 @@ -js = $this->convertDataToJavaScriptExpression($data, $flags, $depth); - } - - /** - * Create a new JavaScript string from the given data. - * - * @param mixed $data - * @param int $flags - * @param int $depth - * @return static - * - * @throws \JsonException - */ - public static function from($data, $flags = 0, $depth = 512) - { - return new static($data, $flags, $depth); - } - - /** - * Convert the given data to a JavaScript expression. - * - * @param mixed $data - * @param int $flags - * @param int $depth - * @return string - * - * @throws \JsonException - */ - protected function convertDataToJavaScriptExpression($data, $flags = 0, $depth = 512) - { - if ($data instanceof self) { - return $data->toHtml(); - } - - if ($data instanceof BackedEnum) { - $data = $data->value; - } - - $json = $this->jsonEncode($data, $flags, $depth); - - if (is_string($data)) { - return "'".substr($json, 1, -1)."'"; - } - - return $this->convertJsonToJavaScriptExpression($json, $flags); - } - - /** - * Encode the given data as JSON. - * - * @param mixed $data - * @param int $flags - * @param int $depth - * @return string - * - * @throws \JsonException - */ - protected function jsonEncode($data, $flags = 0, $depth = 512) - { - if ($data instanceof Jsonable) { - return $data->toJson($flags | static::REQUIRED_FLAGS); - } - - if ($data instanceof Arrayable && ! ($data instanceof JsonSerializable)) { - $data = $data->toArray(); - } - - return json_encode($data, $flags | static::REQUIRED_FLAGS, $depth); - } - - /** - * Convert the given JSON to a JavaScript expression. - * - * @param string $json - * @param int $flags - * @return string - * - * @throws \JsonException - */ - protected function convertJsonToJavaScriptExpression($json, $flags = 0) - { - if ($json === '[]' || $json === '{}') { - return $json; - } - - if (Str::startsWith($json, ['"', '{', '['])) { - return "JSON.parse('".substr(json_encode($json, $flags | static::REQUIRED_FLAGS), 1, -1)."')"; - } - - return $json; - } - - /** - * Get the string representation of the data for use in HTML. - * - * @return string - */ - public function toHtml() - { - return $this->js; - } - - /** - * Get the string representation of the data for use in HTML. - * - * @return string - */ - public function __toString() - { - return $this->toHtml(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/LICENSE.md b/framework-9.50.2/src/Illuminate/Support/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Support/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Support/Lottery.php b/framework-9.50.2/src/Illuminate/Support/Lottery.php deleted file mode 100644 index 9bf3b47..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Lottery.php +++ /dev/null @@ -1,271 +0,0 @@ - 1) { - throw new RuntimeException('Float must not be greater than 1.'); - } - - $this->chances = $chances; - - $this->outOf = $outOf; - } - - /** - * Create a new Lottery instance. - * - * @param int|float $chances - * @param int|null $outOf - * @return static - */ - public static function odds($chances, $outOf = null) - { - return new static($chances, $outOf); - } - - /** - * Set the winner callback. - * - * @param callable $callback - * @return $this - */ - public function winner($callback) - { - $this->winner = $callback; - - return $this; - } - - /** - * Set the loser callback. - * - * @param callable $callback - * @return $this - */ - public function loser($callback) - { - $this->loser = $callback; - - return $this; - } - - /** - * Run the lottery. - * - * @param mixed ...$args - * @return mixed - */ - public function __invoke(...$args) - { - return $this->runCallback(...$args); - } - - /** - * Run the lottery. - * - * @param null|int $times - * @return mixed - */ - public function choose($times = null) - { - if ($times === null) { - return $this->runCallback(); - } - - $results = []; - - for ($i = 0; $i < $times; $i++) { - $results[] = $this->runCallback(); - } - - return $results; - } - - /** - * Run the winner or loser callback, randomly. - * - * @param mixed ...$args - * @return callable - */ - protected function runCallback(...$args) - { - return $this->wins() - ? ($this->winner ?? fn () => true)(...$args) - : ($this->loser ?? fn () => false)(...$args); - } - - /** - * Determine if the lottery "wins" or "loses". - * - * @return bool - */ - protected function wins() - { - return static::resultFactory()($this->chances, $this->outOf); - } - - /** - * The factory that determines the lottery result. - * - * @return callable - */ - protected static function resultFactory() - { - return static::$resultFactory ?? fn ($chances, $outOf) => $outOf === null - ? random_int(0, PHP_INT_MAX) / PHP_INT_MAX <= $chances - : random_int(1, $outOf) <= $chances; - } - - /** - * Force the lottery to always result in a win. - * - * @param callable|null $callback - * @return void - */ - public static function alwaysWin($callback = null) - { - self::setResultFactory(fn () => true); - - if ($callback === null) { - return; - } - - $callback(); - - static::determineResultNormally(); - } - - /** - * Force the lottery to always result in a lose. - * - * @param callable|null $callback - * @return void - */ - public static function alwaysLose($callback = null) - { - self::setResultFactory(fn () => false); - - if ($callback === null) { - return; - } - - $callback(); - - static::determineResultNormally(); - } - - /** - * Set the sequence that will be used to determine lottery results. - * - * @param array $sequence - * @param callable|null $whenMissing - * @return void - */ - public static function fix($sequence, $whenMissing = null) - { - return static::forceResultWithSequence($sequence, $whenMissing); - } - - /** - * Set the sequence that will be used to determine lottery results. - * - * @param array $sequence - * @param callable|null $whenMissing - * @return void - */ - public static function forceResultWithSequence($sequence, $whenMissing = null) - { - $next = 0; - - $whenMissing ??= function ($chances, $outOf) use (&$next) { - $factoryCache = static::$resultFactory; - - static::$resultFactory = null; - - $result = static::resultFactory()($chances, $outOf); - - static::$resultFactory = $factoryCache; - - $next++; - - return $result; - }; - - static::setResultFactory(function ($chances, $outOf) use (&$next, $sequence, $whenMissing) { - if (array_key_exists($next, $sequence)) { - return $sequence[$next++]; - } - - return $whenMissing($chances, $outOf); - }); - } - - /** - * Indicate that the lottery results should be determined normally. - * - * @return void - */ - public static function determineResultNormally() - { - static::$resultFactory = null; - } - - /** - * Set the factory that should be used to determine the lottery results. - * - * @param callable $factory - * @return void - */ - public static function setResultFactory($factory) - { - self::$resultFactory = $factory; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Manager.php b/framework-9.50.2/src/Illuminate/Support/Manager.php deleted file mode 100755 index f8ae072..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Manager.php +++ /dev/null @@ -1,193 +0,0 @@ -container = $container; - $this->config = $container->make('config'); - } - - /** - * Get the default driver name. - * - * @return string - */ - abstract public function getDefaultDriver(); - - /** - * Get a driver instance. - * - * @param string|null $driver - * @return mixed - * - * @throws \InvalidArgumentException - */ - public function driver($driver = null) - { - $driver = $driver ?: $this->getDefaultDriver(); - - if (is_null($driver)) { - throw new InvalidArgumentException(sprintf( - 'Unable to resolve NULL driver for [%s].', static::class - )); - } - - // If the given driver has not been created before, we will create the instances - // here and cache it so we can return it next time very quickly. If there is - // already a driver created by this name, we'll just return that instance. - if (! isset($this->drivers[$driver])) { - $this->drivers[$driver] = $this->createDriver($driver); - } - - return $this->drivers[$driver]; - } - - /** - * Create a new driver instance. - * - * @param string $driver - * @return mixed - * - * @throws \InvalidArgumentException - */ - protected function createDriver($driver) - { - // First, we will determine if a custom driver creator exists for the given driver and - // if it does not we will check for a creator method for the driver. Custom creator - // callbacks allow developers to build their own "drivers" easily using Closures. - if (isset($this->customCreators[$driver])) { - return $this->callCustomCreator($driver); - } else { - $method = 'create'.Str::studly($driver).'Driver'; - - if (method_exists($this, $method)) { - return $this->$method(); - } - } - - throw new InvalidArgumentException("Driver [$driver] not supported."); - } - - /** - * Call a custom driver creator. - * - * @param string $driver - * @return mixed - */ - protected function callCustomCreator($driver) - { - return $this->customCreators[$driver]($this->container); - } - - /** - * 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; - } - - /** - * Get all of the created "drivers". - * - * @return array - */ - public function getDrivers() - { - return $this->drivers; - } - - /** - * Get the container instance used by the manager. - * - * @return \Illuminate\Contracts\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Set the container instance used by the manager. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } - - /** - * Forget all of the resolved driver instances. - * - * @return $this - */ - public function forgetDrivers() - { - $this->drivers = []; - - 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); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/MessageBag.php b/framework-9.50.2/src/Illuminate/Support/MessageBag.php deleted file mode 100755 index 88ebfb0..0000000 --- a/framework-9.50.2/src/Illuminate/Support/MessageBag.php +++ /dev/null @@ -1,420 +0,0 @@ - $value) { - $value = $value instanceof Arrayable ? $value->toArray() : (array) $value; - - $this->messages[$key] = array_unique($value); - } - } - - /** - * Get the keys present in the message bag. - * - * @return array - */ - public function keys() - { - return array_keys($this->messages); - } - - /** - * Add a message to the message bag. - * - * @param string $key - * @param string $message - * @return $this - */ - public function add($key, $message) - { - if ($this->isUnique($key, $message)) { - $this->messages[$key][] = $message; - } - - return $this; - } - - /** - * Add a message to the message bag if the given conditional is "true". - * - * @param bool $boolean - * @param string $key - * @param string $message - * @return $this - */ - public function addIf($boolean, $key, $message) - { - return $boolean ? $this->add($key, $message) : $this; - } - - /** - * Determine if a key and message combination already exists. - * - * @param string $key - * @param string $message - * @return bool - */ - protected function isUnique($key, $message) - { - $messages = (array) $this->messages; - - return ! isset($messages[$key]) || ! in_array($message, $messages[$key]); - } - - /** - * Merge a new array of messages into the message bag. - * - * @param \Illuminate\Contracts\Support\MessageProvider|array $messages - * @return $this - */ - public function merge($messages) - { - if ($messages instanceof MessageProvider) { - $messages = $messages->getMessageBag()->getMessages(); - } - - $this->messages = array_merge_recursive($this->messages, $messages); - - return $this; - } - - /** - * Determine if messages exist for all of the given keys. - * - * @param array|string|null $key - * @return bool - */ - public function has($key) - { - if ($this->isEmpty()) { - return false; - } - - if (is_null($key)) { - return $this->any(); - } - - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $key) { - if ($this->first($key) === '') { - return false; - } - } - - return true; - } - - /** - * Determine if messages exist for any of the given keys. - * - * @param array|string|null $keys - * @return bool - */ - public function hasAny($keys = []) - { - if ($this->isEmpty()) { - return false; - } - - $keys = is_array($keys) ? $keys : func_get_args(); - - foreach ($keys as $key) { - if ($this->has($key)) { - return true; - } - } - - return false; - } - - /** - * Get the first message from the message bag for a given key. - * - * @param string|null $key - * @param string|null $format - * @return string - */ - public function first($key = null, $format = null) - { - $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); - - $firstMessage = Arr::first($messages, null, ''); - - return is_array($firstMessage) ? Arr::first($firstMessage) : $firstMessage; - } - - /** - * Get all of the messages from the message bag for a given key. - * - * @param string $key - * @param string|null $format - * @return array - */ - public function get($key, $format = null) - { - // If the message exists in the message bag, we will transform it and return - // the message. Otherwise, we will check if the key is implicit & collect - // all the messages that match the given key and output it as an array. - if (array_key_exists($key, $this->messages)) { - return $this->transform( - $this->messages[$key], $this->checkFormat($format), $key - ); - } - - if (str_contains($key, '*')) { - return $this->getMessagesForWildcardKey($key, $format); - } - - return []; - } - - /** - * Get the messages for a wildcard key. - * - * @param string $key - * @param string|null $format - * @return array - */ - protected function getMessagesForWildcardKey($key, $format) - { - return collect($this->messages) - ->filter(function ($messages, $messageKey) use ($key) { - return Str::is($key, $messageKey); - }) - ->map(function ($messages, $messageKey) use ($format) { - return $this->transform( - $messages, $this->checkFormat($format), $messageKey - ); - })->all(); - } - - /** - * Get all of the messages for every key in the message bag. - * - * @param string|null $format - * @return array - */ - public function all($format = null) - { - $format = $this->checkFormat($format); - - $all = []; - - foreach ($this->messages as $key => $messages) { - $all = array_merge($all, $this->transform($messages, $format, $key)); - } - - return $all; - } - - /** - * Get all of the unique messages for every key in the message bag. - * - * @param string|null $format - * @return array - */ - public function unique($format = null) - { - return array_unique($this->all($format)); - } - - /** - * Format an array of messages. - * - * @param array $messages - * @param string $format - * @param string $messageKey - * @return array - */ - protected function transform($messages, $format, $messageKey) - { - if ($format == ':message') { - return (array) $messages; - } - - return collect((array) $messages) - ->map(function ($message) use ($format, $messageKey) { - // We will simply spin through the given messages and transform each one - // replacing the :message place holder with the real message allowing - // the messages to be easily formatted to each developer's desires. - return str_replace([':message', ':key'], [$message, $messageKey], $format); - })->all(); - } - - /** - * Get the appropriate format based on the given format. - * - * @param string $format - * @return string - */ - protected function checkFormat($format) - { - return $format ?: $this->format; - } - - /** - * Get the raw messages in the message bag. - * - * @return array - */ - public function messages() - { - return $this->messages; - } - - /** - * Get the raw messages in the message bag. - * - * @return array - */ - public function getMessages() - { - return $this->messages(); - } - - /** - * Get the messages for the instance. - * - * @return \Illuminate\Support\MessageBag - */ - public function getMessageBag() - { - return $this; - } - - /** - * Get the default message format. - * - * @return string - */ - public function getFormat() - { - return $this->format; - } - - /** - * Set the default message format. - * - * @param string $format - * @return \Illuminate\Support\MessageBag - */ - public function setFormat($format = ':message') - { - $this->format = $format; - - return $this; - } - - /** - * Determine if the message bag has any messages. - * - * @return bool - */ - public function isEmpty() - { - return ! $this->any(); - } - - /** - * Determine if the message bag has any messages. - * - * @return bool - */ - public function isNotEmpty() - { - return $this->any(); - } - - /** - * Determine if the message bag has any messages. - * - * @return bool - */ - public function any() - { - return $this->count() > 0; - } - - /** - * Get the number of messages in the message bag. - * - * @return int - */ - public function count(): int - { - return count($this->messages, COUNT_RECURSIVE) - count($this->messages); - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return $this->getMessages(); - } - - /** - * Convert the object into something JSON serializable. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->toArray(); - } - - /** - * Convert the object to its JSON representation. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->jsonSerialize(), $options); - } - - /** - * Convert the message bag to its string representation. - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/MultipleInstanceManager.php b/framework-9.50.2/src/Illuminate/Support/MultipleInstanceManager.php deleted file mode 100644 index 8544bdf..0000000 --- a/framework-9.50.2/src/Illuminate/Support/MultipleInstanceManager.php +++ /dev/null @@ -1,191 +0,0 @@ -app = $app; - } - - /** - * Get the default instance name. - * - * @return string - */ - abstract public function getDefaultInstance(); - - /** - * Set the default instance name. - * - * @param string $name - * @return void - */ - abstract public function setDefaultInstance($name); - - /** - * Get the instance specific configuration. - * - * @param string $name - * @return array - */ - abstract public function getInstanceConfig($name); - - /** - * Get an instance instance by name. - * - * @param string|null $name - * @return mixed - */ - public function instance($name = null) - { - $name = $name ?: $this->getDefaultInstance(); - - return $this->instances[$name] = $this->get($name); - } - - /** - * Attempt to get an instance from the local cache. - * - * @param string $name - * @return mixed - */ - protected function get($name) - { - return $this->instances[$name] ?? $this->resolve($name); - } - - /** - * Resolve the given instance. - * - * @param string $name - * @return mixed - * - * @throws \InvalidArgumentException - */ - protected function resolve($name) - { - $config = $this->getInstanceConfig($name); - - if (is_null($config)) { - throw new InvalidArgumentException("Instance [{$name}] is not defined."); - } - - if (! array_key_exists('driver', $config)) { - throw new RuntimeException("Instance [{$name}] does not specify a driver."); - } - - if (isset($this->customCreators[$config['driver']])) { - return $this->callCustomCreator($config); - } else { - $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; - - if (method_exists($this, $driverMethod)) { - return $this->{$driverMethod}($config); - } else { - throw new InvalidArgumentException("Instance driver [{$config['driver']}] is not supported."); - } - } - } - - /** - * Call a custom instance creator. - * - * @param array $config - * @return mixed - */ - protected function callCustomCreator(array $config) - { - return $this->customCreators[$config['driver']]($this->app, $config); - } - - /** - * Unset the given instances. - * - * @param array|string|null $name - * @return $this - */ - public function forgetInstance($name = null) - { - $name ??= $this->getDefaultInstance(); - - foreach ((array) $name as $instanceName) { - if (isset($this->instances[$instanceName])) { - unset($this->instances[$instanceName]); - } - } - - return $this; - } - - /** - * Disconnect the given instance and remove from local cache. - * - * @param string|null $name - * @return void - */ - public function purge($name = null) - { - $name ??= $this->getDefaultInstance(); - - unset($this->instances[$name]); - } - - /** - * Register a custom instance creator Closure. - * - * @param string $name - * @param \Closure $callback - * @return $this - */ - public function extend($name, Closure $callback) - { - $this->customCreators[$name] = $callback->bindTo($this, $this); - - return $this; - } - - /** - * Dynamically call the default instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->instance()->$method(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/NamespacedItemResolver.php b/framework-9.50.2/src/Illuminate/Support/NamespacedItemResolver.php deleted file mode 100755 index a059c6d..0000000 --- a/framework-9.50.2/src/Illuminate/Support/NamespacedItemResolver.php +++ /dev/null @@ -1,112 +0,0 @@ -parsed[$key])) { - return $this->parsed[$key]; - } - - // If the key does not contain a double colon, it means the key is not in a - // namespace, and is just a regular configuration item. Namespaces are a - // tool for organizing configuration items for things such as modules. - if (! str_contains($key, '::')) { - $segments = explode('.', $key); - - $parsed = $this->parseBasicSegments($segments); - } else { - $parsed = $this->parseNamespacedSegments($key); - } - - // Once we have the parsed array of this key's elements, such as its groups - // and namespace, we will cache each array inside a simple list that has - // the key and the parsed array for quick look-ups for later requests. - return $this->parsed[$key] = $parsed; - } - - /** - * Parse an array of basic segments. - * - * @param array $segments - * @return array - */ - protected function parseBasicSegments(array $segments) - { - // The first segment in a basic array will always be the group, so we can go - // ahead and grab that segment. If there is only one total segment we are - // just pulling an entire group out of the array and not a single item. - $group = $segments[0]; - - // If there is more than one segment in this group, it means we are pulling - // a specific item out of a group and will need to return this item name - // as well as the group so we know which item to pull from the arrays. - $item = count($segments) === 1 - ? null - : implode('.', array_slice($segments, 1)); - - return [null, $group, $item]; - } - - /** - * Parse an array of namespaced segments. - * - * @param string $key - * @return array - */ - protected function parseNamespacedSegments($key) - { - [$namespace, $item] = explode('::', $key); - - // First we'll just explode the first segment to get the namespace and group - // since the item should be in the remaining segments. Once we have these - // two pieces of data we can proceed with parsing out the item's value. - $itemSegments = explode('.', $item); - - $groupAndItem = array_slice( - $this->parseBasicSegments($itemSegments), 1 - ); - - return array_merge([$namespace], $groupAndItem); - } - - /** - * Set the parsed value of a key. - * - * @param string $key - * @param array $parsed - * @return void - */ - public function setParsedKey($key, $parsed) - { - $this->parsed[$key] = $parsed; - } - - /** - * Flush the cache of parsed keys. - * - * @return void - */ - public function flushParsedKeys() - { - $this->parsed = []; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Optional.php b/framework-9.50.2/src/Illuminate/Support/Optional.php deleted file mode 100644 index ba84a2c..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Optional.php +++ /dev/null @@ -1,131 +0,0 @@ -value = $value; - } - - /** - * Dynamically access a property on the underlying object. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - if (is_object($this->value)) { - return $this->value->{$key} ?? null; - } - } - - /** - * Dynamically check a property exists on the underlying object. - * - * @param mixed $name - * @return bool - */ - public function __isset($name) - { - if (is_object($this->value)) { - return isset($this->value->{$name}); - } - - if (is_array($this->value) || $this->value instanceof ArrayObject) { - return isset($this->value[$name]); - } - - return false; - } - - /** - * Determine if an item exists at an offset. - * - * @param mixed $key - * @return bool - */ - public function offsetExists($key): bool - { - return Arr::accessible($this->value) && Arr::exists($this->value, $key); - } - - /** - * Get an item at a given offset. - * - * @param mixed $key - * @return mixed - */ - public function offsetGet($key): mixed - { - return Arr::get($this->value, $key); - } - - /** - * Set the item at a given offset. - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value): void - { - if (Arr::accessible($this->value)) { - $this->value[$key] = $value; - } - } - - /** - * Unset the item at a given offset. - * - * @param string $key - * @return void - */ - public function offsetUnset($key): void - { - if (Arr::accessible($this->value)) { - unset($this->value[$key]); - } - } - - /** - * Dynamically pass a method to the underlying object. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - if (is_object($this->value)) { - return $this->value->{$method}(...$parameters); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Pluralizer.php b/framework-9.50.2/src/Illuminate/Support/Pluralizer.php deleted file mode 100755 index 0d909de..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Pluralizer.php +++ /dev/null @@ -1,127 +0,0 @@ -pluralize($value); - - return static::matchCase($plural, $value); - } - - /** - * Get the singular form of an English word. - * - * @param string $value - * @return string - */ - public static function singular($value) - { - $singular = static::inflector()->singularize($value); - - return static::matchCase($singular, $value); - } - - /** - * Determine if the given value is uncountable. - * - * @param string $value - * @return bool - */ - protected static function uncountable($value) - { - return in_array(strtolower($value), static::$uncountable); - } - - /** - * Attempt to match the case on two strings. - * - * @param string $value - * @param string $comparison - * @return string - */ - protected static function matchCase($value, $comparison) - { - $functions = ['mb_strtolower', 'mb_strtoupper', 'ucfirst', 'ucwords']; - - foreach ($functions as $function) { - if ($function($comparison) === $comparison) { - return $function($value); - } - } - - return $value; - } - - /** - * Get the inflector instance. - * - * @return \Doctrine\Inflector\Inflector - */ - public static function inflector() - { - if (is_null(static::$inflector)) { - static::$inflector = InflectorFactory::createForLanguage(static::$language)->build(); - } - - return static::$inflector; - } - - /** - * Specify the language that should be used by the inflector. - * - * @param string $language - * @return void - */ - public static function useLanguage(string $language) - { - static::$language = $language; - - static::$inflector = null; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/ProcessUtils.php b/framework-9.50.2/src/Illuminate/Support/ProcessUtils.php deleted file mode 100644 index 165e751..0000000 --- a/framework-9.50.2/src/Illuminate/Support/ProcessUtils.php +++ /dev/null @@ -1,69 +0,0 @@ - 2 && $char === $arg[0] && $char === $arg[strlen($arg) - 1]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Reflector.php b/framework-9.50.2/src/Illuminate/Support/Reflector.php deleted file mode 100644 index 1390c9d..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Reflector.php +++ /dev/null @@ -1,162 +0,0 @@ -isPublic(); - } - - if (is_object($var[0]) && method_exists($class, '__call')) { - return (new ReflectionMethod($class, '__call'))->isPublic(); - } - - if (! is_object($var[0]) && method_exists($class, '__callStatic')) { - return (new ReflectionMethod($class, '__callStatic'))->isPublic(); - } - - return false; - } - - /** - * Get the class name of the given parameter's type, if possible. - * - * @param \ReflectionParameter $parameter - * @return string|null - */ - public static function getParameterClassName($parameter) - { - $type = $parameter->getType(); - - if (! $type instanceof ReflectionNamedType || $type->isBuiltin()) { - return; - } - - return static::getTypeName($parameter, $type); - } - - /** - * Get the class names of the given parameter's type, including union types. - * - * @param \ReflectionParameter $parameter - * @return array - */ - public static function getParameterClassNames($parameter) - { - $type = $parameter->getType(); - - if (! $type instanceof ReflectionUnionType) { - return array_filter([static::getParameterClassName($parameter)]); - } - - $unionTypes = []; - - foreach ($type->getTypes() as $listedType) { - if (! $listedType instanceof ReflectionNamedType || $listedType->isBuiltin()) { - continue; - } - - $unionTypes[] = static::getTypeName($parameter, $listedType); - } - - return array_filter($unionTypes); - } - - /** - * Get the given type's class name. - * - * @param \ReflectionParameter $parameter - * @param \ReflectionNamedType $type - * @return string - */ - protected static function getTypeName($parameter, $type) - { - $name = $type->getName(); - - if (! is_null($class = $parameter->getDeclaringClass())) { - if ($name === 'self') { - return $class->getName(); - } - - if ($name === 'parent' && $parent = $class->getParentClass()) { - return $parent->getName(); - } - } - - return $name; - } - - /** - * Determine if the parameter's type is a subclass of the given type. - * - * @param \ReflectionParameter $parameter - * @param string $className - * @return bool - */ - public static function isParameterSubclassOf($parameter, $className) - { - $paramClassName = static::getParameterClassName($parameter); - - return $paramClassName - && (class_exists($paramClassName) || interface_exists($paramClassName)) - && (new ReflectionClass($paramClassName))->isSubclassOf($className); - } - - /** - * Determine if the parameter's type is a Backed Enum with a string backing type. - * - * @param \ReflectionParameter $parameter - * @return bool - */ - public static function isParameterBackedEnumWithStringBackingType($parameter) - { - $backedEnumClass = (string) $parameter->getType(); - - if (function_exists('enum_exists') && enum_exists($backedEnumClass)) { - $reflectionBackedEnum = new ReflectionEnum($backedEnumClass); - - return $reflectionBackedEnum->isBacked() - && $reflectionBackedEnum->getBackingType()->getName() == 'string'; - } - - return false; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/ServiceProvider.php b/framework-9.50.2/src/Illuminate/Support/ServiceProvider.php deleted file mode 100755 index 6c530c1..0000000 --- a/framework-9.50.2/src/Illuminate/Support/ServiceProvider.php +++ /dev/null @@ -1,437 +0,0 @@ -app = $app; - } - - /** - * Register any application services. - * - * @return void - */ - public function register() - { - // - } - - /** - * Register a booting callback to be run before the "boot" method is called. - * - * @param \Closure $callback - * @return void - */ - public function booting(Closure $callback) - { - $this->bootingCallbacks[] = $callback; - } - - /** - * Register a booted callback to be run after the "boot" method is called. - * - * @param \Closure $callback - * @return void - */ - public function booted(Closure $callback) - { - $this->bootedCallbacks[] = $callback; - } - - /** - * Call the registered booting callbacks. - * - * @return void - */ - public function callBootingCallbacks() - { - $index = 0; - - while ($index < count($this->bootingCallbacks)) { - $this->app->call($this->bootingCallbacks[$index]); - - $index++; - } - } - - /** - * Call the registered booted callbacks. - * - * @return void - */ - public function callBootedCallbacks() - { - $index = 0; - - while ($index < count($this->bootedCallbacks)) { - $this->app->call($this->bootedCallbacks[$index]); - - $index++; - } - } - - /** - * Merge the given configuration with the existing configuration. - * - * @param string $path - * @param string $key - * @return void - */ - protected function mergeConfigFrom($path, $key) - { - if (! ($this->app instanceof CachesConfiguration && $this->app->configurationIsCached())) { - $config = $this->app->make('config'); - - $config->set($key, array_merge( - require $path, $config->get($key, []) - )); - } - } - - /** - * Load the given routes file if routes are not already cached. - * - * @param string $path - * @return void - */ - protected function loadRoutesFrom($path) - { - if (! ($this->app instanceof CachesRoutes && $this->app->routesAreCached())) { - require $path; - } - } - - /** - * Register a view file namespace. - * - * @param string|array $path - * @param string $namespace - * @return void - */ - protected function loadViewsFrom($path, $namespace) - { - $this->callAfterResolving('view', function ($view) use ($path, $namespace) { - if (isset($this->app->config['view']['paths']) && - is_array($this->app->config['view']['paths'])) { - foreach ($this->app->config['view']['paths'] as $viewPath) { - if (is_dir($appPath = $viewPath.'/vendor/'.$namespace)) { - $view->addNamespace($namespace, $appPath); - } - } - } - - $view->addNamespace($namespace, $path); - }); - } - - /** - * Register the given view components with a custom prefix. - * - * @param string $prefix - * @param array $components - * @return void - */ - protected function loadViewComponentsAs($prefix, array $components) - { - $this->callAfterResolving(BladeCompiler::class, function ($blade) use ($prefix, $components) { - foreach ($components as $alias => $component) { - $blade->component($component, is_string($alias) ? $alias : null, $prefix); - } - }); - } - - /** - * Register a translation file namespace. - * - * @param string $path - * @param string $namespace - * @return void - */ - protected function loadTranslationsFrom($path, $namespace) - { - $this->callAfterResolving('translator', function ($translator) use ($path, $namespace) { - $translator->addNamespace($namespace, $path); - }); - } - - /** - * Register a JSON translation file path. - * - * @param string $path - * @return void - */ - protected function loadJsonTranslationsFrom($path) - { - $this->callAfterResolving('translator', function ($translator) use ($path) { - $translator->addJsonPath($path); - }); - } - - /** - * Register database migration paths. - * - * @param array|string $paths - * @return void - */ - protected function loadMigrationsFrom($paths) - { - $this->callAfterResolving('migrator', function ($migrator) use ($paths) { - foreach ((array) $paths as $path) { - $migrator->path($path); - } - }); - } - - /** - * Register Eloquent model factory paths. - * - * @deprecated Will be removed in a future Laravel version. - * - * @param array|string $paths - * @return void - */ - protected function loadFactoriesFrom($paths) - { - $this->callAfterResolving(ModelFactory::class, function ($factory) use ($paths) { - foreach ((array) $paths as $path) { - $factory->load($path); - } - }); - } - - /** - * Setup an after resolving listener, or fire immediately if already resolved. - * - * @param string $name - * @param callable $callback - * @return void - */ - protected function callAfterResolving($name, $callback) - { - $this->app->afterResolving($name, $callback); - - if ($this->app->resolved($name)) { - $callback($this->app->make($name), $this->app); - } - } - - /** - * Register paths to be published by the publish command. - * - * @param array $paths - * @param mixed $groups - * @return void - */ - protected function publishes(array $paths, $groups = null) - { - $this->ensurePublishArrayInitialized($class = static::class); - - static::$publishes[$class] = array_merge(static::$publishes[$class], $paths); - - foreach ((array) $groups as $group) { - $this->addPublishGroup($group, $paths); - } - } - - /** - * Ensure the publish array for the service provider is initialized. - * - * @param string $class - * @return void - */ - protected function ensurePublishArrayInitialized($class) - { - if (! array_key_exists($class, static::$publishes)) { - static::$publishes[$class] = []; - } - } - - /** - * Add a publish group / tag to the service provider. - * - * @param string $group - * @param array $paths - * @return void - */ - protected function addPublishGroup($group, $paths) - { - if (! array_key_exists($group, static::$publishGroups)) { - static::$publishGroups[$group] = []; - } - - static::$publishGroups[$group] = array_merge( - static::$publishGroups[$group], $paths - ); - } - - /** - * Get the paths to publish. - * - * @param string|null $provider - * @param string|null $group - * @return array - */ - public static function pathsToPublish($provider = null, $group = null) - { - if (! is_null($paths = static::pathsForProviderOrGroup($provider, $group))) { - return $paths; - } - - return collect(static::$publishes)->reduce(function ($paths, $p) { - return array_merge($paths, $p); - }, []); - } - - /** - * Get the paths for the provider or group (or both). - * - * @param string|null $provider - * @param string|null $group - * @return array - */ - protected static function pathsForProviderOrGroup($provider, $group) - { - if ($provider && $group) { - return static::pathsForProviderAndGroup($provider, $group); - } elseif ($group && array_key_exists($group, static::$publishGroups)) { - return static::$publishGroups[$group]; - } elseif ($provider && array_key_exists($provider, static::$publishes)) { - return static::$publishes[$provider]; - } elseif ($group || $provider) { - return []; - } - } - - /** - * Get the paths for the provider and group. - * - * @param string $provider - * @param string $group - * @return array - */ - protected static function pathsForProviderAndGroup($provider, $group) - { - if (! empty(static::$publishes[$provider]) && ! empty(static::$publishGroups[$group])) { - return array_intersect_key(static::$publishes[$provider], static::$publishGroups[$group]); - } - - return []; - } - - /** - * Get the service providers available for publishing. - * - * @return array - */ - public static function publishableProviders() - { - return array_keys(static::$publishes); - } - - /** - * Get the groups available for publishing. - * - * @return array - */ - public static function publishableGroups() - { - return array_keys(static::$publishGroups); - } - - /** - * Register the package's custom Artisan commands. - * - * @param array|mixed $commands - * @return void - */ - public function commands($commands) - { - $commands = is_array($commands) ? $commands : func_get_args(); - - Artisan::starting(function ($artisan) use ($commands) { - $artisan->resolveCommands($commands); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return []; - } - - /** - * Get the events that trigger this service provider to register. - * - * @return array - */ - public function when() - { - return []; - } - - /** - * Determine if the provider is deferred. - * - * @return bool - */ - public function isDeferred() - { - return $this instanceof DeferrableProvider; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Str.php b/framework-9.50.2/src/Illuminate/Support/Str.php deleted file mode 100644 index 2c7912e..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Str.php +++ /dev/null @@ -1,1367 +0,0 @@ - $needles - * @param bool $ignoreCase - * @return bool - */ - public static function contains($haystack, $needles, $ignoreCase = false) - { - if ($ignoreCase) { - $haystack = mb_strtolower($haystack); - } - - if (! is_iterable($needles)) { - $needles = (array) $needles; - } - - foreach ($needles as $needle) { - if ($ignoreCase) { - $needle = mb_strtolower($needle); - } - - if ($needle !== '' && str_contains($haystack, $needle)) { - return true; - } - } - - return false; - } - - /** - * Determine if a given string contains all array values. - * - * @param string $haystack - * @param iterable $needles - * @param bool $ignoreCase - * @return bool - */ - public static function containsAll($haystack, $needles, $ignoreCase = false) - { - foreach ($needles as $needle) { - if (! static::contains($haystack, $needle, $ignoreCase)) { - return false; - } - } - - return true; - } - - /** - * Determine if a given string ends with a given substring. - * - * @param string $haystack - * @param string|iterable $needles - * @return bool - */ - public static function endsWith($haystack, $needles) - { - if (! is_iterable($needles)) { - $needles = (array) $needles; - } - - foreach ($needles as $needle) { - if ((string) $needle !== '' && str_ends_with($haystack, $needle)) { - return true; - } - } - - return false; - } - - /** - * Extracts an excerpt from text that matches the first instance of a phrase. - * - * @param string $text - * @param string $phrase - * @param array $options - * @return string|null - */ - public static function excerpt($text, $phrase = '', $options = []) - { - $radius = $options['radius'] ?? 100; - $omission = $options['omission'] ?? '...'; - - preg_match('/^(.*?)('.preg_quote((string) $phrase).')(.*)$/iu', (string) $text, $matches); - - if (empty($matches)) { - return null; - } - - $start = ltrim($matches[1]); - - $start = str(mb_substr($start, max(mb_strlen($start, 'UTF-8') - $radius, 0), $radius, 'UTF-8'))->ltrim()->unless( - fn ($startWithRadius) => $startWithRadius->exactly($start), - fn ($startWithRadius) => $startWithRadius->prepend($omission), - ); - - $end = rtrim($matches[3]); - - $end = str(mb_substr($end, 0, $radius, 'UTF-8'))->rtrim()->unless( - fn ($endWithRadius) => $endWithRadius->exactly($end), - fn ($endWithRadius) => $endWithRadius->append($omission), - ); - - return $start->append($matches[2], $end)->toString(); - } - - /** - * Cap a string with a single instance of a given value. - * - * @param string $value - * @param string $cap - * @return string - */ - public static function finish($value, $cap) - { - $quoted = preg_quote($cap, '/'); - - return preg_replace('/(?:'.$quoted.')+$/u', '', $value).$cap; - } - - /** - * Wrap the string with the given strings. - * - * @param string $value - * @param string $before - * @param string|null $after - * @return string - */ - public static function wrap($value, $before, $after = null) - { - return $before.$value.($after ??= $before); - } - - /** - * Determine if a given string matches a given pattern. - * - * @param string|iterable $pattern - * @param string $value - * @return bool - */ - public static function is($pattern, $value) - { - $value = (string) $value; - - if (! is_iterable($pattern)) { - $pattern = [$pattern]; - } - - foreach ($pattern as $pattern) { - $pattern = (string) $pattern; - - // If the given value is an exact match we can of course return true right - // from the beginning. Otherwise, we will translate asterisks and do an - // actual pattern match against the two strings to see if they match. - if ($pattern === $value) { - return true; - } - - $pattern = preg_quote($pattern, '#'); - - // Asterisks are translated into zero-or-more regular expression wildcards - // to make it convenient to check if the strings starts with the given - // pattern such as "library/*", making any string check convenient. - $pattern = str_replace('\*', '.*', $pattern); - - if (preg_match('#^'.$pattern.'\z#u', $value) === 1) { - return true; - } - } - - return false; - } - - /** - * Determine if a given string is 7 bit ASCII. - * - * @param string $value - * @return bool - */ - public static function isAscii($value) - { - return ASCII::is_ascii((string) $value); - } - - /** - * Determine if a given string is valid JSON. - * - * @param string $value - * @return bool - */ - public static function isJson($value) - { - if (! is_string($value)) { - return false; - } - - try { - json_decode($value, true, 512, JSON_THROW_ON_ERROR); - } catch (JsonException) { - return false; - } - - return true; - } - - /** - * Determine if a given string is a valid UUID. - * - * @param string $value - * @return bool - */ - public static function isUuid($value) - { - if (! is_string($value)) { - return false; - } - - return preg_match('/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iD', $value) > 0; - } - - /** - * Determine if a given string is a valid ULID. - * - * @param string $value - * @return bool - */ - public static function isUlid($value) - { - if (! is_string($value)) { - return false; - } - - return Ulid::isValid($value); - } - - /** - * Convert a string to kebab case. - * - * @param string $value - * @return string - */ - public static function kebab($value) - { - return static::snake($value, '-'); - } - - /** - * Return the length of the given string. - * - * @param string $value - * @param string|null $encoding - * @return int - */ - public static function length($value, $encoding = null) - { - if ($encoding) { - return mb_strlen($value, $encoding); - } - - return mb_strlen($value); - } - - /** - * Limit the number of characters in a string. - * - * @param string $value - * @param int $limit - * @param string $end - * @return string - */ - public static function limit($value, $limit = 100, $end = '...') - { - if (mb_strwidth($value, 'UTF-8') <= $limit) { - return $value; - } - - return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')).$end; - } - - /** - * Convert the given string to lower-case. - * - * @param string $value - * @return string - */ - public static function lower($value) - { - return mb_strtolower($value, 'UTF-8'); - } - - /** - * Limit the number of words in a string. - * - * @param string $value - * @param int $words - * @param string $end - * @return string - */ - public static function words($value, $words = 100, $end = '...') - { - preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); - - if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) { - return $value; - } - - return rtrim($matches[0]).$end; - } - - /** - * Converts GitHub flavored Markdown into HTML. - * - * @param string $string - * @param array $options - * @return string - */ - public static function markdown($string, array $options = []) - { - $converter = new GithubFlavoredMarkdownConverter($options); - - return (string) $converter->convert($string); - } - - /** - * Converts inline Markdown into HTML. - * - * @param string $string - * @param array $options - * @return string - */ - public static function inlineMarkdown($string, array $options = []) - { - $environment = new Environment($options); - - $environment->addExtension(new GithubFlavoredMarkdownExtension()); - $environment->addExtension(new InlinesOnlyExtension()); - - $converter = new MarkdownConverter($environment); - - return (string) $converter->convert($string); - } - - /** - * Masks a portion of a string with a repeated character. - * - * @param string $string - * @param string $character - * @param int $index - * @param int|null $length - * @param string $encoding - * @return string - */ - public static function mask($string, $character, $index, $length = null, $encoding = 'UTF-8') - { - if ($character === '') { - return $string; - } - - $segment = mb_substr($string, $index, $length, $encoding); - - if ($segment === '') { - return $string; - } - - $strlen = mb_strlen($string, $encoding); - $startIndex = $index; - - if ($index < 0) { - $startIndex = $index < -$strlen ? 0 : $strlen + $index; - } - - $start = mb_substr($string, 0, $startIndex, $encoding); - $segmentLen = mb_strlen($segment, $encoding); - $end = mb_substr($string, $startIndex + $segmentLen); - - return $start.str_repeat(mb_substr($character, 0, 1, $encoding), $segmentLen).$end; - } - - /** - * Get the string matching the given pattern. - * - * @param string $pattern - * @param string $subject - * @return string - */ - public static function match($pattern, $subject) - { - preg_match($pattern, $subject, $matches); - - if (! $matches) { - return ''; - } - - return $matches[1] ?? $matches[0]; - } - - /** - * Get the string matching the given pattern. - * - * @param string $pattern - * @param string $subject - * @return \Illuminate\Support\Collection - */ - public static function matchAll($pattern, $subject) - { - preg_match_all($pattern, $subject, $matches); - - if (empty($matches[0])) { - return collect(); - } - - return collect($matches[1] ?? $matches[0]); - } - - /** - * Pad both sides of a string with another. - * - * @param string $value - * @param int $length - * @param string $pad - * @return string - */ - public static function padBoth($value, $length, $pad = ' ') - { - $short = max(0, $length - mb_strlen($value)); - $shortLeft = floor($short / 2); - $shortRight = ceil($short / 2); - - return mb_substr(str_repeat($pad, $shortLeft), 0, $shortLeft). - $value. - mb_substr(str_repeat($pad, $shortRight), 0, $shortRight); - } - - /** - * Pad the left side of a string with another. - * - * @param string $value - * @param int $length - * @param string $pad - * @return string - */ - public static function padLeft($value, $length, $pad = ' ') - { - $short = max(0, $length - mb_strlen($value)); - - return mb_substr(str_repeat($pad, $short), 0, $short).$value; - } - - /** - * Pad the right side of a string with another. - * - * @param string $value - * @param int $length - * @param string $pad - * @return string - */ - public static function padRight($value, $length, $pad = ' ') - { - $short = max(0, $length - mb_strlen($value)); - - return $value.mb_substr(str_repeat($pad, $short), 0, $short); - } - - /** - * Parse a Class[@]method style callback into class and method. - * - * @param string $callback - * @param string|null $default - * @return array - */ - public static function parseCallback($callback, $default = null) - { - return static::contains($callback, '@') ? explode('@', $callback, 2) : [$callback, $default]; - } - - /** - * Get the plural form of an English word. - * - * @param string $value - * @param int|array|\Countable $count - * @return string - */ - public static function plural($value, $count = 2) - { - return Pluralizer::plural($value, $count); - } - - /** - * Pluralize the last word of an English, studly caps case string. - * - * @param string $value - * @param int|array|\Countable $count - * @return string - */ - public static function pluralStudly($value, $count = 2) - { - $parts = preg_split('/(.)(?=[A-Z])/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE); - - $lastWord = array_pop($parts); - - return implode('', $parts).self::plural($lastWord, $count); - } - - /** - * Generate a more truly "random" alpha-numeric string. - * - * @param int $length - * @return string - */ - public static function random($length = 16) - { - return (static::$randomStringFactory ?? function ($length) { - $string = ''; - - while (($len = strlen($string)) < $length) { - $size = $length - $len; - - $bytesSize = (int) ceil(($size) / 3) * 3; - - $bytes = random_bytes($bytesSize); - - $string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size); - } - - return $string; - })($length); - } - - /** - * Set the callable that will be used to generate random strings. - * - * @param callable|null $factory - * @return void - */ - public static function createRandomStringsUsing(callable $factory = null) - { - static::$randomStringFactory = $factory; - } - - /** - * Set the sequence that will be used to generate random strings. - * - * @param array $sequence - * @param callable|null $whenMissing - * @return void - */ - public static function createRandomStringsUsingSequence(array $sequence, $whenMissing = null) - { - $next = 0; - - $whenMissing ??= function ($length) use (&$next) { - $factoryCache = static::$randomStringFactory; - - static::$randomStringFactory = null; - - $randomString = static::random($length); - - static::$randomStringFactory = $factoryCache; - - $next++; - - return $randomString; - }; - - static::createRandomStringsUsing(function ($length) use (&$next, $sequence, $whenMissing) { - if (array_key_exists($next, $sequence)) { - return $sequence[$next++]; - } - - return $whenMissing($length); - }); - } - - /** - * Indicate that random strings should be created normally and not using a custom factory. - * - * @return void - */ - public static function createRandomStringsNormally() - { - static::$randomStringFactory = null; - } - - /** - * Repeat the given string. - * - * @param string $string - * @param int $times - * @return string - */ - public static function repeat(string $string, int $times) - { - return str_repeat($string, $times); - } - - /** - * Replace a given value in the string sequentially with an array. - * - * @param string $search - * @param iterable $replace - * @param string $subject - * @return string - */ - public static function replaceArray($search, $replace, $subject) - { - if ($replace instanceof Traversable) { - $replace = collect($replace)->all(); - } - - $segments = explode($search, $subject); - - $result = array_shift($segments); - - foreach ($segments as $segment) { - $result .= (array_shift($replace) ?? $search).$segment; - } - - return $result; - } - - /** - * Replace the given value in the given string. - * - * @param string|iterable $search - * @param string|iterable $replace - * @param string|iterable $subject - * @return string - */ - public static function replace($search, $replace, $subject) - { - if ($search instanceof Traversable) { - $search = collect($search)->all(); - } - - if ($replace instanceof Traversable) { - $replace = collect($replace)->all(); - } - - if ($subject instanceof Traversable) { - $subject = collect($subject)->all(); - } - - return str_replace($search, $replace, $subject); - } - - /** - * Replace the first occurrence of a given value in the string. - * - * @param string $search - * @param string $replace - * @param string $subject - * @return string - */ - public static function replaceFirst($search, $replace, $subject) - { - $search = (string) $search; - - if ($search === '') { - return $subject; - } - - $position = strpos($subject, $search); - - if ($position !== false) { - return substr_replace($subject, $replace, $position, strlen($search)); - } - - return $subject; - } - - /** - * Replace the last occurrence of a given value in the string. - * - * @param string $search - * @param string $replace - * @param string $subject - * @return string - */ - public static function replaceLast($search, $replace, $subject) - { - if ($search === '') { - return $subject; - } - - $position = strrpos($subject, $search); - - if ($position !== false) { - return substr_replace($subject, $replace, $position, strlen($search)); - } - - return $subject; - } - - /** - * Remove any occurrence of the given string in the subject. - * - * @param string|iterable $search - * @param string $subject - * @param bool $caseSensitive - * @return string - */ - public static function remove($search, $subject, $caseSensitive = true) - { - if ($search instanceof Traversable) { - $search = collect($search)->all(); - } - - $subject = $caseSensitive - ? str_replace($search, '', $subject) - : str_ireplace($search, '', $subject); - - return $subject; - } - - /** - * Reverse the given string. - * - * @param string $value - * @return string - */ - public static function reverse(string $value) - { - return implode(array_reverse(mb_str_split($value))); - } - - /** - * Begin a string with a single instance of a given value. - * - * @param string $value - * @param string $prefix - * @return string - */ - public static function start($value, $prefix) - { - $quoted = preg_quote($prefix, '/'); - - return $prefix.preg_replace('/^(?:'.$quoted.')+/u', '', $value); - } - - /** - * Convert the given string to upper-case. - * - * @param string $value - * @return string - */ - public static function upper($value) - { - return mb_strtoupper($value, 'UTF-8'); - } - - /** - * Convert the given string to title case. - * - * @param string $value - * @return string - */ - public static function title($value) - { - return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8'); - } - - /** - * Convert the given string to title case for each word. - * - * @param string $value - * @return string - */ - public static function headline($value) - { - $parts = explode(' ', $value); - - $parts = count($parts) > 1 - ? array_map([static::class, 'title'], $parts) - : array_map([static::class, 'title'], static::ucsplit(implode('_', $parts))); - - $collapsed = static::replace(['-', '_', ' '], '_', implode('_', $parts)); - - return implode(' ', array_filter(explode('_', $collapsed))); - } - - /** - * Get the singular form of an English word. - * - * @param string $value - * @return string - */ - public static function singular($value) - { - return Pluralizer::singular($value); - } - - /** - * Generate a URL friendly "slug" from a given string. - * - * @param string $title - * @param string $separator - * @param string|null $language - * @param array $dictionary - * @return string - */ - public static function slug($title, $separator = '-', $language = 'en', $dictionary = ['@' => 'at']) - { - $title = $language ? static::ascii($title, $language) : $title; - - // Convert all dashes/underscores into separator - $flip = $separator === '-' ? '_' : '-'; - - $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); - - // Replace dictionary words - foreach ($dictionary as $key => $value) { - $dictionary[$key] = $separator.$value.$separator; - } - - $title = str_replace(array_keys($dictionary), array_values($dictionary), $title); - - // Remove all characters that are not the separator, letters, numbers, or whitespace - $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', static::lower($title)); - - // Replace all separator characters and whitespace by a single separator - $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title); - - return trim($title, $separator); - } - - /** - * Convert a string to snake case. - * - * @param string $value - * @param string $delimiter - * @return string - */ - public static function snake($value, $delimiter = '_') - { - $key = $value; - - if (isset(static::$snakeCache[$key][$delimiter])) { - return static::$snakeCache[$key][$delimiter]; - } - - if (! ctype_lower($value)) { - $value = preg_replace('/\s+/u', '', ucwords($value)); - - $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value)); - } - - return static::$snakeCache[$key][$delimiter] = $value; - } - - /** - * Remove all "extra" blank space from the given string. - * - * @param string $value - * @return string - */ - public static function squish($value) - { - return preg_replace('~(\s|\x{3164})+~u', ' ', preg_replace('~^[\s\x{FEFF}]+|[\s\x{FEFF}]+$~u', '', $value)); - } - - /** - * Determine if a given string starts with a given substring. - * - * @param string $haystack - * @param string|iterable $needles - * @return bool - */ - public static function startsWith($haystack, $needles) - { - if (! is_iterable($needles)) { - $needles = [$needles]; - } - - foreach ($needles as $needle) { - if ((string) $needle !== '' && str_starts_with($haystack, $needle)) { - return true; - } - } - - return false; - } - - /** - * Convert a value to studly caps case. - * - * @param string $value - * @return string - */ - public static function studly($value) - { - $key = $value; - - if (isset(static::$studlyCache[$key])) { - return static::$studlyCache[$key]; - } - - $words = explode(' ', static::replace(['-', '_'], ' ', $value)); - - $studlyWords = array_map(fn ($word) => static::ucfirst($word), $words); - - return static::$studlyCache[$key] = implode($studlyWords); - } - - /** - * Returns the portion of the string specified by the start and length parameters. - * - * @param string $string - * @param int $start - * @param int|null $length - * @param string $encoding - * @return string - */ - public static function substr($string, $start, $length = null, $encoding = 'UTF-8') - { - return mb_substr($string, $start, $length, $encoding); - } - - /** - * Returns the number of substring occurrences. - * - * @param string $haystack - * @param string $needle - * @param int $offset - * @param int|null $length - * @return int - */ - public static function substrCount($haystack, $needle, $offset = 0, $length = null) - { - if (! is_null($length)) { - return substr_count($haystack, $needle, $offset, $length); - } - - return substr_count($haystack, $needle, $offset); - } - - /** - * Replace text within a portion of a string. - * - * @param string|string[] $string - * @param string|string[] $replace - * @param int|int[] $offset - * @param int|int[]|null $length - * @return string|string[] - */ - public static function substrReplace($string, $replace, $offset = 0, $length = null) - { - if ($length === null) { - $length = strlen($string); - } - - return substr_replace($string, $replace, $offset, $length); - } - - /** - * Swap multiple keywords in a string with other keywords. - * - * @param array $map - * @param string $subject - * @return string - */ - public static function swap(array $map, $subject) - { - return strtr($subject, $map); - } - - /** - * Make a string's first character lowercase. - * - * @param string $string - * @return string - */ - public static function lcfirst($string) - { - return static::lower(static::substr($string, 0, 1)).static::substr($string, 1); - } - - /** - * Make a string's first character uppercase. - * - * @param string $string - * @return string - */ - public static function ucfirst($string) - { - return static::upper(static::substr($string, 0, 1)).static::substr($string, 1); - } - - /** - * Split a string into pieces by uppercase characters. - * - * @param string $string - * @return string[] - */ - public static function ucsplit($string) - { - return preg_split('/(?=\p{Lu})/u', $string, -1, PREG_SPLIT_NO_EMPTY); - } - - /** - * Get the number of words a string contains. - * - * @param string $string - * @param string|null $characters - * @return int - */ - public static function wordCount($string, $characters = null) - { - return str_word_count($string, 0, $characters); - } - - /** - * Generate a UUID (version 4). - * - * @return \Ramsey\Uuid\UuidInterface - */ - public static function uuid() - { - return static::$uuidFactory - ? call_user_func(static::$uuidFactory) - : Uuid::uuid4(); - } - - /** - * Generate a time-ordered UUID (version 4). - * - * @return \Ramsey\Uuid\UuidInterface - */ - public static function orderedUuid() - { - if (static::$uuidFactory) { - return call_user_func(static::$uuidFactory); - } - - $factory = new UuidFactory; - - $factory->setRandomGenerator(new CombGenerator( - $factory->getRandomGenerator(), - $factory->getNumberConverter() - )); - - $factory->setCodec(new TimestampFirstCombCodec( - $factory->getUuidBuilder() - )); - - return $factory->uuid4(); - } - - /** - * Set the callable that will be used to generate UUIDs. - * - * @param callable|null $factory - * @return void - */ - public static function createUuidsUsing(callable $factory = null) - { - static::$uuidFactory = $factory; - } - - /** - * Set the sequence that will be used to generate UUIDs. - * - * @param array $sequence - * @param callable|null $whenMissing - * @return void - */ - public static function createUuidsUsingSequence(array $sequence, $whenMissing = null) - { - $next = 0; - - $whenMissing ??= function () use (&$next) { - $factoryCache = static::$uuidFactory; - - static::$uuidFactory = null; - - $uuid = static::uuid(); - - static::$uuidFactory = $factoryCache; - - $next++; - - return $uuid; - }; - - static::createUuidsUsing(function () use (&$next, $sequence, $whenMissing) { - if (array_key_exists($next, $sequence)) { - return $sequence[$next++]; - } - - return $whenMissing(); - }); - } - - /** - * Always return the same UUID when generating new UUIDs. - * - * @param \Closure|null $callback - * @return \Ramsey\Uuid\UuidInterface - */ - public static function freezeUuids(Closure $callback = null) - { - $uuid = Str::uuid(); - - Str::createUuidsUsing(fn () => $uuid); - - if ($callback !== null) { - try { - $callback($uuid); - } finally { - Str::createUuidsNormally(); - } - } - - return $uuid; - } - - /** - * Indicate that UUIDs should be created normally and not using a custom factory. - * - * @return void - */ - public static function createUuidsNormally() - { - static::$uuidFactory = null; - } - - /** - * Generate a ULID. - * - * @return \Symfony\Component\Uid\Ulid - */ - public static function ulid() - { - return new Ulid(); - } - - /** - * Remove all strings from the casing caches. - * - * @return void - */ - public static function flushCache() - { - static::$snakeCache = []; - static::$camelCache = []; - static::$studlyCache = []; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Stringable.php b/framework-9.50.2/src/Illuminate/Support/Stringable.php deleted file mode 100644 index 0ca11af..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Stringable.php +++ /dev/null @@ -1,1228 +0,0 @@ -value = (string) $value; - } - - /** - * Return the remainder of a string after the first occurrence of a given value. - * - * @param string $search - * @return static - */ - public function after($search) - { - return new static(Str::after($this->value, $search)); - } - - /** - * Return the remainder of a string after the last occurrence of a given value. - * - * @param string $search - * @return static - */ - public function afterLast($search) - { - return new static(Str::afterLast($this->value, $search)); - } - - /** - * Append the given values to the string. - * - * @param array ...$values - * @return static - */ - public function append(...$values) - { - return new static($this->value.implode('', $values)); - } - - /** - * Append a new line to the string. - * - * @param int $count - * @return $this - */ - public function newLine($count = 1) - { - return $this->append(str_repeat(PHP_EOL, $count)); - } - - /** - * Transliterate a UTF-8 value to ASCII. - * - * @param string $language - * @return static - */ - public function ascii($language = 'en') - { - return new static(Str::ascii($this->value, $language)); - } - - /** - * Get the trailing name component of the path. - * - * @param string $suffix - * @return static - */ - public function basename($suffix = '') - { - return new static(basename($this->value, $suffix)); - } - - /** - * Get the basename of the class path. - * - * @return static - */ - public function classBasename() - { - return new static(class_basename($this->value)); - } - - /** - * Get the portion of a string before the first occurrence of a given value. - * - * @param string $search - * @return static - */ - public function before($search) - { - return new static(Str::before($this->value, $search)); - } - - /** - * Get the portion of a string before the last occurrence of a given value. - * - * @param string $search - * @return static - */ - public function beforeLast($search) - { - return new static(Str::beforeLast($this->value, $search)); - } - - /** - * Get the portion of a string between two given values. - * - * @param string $from - * @param string $to - * @return static - */ - public function between($from, $to) - { - return new static(Str::between($this->value, $from, $to)); - } - - /** - * Get the smallest possible portion of a string between two given values. - * - * @param string $from - * @param string $to - * @return static - */ - public function betweenFirst($from, $to) - { - return new static(Str::betweenFirst($this->value, $from, $to)); - } - - /** - * Convert a value to camel case. - * - * @return static - */ - public function camel() - { - return new static(Str::camel($this->value)); - } - - /** - * Determine if a given string contains a given substring. - * - * @param string|iterable $needles - * @param bool $ignoreCase - * @return bool - */ - public function contains($needles, $ignoreCase = false) - { - return Str::contains($this->value, $needles, $ignoreCase); - } - - /** - * Determine if a given string contains all array values. - * - * @param iterable $needles - * @param bool $ignoreCase - * @return bool - */ - public function containsAll($needles, $ignoreCase = false) - { - return Str::containsAll($this->value, $needles, $ignoreCase); - } - - /** - * Get the parent directory's path. - * - * @param int $levels - * @return static - */ - public function dirname($levels = 1) - { - return new static(dirname($this->value, $levels)); - } - - /** - * Determine if a given string ends with a given substring. - * - * @param string|iterable $needles - * @return bool - */ - public function endsWith($needles) - { - return Str::endsWith($this->value, $needles); - } - - /** - * Determine if the string is an exact match with the given value. - * - * @param \Illuminate\Support\Stringable|string $value - * @return bool - */ - public function exactly($value) - { - if ($value instanceof Stringable) { - $value = $value->toString(); - } - - return $this->value === $value; - } - - /** - * Extracts an excerpt from text that matches the first instance of a phrase. - * - * @param string $phrase - * @param array $options - * @return string|null - */ - public function excerpt($phrase = '', $options = []) - { - return Str::excerpt($this->value, $phrase, $options); - } - - /** - * Explode the string into an array. - * - * @param string $delimiter - * @param int $limit - * @return \Illuminate\Support\Collection - */ - public function explode($delimiter, $limit = PHP_INT_MAX) - { - return collect(explode($delimiter, $this->value, $limit)); - } - - /** - * Split a string using a regular expression or by length. - * - * @param string|int $pattern - * @param int $limit - * @param int $flags - * @return \Illuminate\Support\Collection - */ - public function split($pattern, $limit = -1, $flags = 0) - { - if (filter_var($pattern, FILTER_VALIDATE_INT) !== false) { - return collect(mb_str_split($this->value, $pattern)); - } - - $segments = preg_split($pattern, $this->value, $limit, $flags); - - return ! empty($segments) ? collect($segments) : collect(); - } - - /** - * Cap a string with a single instance of a given value. - * - * @param string $cap - * @return static - */ - public function finish($cap) - { - return new static(Str::finish($this->value, $cap)); - } - - /** - * Determine if a given string matches a given pattern. - * - * @param string|iterable $pattern - * @return bool - */ - public function is($pattern) - { - return Str::is($pattern, $this->value); - } - - /** - * Determine if a given string is 7 bit ASCII. - * - * @return bool - */ - public function isAscii() - { - return Str::isAscii($this->value); - } - - /** - * Determine if a given string is valid JSON. - * - * @return bool - */ - public function isJson() - { - return Str::isJson($this->value); - } - - /** - * Determine if a given string is a valid UUID. - * - * @return bool - */ - public function isUuid() - { - return Str::isUuid($this->value); - } - - /** - * Determine if a given string is a valid ULID. - * - * @return bool - */ - public function isUlid() - { - return Str::isUlid($this->value); - } - - /** - * Determine if the given string is empty. - * - * @return bool - */ - public function isEmpty() - { - return $this->value === ''; - } - - /** - * Determine if the given string is not empty. - * - * @return bool - */ - public function isNotEmpty() - { - return ! $this->isEmpty(); - } - - /** - * Convert a string to kebab case. - * - * @return static - */ - public function kebab() - { - return new static(Str::kebab($this->value)); - } - - /** - * Return the length of the given string. - * - * @param string|null $encoding - * @return int - */ - public function length($encoding = null) - { - return Str::length($this->value, $encoding); - } - - /** - * Limit the number of characters in a string. - * - * @param int $limit - * @param string $end - * @return static - */ - public function limit($limit = 100, $end = '...') - { - return new static(Str::limit($this->value, $limit, $end)); - } - - /** - * Convert the given string to lower-case. - * - * @return static - */ - public function lower() - { - return new static(Str::lower($this->value)); - } - - /** - * Convert GitHub flavored Markdown into HTML. - * - * @param array $options - * @return static - */ - public function markdown(array $options = []) - { - return new static(Str::markdown($this->value, $options)); - } - - /** - * Convert inline Markdown into HTML. - * - * @param array $options - * @return static - */ - public function inlineMarkdown(array $options = []) - { - return new static(Str::inlineMarkdown($this->value, $options)); - } - - /** - * Masks a portion of a string with a repeated character. - * - * @param string $character - * @param int $index - * @param int|null $length - * @param string $encoding - * @return static - */ - public function mask($character, $index, $length = null, $encoding = 'UTF-8') - { - return new static(Str::mask($this->value, $character, $index, $length, $encoding)); - } - - /** - * Get the string matching the given pattern. - * - * @param string $pattern - * @return static - */ - public function match($pattern) - { - return new static(Str::match($pattern, $this->value)); - } - - /** - * Get the string matching the given pattern. - * - * @param string $pattern - * @return \Illuminate\Support\Collection - */ - public function matchAll($pattern) - { - return Str::matchAll($pattern, $this->value); - } - - /** - * Determine if the string matches the given pattern. - * - * @param string $pattern - * @return bool - */ - public function test($pattern) - { - return $this->match($pattern)->isNotEmpty(); - } - - /** - * Pad both sides of the string with another. - * - * @param int $length - * @param string $pad - * @return static - */ - public function padBoth($length, $pad = ' ') - { - return new static(Str::padBoth($this->value, $length, $pad)); - } - - /** - * Pad the left side of the string with another. - * - * @param int $length - * @param string $pad - * @return static - */ - public function padLeft($length, $pad = ' ') - { - return new static(Str::padLeft($this->value, $length, $pad)); - } - - /** - * Pad the right side of the string with another. - * - * @param int $length - * @param string $pad - * @return static - */ - public function padRight($length, $pad = ' ') - { - return new static(Str::padRight($this->value, $length, $pad)); - } - - /** - * Parse a Class@method style callback into class and method. - * - * @param string|null $default - * @return array - */ - public function parseCallback($default = null) - { - return Str::parseCallback($this->value, $default); - } - - /** - * Call the given callback and return a new string. - * - * @param callable $callback - * @return static - */ - public function pipe(callable $callback) - { - return new static($callback($this)); - } - - /** - * Get the plural form of an English word. - * - * @param int|array|\Countable $count - * @return static - */ - public function plural($count = 2) - { - return new static(Str::plural($this->value, $count)); - } - - /** - * Pluralize the last word of an English, studly caps case string. - * - * @param int|array|\Countable $count - * @return static - */ - public function pluralStudly($count = 2) - { - return new static(Str::pluralStudly($this->value, $count)); - } - - /** - * Prepend the given values to the string. - * - * @param array ...$values - * @return static - */ - public function prepend(...$values) - { - return new static(implode('', $values).$this->value); - } - - /** - * Remove any occurrence of the given string in the subject. - * - * @param string|iterable $search - * @param bool $caseSensitive - * @return static - */ - public function remove($search, $caseSensitive = true) - { - return new static(Str::remove($search, $this->value, $caseSensitive)); - } - - /** - * Reverse the string. - * - * @return static - */ - public function reverse() - { - return new static(Str::reverse($this->value)); - } - - /** - * Repeat the string. - * - * @param int $times - * @return static - */ - public function repeat(int $times) - { - return new static(str_repeat($this->value, $times)); - } - - /** - * Replace the given value in the given string. - * - * @param string|iterable $search - * @param string|iterable $replace - * @return static - */ - public function replace($search, $replace) - { - return new static(Str::replace($search, $replace, $this->value)); - } - - /** - * Replace a given value in the string sequentially with an array. - * - * @param string $search - * @param iterable $replace - * @return static - */ - public function replaceArray($search, $replace) - { - return new static(Str::replaceArray($search, $replace, $this->value)); - } - - /** - * Replace the first occurrence of a given value in the string. - * - * @param string $search - * @param string $replace - * @return static - */ - public function replaceFirst($search, $replace) - { - return new static(Str::replaceFirst($search, $replace, $this->value)); - } - - /** - * Replace the last occurrence of a given value in the string. - * - * @param string $search - * @param string $replace - * @return static - */ - public function replaceLast($search, $replace) - { - return new static(Str::replaceLast($search, $replace, $this->value)); - } - - /** - * Replace the patterns matching the given regular expression. - * - * @param string $pattern - * @param \Closure|string $replace - * @param int $limit - * @return static - */ - public function replaceMatches($pattern, $replace, $limit = -1) - { - if ($replace instanceof Closure) { - return new static(preg_replace_callback($pattern, $replace, $this->value, $limit)); - } - - return new static(preg_replace($pattern, $replace, $this->value, $limit)); - } - - /** - * Parse input from a string to a collection, according to a format. - * - * @param string $format - * @return \Illuminate\Support\Collection - */ - public function scan($format) - { - return collect(sscanf($this->value, $format)); - } - - /** - * Remove all "extra" blank space from the given string. - * - * @return static - */ - public function squish() - { - return new static(Str::squish($this->value)); - } - - /** - * Begin a string with a single instance of a given value. - * - * @param string $prefix - * @return static - */ - public function start($prefix) - { - return new static(Str::start($this->value, $prefix)); - } - - /** - * Strip HTML and PHP tags from the given string. - * - * @param string $allowedTags - * @return static - */ - public function stripTags($allowedTags = null) - { - return new static(strip_tags($this->value, $allowedTags)); - } - - /** - * Convert the given string to upper-case. - * - * @return static - */ - public function upper() - { - return new static(Str::upper($this->value)); - } - - /** - * Convert the given string to title case. - * - * @return static - */ - public function title() - { - return new static(Str::title($this->value)); - } - - /** - * Convert the given string to title case for each word. - * - * @return static - */ - public function headline() - { - return new static(Str::headline($this->value)); - } - - /** - * Get the singular form of an English word. - * - * @return static - */ - public function singular() - { - return new static(Str::singular($this->value)); - } - - /** - * Generate a URL friendly "slug" from a given string. - * - * @param string $separator - * @param string|null $language - * @param array $dictionary - * @return static - */ - public function slug($separator = '-', $language = 'en', $dictionary = ['@' => 'at']) - { - return new static(Str::slug($this->value, $separator, $language, $dictionary)); - } - - /** - * Convert a string to snake case. - * - * @param string $delimiter - * @return static - */ - public function snake($delimiter = '_') - { - return new static(Str::snake($this->value, $delimiter)); - } - - /** - * Determine if a given string starts with a given substring. - * - * @param string|iterable $needles - * @return bool - */ - public function startsWith($needles) - { - return Str::startsWith($this->value, $needles); - } - - /** - * Convert a value to studly caps case. - * - * @return static - */ - public function studly() - { - return new static(Str::studly($this->value)); - } - - /** - * Returns the portion of the string specified by the start and length parameters. - * - * @param int $start - * @param int|null $length - * @param string $encoding - * @return static - */ - public function substr($start, $length = null, $encoding = 'UTF-8') - { - return new static(Str::substr($this->value, $start, $length, $encoding)); - } - - /** - * Returns the number of substring occurrences. - * - * @param string $needle - * @param int $offset - * @param int|null $length - * @return int - */ - public function substrCount($needle, $offset = 0, $length = null) - { - return Str::substrCount($this->value, $needle, $offset, $length); - } - - /** - * Replace text within a portion of a string. - * - * @param string|string[] $replace - * @param int|int[] $offset - * @param int|int[]|null $length - * @return static - */ - public function substrReplace($replace, $offset = 0, $length = null) - { - return new static(Str::substrReplace($this->value, $replace, $offset, $length)); - } - - /** - * Swap multiple keywords in a string with other keywords. - * - * @param array $map - * @return static - */ - public function swap(array $map) - { - return new static(strtr($this->value, $map)); - } - - /** - * Trim the string of the given characters. - * - * @param string $characters - * @return static - */ - public function trim($characters = null) - { - return new static(trim(...array_merge([$this->value], func_get_args()))); - } - - /** - * Left trim the string of the given characters. - * - * @param string $characters - * @return static - */ - public function ltrim($characters = null) - { - return new static(ltrim(...array_merge([$this->value], func_get_args()))); - } - - /** - * Right trim the string of the given characters. - * - * @param string $characters - * @return static - */ - public function rtrim($characters = null) - { - return new static(rtrim(...array_merge([$this->value], func_get_args()))); - } - - /** - * Make a string's first character lowercase. - * - * @return static - */ - public function lcfirst() - { - return new static(Str::lcfirst($this->value)); - } - - /** - * Make a string's first character uppercase. - * - * @return static - */ - public function ucfirst() - { - return new static(Str::ucfirst($this->value)); - } - - /** - * Split a string by uppercase characters. - * - * @return \Illuminate\Support\Collection - */ - public function ucsplit() - { - return collect(Str::ucsplit($this->value)); - } - - /** - * Execute the given callback if the string contains a given substring. - * - * @param string|iterable $needles - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenContains($needles, $callback, $default = null) - { - return $this->when($this->contains($needles), $callback, $default); - } - - /** - * Execute the given callback if the string contains all array values. - * - * @param iterable $needles - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenContainsAll(array $needles, $callback, $default = null) - { - return $this->when($this->containsAll($needles), $callback, $default); - } - - /** - * Execute the given callback if the string is empty. - * - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenEmpty($callback, $default = null) - { - return $this->when($this->isEmpty(), $callback, $default); - } - - /** - * Execute the given callback if the string is not empty. - * - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenNotEmpty($callback, $default = null) - { - return $this->when($this->isNotEmpty(), $callback, $default); - } - - /** - * Execute the given callback if the string ends with a given substring. - * - * @param string|iterable $needles - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenEndsWith($needles, $callback, $default = null) - { - return $this->when($this->endsWith($needles), $callback, $default); - } - - /** - * Execute the given callback if the string is an exact match with the given value. - * - * @param string $value - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenExactly($value, $callback, $default = null) - { - return $this->when($this->exactly($value), $callback, $default); - } - - /** - * Execute the given callback if the string is not an exact match with the given value. - * - * @param string $value - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenNotExactly($value, $callback, $default = null) - { - return $this->when(! $this->exactly($value), $callback, $default); - } - - /** - * Execute the given callback if the string matches a given pattern. - * - * @param string|iterable $pattern - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenIs($pattern, $callback, $default = null) - { - return $this->when($this->is($pattern), $callback, $default); - } - - /** - * Execute the given callback if the string is 7 bit ASCII. - * - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenIsAscii($callback, $default = null) - { - return $this->when($this->isAscii(), $callback, $default); - } - - /** - * Execute the given callback if the string is a valid UUID. - * - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenIsUuid($callback, $default = null) - { - return $this->when($this->isUuid(), $callback, $default); - } - - /** - * Execute the given callback if the string is a valid ULID. - * - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenIsUlid($callback, $default = null) - { - return $this->when($this->isUlid(), $callback, $default); - } - - /** - * Execute the given callback if the string starts with a given substring. - * - * @param string|iterable $needles - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenStartsWith($needles, $callback, $default = null) - { - return $this->when($this->startsWith($needles), $callback, $default); - } - - /** - * Execute the given callback if the string matches the given pattern. - * - * @param string $pattern - * @param callable $callback - * @param callable|null $default - * @return static - */ - public function whenTest($pattern, $callback, $default = null) - { - return $this->when($this->test($pattern), $callback, $default); - } - - /** - * Limit the number of words in a string. - * - * @param int $words - * @param string $end - * @return static - */ - public function words($words = 100, $end = '...') - { - return new static(Str::words($this->value, $words, $end)); - } - - /** - * Get the number of words a string contains. - * - * @param string|null $characters - * @return int - */ - public function wordCount($characters = null) - { - return Str::wordCount($this->value, $characters); - } - - /** - * Wrap the string with the given strings. - * - * @param string $before - * @param string|null $after - * @return static - */ - public function wrap($before, $after = null) - { - return new static(Str::wrap($this->value, $before, $after)); - } - - /** - * Convert the string into a `HtmlString` instance. - * - * @return \Illuminate\Support\HtmlString - */ - public function toHtmlString() - { - return new HtmlString($this->value); - } - - /** - * Dump the string. - * - * @return $this - */ - public function dump() - { - VarDumper::dump($this->value); - - return $this; - } - - /** - * Dump the string and end the script. - * - * @return never - */ - public function dd() - { - $this->dump(); - - exit(1); - } - - /** - * Get the underlying string value. - * - * @return string - */ - public function value() - { - return $this->toString(); - } - - /** - * Get the underlying string value. - * - * @return string - */ - public function toString() - { - return $this->value; - } - - /** - * Get the underlying string value as an integer. - * - * @return int - */ - public function toInteger() - { - return intval($this->value); - } - - /** - * Get the underlying string value as a float. - * - * @return float - */ - public function toFloat() - { - return floatval($this->value); - } - - /** - * Get the underlying string value as a boolean. - * - * Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false. - * - * @return bool - */ - public function toBoolean() - { - return filter_var($this->value, FILTER_VALIDATE_BOOLEAN); - } - - /** - * Get the underlying string value as a Carbon instance. - * - * @param string|null $format - * @param string|null $tz - * @return \Illuminate\Support\Carbon - * - * @throws \Carbon\Exceptions\InvalidFormatException - */ - public function toDate($format = null, $tz = null) - { - if (is_null($format)) { - return Date::parse($this->value, $tz); - } - - return Date::createFromFormat($format, $this->value, $tz); - } - - /** - * Convert the object to a string when JSON encoded. - * - * @return string - */ - public function jsonSerialize(): string - { - return $this->__toString(); - } - - /** - * Proxy dynamic properties onto methods. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->{$key}(); - } - - /** - * Get the raw string value. - * - * @return string - */ - public function __toString() - { - return (string) $this->value; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BatchFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BatchFake.php deleted file mode 100644 index 607168b..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BatchFake.php +++ /dev/null @@ -1,163 +0,0 @@ -id = $id; - $this->name = $name; - $this->totalJobs = $totalJobs; - $this->pendingJobs = $pendingJobs; - $this->failedJobs = $failedJobs; - $this->failedJobIds = $failedJobIds; - $this->options = $options; - $this->createdAt = $createdAt; - $this->cancelledAt = $cancelledAt; - $this->finishedAt = $finishedAt; - } - - /** - * Get a fresh instance of the batch represented by this ID. - * - * @return self - */ - public function fresh() - { - return $this; - } - - /** - * Add additional jobs to the batch. - * - * @param \Illuminate\Support\Enumerable|object|array $jobs - * @return self - */ - public function add($jobs) - { - foreach ($jobs as $job) { - $this->added[] = $job; - } - - return $this; - } - - /** - * Record that a job within the batch finished successfully, executing any callbacks if necessary. - * - * @param string $jobId - * @return void - */ - public function recordSuccessfulJob(string $jobId) - { - // - } - - /** - * Decrement the pending jobs for the batch. - * - * @param string $jobId - * @return \Illuminate\Bus\UpdatedBatchJobCounts - */ - public function decrementPendingJobs(string $jobId) - { - // - } - - /** - * Record that a job within the batch failed to finish successfully, executing any callbacks if necessary. - * - * @param string $jobId - * @param \Throwable $e - * @return void - */ - public function recordFailedJob(string $jobId, $e) - { - // - } - - /** - * Increment the failed jobs for the batch. - * - * @param string $jobId - * @return \Illuminate\Bus\UpdatedBatchJobCounts - */ - public function incrementFailedJobs(string $jobId) - { - return new UpdatedBatchJobCounts; - } - - /** - * Cancel the batch. - * - * @return void - */ - public function cancel() - { - $this->cancelledAt = Carbon::now(); - } - - /** - * Delete the batch from storage. - * - * @return void - */ - public function delete() - { - $this->deleted = true; - } - - /** - * Determine if the batch has been deleted. - * - * @return bool - */ - public function deleted() - { - return $this->deleted; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php deleted file mode 100644 index 021c73f..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BatchRepositoryFake.php +++ /dev/null @@ -1,153 +0,0 @@ -batches; - } - - /** - * Retrieve information about an existing batch. - * - * @param string $batchId - * @return \Illuminate\Bus\Batch|null - */ - public function find(string $batchId) - { - return $this->batches[$batchId] ?? null; - } - - /** - * Store a new pending batch. - * - * @param \Illuminate\Bus\PendingBatch $batch - * @return \Illuminate\Bus\Batch - */ - public function store(PendingBatch $batch) - { - $id = (string) Str::orderedUuid(); - - $this->batches[$id] = new BatchFake( - $id, - $batch->name, - count($batch->jobs), - count($batch->jobs), - 0, - [], - $batch->options, - CarbonImmutable::now(), - null, - null - ); - - return $this->batches[$id]; - } - - /** - * Increment the total number of jobs within the batch. - * - * @param string $batchId - * @param int $amount - * @return void - */ - public function incrementTotalJobs(string $batchId, int $amount) - { - // - } - - /** - * Decrement the total number of pending jobs for the batch. - * - * @param string $batchId - * @param string $jobId - * @return \Illuminate\Bus\UpdatedBatchJobCounts - */ - public function decrementPendingJobs(string $batchId, string $jobId) - { - return new UpdatedBatchJobCounts; - } - - /** - * Increment the total number of failed jobs for the batch. - * - * @param string $batchId - * @param string $jobId - * @return \Illuminate\Bus\UpdatedBatchJobCounts - */ - public function incrementFailedJobs(string $batchId, string $jobId) - { - return new UpdatedBatchJobCounts; - } - - /** - * Mark the batch that has the given ID as finished. - * - * @param string $batchId - * @return void - */ - public function markAsFinished(string $batchId) - { - if (isset($this->batches[$batchId])) { - $this->batches[$batchId]->finishedAt = now(); - } - } - - /** - * Cancel the batch that has the given ID. - * - * @param string $batchId - * @return void - */ - public function cancel(string $batchId) - { - if (isset($this->batches[$batchId])) { - $this->batches[$batchId]->cancel(); - } - } - - /** - * Delete the batch that has the given ID. - * - * @param string $batchId - * @return void - */ - public function delete(string $batchId) - { - unset($this->batches[$batchId]); - } - - /** - * Execute the given Closure within a storage specific transaction. - * - * @param \Closure $callback - * @return mixed - */ - public function transaction(Closure $callback) - { - return $callback(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BusFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BusFake.php deleted file mode 100644 index 21bd822..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/BusFake.php +++ /dev/null @@ -1,791 +0,0 @@ -dispatcher = $dispatcher; - $this->jobsToFake = Arr::wrap($jobsToFake); - $this->batchRepository = $batchRepository ?: new BatchRepositoryFake; - } - - /** - * Specify the jobs that should be dispatched instead of faked. - * - * @param array|string $jobsToDispatch - * @return void - */ - public function except($jobsToDispatch) - { - $this->jobsToDispatch = array_merge($this->jobsToDispatch, Arr::wrap($jobsToDispatch)); - - return $this; - } - - /** - * Assert if a job was dispatched based on a truth-test callback. - * - * @param string|\Closure $command - * @param callable|int|null $callback - * @return void - */ - public function assertDispatched($command, $callback = null) - { - if ($command instanceof Closure) { - [$command, $callback] = [$this->firstClosureParameterType($command), $command]; - } - - if (is_numeric($callback)) { - return $this->assertDispatchedTimes($command, $callback); - } - - PHPUnit::assertTrue( - $this->dispatched($command, $callback)->count() > 0 || - $this->dispatchedAfterResponse($command, $callback)->count() > 0 || - $this->dispatchedSync($command, $callback)->count() > 0, - "The expected [{$command}] job was not dispatched." - ); - } - - /** - * Assert if a job was pushed a number of times. - * - * @param string $command - * @param int $times - * @return void - */ - public function assertDispatchedTimes($command, $times = 1) - { - $count = $this->dispatched($command)->count() + - $this->dispatchedAfterResponse($command)->count() + - $this->dispatchedSync($command)->count(); - - PHPUnit::assertSame( - $times, $count, - "The expected [{$command}] job was pushed {$count} times instead of {$times} times." - ); - } - - /** - * Determine if a job was dispatched based on a truth-test callback. - * - * @param string|\Closure $command - * @param callable|null $callback - * @return void - */ - public function assertNotDispatched($command, $callback = null) - { - if ($command instanceof Closure) { - [$command, $callback] = [$this->firstClosureParameterType($command), $command]; - } - - PHPUnit::assertTrue( - $this->dispatched($command, $callback)->count() === 0 && - $this->dispatchedAfterResponse($command, $callback)->count() === 0 && - $this->dispatchedSync($command, $callback)->count() === 0, - "The unexpected [{$command}] job was dispatched." - ); - } - - /** - * Assert that no jobs were dispatched. - * - * @return void - */ - public function assertNothingDispatched() - { - PHPUnit::assertEmpty($this->commands, 'Jobs were dispatched unexpectedly.'); - } - - /** - * Assert if a job was explicitly dispatched synchronously based on a truth-test callback. - * - * @param string|\Closure $command - * @param callable|int|null $callback - * @return void - */ - public function assertDispatchedSync($command, $callback = null) - { - if ($command instanceof Closure) { - [$command, $callback] = [$this->firstClosureParameterType($command), $command]; - } - - if (is_numeric($callback)) { - return $this->assertDispatchedSyncTimes($command, $callback); - } - - PHPUnit::assertTrue( - $this->dispatchedSync($command, $callback)->count() > 0, - "The expected [{$command}] job was not dispatched synchronously." - ); - } - - /** - * Assert if a job was pushed synchronously a number of times. - * - * @param string $command - * @param int $times - * @return void - */ - public function assertDispatchedSyncTimes($command, $times = 1) - { - $count = $this->dispatchedSync($command)->count(); - - PHPUnit::assertSame( - $times, $count, - "The expected [{$command}] job was synchronously pushed {$count} times instead of {$times} times." - ); - } - - /** - * Determine if a job was dispatched based on a truth-test callback. - * - * @param string|\Closure $command - * @param callable|null $callback - * @return void - */ - public function assertNotDispatchedSync($command, $callback = null) - { - if ($command instanceof Closure) { - [$command, $callback] = [$this->firstClosureParameterType($command), $command]; - } - - PHPUnit::assertCount( - 0, $this->dispatchedSync($command, $callback), - "The unexpected [{$command}] job was dispatched synchronously." - ); - } - - /** - * Assert if a job was dispatched after the response was sent based on a truth-test callback. - * - * @param string|\Closure $command - * @param callable|int|null $callback - * @return void - */ - public function assertDispatchedAfterResponse($command, $callback = null) - { - if ($command instanceof Closure) { - [$command, $callback] = [$this->firstClosureParameterType($command), $command]; - } - - if (is_numeric($callback)) { - return $this->assertDispatchedAfterResponseTimes($command, $callback); - } - - PHPUnit::assertTrue( - $this->dispatchedAfterResponse($command, $callback)->count() > 0, - "The expected [{$command}] job was not dispatched after sending the response." - ); - } - - /** - * Assert if a job was pushed after the response was sent a number of times. - * - * @param string $command - * @param int $times - * @return void - */ - public function assertDispatchedAfterResponseTimes($command, $times = 1) - { - $count = $this->dispatchedAfterResponse($command)->count(); - - PHPUnit::assertSame( - $times, $count, - "The expected [{$command}] job was pushed {$count} times instead of {$times} times." - ); - } - - /** - * Determine if a job was dispatched based on a truth-test callback. - * - * @param string|\Closure $command - * @param callable|null $callback - * @return void - */ - public function assertNotDispatchedAfterResponse($command, $callback = null) - { - if ($command instanceof Closure) { - [$command, $callback] = [$this->firstClosureParameterType($command), $command]; - } - - PHPUnit::assertCount( - 0, $this->dispatchedAfterResponse($command, $callback), - "The unexpected [{$command}] job was dispatched after sending the response." - ); - } - - /** - * Assert if a chain of jobs was dispatched. - * - * @param array $expectedChain - * @return void - */ - public function assertChained(array $expectedChain) - { - $command = $expectedChain[0]; - - $expectedChain = array_slice($expectedChain, 1); - - $callback = null; - - if ($command instanceof Closure) { - [$command, $callback] = [$this->firstClosureParameterType($command), $command]; - } elseif (! is_string($command)) { - $instance = $command; - - $command = get_class($instance); - - $callback = function ($job) use ($instance) { - return serialize($this->resetChainPropertiesToDefaults($job)) === serialize($instance); - }; - } - - PHPUnit::assertTrue( - $this->dispatched($command, $callback)->isNotEmpty(), - "The expected [{$command}] job was not dispatched." - ); - - PHPUnit::assertTrue( - collect($expectedChain)->isNotEmpty(), - 'The expected chain can not be empty.' - ); - - $this->isChainOfObjects($expectedChain) - ? $this->assertDispatchedWithChainOfObjects($command, $expectedChain, $callback) - : $this->assertDispatchedWithChainOfClasses($command, $expectedChain, $callback); - } - - /** - * Reset the chain properties to their default values on the job. - * - * @param mixed $job - * @return mixed - */ - protected function resetChainPropertiesToDefaults($job) - { - return tap(clone $job, function ($job) { - $job->chainConnection = null; - $job->chainQueue = null; - $job->chainCatchCallbacks = null; - $job->chained = []; - }); - } - - /** - * Assert if a job was dispatched with an empty chain based on a truth-test callback. - * - * @param string|\Closure $command - * @param callable|null $callback - * @return void - */ - public function assertDispatchedWithoutChain($command, $callback = null) - { - if ($command instanceof Closure) { - [$command, $callback] = [$this->firstClosureParameterType($command), $command]; - } - - PHPUnit::assertTrue( - $this->dispatched($command, $callback)->isNotEmpty(), - "The expected [{$command}] job was not dispatched." - ); - - $this->assertDispatchedWithChainOfClasses($command, [], $callback); - } - - /** - * Assert if a job was dispatched with chained jobs based on a truth-test callback. - * - * @param string $command - * @param array $expectedChain - * @param callable|null $callback - * @return void - */ - protected function assertDispatchedWithChainOfObjects($command, $expectedChain, $callback) - { - $chain = collect($expectedChain)->map(fn ($job) => serialize($job))->all(); - - PHPUnit::assertTrue( - $this->dispatched($command, $callback)->filter( - fn ($job) => $job->chained == $chain - )->isNotEmpty(), - 'The expected chain was not dispatched.' - ); - } - - /** - * Assert if a job was dispatched with chained jobs based on a truth-test callback. - * - * @param string $command - * @param array $expectedChain - * @param callable|null $callback - * @return void - */ - protected function assertDispatchedWithChainOfClasses($command, $expectedChain, $callback) - { - $matching = $this->dispatched($command, $callback)->map->chained->map(function ($chain) { - return collect($chain)->map( - fn ($job) => get_class(unserialize($job)) - ); - })->filter( - fn ($chain) => $chain->all() === $expectedChain - ); - - PHPUnit::assertTrue( - $matching->isNotEmpty(), 'The expected chain was not dispatched.' - ); - } - - /** - * Determine if the given chain is entirely composed of objects. - * - * @param array $chain - * @return bool - */ - protected function isChainOfObjects($chain) - { - return ! collect($chain)->contains(fn ($job) => ! is_object($job)); - } - - /** - * Assert if a batch was dispatched based on a truth-test callback. - * - * @param callable $callback - * @return void - */ - public function assertBatched(callable $callback) - { - PHPUnit::assertTrue( - $this->batched($callback)->count() > 0, - 'The expected batch was not dispatched.' - ); - } - - /** - * Assert the number of batches that have been dispatched. - * - * @param int $count - * @return void - */ - public function assertBatchCount($count) - { - PHPUnit::assertCount( - $count, $this->batches, - ); - } - - /** - * Assert that no batched jobs were dispatched. - * - * @return void - */ - public function assertNothingBatched() - { - PHPUnit::assertEmpty($this->batches, 'Batched jobs were dispatched unexpectedly.'); - } - - /** - * Get all of the jobs matching a truth-test callback. - * - * @param string $command - * @param callable|null $callback - * @return \Illuminate\Support\Collection - */ - public function dispatched($command, $callback = null) - { - if (! $this->hasDispatched($command)) { - return collect(); - } - - $callback = $callback ?: fn () => true; - - return collect($this->commands[$command])->filter(fn ($command) => $callback($command)); - } - - /** - * Get all of the jobs dispatched synchronously matching a truth-test callback. - * - * @param string $command - * @param callable|null $callback - * @return \Illuminate\Support\Collection - */ - public function dispatchedSync(string $command, $callback = null) - { - if (! $this->hasDispatchedSync($command)) { - return collect(); - } - - $callback = $callback ?: fn () => true; - - return collect($this->commandsSync[$command])->filter(fn ($command) => $callback($command)); - } - - /** - * Get all of the jobs dispatched after the response was sent matching a truth-test callback. - * - * @param string $command - * @param callable|null $callback - * @return \Illuminate\Support\Collection - */ - public function dispatchedAfterResponse(string $command, $callback = null) - { - if (! $this->hasDispatchedAfterResponse($command)) { - return collect(); - } - - $callback = $callback ?: fn () => true; - - return collect($this->commandsAfterResponse[$command])->filter(fn ($command) => $callback($command)); - } - - /** - * Get all of the pending batches matching a truth-test callback. - * - * @param callable $callback - * @return \Illuminate\Support\Collection - */ - public function batched(callable $callback) - { - if (empty($this->batches)) { - return collect(); - } - - return collect($this->batches)->filter(fn ($batch) => $callback($batch)); - } - - /** - * Determine if there are any stored commands for a given class. - * - * @param string $command - * @return bool - */ - public function hasDispatched($command) - { - return isset($this->commands[$command]) && ! empty($this->commands[$command]); - } - - /** - * Determine if there are any stored commands for a given class. - * - * @param string $command - * @return bool - */ - public function hasDispatchedSync($command) - { - return isset($this->commandsSync[$command]) && ! empty($this->commandsSync[$command]); - } - - /** - * Determine if there are any stored commands for a given class. - * - * @param string $command - * @return bool - */ - public function hasDispatchedAfterResponse($command) - { - return isset($this->commandsAfterResponse[$command]) && ! empty($this->commandsAfterResponse[$command]); - } - - /** - * Dispatch a command to its appropriate handler. - * - * @param mixed $command - * @return mixed - */ - public function dispatch($command) - { - if ($this->shouldFakeJob($command)) { - $this->commands[get_class($command)][] = $command; - } else { - return $this->dispatcher->dispatch($command); - } - } - - /** - * Dispatch a command to its appropriate handler in the current process. - * - * Queueable jobs will be dispatched to the "sync" queue. - * - * @param mixed $command - * @param mixed $handler - * @return mixed - */ - public function dispatchSync($command, $handler = null) - { - if ($this->shouldFakeJob($command)) { - $this->commandsSync[get_class($command)][] = $command; - } else { - return $this->dispatcher->dispatchSync($command, $handler); - } - } - - /** - * 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 ($this->shouldFakeJob($command)) { - $this->commands[get_class($command)][] = $command; - } else { - return $this->dispatcher->dispatchNow($command, $handler); - } - } - - /** - * Dispatch a command to its appropriate handler behind a queue. - * - * @param mixed $command - * @return mixed - */ - public function dispatchToQueue($command) - { - if ($this->shouldFakeJob($command)) { - $this->commands[get_class($command)][] = $command; - } else { - return $this->dispatcher->dispatchToQueue($command); - } - } - - /** - * Dispatch a command to its appropriate handler. - * - * @param mixed $command - * @return mixed - */ - public function dispatchAfterResponse($command) - { - if ($this->shouldFakeJob($command)) { - $this->commandsAfterResponse[get_class($command)][] = $command; - } else { - return $this->dispatcher->dispatch($command); - } - } - - /** - * Create a new chain of queueable jobs. - * - * @param \Illuminate\Support\Collection|array $jobs - * @return \Illuminate\Foundation\Bus\PendingChain - */ - public function chain($jobs) - { - $jobs = Collection::wrap($jobs); - - return new PendingChainFake($this, $jobs->shift(), $jobs->toArray()); - } - - /** - * Attempt to find the batch with the given ID. - * - * @param string $batchId - * @return \Illuminate\Bus\Batch|null - */ - public function findBatch(string $batchId) - { - return $this->batchRepository->find($batchId); - } - - /** - * Create a new batch of queueable jobs. - * - * @param \Illuminate\Support\Collection|array $jobs - * @return \Illuminate\Bus\PendingBatch - */ - public function batch($jobs) - { - return new PendingBatchFake($this, Collection::wrap($jobs)); - } - - /** - * Dispatch an empty job batch for testing. - * - * @param string $name - * @return \Illuminate\Bus\Batch - */ - public function dispatchFakeBatch($name = '') - { - return $this->batch([])->name($name)->dispatch(); - } - - /** - * Record the fake pending batch dispatch. - * - * @param \Illuminate\Bus\PendingBatch $pendingBatch - * @return \Illuminate\Bus\Batch - */ - public function recordPendingBatch(PendingBatch $pendingBatch) - { - $this->batches[] = $pendingBatch; - - return $this->batchRepository->store($pendingBatch); - } - - /** - * Determine if a command should be faked or actually dispatched. - * - * @param mixed $command - * @return bool - */ - protected function shouldFakeJob($command) - { - if ($this->shouldDispatchCommand($command)) { - return false; - } - - if (empty($this->jobsToFake)) { - return true; - } - - return collect($this->jobsToFake) - ->filter(function ($job) use ($command) { - return $job instanceof Closure - ? $job($command) - : $job === get_class($command); - })->isNotEmpty(); - } - - /** - * Determine if a command should be dispatched or not. - * - * @param mixed $command - * @return bool - */ - protected function shouldDispatchCommand($command) - { - return collect($this->jobsToDispatch) - ->filter(function ($job) use ($command) { - return $job instanceof Closure - ? $job($command) - : $job === get_class($command); - })->isNotEmpty(); - } - - /** - * Set the pipes commands should be piped through before dispatching. - * - * @param array $pipes - * @return $this - */ - public function pipeThrough(array $pipes) - { - $this->dispatcher->pipeThrough($pipes); - - return $this; - } - - /** - * Determine if the given command has a handler. - * - * @param mixed $command - * @return bool - */ - public function hasCommandHandler($command) - { - return $this->dispatcher->hasCommandHandler($command); - } - - /** - * Retrieve the handler for a command. - * - * @param mixed $command - * @return mixed - */ - public function getCommandHandler($command) - { - return $this->dispatcher->getCommandHandler($command); - } - - /** - * Map a command to a handler. - * - * @param array $map - * @return $this - */ - public function map(array $map) - { - $this->dispatcher->map($map); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/EventFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/EventFake.php deleted file mode 100644 index 2a102af..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/EventFake.php +++ /dev/null @@ -1,380 +0,0 @@ -dispatcher = $dispatcher; - - $this->eventsToFake = Arr::wrap($eventsToFake); - } - - /** - * Specify the events that should be dispatched instead of faked. - * - * @param array|string $eventsToDispatch - * @return $this - */ - public function except($eventsToDispatch) - { - $this->eventsToDispatch = array_merge( - $this->eventsToDispatch, - Arr::wrap($eventsToDispatch) - ); - - return $this; - } - - /** - * Assert if an event has a listener attached to it. - * - * @param string $expectedEvent - * @param string|array $expectedListener - * @return void - */ - public function assertListening($expectedEvent, $expectedListener) - { - foreach ($this->dispatcher->getListeners($expectedEvent) as $listenerClosure) { - $actualListener = (new ReflectionFunction($listenerClosure)) - ->getStaticVariables()['listener']; - - if (is_string($actualListener) && Str::contains($actualListener, '@')) { - $actualListener = Str::parseCallback($actualListener); - - if (is_string($expectedListener)) { - if (Str::contains($expectedListener, '@')) { - $expectedListener = Str::parseCallback($expectedListener); - } else { - $expectedListener = [$expectedListener, 'handle']; - } - } - } - - if ($actualListener === $expectedListener || - ($actualListener instanceof Closure && - $expectedListener === Closure::class)) { - PHPUnit::assertTrue(true); - - return; - } - } - - PHPUnit::assertTrue( - false, - sprintf( - 'Event [%s] does not have the [%s] listener attached to it', - $expectedEvent, - print_r($expectedListener, true) - ) - ); - } - - /** - * Assert if an event was dispatched based on a truth-test callback. - * - * @param string|\Closure $event - * @param callable|int|null $callback - * @return void - */ - public function assertDispatched($event, $callback = null) - { - if ($event instanceof Closure) { - [$event, $callback] = [$this->firstClosureParameterType($event), $event]; - } - - if (is_int($callback)) { - return $this->assertDispatchedTimes($event, $callback); - } - - PHPUnit::assertTrue( - $this->dispatched($event, $callback)->count() > 0, - "The expected [{$event}] event was not dispatched." - ); - } - - /** - * Assert if an event was dispatched a number of times. - * - * @param string $event - * @param int $times - * @return void - */ - public function assertDispatchedTimes($event, $times = 1) - { - $count = $this->dispatched($event)->count(); - - PHPUnit::assertSame( - $times, $count, - "The expected [{$event}] event was dispatched {$count} times instead of {$times} times." - ); - } - - /** - * Determine if an event was dispatched based on a truth-test callback. - * - * @param string|\Closure $event - * @param callable|null $callback - * @return void - */ - public function assertNotDispatched($event, $callback = null) - { - if ($event instanceof Closure) { - [$event, $callback] = [$this->firstClosureParameterType($event), $event]; - } - - PHPUnit::assertCount( - 0, $this->dispatched($event, $callback), - "The unexpected [{$event}] event was dispatched." - ); - } - - /** - * Assert that no events were dispatched. - * - * @return void - */ - public function assertNothingDispatched() - { - $count = count(Arr::flatten($this->events)); - - PHPUnit::assertSame( - 0, $count, - "{$count} unexpected events were dispatched." - ); - } - - /** - * Get all of the events matching a truth-test callback. - * - * @param string $event - * @param callable|null $callback - * @return \Illuminate\Support\Collection - */ - public function dispatched($event, $callback = null) - { - if (! $this->hasDispatched($event)) { - return collect(); - } - - $callback = $callback ?: fn () => true; - - return collect($this->events[$event])->filter( - fn ($arguments) => $callback(...$arguments) - ); - } - - /** - * Determine if the given event has been dispatched. - * - * @param string $event - * @return bool - */ - public function hasDispatched($event) - { - return isset($this->events[$event]) && ! empty($this->events[$event]); - } - - /** - * Register an event listener with the dispatcher. - * - * @param \Closure|string|array $events - * @param mixed $listener - * @return void - */ - public function listen($events, $listener = null) - { - $this->dispatcher->listen($events, $listener); - } - - /** - * Determine if a given event has listeners. - * - * @param string $eventName - * @return bool - */ - public function hasListeners($eventName) - { - return $this->dispatcher->hasListeners($eventName); - } - - /** - * Register an event and payload to be dispatched later. - * - * @param string $event - * @param array $payload - * @return void - */ - public function push($event, $payload = []) - { - // - } - - /** - * Register an event subscriber with the dispatcher. - * - * @param object|string $subscriber - * @return void - */ - public function subscribe($subscriber) - { - $this->dispatcher->subscribe($subscriber); - } - - /** - * Flush a set of pushed events. - * - * @param string $event - * @return void - */ - public function flush($event) - { - // - } - - /** - * Fire an event and call the listeners. - * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * @return array|null - */ - public function dispatch($event, $payload = [], $halt = false) - { - $name = is_object($event) ? get_class($event) : (string) $event; - - if ($this->shouldFakeEvent($name, $payload)) { - $this->events[$name][] = func_get_args(); - } else { - return $this->dispatcher->dispatch($event, $payload, $halt); - } - } - - /** - * Determine if an event should be faked or actually dispatched. - * - * @param string $eventName - * @param mixed $payload - * @return bool - */ - protected function shouldFakeEvent($eventName, $payload) - { - if ($this->shouldDispatchEvent($eventName, $payload)) { - return false; - } - - if (empty($this->eventsToFake)) { - return true; - } - - return collect($this->eventsToFake) - ->filter(function ($event) use ($eventName, $payload) { - return $event instanceof Closure - ? $event($eventName, $payload) - : $event === $eventName; - }) - ->isNotEmpty(); - } - - /** - * Determine whether an event should be dispatched or not. - * - * @param string $eventName - * @param mixed $payload - * @return bool - */ - protected function shouldDispatchEvent($eventName, $payload) - { - if (empty($this->eventsToDispatch)) { - return false; - } - - return collect($this->eventsToDispatch) - ->filter(function ($event) use ($eventName, $payload) { - return $event instanceof Closure - ? $event($eventName, $payload) - : $event === $eventName; - }) - ->isNotEmpty(); - } - - /** - * Remove a set of listeners from the dispatcher. - * - * @param string $event - * @return void - */ - public function forget($event) - { - // - } - - /** - * Forget all of the queued listeners. - * - * @return void - */ - public function forgetPushed() - { - // - } - - /** - * Dispatch an event and call the listeners. - * - * @param string|object $event - * @param mixed $payload - * @return array|null - */ - public function until($event, $payload = []) - { - return $this->dispatch($event, $payload, true); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/MailFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/MailFake.php deleted file mode 100644 index c95c15a..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/MailFake.php +++ /dev/null @@ -1,444 +0,0 @@ -prepareMailableAndCallback($mailable, $callback); - - if (is_numeric($callback)) { - return $this->assertSentTimes($mailable, $callback); - } - - $message = "The expected [{$mailable}] mailable was not sent."; - - if (count($this->queuedMailables) > 0) { - $message .= ' Did you mean to use assertQueued() instead?'; - } - - PHPUnit::assertTrue( - $this->sent($mailable, $callback)->count() > 0, - $message - ); - } - - /** - * Assert if a mailable was sent a number of times. - * - * @param string $mailable - * @param int $times - * @return void - */ - protected function assertSentTimes($mailable, $times = 1) - { - $count = $this->sent($mailable)->count(); - - PHPUnit::assertSame( - $times, $count, - "The expected [{$mailable}] mailable was sent {$count} times instead of {$times} times." - ); - } - - /** - * Determine if a mailable was not sent or queued to be sent based on a truth-test callback. - * - * @param string|\Closure $mailable - * @param callable|null $callback - * @return void - */ - public function assertNotOutgoing($mailable, $callback = null) - { - $this->assertNotSent($mailable, $callback); - $this->assertNotQueued($mailable, $callback); - } - - /** - * Determine if a mailable was not sent based on a truth-test callback. - * - * @param string|\Closure $mailable - * @param callable|null $callback - * @return void - */ - public function assertNotSent($mailable, $callback = null) - { - [$mailable, $callback] = $this->prepareMailableAndCallback($mailable, $callback); - - PHPUnit::assertCount( - 0, $this->sent($mailable, $callback), - "The unexpected [{$mailable}] mailable was sent." - ); - } - - /** - * Assert that no mailables were sent or queued to be sent. - * - * @return void - */ - public function assertNothingOutgoing() - { - $this->assertNothingSent(); - $this->assertNothingQueued(); - } - - /** - * Assert that no mailables were sent. - * - * @return void - */ - public function assertNothingSent() - { - $mailableNames = collect($this->mailables)->map( - fn ($mailable) => get_class($mailable) - )->join(', '); - - PHPUnit::assertEmpty($this->mailables, 'The following mailables were sent unexpectedly: '.$mailableNames); - } - - /** - * Assert if a mailable was queued based on a truth-test callback. - * - * @param string|\Closure $mailable - * @param callable|int|null $callback - * @return void - */ - public function assertQueued($mailable, $callback = null) - { - [$mailable, $callback] = $this->prepareMailableAndCallback($mailable, $callback); - - if (is_numeric($callback)) { - return $this->assertQueuedTimes($mailable, $callback); - } - - PHPUnit::assertTrue( - $this->queued($mailable, $callback)->count() > 0, - "The expected [{$mailable}] mailable was not queued." - ); - } - - /** - * Assert if a mailable was queued a number of times. - * - * @param string $mailable - * @param int $times - * @return void - */ - protected function assertQueuedTimes($mailable, $times = 1) - { - $count = $this->queued($mailable)->count(); - - PHPUnit::assertSame( - $times, $count, - "The expected [{$mailable}] mailable was queued {$count} times instead of {$times} times." - ); - } - - /** - * Determine if a mailable was not queued based on a truth-test callback. - * - * @param string|\Closure $mailable - * @param callable|null $callback - * @return void - */ - public function assertNotQueued($mailable, $callback = null) - { - [$mailable, $callback] = $this->prepareMailableAndCallback($mailable, $callback); - - PHPUnit::assertCount( - 0, $this->queued($mailable, $callback), - "The unexpected [{$mailable}] mailable was queued." - ); - } - - /** - * Assert that no mailables were queued. - * - * @return void - */ - public function assertNothingQueued() - { - $mailableNames = collect($this->queuedMailables)->map( - fn ($mailable) => get_class($mailable) - )->join(', '); - - PHPUnit::assertEmpty($this->queuedMailables, 'The following mailables were queued unexpectedly: '.$mailableNames); - } - - /** - * Get all of the mailables matching a truth-test callback. - * - * @param string|\Closure $mailable - * @param callable|null $callback - * @return \Illuminate\Support\Collection - */ - public function sent($mailable, $callback = null) - { - [$mailable, $callback] = $this->prepareMailableAndCallback($mailable, $callback); - - if (! $this->hasSent($mailable)) { - return collect(); - } - - $callback = $callback ?: fn () => true; - - return $this->mailablesOf($mailable)->filter(fn ($mailable) => $callback($mailable)); - } - - /** - * Determine if the given mailable has been sent. - * - * @param string $mailable - * @return bool - */ - public function hasSent($mailable) - { - return $this->mailablesOf($mailable)->count() > 0; - } - - /** - * Get all of the queued mailables matching a truth-test callback. - * - * @param string|\Closure $mailable - * @param callable|null $callback - * @return \Illuminate\Support\Collection - */ - public function queued($mailable, $callback = null) - { - [$mailable, $callback] = $this->prepareMailableAndCallback($mailable, $callback); - - if (! $this->hasQueued($mailable)) { - return collect(); - } - - $callback = $callback ?: fn () => true; - - return $this->queuedMailablesOf($mailable)->filter(fn ($mailable) => $callback($mailable)); - } - - /** - * Determine if the given mailable has been queued. - * - * @param string $mailable - * @return bool - */ - public function hasQueued($mailable) - { - return $this->queuedMailablesOf($mailable)->count() > 0; - } - - /** - * Get all of the mailed mailables for a given type. - * - * @param string $type - * @return \Illuminate\Support\Collection - */ - protected function mailablesOf($type) - { - return collect($this->mailables)->filter(fn ($mailable) => $mailable instanceof $type); - } - - /** - * Get all of the mailed mailables for a given type. - * - * @param string $type - * @return \Illuminate\Support\Collection - */ - protected function queuedMailablesOf($type) - { - return collect($this->queuedMailables)->filter(fn ($mailable) => $mailable instanceof $type); - } - - /** - * Get a mailer instance by name. - * - * @param string|null $name - * @return \Illuminate\Contracts\Mail\Mailer - */ - public function mailer($name = null) - { - $this->currentMailer = $name; - - return $this; - } - - /** - * Begin the process of mailing a mailable class instance. - * - * @param mixed $users - * @return \Illuminate\Mail\PendingMail - */ - public function to($users) - { - return (new PendingMailFake($this))->to($users); - } - - /** - * Begin the process of mailing a mailable class instance. - * - * @param mixed $users - * @return \Illuminate\Mail\PendingMail - */ - public function cc($users) - { - return (new PendingMailFake($this))->cc($users); - } - - /** - * Begin the process of mailing a mailable class instance. - * - * @param mixed $users - * @return \Illuminate\Mail\PendingMail - */ - public function bcc($users) - { - return (new PendingMailFake($this))->bcc($users); - } - - /** - * Send a new message with only a raw text part. - * - * @param string $text - * @param \Closure|string $callback - * @return void - */ - public function raw($text, $callback) - { - // - } - - /** - * Send a new message using a view. - * - * @param \Illuminate\Contracts\Mail\Mailable|string|array $view - * @param array $data - * @param \Closure|string|null $callback - * @return void - */ - public function send($view, array $data = [], $callback = null) - { - if (! $view instanceof Mailable) { - return; - } - - $view->mailer($this->currentMailer); - - if ($view instanceof ShouldQueue) { - return $this->queue($view, $data); - } - - $this->currentMailer = null; - - $this->mailables[] = $view; - } - - /** - * Queue a new e-mail message for sending. - * - * @param \Illuminate\Contracts\Mail\Mailable|string|array $view - * @param string|null $queue - * @return mixed - */ - public function queue($view, $queue = null) - { - if (! $view instanceof Mailable) { - return; - } - - $view->mailer($this->currentMailer); - - $this->currentMailer = null; - - $this->queuedMailables[] = $view; - } - - /** - * Queue a new e-mail message for sending after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param \Illuminate\Contracts\Mail\Mailable|string|array $view - * @param string|null $queue - * @return mixed - */ - public function later($delay, $view, $queue = null) - { - $this->queue($view, $queue); - } - - /** - * Get the array of failed recipients. - * - * @return array - */ - public function failures() - { - return []; - } - - /** - * Infer mailable class using reflection if a typehinted closure is passed to assertion. - * - * @param string|\Closure $mailable - * @param callable|null $callback - * @return array - */ - protected function prepareMailableAndCallback($mailable, $callback) - { - if ($mailable instanceof Closure) { - return [$this->firstClosureParameterType($mailable), $mailable]; - } - - return [$mailable, $callback]; - } - - /** - * Forget all of the resolved mailer instances. - * - * @return $this - */ - public function forgetMailers() - { - $this->currentMailer = null; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/NotificationFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/NotificationFake.php deleted file mode 100644 index 5991420..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/NotificationFake.php +++ /dev/null @@ -1,375 +0,0 @@ -assertSentTo(new AnonymousNotifiable, $notification, $callback); - } - - /** - * Assert if a notification was sent based on a truth-test callback. - * - * @param mixed $notifiable - * @param string|\Closure $notification - * @param callable|null $callback - * @return void - * - * @throws \Exception - */ - public function assertSentTo($notifiable, $notification, $callback = null) - { - if (is_array($notifiable) || $notifiable instanceof Collection) { - if (count($notifiable) === 0) { - throw new Exception('No notifiable given.'); - } - - foreach ($notifiable as $singleNotifiable) { - $this->assertSentTo($singleNotifiable, $notification, $callback); - } - - return; - } - - if ($notification instanceof Closure) { - [$notification, $callback] = [$this->firstClosureParameterType($notification), $notification]; - } - - if (is_numeric($callback)) { - return $this->assertSentToTimes($notifiable, $notification, $callback); - } - - PHPUnit::assertTrue( - $this->sent($notifiable, $notification, $callback)->count() > 0, - "The expected [{$notification}] notification was not sent." - ); - } - - /** - * Assert if a notification was sent on-demand a number of times. - * - * @param string $notification - * @param int $times - * @return void - */ - public function assertSentOnDemandTimes($notification, $times = 1) - { - return $this->assertSentToTimes(new AnonymousNotifiable, $notification, $times); - } - - /** - * Assert if a notification was sent a number of times. - * - * @param mixed $notifiable - * @param string $notification - * @param int $times - * @return void - */ - public function assertSentToTimes($notifiable, $notification, $times = 1) - { - $count = $this->sent($notifiable, $notification)->count(); - - PHPUnit::assertSame( - $times, $count, - "Expected [{$notification}] to be sent {$times} times, but was sent {$count} times." - ); - } - - /** - * Determine if a notification was sent based on a truth-test callback. - * - * @param mixed $notifiable - * @param string|\Closure $notification - * @param callable|null $callback - * @return void - * - * @throws \Exception - */ - public function assertNotSentTo($notifiable, $notification, $callback = null) - { - if (is_array($notifiable) || $notifiable instanceof Collection) { - if (count($notifiable) === 0) { - throw new Exception('No notifiable given.'); - } - - foreach ($notifiable as $singleNotifiable) { - $this->assertNotSentTo($singleNotifiable, $notification, $callback); - } - - return; - } - - if ($notification instanceof Closure) { - [$notification, $callback] = [$this->firstClosureParameterType($notification), $notification]; - } - - PHPUnit::assertCount( - 0, $this->sent($notifiable, $notification, $callback), - "The unexpected [{$notification}] notification was sent." - ); - } - - /** - * Assert that no notifications were sent. - * - * @return void - */ - public function assertNothingSent() - { - PHPUnit::assertEmpty($this->notifications, 'Notifications were sent unexpectedly.'); - } - - /** - * Assert that no notifications were sent to the given notifiable. - * - * @param mixed $notifiable - * @return void - * - * @throws \Exception - */ - public function assertNothingSentTo($notifiable) - { - if (is_array($notifiable) || $notifiable instanceof Collection) { - if (count($notifiable) === 0) { - throw new Exception('No notifiable given.'); - } - - foreach ($notifiable as $singleNotifiable) { - $this->assertNothingSentTo($singleNotifiable); - } - - return; - } - - PHPUnit::assertEmpty( - $this->notifications[get_class($notifiable)][$notifiable->getKey()] ?? [], - 'Notifications were sent unexpectedly.', - ); - } - - /** - * Assert the total amount of times a notification was sent. - * - * @param string $notification - * @param int $expectedCount - * @return void - */ - public function assertSentTimes($notification, $expectedCount) - { - $actualCount = collect($this->notifications) - ->flatten(1) - ->reduce(fn ($count, $sent) => $count + count($sent[$notification] ?? []), 0); - - PHPUnit::assertSame( - $expectedCount, $actualCount, - "Expected [{$notification}] to be sent {$expectedCount} times, but was sent {$actualCount} times." - ); - } - - /** - * Assert the total count of notification that were sent. - * - * @param int $expectedCount - * @return void - */ - public function assertCount($expectedCount) - { - $actualCount = collect($this->notifications)->flatten(3)->count(); - - PHPUnit::assertSame( - $expectedCount, $actualCount, - "Expected {$expectedCount} notifications to be sent, but {$actualCount} were sent." - ); - } - - /** - * Assert the total amount of times a notification was sent. - * - * @param int $expectedCount - * @param string $notification - * @return void - * - * @deprecated Use the assertSentTimes method instead - */ - public function assertTimesSent($expectedCount, $notification) - { - $this->assertSentTimes($notification, $expectedCount); - } - - /** - * Get all of the notifications matching a truth-test callback. - * - * @param mixed $notifiable - * @param string $notification - * @param callable|null $callback - * @return \Illuminate\Support\Collection - */ - public function sent($notifiable, $notification, $callback = null) - { - if (! $this->hasSent($notifiable, $notification)) { - return collect(); - } - - $callback = $callback ?: fn () => true; - - $notifications = collect($this->notificationsFor($notifiable, $notification)); - - return $notifications->filter( - fn ($arguments) => $callback(...array_values($arguments)) - )->pluck('notification'); - } - - /** - * Determine if there are more notifications left to inspect. - * - * @param mixed $notifiable - * @param string $notification - * @return bool - */ - public function hasSent($notifiable, $notification) - { - return ! empty($this->notificationsFor($notifiable, $notification)); - } - - /** - * Get all of the notifications for a notifiable entity by type. - * - * @param mixed $notifiable - * @param string $notification - * @return array - */ - protected function notificationsFor($notifiable, $notification) - { - return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification] ?? []; - } - - /** - * 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) - { - $this->sendNow($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) - { - if (! $notifiables instanceof Collection && ! is_array($notifiables)) { - $notifiables = [$notifiables]; - } - - foreach ($notifiables as $notifiable) { - if (! $notification->id) { - $notification->id = Str::uuid()->toString(); - } - - $notifiableChannels = $channels ?: $notification->via($notifiable); - - if (method_exists($notification, 'shouldSend')) { - $notifiableChannels = array_filter( - $notifiableChannels, - fn ($channel) => $notification->shouldSend($notifiable, $channel) !== false - ); - - if (empty($notifiableChannels)) { - continue; - } - } - - $this->notifications[get_class($notifiable)][$notifiable->getKey()][get_class($notification)][] = [ - 'notification' => $notification, - 'channels' => $notifiableChannels, - 'notifiable' => $notifiable, - 'locale' => $notification->locale ?? $this->locale ?? value(function () use ($notifiable) { - if ($notifiable instanceof HasLocalePreference) { - return $notifiable->preferredLocale(); - } - }), - ]; - } - } - - /** - * Get a channel instance by name. - * - * @param string|null $name - * @return mixed - */ - public function channel($name = null) - { - // - } - - /** - * Set the locale of notifications. - * - * @param string $locale - * @return $this - */ - public function locale($locale) - { - $this->locale = $locale; - - return $this; - } - - /** - * Get the notifications that have been sent. - * - * @return array - */ - public function sentNotifications() - { - return $this->notifications; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingBatchFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingBatchFake.php deleted file mode 100644 index 3d0f499..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingBatchFake.php +++ /dev/null @@ -1,49 +0,0 @@ -bus = $bus; - $this->jobs = $jobs; - } - - /** - * Dispatch the batch. - * - * @return \Illuminate\Bus\Batch - */ - public function dispatch() - { - return $this->bus->recordPendingBatch($this); - } - - /** - * Dispatch the batch after the response is sent to the browser. - * - * @return \Illuminate\Bus\Batch - */ - public function dispatchAfterResponse() - { - return $this->bus->recordPendingBatch($this); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingChainFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingChainFake.php deleted file mode 100644 index 533c649..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingChainFake.php +++ /dev/null @@ -1,56 +0,0 @@ -bus = $bus; - $this->job = $job; - $this->chain = $chain; - } - - /** - * Dispatch the job with the given arguments. - * - * @return \Illuminate\Foundation\Bus\PendingDispatch - */ - public function dispatch() - { - if (is_string($this->job)) { - $firstJob = new $this->job(...func_get_args()); - } elseif ($this->job instanceof Closure) { - $firstJob = CallQueuedClosure::create($this->job); - } else { - $firstJob = $this->job; - } - - $firstJob->allOnConnection($this->connection); - $firstJob->allOnQueue($this->queue); - $firstJob->chain($this->chain); - $firstJob->delay($this->delay); - $firstJob->chainCatchCallbacks = $this->catchCallbacks(); - - return $this->bus->dispatch($firstJob); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php deleted file mode 100644 index 5225130..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php +++ /dev/null @@ -1,42 +0,0 @@ -mailer = $mailer; - } - - /** - * Send a new mailable message instance. - * - * @param \Illuminate\Contracts\Mail\Mailable $mailable - * @return void - */ - public function send(Mailable $mailable) - { - $this->mailer->send($this->fill($mailable)); - } - - /** - * Push the given mailable onto the queue. - * - * @param \Illuminate\Contracts\Mail\Mailable $mailable - * @return mixed - */ - public function queue(Mailable $mailable) - { - return $this->mailer->queue($this->fill($mailable)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/QueueFake.php b/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/QueueFake.php deleted file mode 100644 index f2caa76..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Testing/Fakes/QueueFake.php +++ /dev/null @@ -1,503 +0,0 @@ -jobsToFake = Collection::wrap($jobsToFake); - $this->jobsToBeQueued = Collection::make(); - $this->queue = $queue; - } - - /** - * Specify the jobs that should be queued instead of faked. - * - * @param array|string $jobsToBeQueued - * @return $this - */ - public function except($jobsToBeQueued) - { - $this->jobsToBeQueued = Collection::wrap($jobsToBeQueued)->merge($this->jobsToBeQueued); - - return $this; - } - - /** - * Assert if a job was pushed based on a truth-test callback. - * - * @param string|\Closure $job - * @param callable|int|null $callback - * @return void - */ - public function assertPushed($job, $callback = null) - { - if ($job instanceof Closure) { - [$job, $callback] = [$this->firstClosureParameterType($job), $job]; - } - - if (is_numeric($callback)) { - return $this->assertPushedTimes($job, $callback); - } - - PHPUnit::assertTrue( - $this->pushed($job, $callback)->count() > 0, - "The expected [{$job}] job was not pushed." - ); - } - - /** - * Assert if a job was pushed a number of times. - * - * @param string $job - * @param int $times - * @return void - */ - protected function assertPushedTimes($job, $times = 1) - { - $count = $this->pushed($job)->count(); - - PHPUnit::assertSame( - $times, $count, - "The expected [{$job}] job was pushed {$count} times instead of {$times} times." - ); - } - - /** - * Assert if a job was pushed based on a truth-test callback. - * - * @param string $queue - * @param string|\Closure $job - * @param callable|null $callback - * @return void - */ - public function assertPushedOn($queue, $job, $callback = null) - { - if ($job instanceof Closure) { - [$job, $callback] = [$this->firstClosureParameterType($job), $job]; - } - - $this->assertPushed($job, function ($job, $pushedQueue) use ($callback, $queue) { - if ($pushedQueue !== $queue) { - return false; - } - - return $callback ? $callback(...func_get_args()) : true; - }); - } - - /** - * Assert if a job was pushed with chained jobs based on a truth-test callback. - * - * @param string $job - * @param array $expectedChain - * @param callable|null $callback - * @return void - */ - public function assertPushedWithChain($job, $expectedChain = [], $callback = null) - { - PHPUnit::assertTrue( - $this->pushed($job, $callback)->isNotEmpty(), - "The expected [{$job}] job was not pushed." - ); - - PHPUnit::assertTrue( - collect($expectedChain)->isNotEmpty(), - 'The expected chain can not be empty.' - ); - - $this->isChainOfObjects($expectedChain) - ? $this->assertPushedWithChainOfObjects($job, $expectedChain, $callback) - : $this->assertPushedWithChainOfClasses($job, $expectedChain, $callback); - } - - /** - * Assert if a job was pushed with an empty chain based on a truth-test callback. - * - * @param string $job - * @param callable|null $callback - * @return void - */ - public function assertPushedWithoutChain($job, $callback = null) - { - PHPUnit::assertTrue( - $this->pushed($job, $callback)->isNotEmpty(), - "The expected [{$job}] job was not pushed." - ); - - $this->assertPushedWithChainOfClasses($job, [], $callback); - } - - /** - * Assert if a job was pushed with chained jobs based on a truth-test callback. - * - * @param string $job - * @param array $expectedChain - * @param callable|null $callback - * @return void - */ - protected function assertPushedWithChainOfObjects($job, $expectedChain, $callback) - { - $chain = collect($expectedChain)->map(fn ($job) => serialize($job))->all(); - - PHPUnit::assertTrue( - $this->pushed($job, $callback)->filter(fn ($job) => $job->chained == $chain)->isNotEmpty(), - 'The expected chain was not pushed.' - ); - } - - /** - * Assert if a job was pushed with chained jobs based on a truth-test callback. - * - * @param string $job - * @param array $expectedChain - * @param callable|null $callback - * @return void - */ - protected function assertPushedWithChainOfClasses($job, $expectedChain, $callback) - { - $matching = $this->pushed($job, $callback)->map->chained->map(function ($chain) { - return collect($chain)->map(function ($job) { - return get_class(unserialize($job)); - }); - })->filter(function ($chain) use ($expectedChain) { - return $chain->all() === $expectedChain; - }); - - PHPUnit::assertTrue( - $matching->isNotEmpty(), 'The expected chain was not pushed.' - ); - } - - /** - * Determine if the given chain is entirely composed of objects. - * - * @param array $chain - * @return bool - */ - protected function isChainOfObjects($chain) - { - return ! collect($chain)->contains(fn ($job) => ! is_object($job)); - } - - /** - * Determine if a job was pushed based on a truth-test callback. - * - * @param string|\Closure $job - * @param callable|null $callback - * @return void - */ - public function assertNotPushed($job, $callback = null) - { - if ($job instanceof Closure) { - [$job, $callback] = [$this->firstClosureParameterType($job), $job]; - } - - PHPUnit::assertCount( - 0, $this->pushed($job, $callback), - "The unexpected [{$job}] job was pushed." - ); - } - - /** - * Assert that no jobs were pushed. - * - * @return void - */ - public function assertNothingPushed() - { - PHPUnit::assertEmpty($this->jobs, 'Jobs were pushed unexpectedly.'); - } - - /** - * Get all of the jobs matching a truth-test callback. - * - * @param string $job - * @param callable|null $callback - * @return \Illuminate\Support\Collection - */ - public function pushed($job, $callback = null) - { - if (! $this->hasPushed($job)) { - return collect(); - } - - $callback = $callback ?: fn () => true; - - return collect($this->jobs[$job])->filter( - fn ($data) => $callback($data['job'], $data['queue'], $data['data']) - )->pluck('job'); - } - - /** - * Determine if there are any stored jobs for a given class. - * - * @param string $job - * @return bool - */ - public function hasPushed($job) - { - return isset($this->jobs[$job]) && ! empty($this->jobs[$job]); - } - - /** - * Resolve a queue connection instance. - * - * @param mixed $value - * @return \Illuminate\Contracts\Queue\Queue - */ - public function connection($value = null) - { - return $this; - } - - /** - * Get the size of the queue. - * - * @param string|null $queue - * @return int - */ - public function size($queue = null) - { - return collect($this->jobs)->flatten(1)->filter( - fn ($job) => $job['queue'] === $queue - )->count(); - } - - /** - * Push a new job onto the queue. - * - * @param string|object $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function push($job, $data = '', $queue = null) - { - if ($this->shouldFakeJob($job)) { - $this->jobs[is_object($job) ? get_class($job) : $job][] = [ - 'job' => $job, - 'queue' => $queue, - 'data' => $data, - ]; - } else { - is_object($job) && isset($job->connection) - ? $this->queue->connection($job->connection)->push($job, $data, $queue) - : $this->queue->push($job, $data, $queue); - } - } - - /** - * Determine if a job should be faked or actually dispatched. - * - * @param object $job - * @return bool - */ - public function shouldFakeJob($job) - { - if ($this->shouldDispatchJob($job)) { - return false; - } - - if ($this->jobsToFake->isEmpty()) { - return true; - } - - return $this->jobsToFake->contains( - fn ($jobToFake) => $job instanceof ((string) $jobToFake) - ); - } - - /** - * Determine if a job should be pushed to the queue instead of faked. - * - * @param object $job - * @return bool - */ - protected function shouldDispatchJob($job) - { - if ($this->jobsToBeQueued->isEmpty()) { - return false; - } - - return $this->jobsToBeQueued->contains( - fn ($jobToQueue) => $job instanceof ((string) $jobToQueue) - ); - } - - /** - * Push a raw payload onto the queue. - * - * @param string $payload - * @param string|null $queue - * @param array $options - * @return mixed - */ - public function pushRaw($payload, $queue = null, array $options = []) - { - // - } - - /** - * Push a new job onto the queue after (n) seconds. - * - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string|object $job - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->push($job, $data, $queue); - } - - /** - * Push a new job onto the queue. - * - * @param string $queue - * @param string|object $job - * @param mixed $data - * @return mixed - */ - public function pushOn($queue, $job, $data = '') - { - return $this->push($job, $data, $queue); - } - - /** - * Push a new job onto a specific queue after (n) seconds. - * - * @param string $queue - * @param \DateTimeInterface|\DateInterval|int $delay - * @param string|object $job - * @param mixed $data - * @return mixed - */ - public function laterOn($queue, $delay, $job, $data = '') - { - return $this->push($job, $data, $queue); - } - - /** - * Pop the next job off of the queue. - * - * @param string|null $queue - * @return \Illuminate\Contracts\Queue\Job|null - */ - public function pop($queue = null) - { - // - } - - /** - * Push an array of jobs onto the queue. - * - * @param array $jobs - * @param mixed $data - * @param string|null $queue - * @return mixed - */ - public function bulk($jobs, $data = '', $queue = null) - { - foreach ($jobs as $job) { - $this->push($job, $data, $queue); - } - } - - /** - * Get the jobs that have been pushed. - * - * @return array - */ - public function pushedJobs() - { - return $this->jobs; - } - - /** - * Get the connection name for the queue. - * - * @return string - */ - public function getConnectionName() - { - // - } - - /** - * Set the connection name for the queue. - * - * @param string $name - * @return $this - */ - public function setConnectionName($name) - { - return $this; - } - - /** - * Override the QueueManager to prevent circular dependency. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - throw new BadMethodCallException(sprintf( - 'Call to undefined method %s::%s()', static::class, $method - )); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Timebox.php b/framework-9.50.2/src/Illuminate/Support/Timebox.php deleted file mode 100644 index 6e2aa4d..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Timebox.php +++ /dev/null @@ -1,72 +0,0 @@ -earlyReturn && $remainder > 0) { - $this->usleep($remainder); - } - - return $result; - } - - /** - * Indicate that the timebox can return early. - * - * @return $this - */ - public function returnEarly() - { - $this->earlyReturn = true; - - return $this; - } - - /** - * Indicate that the timebox cannot return early. - * - * @return $this - */ - public function dontReturnEarly() - { - $this->earlyReturn = false; - - return $this; - } - - /** - * Sleep for the specified number of microseconds. - * - * @param int $microseconds - * @return void - */ - protected function usleep(int $microseconds) - { - usleep($microseconds); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Traits/CapsuleManagerTrait.php b/framework-9.50.2/src/Illuminate/Support/Traits/CapsuleManagerTrait.php deleted file mode 100644 index 0532755..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Traits/CapsuleManagerTrait.php +++ /dev/null @@ -1,69 +0,0 @@ -container = $container; - - if (! $this->container->bound('config')) { - $this->container->instance('config', new Fluent); - } - } - - /** - * Make this capsule instance available globally. - * - * @return void - */ - public function setAsGlobal() - { - static::$instance = $this; - } - - /** - * Get the IoC container instance. - * - * @return \Illuminate\Contracts\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Traits/ForwardsCalls.php b/framework-9.50.2/src/Illuminate/Support/Traits/ForwardsCalls.php deleted file mode 100644 index e718180..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Traits/ForwardsCalls.php +++ /dev/null @@ -1,75 +0,0 @@ -{$method}(...$parameters); - } catch (Error|BadMethodCallException $e) { - $pattern = '~^Call to undefined method (?P[^:]+)::(?P[^\(]+)\(\)$~'; - - if (! preg_match($pattern, $e->getMessage(), $matches)) { - throw $e; - } - - if ($matches['class'] != get_class($object) || - $matches['method'] != $method) { - throw $e; - } - - static::throwBadMethodCallException($method); - } - } - - /** - * Forward a method call to the given object, returning $this if the forwarded call returned itself. - * - * @param mixed $object - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - protected function forwardDecoratedCallTo($object, $method, $parameters) - { - $result = $this->forwardCallTo($object, $method, $parameters); - - if ($result === $object) { - return $this; - } - - return $result; - } - - /** - * Throw a bad method call exception for the given method. - * - * @param string $method - * @return void - * - * @throws \BadMethodCallException - */ - protected static function throwBadMethodCallException($method) - { - throw new BadMethodCallException(sprintf( - 'Call to undefined method %s::%s()', static::class, $method - )); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Traits/Localizable.php b/framework-9.50.2/src/Illuminate/Support/Traits/Localizable.php deleted file mode 100644 index 1e9fa58..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Traits/Localizable.php +++ /dev/null @@ -1,34 +0,0 @@ -getLocale(); - - try { - $app->setLocale($locale); - - return $callback(); - } finally { - $app->setLocale($original); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Traits/ReflectsClosures.php b/framework-9.50.2/src/Illuminate/Support/Traits/ReflectsClosures.php deleted file mode 100644 index bf47d7e..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Traits/ReflectsClosures.php +++ /dev/null @@ -1,88 +0,0 @@ -closureParameterTypes($closure)); - - if (! $types) { - throw new RuntimeException('The given Closure has no parameters.'); - } - - if ($types[0] === null) { - throw new RuntimeException('The first parameter of the given Closure is missing a type hint.'); - } - - return $types[0]; - } - - /** - * Get the class names of the first parameter of the given Closure, including union types. - * - * @param \Closure $closure - * @return array - * - * @throws \ReflectionException - * @throws \RuntimeException - */ - protected function firstClosureParameterTypes(Closure $closure) - { - $reflection = new ReflectionFunction($closure); - - $types = collect($reflection->getParameters())->mapWithKeys(function ($parameter) { - if ($parameter->isVariadic()) { - return [$parameter->getName() => null]; - } - - return [$parameter->getName() => Reflector::getParameterClassNames($parameter)]; - })->filter()->values()->all(); - - if (empty($types)) { - throw new RuntimeException('The given Closure has no parameters.'); - } - - if (isset($types[0]) && empty($types[0])) { - throw new RuntimeException('The first parameter of the given Closure is missing a type hint.'); - } - - return $types[0]; - } - - /** - * Get the class names / types of the parameters of the given Closure. - * - * @param \Closure $closure - * @return array - * - * @throws \ReflectionException - */ - protected function closureParameterTypes(Closure $closure) - { - $reflection = new ReflectionFunction($closure); - - return collect($reflection->getParameters())->mapWithKeys(function ($parameter) { - if ($parameter->isVariadic()) { - return [$parameter->getName() => null]; - } - - return [$parameter->getName() => Reflector::getParameterClassName($parameter)]; - })->all(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/Traits/Tappable.php b/framework-9.50.2/src/Illuminate/Support/Traits/Tappable.php deleted file mode 100644 index 9353451..0000000 --- a/framework-9.50.2/src/Illuminate/Support/Traits/Tappable.php +++ /dev/null @@ -1,17 +0,0 @@ -input = $input; - } - - /** - * Determine if the validated input has one or more keys. - * - * @param mixed $keys - * @return bool - */ - public function has($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - foreach ($keys as $key) { - if (! Arr::has($this->input, $key)) { - return false; - } - } - - return true; - } - - /** - * Determine if the validated input is missing one or more keys. - * - * @param mixed $keys - * @return bool - */ - public function missing($keys) - { - return ! $this->has($keys); - } - - /** - * Get a subset containing the provided keys with values from the input data. - * - * @param mixed $keys - * @return array - */ - public function only($keys) - { - $results = []; - - $input = $this->input; - - $placeholder = new stdClass; - - foreach (is_array($keys) ? $keys : func_get_args() as $key) { - $value = data_get($input, $key, $placeholder); - - if ($value !== $placeholder) { - Arr::set($results, $key, $value); - } - } - - return $results; - } - - /** - * Get all of the input except for a specified array of items. - * - * @param mixed $keys - * @return array - */ - public function except($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - $results = $this->input; - - Arr::forget($results, $keys); - - return $results; - } - - /** - * Merge the validated input with the given array of additional data. - * - * @param array $items - * @return static - */ - public function merge(array $items) - { - return new static(array_merge($this->input, $items)); - } - - /** - * Get the input as a collection. - * - * @return \Illuminate\Support\Collection - */ - public function collect() - { - return new Collection($this->input); - } - - /** - * Get the raw, underlying input array. - * - * @return array - */ - public function all() - { - return $this->input; - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return $this->all(); - } - - /** - * Dynamically access input data. - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - return $this->input[$name]; - } - - /** - * Dynamically set input data. - * - * @param string $name - * @param mixed $value - * @return mixed - */ - public function __set($name, $value) - { - $this->input[$name] = $value; - } - - /** - * Determine if an input key is set. - * - * @return bool - */ - public function __isset($name) - { - return isset($this->input[$name]); - } - - /** - * Remove an input key. - * - * @param string $name - * @return void - */ - public function __unset($name) - { - unset($this->input[$name]); - } - - /** - * Determine if an item exists at an offset. - * - * @param mixed $key - * @return bool - */ - public function offsetExists($key): bool - { - return isset($this->input[$key]); - } - - /** - * Get an item at a given offset. - * - * @param mixed $key - * @return mixed - */ - public function offsetGet($key): mixed - { - return $this->input[$key]; - } - - /** - * Set the item at a given offset. - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value): void - { - if (is_null($key)) { - $this->input[] = $value; - } else { - $this->input[$key] = $value; - } - } - - /** - * Unset the item at a given offset. - * - * @param string $key - * @return void - */ - public function offsetUnset($key): void - { - unset($this->input[$key]); - } - - /** - * Get an iterator for the input. - * - * @return \ArrayIterator - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->input); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/ViewErrorBag.php b/framework-9.50.2/src/Illuminate/Support/ViewErrorBag.php deleted file mode 100644 index ff9da4f..0000000 --- a/framework-9.50.2/src/Illuminate/Support/ViewErrorBag.php +++ /dev/null @@ -1,130 +0,0 @@ -bags[$key]); - } - - /** - * Get a MessageBag instance from the bags. - * - * @param string $key - * @return \Illuminate\Contracts\Support\MessageBag - */ - public function getBag($key) - { - return Arr::get($this->bags, $key) ?: new MessageBag; - } - - /** - * Get all the bags. - * - * @return array - */ - public function getBags() - { - return $this->bags; - } - - /** - * Add a new MessageBag instance to the bags. - * - * @param string $key - * @param \Illuminate\Contracts\Support\MessageBag $bag - * @return $this - */ - public function put($key, MessageBagContract $bag) - { - $this->bags[$key] = $bag; - - return $this; - } - - /** - * Determine if the default message bag has any messages. - * - * @return bool - */ - public function any() - { - return $this->count() > 0; - } - - /** - * Get the number of messages in the default bag. - * - * @return int - */ - public function count(): int - { - return $this->getBag('default')->count(); - } - - /** - * Dynamically call methods on the default bag. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->getBag('default')->$method(...$parameters); - } - - /** - * Dynamically access a view error bag. - * - * @param string $key - * @return \Illuminate\Contracts\Support\MessageBag - */ - public function __get($key) - { - return $this->getBag($key); - } - - /** - * Dynamically set a view error bag. - * - * @param string $key - * @param \Illuminate\Contracts\Support\MessageBag $value - * @return void - */ - public function __set($key, $value) - { - $this->put($key, $value); - } - - /** - * Convert the default bag to its string representation. - * - * @return string - */ - public function __toString() - { - return (string) $this->getBag('default'); - } -} diff --git a/framework-9.50.2/src/Illuminate/Support/composer.json b/framework-9.50.2/src/Illuminate/Support/composer.json deleted file mode 100644 index cc86a27..0000000 --- a/framework-9.50.2/src/Illuminate/Support/composer.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "illuminate/support", - "description": "The Illuminate Support package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "ext-mbstring": "*", - "doctrine/inflector": "^2.0", - "illuminate/collections": "^9.0", - "illuminate/conditionable": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "nesbot/carbon": "^2.62.1", - "voku/portable-ascii": "^2.0" - }, - "conflict": { - "tightenco/collect": "<5.5.33" - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "illuminate/filesystem": "Required to use the composer class (^9.0).", - "league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^2.0.2).", - "ramsey/uuid": "Required to use Str::uuid() (^4.7).", - "symfony/process": "Required to use the composer class (^6.0).", - "symfony/uid": "Required to use Str::ulid() (^6.0).", - "symfony/var-dumper": "Required to use the dd function (^6.0).", - "vlucas/phpdotenv": "Required to use the Env class and env helper (^5.4.1)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Support/helpers.php b/framework-9.50.2/src/Illuminate/Support/helpers.php deleted file mode 100755 index bb8d178..0000000 --- a/framework-9.50.2/src/Illuminate/Support/helpers.php +++ /dev/null @@ -1,425 +0,0 @@ - $value) { - if (is_numeric($key)) { - $start++; - - $array[$start] = Arr::pull($array, $key); - } - } - - return $array; - } -} - -if (! function_exists('blank')) { - /** - * Determine if the given value is "blank". - * - * @param mixed $value - * @return bool - */ - function blank($value) - { - if (is_null($value)) { - return true; - } - - if (is_string($value)) { - return trim($value) === ''; - } - - if (is_numeric($value) || is_bool($value)) { - return false; - } - - if ($value instanceof Countable) { - return count($value) === 0; - } - - return empty($value); - } -} - -if (! function_exists('class_basename')) { - /** - * Get the class "basename" of the given object / class. - * - * @param string|object $class - * @return string - */ - function class_basename($class) - { - $class = is_object($class) ? get_class($class) : $class; - - return basename(str_replace('\\', '/', $class)); - } -} - -if (! function_exists('class_uses_recursive')) { - /** - * Returns all traits used by a class, its parent classes and trait of their traits. - * - * @param object|string $class - * @return array - */ - function class_uses_recursive($class) - { - if (is_object($class)) { - $class = get_class($class); - } - - $results = []; - - foreach (array_reverse(class_parents($class)) + [$class => $class] as $class) { - $results += trait_uses_recursive($class); - } - - return array_unique($results); - } -} - -if (! function_exists('e')) { - /** - * Encode HTML special characters in a string. - * - * @param \Illuminate\Contracts\Support\DeferringDisplayableValue|\Illuminate\Contracts\Support\Htmlable|\BackedEnum|string|null $value - * @param bool $doubleEncode - * @return string - */ - function e($value, $doubleEncode = true) - { - if ($value instanceof DeferringDisplayableValue) { - $value = $value->resolveDisplayableValue(); - } - - if ($value instanceof Htmlable) { - return $value->toHtml(); - } - - if ($value instanceof BackedEnum) { - $value = $value->value; - } - - return htmlspecialchars($value ?? '', ENT_QUOTES, 'UTF-8', $doubleEncode); - } -} - -if (! function_exists('env')) { - /** - * Gets the value of an environment variable. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - function env($key, $default = null) - { - return Env::get($key, $default); - } -} - -if (! function_exists('filled')) { - /** - * Determine if a value is "filled". - * - * @param mixed $value - * @return bool - */ - function filled($value) - { - return ! blank($value); - } -} - -if (! function_exists('object_get')) { - /** - * Get an item from an object using "dot" notation. - * - * @param object $object - * @param string|null $key - * @param mixed $default - * @return mixed - */ - function object_get($object, $key, $default = null) - { - if (is_null($key) || trim($key) === '') { - return $object; - } - - foreach (explode('.', $key) as $segment) { - if (! is_object($object) || ! isset($object->{$segment})) { - return value($default); - } - - $object = $object->{$segment}; - } - - return $object; - } -} - -if (! function_exists('optional')) { - /** - * Provide access to optional objects. - * - * @param mixed $value - * @param callable|null $callback - * @return mixed - */ - function optional($value = null, callable $callback = null) - { - if (is_null($callback)) { - return new Optional($value); - } elseif (! is_null($value)) { - return $callback($value); - } - } -} - -if (! function_exists('preg_replace_array')) { - /** - * Replace a given pattern with each value in the array in sequentially. - * - * @param string $pattern - * @param array $replacements - * @param string $subject - * @return string - */ - function preg_replace_array($pattern, array $replacements, $subject) - { - return preg_replace_callback($pattern, function () use (&$replacements) { - foreach ($replacements as $value) { - return array_shift($replacements); - } - }, $subject); - } -} - -if (! function_exists('retry')) { - /** - * Retry an operation a given number of times. - * - * @param int|array $times - * @param callable $callback - * @param int|\Closure $sleepMilliseconds - * @param callable|null $when - * @return mixed - * - * @throws \Exception - */ - function retry($times, callable $callback, $sleepMilliseconds = 0, $when = null) - { - $attempts = 0; - - $backoff = []; - - if (is_array($times)) { - $backoff = $times; - - $times = count($times) + 1; - } - - beginning: - $attempts++; - $times--; - - try { - return $callback($attempts); - } catch (Exception $e) { - if ($times < 1 || ($when && ! $when($e))) { - throw $e; - } - - $sleepMilliseconds = $backoff[$attempts - 1] ?? $sleepMilliseconds; - - if ($sleepMilliseconds) { - usleep(value($sleepMilliseconds, $attempts, $e) * 1000); - } - - goto beginning; - } - } -} - -if (! function_exists('str')) { - /** - * Get a new stringable object from the given string. - * - * @param string|null $string - * @return \Illuminate\Support\Stringable|mixed - */ - function str($string = null) - { - if (func_num_args() === 0) { - return new class - { - public function __call($method, $parameters) - { - return Str::$method(...$parameters); - } - - public function __toString() - { - return ''; - } - }; - } - - return Str::of($string); - } -} - -if (! function_exists('tap')) { - /** - * Call the given Closure with the given value then return the value. - * - * @param mixed $value - * @param callable|null $callback - * @return mixed - */ - function tap($value, $callback = null) - { - if (is_null($callback)) { - return new HigherOrderTapProxy($value); - } - - $callback($value); - - return $value; - } -} - -if (! function_exists('throw_if')) { - /** - * Throw the given exception if the given condition is true. - * - * @param mixed $condition - * @param \Throwable|string $exception - * @param mixed ...$parameters - * @return mixed - * - * @throws \Throwable - */ - function throw_if($condition, $exception = 'RuntimeException', ...$parameters) - { - if ($condition) { - if (is_string($exception) && class_exists($exception)) { - $exception = new $exception(...$parameters); - } - - throw is_string($exception) ? new RuntimeException($exception) : $exception; - } - - return $condition; - } -} - -if (! function_exists('throw_unless')) { - /** - * Throw the given exception unless the given condition is true. - * - * @param mixed $condition - * @param \Throwable|string $exception - * @param mixed ...$parameters - * @return mixed - * - * @throws \Throwable - */ - function throw_unless($condition, $exception = 'RuntimeException', ...$parameters) - { - throw_if(! $condition, $exception, ...$parameters); - - return $condition; - } -} - -if (! function_exists('trait_uses_recursive')) { - /** - * Returns all traits used by a trait and its traits. - * - * @param string $trait - * @return array - */ - function trait_uses_recursive($trait) - { - $traits = class_uses($trait) ?: []; - - foreach ($traits as $trait) { - $traits += trait_uses_recursive($trait); - } - - return $traits; - } -} - -if (! function_exists('transform')) { - /** - * Transform the given value if it is present. - * - * @param mixed $value - * @param callable $callback - * @param mixed $default - * @return mixed|null - */ - function transform($value, callable $callback, $default = null) - { - if (filled($value)) { - return $callback($value); - } - - if (is_callable($default)) { - return $default($value); - } - - return $default; - } -} - -if (! function_exists('windows_os')) { - /** - * Determine whether the current environment is Windows based. - * - * @return bool - */ - function windows_os() - { - return PHP_OS_FAMILY === 'Windows'; - } -} - -if (! function_exists('with')) { - /** - * Return the given value, optionally passed through the given callback. - * - * @template TValue - * @template TReturn - * - * @param TValue $value - * @param (callable(TValue): (TReturn))|null $callback - * @return ($callback is null ? TValue : TReturn) - */ - function with($value, callable $callback = null) - { - return is_null($callback) ? $value : $callback($value); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Assert.php b/framework-9.50.2/src/Illuminate/Testing/Assert.php deleted file mode 100644 index c0184b7..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Assert.php +++ /dev/null @@ -1,79 +0,0 @@ -json = $jsonable; - - if ($jsonable instanceof JsonSerializable) { - $this->decoded = $jsonable->jsonSerialize(); - } elseif ($jsonable instanceof Jsonable) { - $this->decoded = json_decode($jsonable->toJson(), true); - } elseif (is_array($jsonable)) { - $this->decoded = $jsonable; - } else { - $this->decoded = json_decode($jsonable, true); - } - } - - /** - * Validate and return the decoded response JSON. - * - * @param string|null $key - * @return mixed - */ - public function json($key = null) - { - return data_get($this->decoded, $key); - } - - /** - * Assert that the response JSON has the expected count of items at the given key. - * - * @param int $count - * @param string|null $key - * @return $this - */ - public function assertCount(int $count, $key = null) - { - if (! is_null($key)) { - PHPUnit::assertCount( - $count, data_get($this->decoded, $key), - "Failed to assert that the response count matched the expected {$count}" - ); - - return $this; - } - - PHPUnit::assertCount($count, - $this->decoded, - "Failed to assert that the response count matched the expected {$count}" - ); - - return $this; - } - - /** - * Assert that the response has the exact given JSON. - * - * @param array $data - * @return $this - */ - public function assertExact(array $data) - { - $actual = $this->reorderAssocKeys((array) $this->decoded); - - $expected = $this->reorderAssocKeys($data); - - PHPUnit::assertEquals( - json_encode($expected, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), - json_encode($actual, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) - ); - - return $this; - } - - /** - * Assert that the response has the similar JSON as given. - * - * @param array $data - * @return $this - */ - public function assertSimilar(array $data) - { - $actual = json_encode( - Arr::sortRecursive((array) $this->decoded), - JSON_UNESCAPED_UNICODE - ); - - PHPUnit::assertEquals(json_encode(Arr::sortRecursive($data), JSON_UNESCAPED_UNICODE), $actual); - - return $this; - } - - /** - * Assert that the response contains the given JSON fragment. - * - * @param array $data - * @return $this - */ - public function assertFragment(array $data) - { - $actual = json_encode( - Arr::sortRecursive((array) $this->decoded), - JSON_UNESCAPED_UNICODE - ); - - foreach (Arr::sortRecursive($data) as $key => $value) { - $expected = $this->jsonSearchStrings($key, $value); - - PHPUnit::assertTrue( - Str::contains($actual, $expected), - 'Unable to find JSON fragment: '.PHP_EOL.PHP_EOL. - '['.json_encode([$key => $value], JSON_UNESCAPED_UNICODE).']'.PHP_EOL.PHP_EOL. - 'within'.PHP_EOL.PHP_EOL. - "[{$actual}]." - ); - } - - return $this; - } - - /** - * Assert that the response does not contain the given JSON fragment. - * - * @param array $data - * @param bool $exact - * @return $this - */ - public function assertMissing(array $data, $exact = false) - { - if ($exact) { - return $this->assertMissingExact($data); - } - - $actual = json_encode( - Arr::sortRecursive((array) $this->decoded), - JSON_UNESCAPED_UNICODE - ); - - foreach (Arr::sortRecursive($data) as $key => $value) { - $unexpected = $this->jsonSearchStrings($key, $value); - - PHPUnit::assertFalse( - Str::contains($actual, $unexpected), - 'Found unexpected JSON fragment: '.PHP_EOL.PHP_EOL. - '['.json_encode([$key => $value], JSON_UNESCAPED_UNICODE).']'.PHP_EOL.PHP_EOL. - 'within'.PHP_EOL.PHP_EOL. - "[{$actual}]." - ); - } - - return $this; - } - - /** - * Assert that the response does not contain the exact JSON fragment. - * - * @param array $data - * @return $this - */ - public function assertMissingExact(array $data) - { - $actual = json_encode( - Arr::sortRecursive((array) $this->decoded), - JSON_UNESCAPED_UNICODE - ); - - foreach (Arr::sortRecursive($data) as $key => $value) { - $unexpected = $this->jsonSearchStrings($key, $value); - - if (! Str::contains($actual, $unexpected)) { - return $this; - } - } - - PHPUnit::fail( - 'Found unexpected JSON fragment: '.PHP_EOL.PHP_EOL. - '['.json_encode($data, JSON_UNESCAPED_UNICODE).']'.PHP_EOL.PHP_EOL. - 'within'.PHP_EOL.PHP_EOL. - "[{$actual}]." - ); - - return $this; - } - - /** - * Assert that the response does not contain the given path. - * - * @param string $path - * @return $this - */ - public function assertMissingPath($path) - { - PHPUnit::assertFalse(Arr::has($this->json(), $path)); - - return $this; - } - - /** - * Assert that the expected value and type exists at the given path in the response. - * - * @param string $path - * @param mixed $expect - * @return $this - */ - public function assertPath($path, $expect) - { - if ($expect instanceof Closure) { - PHPUnit::assertTrue($expect($this->json($path))); - } else { - PHPUnit::assertSame($expect, $this->json($path)); - } - - return $this; - } - - /** - * Assert that the response has a given JSON structure. - * - * @param array|null $structure - * @param array|null $responseData - * @return $this - */ - public function assertStructure(array $structure = null, $responseData = null) - { - if (is_null($structure)) { - return $this->assertSimilar($this->decoded); - } - - if (! is_null($responseData)) { - return (new static($responseData))->assertStructure($structure); - } - - foreach ($structure as $key => $value) { - if (is_array($value) && $key === '*') { - PHPUnit::assertIsArray($this->decoded); - - foreach ($this->decoded as $responseDataItem) { - $this->assertStructure($structure['*'], $responseDataItem); - } - } elseif (is_array($value)) { - PHPUnit::assertArrayHasKey($key, $this->decoded); - - $this->assertStructure($structure[$key], $this->decoded[$key]); - } else { - PHPUnit::assertArrayHasKey($value, $this->decoded); - } - } - - return $this; - } - - /** - * Assert that the response is a superset of the given JSON. - * - * @param array $data - * @param bool $strict - * @return $this - */ - public function assertSubset(array $data, $strict = false) - { - PHPUnit::assertArraySubset( - $data, $this->decoded, $strict, $this->assertJsonMessage($data) - ); - - return $this; - } - - /** - * Reorder associative array keys to make it easy to compare arrays. - * - * @param array $data - * @return array - */ - protected function reorderAssocKeys(array $data) - { - $data = Arr::dot($data); - ksort($data); - - $result = []; - - foreach ($data as $key => $value) { - Arr::set($result, $key, $value); - } - - return $result; - } - - /** - * Get the assertion message for assertJson. - * - * @param array $data - * @return string - */ - protected function assertJsonMessage(array $data) - { - $expected = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - - $actual = json_encode($this->decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - - return 'Unable to find JSON: '.PHP_EOL.PHP_EOL. - "[{$expected}]".PHP_EOL.PHP_EOL. - 'within response JSON:'.PHP_EOL.PHP_EOL. - "[{$actual}].".PHP_EOL.PHP_EOL; - } - - /** - * Get the strings we need to search for when examining the JSON. - * - * @param string $key - * @param string $value - * @return array - */ - protected function jsonSearchStrings($key, $value) - { - $needle = Str::substr(json_encode([$key => $value], JSON_UNESCAPED_UNICODE), 1, -1); - - return [ - $needle.']', - $needle.'}', - $needle.',', - ]; - } - - /** - * Get the total number of items in the underlying JSON array. - * - * @return int - */ - public function count(): int - { - return count($this->decoded); - } - - /** - * Determine whether an offset exists. - * - * @param mixed $offset - * @return bool - */ - public function offsetExists($offset): bool - { - return isset($this->decoded[$offset]); - } - - /** - * Get the value at the given offset. - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset): mixed - { - return $this->decoded[$offset]; - } - - /** - * Set the value at the given offset. - * - * @param string $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset, $value): void - { - $this->decoded[$offset] = $value; - } - - /** - * Unset the value at the given offset. - * - * @param string $offset - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->decoded[$offset]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Concerns/AssertsStatusCodes.php b/framework-9.50.2/src/Illuminate/Testing/Concerns/AssertsStatusCodes.php deleted file mode 100644 index 9622620..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Concerns/AssertsStatusCodes.php +++ /dev/null @@ -1,165 +0,0 @@ -assertStatus(200); - } - - /** - * Assert that the response has a 201 "Created" status code. - * - * @return $this - */ - public function assertCreated() - { - return $this->assertStatus(201); - } - - /** - * Assert that the response has a 202 "Accepted" status code. - * - * @return $this - */ - public function assertAccepted() - { - return $this->assertStatus(202); - } - - /** - * Assert that the response has the given status code and no content. - * - * @param int $status - * @return $this - */ - public function assertNoContent($status = 204) - { - $this->assertStatus($status); - - PHPUnit::assertEmpty($this->getContent(), 'Response content is not empty.'); - - return $this; - } - - /** - * Assert that the response has a 301 "Moved Permanently" status code. - * - * @param int $status - * @return $this - */ - public function assertMovedPermanently() - { - return $this->assertStatus(301); - } - - /** - * Assert that the response has a 302 "Found" status code. - * - * @param int $status - * @return $this - */ - public function assertFound() - { - return $this->assertStatus(302); - } - - /** - * Assert that the response has a 400 "Bad Request" status code. - * - * @return $this - */ - public function assertBadRequest() - { - return $this->assertStatus(400); - } - - /** - * Assert that the response has a 401 "Unauthorized" status code. - * - * @return $this - */ - public function assertUnauthorized() - { - return $this->assertStatus(401); - } - - /** - * Assert that the response has a 402 "Payment Required" status code. - * - * @return $this - */ - public function assertPaymentRequired() - { - return $this->assertStatus(402); - } - - /** - * Assert that the response has a 403 "Forbidden" status code. - * - * @return $this - */ - public function assertForbidden() - { - return $this->assertStatus(403); - } - - /** - * Assert that the response has a 404 "Not Found" status code. - * - * @return $this - */ - public function assertNotFound() - { - return $this->assertStatus(404); - } - - /** - * Assert that the response has a 408 "Request Timeout" status code. - * - * @return $this - */ - public function assertRequestTimeout() - { - return $this->assertStatus(408); - } - - /** - * Assert that the response has a 409 "Conflict" status code. - * - * @return $this - */ - public function assertConflict() - { - return $this->assertStatus(409); - } - - /** - * Assert that the response has a 422 "Unprocessable Entity" status code. - * - * @return $this - */ - public function assertUnprocessable() - { - return $this->assertStatus(422); - } - - /** - * Assert that the response has a 429 "Too Many Requests" status code. - * - * @return $this - */ - public function assertTooManyRequests() - { - return $this->assertStatus(429); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Concerns/TestDatabases.php b/framework-9.50.2/src/Illuminate/Testing/Concerns/TestDatabases.php deleted file mode 100644 index f13ed05..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Concerns/TestDatabases.php +++ /dev/null @@ -1,189 +0,0 @@ -whenNotUsingInMemoryDatabase(function ($database) { - if (ParallelTesting::option('recreate_databases')) { - Schema::dropDatabaseIfExists( - $this->testDatabase($database) - ); - } - }); - }); - - ParallelTesting::setUpTestCase(function ($testCase) { - $uses = array_flip(class_uses_recursive(get_class($testCase))); - - $databaseTraits = [ - Testing\DatabaseMigrations::class, - Testing\DatabaseTransactions::class, - Testing\DatabaseTruncation::class, - Testing\RefreshDatabase::class, - ]; - - if (Arr::hasAny($uses, $databaseTraits) && ! ParallelTesting::option('without_databases')) { - $this->whenNotUsingInMemoryDatabase(function ($database) use ($uses) { - [$testDatabase, $created] = $this->ensureTestDatabaseExists($database); - - $this->switchToDatabase($testDatabase); - - if (isset($uses[Testing\DatabaseTransactions::class])) { - $this->ensureSchemaIsUpToDate(); - } - - if ($created) { - ParallelTesting::callSetUpTestDatabaseCallbacks($testDatabase); - } - }); - } - }); - - ParallelTesting::tearDownProcess(function () { - $this->whenNotUsingInMemoryDatabase(function ($database) { - if (ParallelTesting::option('drop_databases')) { - Schema::dropDatabaseIfExists( - $this->testDatabase($database) - ); - } - }); - }); - } - - /** - * Ensure a test database exists and returns its name. - * - * @param string $database - * @return array - */ - protected function ensureTestDatabaseExists($database) - { - $testDatabase = $this->testDatabase($database); - - try { - $this->usingDatabase($testDatabase, function () { - Schema::hasTable('dummy'); - }); - } catch (QueryException $e) { - $this->usingDatabase($database, function () use ($testDatabase) { - Schema::dropDatabaseIfExists($testDatabase); - Schema::createDatabase($testDatabase); - }); - - return [$testDatabase, true]; - } - - return [$testDatabase, false]; - } - - /** - * Ensure the current database test schema is up to date. - * - * @return void - */ - protected function ensureSchemaIsUpToDate() - { - if (! static::$schemaIsUpToDate) { - Artisan::call('migrate'); - - static::$schemaIsUpToDate = true; - } - } - - /** - * Runs the given callable using the given database. - * - * @param string $database - * @param callable $callable - * @return void - */ - protected function usingDatabase($database, $callable) - { - $original = DB::getConfig('database'); - - try { - $this->switchToDatabase($database); - $callable(); - } finally { - $this->switchToDatabase($original); - } - } - - /** - * Apply the given callback when tests are not using in memory database. - * - * @param callable $callback - * @return void - */ - protected function whenNotUsingInMemoryDatabase($callback) - { - $database = DB::getConfig('database'); - - if ($database !== ':memory:') { - $callback($database); - } - } - - /** - * Switch to the given database. - * - * @param string $database - * @return void - */ - protected function switchToDatabase($database) - { - DB::purge(); - - $default = config('database.default'); - - $url = config("database.connections.{$default}.url"); - - if ($url) { - config()->set( - "database.connections.{$default}.url", - preg_replace('/^(.*)(\/[\w-]*)(\??.*)$/', "$1/{$database}$3", $url), - ); - } else { - config()->set( - "database.connections.{$default}.database", - $database, - ); - } - } - - /** - * Returns the test database name. - * - * @return string - */ - protected function testDatabase($database) - { - $token = ParallelTesting::token(); - - return "{$database}_test_{$token}"; - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Constraints/ArraySubset.php b/framework-9.50.2/src/Illuminate/Testing/Constraints/ArraySubset.php deleted file mode 100644 index c455bdd..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Constraints/ArraySubset.php +++ /dev/null @@ -1,279 +0,0 @@ -= 9) { - /** - * @internal This class is not meant to be used or overwritten outside the framework itself. - */ - final class ArraySubset extends Constraint - { - /** - * @var iterable - */ - private $subset; - - /** - * @var bool - */ - private $strict; - - /** - * Create a new array subset constraint instance. - * - * @param iterable $subset - * @param bool $strict - * @return void - */ - public function __construct(iterable $subset, bool $strict = false) - { - $this->strict = $strict; - $this->subset = $subset; - } - - /** - * Evaluates the constraint for parameter $other. - * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. - * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. - * - * @param mixed $other - * @param string $description - * @param bool $returnResult - * @return bool|null - * - * @throws \PHPUnit\Framework\ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function evaluate($other, string $description = '', bool $returnResult = false): ?bool - { - // type cast $other & $this->subset as an array to allow - // support in standard array functions. - $other = $this->toArray($other); - $this->subset = $this->toArray($this->subset); - - $patched = array_replace_recursive($other, $this->subset); - - if ($this->strict) { - $result = $other === $patched; - } else { - $result = $other == $patched; - } - - if ($returnResult) { - return $result; - } - - if (! $result) { - $f = new ComparisonFailure( - $patched, - $other, - var_export($patched, true), - var_export($other, true) - ); - - $this->fail($other, $description, $f); - } - - return null; - } - - /** - * Returns a string representation of the constraint. - * - * @return string - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function toString(): string - { - return 'has the subset '.$this->exporter()->export($this->subset); - } - - /** - * Returns the description of the failure. - * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. - * - * @param mixed $other - * @return string - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - protected function failureDescription($other): string - { - return 'an array '.$this->toString(); - } - - /** - * Returns the description of the failure. - * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. - * - * @param iterable $other - * @return array - */ - private function toArray(iterable $other): array - { - if (is_array($other)) { - return $other; - } - - if ($other instanceof ArrayObject) { - return $other->getArrayCopy(); - } - - if ($other instanceof Traversable) { - return iterator_to_array($other); - } - - // Keep BC even if we know that array would not be the expected one - return (array) $other; - } - } -} else { - /** - * @internal This class is not meant to be used or overwritten outside the framework itself. - */ - final class ArraySubset extends Constraint - { - /** - * @var iterable - */ - private $subset; - - /** - * @var bool - */ - private $strict; - - /** - * Create a new array subset constraint instance. - * - * @param iterable $subset - * @param bool $strict - * @return void - */ - public function __construct(iterable $subset, bool $strict = false) - { - $this->strict = $strict; - $this->subset = $subset; - } - - /** - * Evaluates the constraint for parameter $other. - * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. - * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. - * - * @param mixed $other - * @param string $description - * @param bool $returnResult - * @return bool|null - * - * @throws \PHPUnit\Framework\ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function evaluate($other, string $description = '', bool $returnResult = false) - { - // type cast $other & $this->subset as an array to allow - // support in standard array functions. - $other = $this->toArray($other); - $this->subset = $this->toArray($this->subset); - - $patched = array_replace_recursive($other, $this->subset); - - if ($this->strict) { - $result = $other === $patched; - } else { - $result = $other == $patched; - } - - if ($returnResult) { - return $result; - } - - if (! $result) { - $f = new ComparisonFailure( - $patched, - $other, - var_export($patched, true), - var_export($other, true) - ); - - $this->fail($other, $description, $f); - } - } - - /** - * Returns a string representation of the constraint. - * - * @return string - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function toString(): string - { - return 'has the subset '.$this->exporter()->export($this->subset); - } - - /** - * Returns the description of the failure. - * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. - * - * @param mixed $other - * @return string - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - protected function failureDescription($other): string - { - return 'an array '.$this->toString(); - } - - /** - * Returns the description of the failure. - * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. - * - * @param iterable $other - * @return array - */ - private function toArray(iterable $other): array - { - if (is_array($other)) { - return $other; - } - - if ($other instanceof ArrayObject) { - return $other->getArrayCopy(); - } - - if ($other instanceof Traversable) { - return iterator_to_array($other); - } - - // Keep BC even if we know that array would not be the expected one - return (array) $other; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Constraints/CountInDatabase.php b/framework-9.50.2/src/Illuminate/Testing/Constraints/CountInDatabase.php deleted file mode 100644 index 3ed6826..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Constraints/CountInDatabase.php +++ /dev/null @@ -1,83 +0,0 @@ -expectedCount = $expectedCount; - - $this->database = $database; - } - - /** - * Check if the expected and actual count are equal. - * - * @param string $table - * @return bool - */ - public function matches($table): bool - { - $this->actualCount = $this->database->table($table)->count(); - - return $this->actualCount === $this->expectedCount; - } - - /** - * Get the description of the failure. - * - * @param string $table - * @return string - */ - public function failureDescription($table): string - { - return sprintf( - "table [%s] matches expected entries count of %s. Entries found: %s.\n", - $table, $this->expectedCount, $this->actualCount - ); - } - - /** - * Get a string representation of the object. - * - * @param int $options - * @return string - */ - public function toString($options = 0): string - { - return (new ReflectionClass($this))->name; - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Constraints/HasInDatabase.php b/framework-9.50.2/src/Illuminate/Testing/Constraints/HasInDatabase.php deleted file mode 100644 index c377f01..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Constraints/HasInDatabase.php +++ /dev/null @@ -1,121 +0,0 @@ -data = $data; - - $this->database = $database; - } - - /** - * Check if the data is found in the given table. - * - * @param string $table - * @return bool - */ - public function matches($table): bool - { - return $this->database->table($table)->where($this->data)->count() > 0; - } - - /** - * Get the description of the failure. - * - * @param string $table - * @return string - */ - public function failureDescription($table): string - { - return sprintf( - "a row in the table [%s] matches the attributes %s.\n\n%s", - $table, $this->toString(JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), $this->getAdditionalInfo($table) - ); - } - - /** - * Get additional info about the records found in the database table. - * - * @param string $table - * @return string - */ - protected function getAdditionalInfo($table) - { - $query = $this->database->table($table); - - $similarResults = $query->where( - array_key_first($this->data), - $this->data[array_key_first($this->data)] - )->select(array_keys($this->data))->limit($this->show)->get(); - - if ($similarResults->isNotEmpty()) { - $description = 'Found similar results: '.json_encode($similarResults, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); - } else { - $query = $this->database->table($table); - - $results = $query->select(array_keys($this->data))->limit($this->show)->get(); - - if ($results->isEmpty()) { - return 'The table is empty'; - } - - $description = 'Found: '.json_encode($results, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); - } - - if ($query->count() > $this->show) { - $description .= sprintf(' and %s others', $query->count() - $this->show); - } - - return $description; - } - - /** - * Get a string representation of the object. - * - * @param int $options - * @return string - */ - public function toString($options = 0): string - { - foreach ($this->data as $key => $data) { - $output[$key] = $data instanceof Expression ? (string) $data : $data; - } - - return json_encode($output ?? [], $options); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Constraints/NotSoftDeletedInDatabase.php b/framework-9.50.2/src/Illuminate/Testing/Constraints/NotSoftDeletedInDatabase.php deleted file mode 100644 index ff81958..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Constraints/NotSoftDeletedInDatabase.php +++ /dev/null @@ -1,115 +0,0 @@ -database = $database; - $this->data = $data; - $this->deletedAtColumn = $deletedAtColumn; - } - - /** - * Check if the data is found in the given table. - * - * @param string $table - * @return bool - */ - public function matches($table): bool - { - return $this->database->table($table) - ->where($this->data) - ->whereNull($this->deletedAtColumn) - ->count() > 0; - } - - /** - * Get the description of the failure. - * - * @param string $table - * @return string - */ - public function failureDescription($table): string - { - return sprintf( - "any existing row in the table [%s] matches the attributes %s.\n\n%s", - $table, $this->toString(), $this->getAdditionalInfo($table) - ); - } - - /** - * Get additional info about the records found in the database table. - * - * @param string $table - * @return string - */ - protected function getAdditionalInfo($table) - { - $query = $this->database->table($table); - - $results = $query->limit($this->show)->get(); - - if ($results->isEmpty()) { - return 'The table is empty'; - } - - $description = 'Found: '.json_encode($results, JSON_PRETTY_PRINT); - - if ($query->count() > $this->show) { - $description .= sprintf(' and %s others', $query->count() - $this->show); - } - - return $description; - } - - /** - * Get a string representation of the object. - * - * @return string - */ - public function toString(): string - { - return json_encode($this->data); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Constraints/SeeInOrder.php b/framework-9.50.2/src/Illuminate/Testing/Constraints/SeeInOrder.php deleted file mode 100644 index 609f32d..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Constraints/SeeInOrder.php +++ /dev/null @@ -1,88 +0,0 @@ -content = $content; - } - - /** - * Determine if the rule passes validation. - * - * @param array $values - * @return bool - */ - public function matches($values): bool - { - $position = 0; - - foreach ($values as $value) { - if (empty($value)) { - continue; - } - - $valuePosition = mb_strpos($this->content, $value, $position); - - if ($valuePosition === false || $valuePosition < $position) { - $this->failedValue = $value; - - return false; - } - - $position = $valuePosition + mb_strlen($value); - } - - return true; - } - - /** - * Get the description of the failure. - * - * @param array $values - * @return string - */ - public function failureDescription($values): string - { - return sprintf( - 'Failed asserting that \'%s\' contains "%s" in specified order.', - $this->content, - $this->failedValue - ); - } - - /** - * Get a string representation of the object. - * - * @return string - */ - public function toString(): string - { - return (new ReflectionClass($this))->name; - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Constraints/SoftDeletedInDatabase.php b/framework-9.50.2/src/Illuminate/Testing/Constraints/SoftDeletedInDatabase.php deleted file mode 100644 index baaeee2..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Constraints/SoftDeletedInDatabase.php +++ /dev/null @@ -1,117 +0,0 @@ -data = $data; - - $this->database = $database; - - $this->deletedAtColumn = $deletedAtColumn; - } - - /** - * Check if the data is found in the given table. - * - * @param string $table - * @return bool - */ - public function matches($table): bool - { - return $this->database->table($table) - ->where($this->data) - ->whereNotNull($this->deletedAtColumn) - ->count() > 0; - } - - /** - * Get the description of the failure. - * - * @param string $table - * @return string - */ - public function failureDescription($table): string - { - return sprintf( - "any soft deleted row in the table [%s] matches the attributes %s.\n\n%s", - $table, $this->toString(), $this->getAdditionalInfo($table) - ); - } - - /** - * Get additional info about the records found in the database table. - * - * @param string $table - * @return string - */ - protected function getAdditionalInfo($table) - { - $query = $this->database->table($table); - - $results = $query->limit($this->show)->get(); - - if ($results->isEmpty()) { - return 'The table is empty'; - } - - $description = 'Found: '.json_encode($results, JSON_PRETTY_PRINT); - - if ($query->count() > $this->show) { - $description .= sprintf(' and %s others', $query->count() - $this->show); - } - - return $description; - } - - /** - * Get a string representation of the object. - * - * @return string - */ - public function toString(): string - { - return json_encode($this->data); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Fluent/AssertableJson.php b/framework-9.50.2/src/Illuminate/Testing/Fluent/AssertableJson.php deleted file mode 100644 index fde468e..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Fluent/AssertableJson.php +++ /dev/null @@ -1,177 +0,0 @@ -path = $path; - $this->props = $props; - } - - /** - * Compose the absolute "dot" path to the given key. - * - * @param string $key - * @return string - */ - protected function dotPath(string $key = ''): string - { - if (is_null($this->path)) { - return $key; - } - - return rtrim(implode('.', [$this->path, $key]), '.'); - } - - /** - * Retrieve a prop within the current scope using "dot" notation. - * - * @param string|null $key - * @return mixed - */ - protected function prop(string $key = null) - { - return Arr::get($this->props, $key); - } - - /** - * Instantiate a new "scope" at the path of the given key. - * - * @param string $key - * @param \Closure $callback - * @return $this - */ - protected function scope(string $key, Closure $callback): self - { - $props = $this->prop($key); - $path = $this->dotPath($key); - - PHPUnit::assertIsArray($props, sprintf('Property [%s] is not scopeable.', $path)); - - $scope = new static($props, $path); - $callback($scope); - $scope->interacted(); - - return $this; - } - - /** - * Instantiate a new "scope" on the first child element. - * - * @param \Closure $callback - * @return $this - */ - public function first(Closure $callback): self - { - $props = $this->prop(); - - $path = $this->dotPath(); - - PHPUnit::assertNotEmpty($props, $path === '' - ? 'Cannot scope directly onto the first element of the root level because it is empty.' - : sprintf('Cannot scope directly onto the first element of property [%s] because it is empty.', $path) - ); - - $key = array_keys($props)[0]; - - $this->interactsWith($key); - - return $this->scope($key, $callback); - } - - /** - * Instantiate a new "scope" on each child element. - * - * @param \Closure $callback - * @return $this - */ - public function each(Closure $callback): self - { - $props = $this->prop(); - - $path = $this->dotPath(); - - PHPUnit::assertNotEmpty($props, $path === '' - ? 'Cannot scope directly onto each element of the root level because it is empty.' - : sprintf('Cannot scope directly onto each element of property [%s] because it is empty.', $path) - ); - - foreach (array_keys($props) as $key) { - $this->interactsWith($key); - - $this->scope($key, $callback); - } - - return $this; - } - - /** - * Create a new instance from an array. - * - * @param array $data - * @return static - */ - public static function fromArray(array $data): self - { - return new static($data); - } - - /** - * Create a new instance from an AssertableJsonString. - * - * @param \Illuminate\Testing\AssertableJsonString $json - * @return static - */ - public static function fromAssertableJsonString(AssertableJsonString $json): self - { - return static::fromArray($json->json()); - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return $this->props; - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Debugging.php b/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Debugging.php deleted file mode 100644 index e655556..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Debugging.php +++ /dev/null @@ -1,38 +0,0 @@ -prop($prop)); - - return $this; - } - - /** - * Dumps the given props and exits. - * - * @param string|null $prop - * @return never - */ - public function dd(string $prop = null): void - { - dd($this->prop($prop)); - } - - /** - * Retrieve a prop within the current scope using "dot" notation. - * - * @param string|null $key - * @return mixed - */ - abstract protected function prop(string $key = null); -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Has.php b/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Has.php deleted file mode 100644 index 7765f4a..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Has.php +++ /dev/null @@ -1,213 +0,0 @@ -dotPath(); - - PHPUnit::assertCount( - $key, - $this->prop(), - $path - ? sprintf('Property [%s] does not have the expected size.', $path) - : sprintf('Root level does not have the expected size.') - ); - - return $this; - } - - PHPUnit::assertCount( - $length, - $this->prop($key), - sprintf('Property [%s] does not have the expected size.', $this->dotPath($key)) - ); - - return $this; - } - - /** - * Ensure that the given prop exists. - * - * @param string|int $key - * @param int|\Closure|null $length - * @param \Closure|null $callback - * @return $this - */ - public function has($key, $length = null, Closure $callback = null): self - { - $prop = $this->prop(); - - if (is_int($key) && is_null($length)) { - return $this->count($key); - } - - PHPUnit::assertTrue( - Arr::has($prop, $key), - sprintf('Property [%s] does not exist.', $this->dotPath($key)) - ); - - $this->interactsWith($key); - - if (! is_null($callback)) { - return $this->has($key, function (self $scope) use ($length, $callback) { - return $scope - ->tap(function (self $scope) use ($length) { - if (! is_null($length)) { - $scope->count($length); - } - }) - ->first($callback) - ->etc(); - }); - } - - if (is_callable($length)) { - return $this->scope($key, $length); - } - - if (! is_null($length)) { - return $this->count($key, $length); - } - - return $this; - } - - /** - * Assert that all of the given props exist. - * - * @param array|string $key - * @return $this - */ - public function hasAll($key): self - { - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $prop => $count) { - if (is_int($prop)) { - $this->has($count); - } else { - $this->has($prop, $count); - } - } - - return $this; - } - - /** - * Assert that at least one of the given props exists. - * - * @param array|string $key - * @return $this - */ - public function hasAny($key): self - { - $keys = is_array($key) ? $key : func_get_args(); - - PHPUnit::assertTrue( - Arr::hasAny($this->prop(), $keys), - sprintf('None of properties [%s] exist.', implode(', ', $keys)) - ); - - foreach ($keys as $key) { - $this->interactsWith($key); - } - - return $this; - } - - /** - * Assert that none of the given props exist. - * - * @param array|string $key - * @return $this - */ - public function missingAll($key): self - { - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $prop) { - $this->missing($prop); - } - - return $this; - } - - /** - * Assert that the given prop does not exist. - * - * @param string $key - * @return $this - */ - public function missing(string $key): self - { - PHPUnit::assertNotTrue( - Arr::has($this->prop(), $key), - sprintf('Property [%s] was found while it was expected to be missing.', $this->dotPath($key)) - ); - - return $this; - } - - /** - * Compose the absolute "dot" path to the given key. - * - * @param string $key - * @return string - */ - abstract protected function dotPath(string $key = ''): string; - - /** - * Marks the property as interacted. - * - * @param string $key - * @return void - */ - abstract protected function interactsWith(string $key): void; - - /** - * Retrieve a prop within the current scope using "dot" notation. - * - * @param string|null $key - * @return mixed - */ - abstract protected function prop(string $key = null); - - /** - * Instantiate a new "scope" at the path of the given key. - * - * @param string $key - * @param \Closure $callback - * @return $this - */ - abstract protected function scope(string $key, Closure $callback); - - /** - * Disables the interaction check. - * - * @return $this - */ - abstract public function etc(); - - /** - * Instantiate a new "scope" on the first element. - * - * @param \Closure $callback - * @return $this - */ - abstract public function first(Closure $callback); -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Interaction.php b/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Interaction.php deleted file mode 100644 index 15e7e95..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Interaction.php +++ /dev/null @@ -1,67 +0,0 @@ -interacted, true)) { - $this->interacted[] = $prop; - } - } - - /** - * Asserts that all properties have been interacted with. - * - * @return void - */ - public function interacted(): void - { - PHPUnit::assertSame( - [], - array_diff(array_keys($this->prop()), $this->interacted), - $this->path - ? sprintf('Unexpected properties were found in scope [%s].', $this->path) - : 'Unexpected properties were found on the root level.' - ); - } - - /** - * Disables the interaction check. - * - * @return $this - */ - public function etc(): self - { - $this->interacted = array_keys($this->prop()); - - return $this; - } - - /** - * Retrieve a prop within the current scope using "dot" notation. - * - * @param string|null $key - * @return mixed - */ - abstract protected function prop(string $key = null); -} diff --git a/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Matching.php b/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Matching.php deleted file mode 100644 index 9ff7a31..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/Fluent/Concerns/Matching.php +++ /dev/null @@ -1,236 +0,0 @@ -has($key); - - $actual = $this->prop($key); - - if ($expected instanceof Closure) { - PHPUnit::assertTrue( - $expected(is_array($actual) ? Collection::make($actual) : $actual), - sprintf('Property [%s] was marked as invalid using a closure.', $this->dotPath($key)) - ); - - return $this; - } - - if ($expected instanceof Arrayable) { - $expected = $expected->toArray(); - } - - $this->ensureSorted($expected); - $this->ensureSorted($actual); - - PHPUnit::assertSame( - $expected, - $actual, - sprintf('Property [%s] does not match the expected value.', $this->dotPath($key)) - ); - - return $this; - } - - /** - * Asserts that the property does not match the expected value. - * - * @param string $key - * @param mixed|\Closure $expected - * @return $this - */ - public function whereNot(string $key, $expected): self - { - $this->has($key); - - $actual = $this->prop($key); - - if ($expected instanceof Closure) { - PHPUnit::assertFalse( - $expected(is_array($actual) ? Collection::make($actual) : $actual), - sprintf('Property [%s] was marked as invalid using a closure.', $this->dotPath($key)) - ); - - return $this; - } - - if ($expected instanceof Arrayable) { - $expected = $expected->toArray(); - } - - $this->ensureSorted($expected); - $this->ensureSorted($actual); - - PHPUnit::assertNotSame( - $expected, - $actual, - sprintf( - 'Property [%s] contains a value that should be missing: [%s, %s]', - $this->dotPath($key), - $key, - $expected - ) - ); - - return $this; - } - - /** - * Asserts that all properties match their expected values. - * - * @param array $bindings - * @return $this - */ - public function whereAll(array $bindings): self - { - foreach ($bindings as $key => $value) { - $this->where($key, $value); - } - - return $this; - } - - /** - * Asserts that the property is of the expected type. - * - * @param string $key - * @param string|array $expected - * @return $this - */ - public function whereType(string $key, $expected): self - { - $this->has($key); - - $actual = $this->prop($key); - - if (! is_array($expected)) { - $expected = explode('|', $expected); - } - - PHPUnit::assertContains( - strtolower(gettype($actual)), - $expected, - sprintf('Property [%s] is not of expected type [%s].', $this->dotPath($key), implode('|', $expected)) - ); - - return $this; - } - - /** - * Asserts that all properties are of their expected types. - * - * @param array $bindings - * @return $this - */ - public function whereAllType(array $bindings): self - { - foreach ($bindings as $key => $value) { - $this->whereType($key, $value); - } - - return $this; - } - - /** - * Asserts that the property contains the expected values. - * - * @param string $key - * @param mixed $expected - * @return $this - */ - public function whereContains(string $key, $expected) - { - $actual = Collection::make( - $this->prop($key) ?? $this->prop() - ); - - $missing = Collection::make($expected)->reject(function ($search) use ($key, $actual) { - if ($actual->containsStrict($key, $search)) { - return true; - } - - return $actual->containsStrict($search); - }); - - if ($missing->whereInstanceOf('Closure')->isNotEmpty()) { - PHPUnit::assertEmpty( - $missing->toArray(), - sprintf( - 'Property [%s] does not contain a value that passes the truth test within the given closure.', - $key, - ) - ); - } else { - PHPUnit::assertEmpty( - $missing->toArray(), - sprintf( - 'Property [%s] does not contain [%s].', - $key, - implode(', ', array_values($missing->toArray())) - ) - ); - } - - return $this; - } - - /** - * Ensures that all properties are sorted the same way, recursively. - * - * @param mixed $value - * @return void - */ - protected function ensureSorted(&$value): void - { - if (! is_array($value)) { - return; - } - - foreach ($value as &$arg) { - $this->ensureSorted($arg); - } - - ksort($value); - } - - /** - * Compose the absolute "dot" path to the given key. - * - * @param string $key - * @return string - */ - abstract protected function dotPath(string $key = ''): string; - - /** - * Ensure that the given prop exists. - * - * @param string $key - * @param null $value - * @param \Closure|null $scope - * @return $this - */ - abstract public function has(string $key, $value = null, Closure $scope = null); - - /** - * Retrieve a prop within the current scope using "dot" notation. - * - * @param string|null $key - * @return mixed - */ - abstract protected function prop(string $key = null); -} diff --git a/framework-9.50.2/src/Illuminate/Testing/LICENSE.md b/framework-9.50.2/src/Illuminate/Testing/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Testing/LoggedExceptionCollection.php b/framework-9.50.2/src/Illuminate/Testing/LoggedExceptionCollection.php deleted file mode 100644 index 907b061..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/LoggedExceptionCollection.php +++ /dev/null @@ -1,10 +0,0 @@ -getVerbosity(), - $output->isDecorated(), - $output->getFormatter(), - ); - - $this->output = $output; - } - - /** - * Writes a message to the output. - * - * @param string|iterable $messages - * @param bool $newline - * @param int $options - * @return void - */ - public function write($messages, bool $newline = false, int $options = 0) - { - $messages = collect($messages)->filter(function ($message) { - return ! Str::contains($message, $this->ignore); - }); - - $this->output->write($messages->toArray(), $newline, $options); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/ParallelRunner.php b/framework-9.50.2/src/Illuminate/Testing/ParallelRunner.php deleted file mode 100644 index 6eeb45c..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/ParallelRunner.php +++ /dev/null @@ -1,175 +0,0 @@ -options = $options; - - if ($output instanceof ConsoleOutput) { - $output = new ParallelConsoleOutput($output); - } - - $runnerResolver = static::$runnerResolver ?: function (Options $options, OutputInterface $output) { - return new WrapperRunner($options, $output); - }; - - $this->runner = $runnerResolver($options, $output); - } - - /** - * Set the application resolver callback. - * - * @param \Closure|null $resolver - * @return void - */ - public static function resolveApplicationUsing($resolver) - { - static::$applicationResolver = $resolver; - } - - /** - * Set the runner resolver callback. - * - * @param \Closure|null $resolver - * @return void - */ - public static function resolveRunnerUsing($resolver) - { - static::$runnerResolver = $resolver; - } - - /** - * Runs the test suite. - * - * @return void - */ - public function run(): void - { - (new PhpHandler)->handle($this->options->configuration()->php()); - - $this->forEachProcess(function () { - ParallelTesting::callSetUpProcessCallbacks(); - }); - - try { - $this->runner->run(); - } finally { - $this->forEachProcess(function () { - ParallelTesting::callTearDownProcessCallbacks(); - }); - } - } - - /** - * Returns the highest exit code encountered throughout the course of test execution. - * - * @return int - */ - public function getExitCode(): int - { - return $this->runner->getExitCode(); - } - - /** - * Apply the given callback for each process. - * - * @param callable $callback - * @return void - */ - protected function forEachProcess($callback) - { - collect(range(1, $this->options->processes()))->each(function ($token) use ($callback) { - tap($this->createApplication(), function ($app) use ($callback, $token) { - ParallelTesting::resolveTokenUsing(fn () => $token); - - $callback($app); - })->flush(); - }); - } - - /** - * Creates the application. - * - * @return \Illuminate\Contracts\Foundation\Application - * - * @throws \RuntimeException - */ - protected function createApplication() - { - $applicationResolver = static::$applicationResolver ?: function () { - if (trait_exists(\Tests\CreatesApplication::class)) { - $applicationCreator = new class - { - use \Tests\CreatesApplication; - }; - - return $applicationCreator->createApplication(); - } elseif (file_exists(getcwd().'/bootstrap/app.php')) { - $app = require getcwd().'/bootstrap/app.php'; - - $app->make(Kernel::class)->bootstrap(); - - return $app; - } - - throw new RuntimeException('Parallel Runner unable to resolve application.'); - }; - - return $applicationResolver(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/ParallelTesting.php b/framework-9.50.2/src/Illuminate/Testing/ParallelTesting.php deleted file mode 100644 index e633bc5..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/ParallelTesting.php +++ /dev/null @@ -1,291 +0,0 @@ -container = $container; - } - - /** - * Set a callback that should be used when resolving options. - * - * @param \Closure|null $resolver - * @return void - */ - public function resolveOptionsUsing($resolver) - { - $this->optionsResolver = $resolver; - } - - /** - * Set a callback that should be used when resolving the unique process token. - * - * @param \Closure|null $resolver - * @return void - */ - public function resolveTokenUsing($resolver) - { - $this->tokenResolver = $resolver; - } - - /** - * Register a "setUp" process callback. - * - * @param callable $callback - * @return void - */ - public function setUpProcess($callback) - { - $this->setUpProcessCallbacks[] = $callback; - } - - /** - * Register a "setUp" test case callback. - * - * @param callable $callback - * @return void - */ - public function setUpTestCase($callback) - { - $this->setUpTestCaseCallbacks[] = $callback; - } - - /** - * Register a "setUp" test database callback. - * - * @param callable $callback - * @return void - */ - public function setUpTestDatabase($callback) - { - $this->setUpTestDatabaseCallbacks[] = $callback; - } - - /** - * Register a "tearDown" process callback. - * - * @param callable $callback - * @return void - */ - public function tearDownProcess($callback) - { - $this->tearDownProcessCallbacks[] = $callback; - } - - /** - * Register a "tearDown" test case callback. - * - * @param callable $callback - * @return void - */ - public function tearDownTestCase($callback) - { - $this->tearDownTestCaseCallbacks[] = $callback; - } - - /** - * Call all of the "setUp" process callbacks. - * - * @return void - */ - public function callSetUpProcessCallbacks() - { - $this->whenRunningInParallel(function () { - foreach ($this->setUpProcessCallbacks as $callback) { - $this->container->call($callback, [ - 'token' => $this->token(), - ]); - } - }); - } - - /** - * Call all of the "setUp" test case callbacks. - * - * @param \Illuminate\Foundation\Testing\TestCase $testCase - * @return void - */ - public function callSetUpTestCaseCallbacks($testCase) - { - $this->whenRunningInParallel(function () use ($testCase) { - foreach ($this->setUpTestCaseCallbacks as $callback) { - $this->container->call($callback, [ - 'testCase' => $testCase, - 'token' => $this->token(), - ]); - } - }); - } - - /** - * Call all of the "setUp" test database callbacks. - * - * @param string $database - * @return void - */ - public function callSetUpTestDatabaseCallbacks($database) - { - $this->whenRunningInParallel(function () use ($database) { - foreach ($this->setUpTestDatabaseCallbacks as $callback) { - $this->container->call($callback, [ - 'database' => $database, - 'token' => $this->token(), - ]); - } - }); - } - - /** - * Call all of the "tearDown" process callbacks. - * - * @return void - */ - public function callTearDownProcessCallbacks() - { - $this->whenRunningInParallel(function () { - foreach ($this->tearDownProcessCallbacks as $callback) { - $this->container->call($callback, [ - 'token' => $this->token(), - ]); - } - }); - } - - /** - * Call all of the "tearDown" test case callbacks. - * - * @param \Illuminate\Foundation\Testing\TestCase $testCase - * @return void - */ - public function callTearDownTestCaseCallbacks($testCase) - { - $this->whenRunningInParallel(function () use ($testCase) { - foreach ($this->tearDownTestCaseCallbacks as $callback) { - $this->container->call($callback, [ - 'testCase' => $testCase, - 'token' => $this->token(), - ]); - } - }); - } - - /** - * Get a parallel testing option. - * - * @param string $option - * @return mixed - */ - public function option($option) - { - $optionsResolver = $this->optionsResolver ?: function ($option) { - $option = 'LARAVEL_PARALLEL_TESTING_'.Str::upper($option); - - return $_SERVER[$option] ?? false; - }; - - return $optionsResolver($option); - } - - /** - * Gets a unique test token. - * - * @return string|false - */ - public function token() - { - return $this->tokenResolver - ? call_user_func($this->tokenResolver) - : ($_SERVER['TEST_TOKEN'] ?? false); - } - - /** - * Apply the callback if tests are running in parallel. - * - * @param callable $callback - * @return void - */ - protected function whenRunningInParallel($callback) - { - if ($this->inParallel()) { - $callback(); - } - } - - /** - * Indicates if the current tests are been run in parallel. - * - * @return bool - */ - protected function inParallel() - { - return ! empty($_SERVER['LARAVEL_PARALLEL_TESTING']) && $this->token(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/ParallelTestingServiceProvider.php b/framework-9.50.2/src/Illuminate/Testing/ParallelTestingServiceProvider.php deleted file mode 100644 index 20b900d..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/ParallelTestingServiceProvider.php +++ /dev/null @@ -1,38 +0,0 @@ -app->runningInConsole()) { - $this->bootTestDatabase(); - } - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - if ($this->app->runningInConsole()) { - $this->app->singleton(ParallelTesting::class, function () { - return new ParallelTesting($this->app); - }); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/PendingCommand.php b/framework-9.50.2/src/Illuminate/Testing/PendingCommand.php deleted file mode 100644 index 56d5fad..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/PendingCommand.php +++ /dev/null @@ -1,483 +0,0 @@ -app = $app; - $this->test = $test; - $this->command = $command; - $this->parameters = $parameters; - } - - /** - * Specify an expected question that will be asked when the command runs. - * - * @param string $question - * @param string|bool $answer - * @return $this - */ - public function expectsQuestion($question, $answer) - { - $this->test->expectedQuestions[] = [$question, $answer]; - - return $this; - } - - /** - * Specify an expected confirmation question that will be asked when the command runs. - * - * @param string $question - * @param string $answer - * @return $this - */ - public function expectsConfirmation($question, $answer = 'no') - { - return $this->expectsQuestion($question, strtolower($answer) === 'yes'); - } - - /** - * Specify an expected choice question with expected answers that will be asked/shown when the command runs. - * - * @param string $question - * @param string|array $answer - * @param array $answers - * @param bool $strict - * @return $this - */ - public function expectsChoice($question, $answer, $answers, $strict = false) - { - $this->test->expectedChoices[$question] = [ - 'expected' => $answers, - 'strict' => $strict, - ]; - - return $this->expectsQuestion($question, $answer); - } - - /** - * Specify output that should be printed when the command runs. - * - * @param string $output - * @return $this - */ - public function expectsOutput($output) - { - $this->test->expectedOutput[] = $output; - - return $this; - } - - /** - * Specify output that should never be printed when the command runs. - * - * @param string $output - * @return $this - */ - public function doesntExpectOutput($output) - { - $this->test->unexpectedOutput[$output] = false; - - return $this; - } - - /** - * Specify that the given string should be contained in the command output. - * - * @param string $string - * @return $this - */ - public function expectsOutputToContain($string) - { - $this->test->expectedOutputSubstrings[] = $string; - - return $this; - } - - /** - * Specify that the given string shouldn't be contained in the command output. - * - * @param string $string - * @return $this - */ - public function doesntExpectOutputToContain($string) - { - $this->test->unexpectedOutputSubstrings[$string] = false; - - return $this; - } - - /** - * Specify a table that should be printed when the command runs. - * - * @param array $headers - * @param \Illuminate\Contracts\Support\Arrayable|array $rows - * @param string $tableStyle - * @param array $columnStyles - * @return $this - */ - public function expectsTable($headers, $rows, $tableStyle = 'default', array $columnStyles = []) - { - $table = (new Table($output = new BufferedOutput)) - ->setHeaders((array) $headers) - ->setRows($rows instanceof Arrayable ? $rows->toArray() : $rows) - ->setStyle($tableStyle); - - foreach ($columnStyles as $columnIndex => $columnStyle) { - $table->setColumnStyle($columnIndex, $columnStyle); - } - - $table->render(); - - $lines = array_filter( - explode(PHP_EOL, $output->fetch()) - ); - - foreach ($lines as $line) { - $this->expectsOutput($line); - } - - return $this; - } - - /** - * Assert that the command has the given exit code. - * - * @param int $exitCode - * @return $this - */ - public function assertExitCode($exitCode) - { - $this->expectedExitCode = $exitCode; - - return $this; - } - - /** - * Assert that the command does not have the given exit code. - * - * @param int $exitCode - * @return $this - */ - public function assertNotExitCode($exitCode) - { - $this->unexpectedExitCode = $exitCode; - - return $this; - } - - /** - * Assert that the command has the success exit code. - * - * @return $this - */ - public function assertSuccessful() - { - return $this->assertExitCode(Command::SUCCESS); - } - - /** - * Assert that the command has the success exit code. - * - * @return $this - */ - public function assertOk() - { - return $this->assertSuccessful(); - } - - /** - * Assert that the command does not have the success exit code. - * - * @return $this - */ - public function assertFailed() - { - return $this->assertNotExitCode(Command::SUCCESS); - } - - /** - * Execute the command. - * - * @return int - */ - public function execute() - { - return $this->run(); - } - - /** - * Execute the command. - * - * @return int - * - * @throws \Mockery\Exception\NoMatchingExpectationException - */ - public function run() - { - $this->hasExecuted = true; - - $mock = $this->mockConsoleOutput(); - - try { - $exitCode = $this->app->make(Kernel::class)->call($this->command, $this->parameters, $mock); - } catch (NoMatchingExpectationException $e) { - if ($e->getMethodName() === 'askQuestion') { - $this->test->fail('Unexpected question "'.$e->getActualArguments()[0]->getQuestion().'" was asked.'); - } - - throw $e; - } - - if ($this->expectedExitCode !== null) { - $this->test->assertEquals( - $this->expectedExitCode, $exitCode, - "Expected status code {$this->expectedExitCode} but received {$exitCode}." - ); - } elseif (! is_null($this->unexpectedExitCode)) { - $this->test->assertNotEquals( - $this->unexpectedExitCode, $exitCode, - "Unexpected status code {$this->unexpectedExitCode} was received." - ); - } - - $this->verifyExpectations(); - $this->flushExpectations(); - - return $exitCode; - } - - /** - * Determine if expected questions / choices / outputs are fulfilled. - * - * @return void - */ - protected function verifyExpectations() - { - if (count($this->test->expectedQuestions)) { - $this->test->fail('Question "'.Arr::first($this->test->expectedQuestions)[0].'" was not asked.'); - } - - if (count($this->test->expectedChoices) > 0) { - foreach ($this->test->expectedChoices as $question => $answers) { - $assertion = $answers['strict'] ? 'assertEquals' : 'assertEqualsCanonicalizing'; - - $this->test->{$assertion}( - $answers['expected'], - $answers['actual'], - 'Question "'.$question.'" has different options.' - ); - } - } - - if (count($this->test->expectedOutput)) { - $this->test->fail('Output "'.Arr::first($this->test->expectedOutput).'" was not printed.'); - } - - if (count($this->test->expectedOutputSubstrings)) { - $this->test->fail('Output does not contain "'.Arr::first($this->test->expectedOutputSubstrings).'".'); - } - - if ($output = array_search(true, $this->test->unexpectedOutput)) { - $this->test->fail('Output "'.$output.'" was printed.'); - } - - if ($output = array_search(true, $this->test->unexpectedOutputSubstrings)) { - $this->test->fail('Output "'.$output.'" was printed.'); - } - } - - /** - * Mock the application's console output. - * - * @return \Mockery\MockInterface - */ - protected function mockConsoleOutput() - { - $mock = Mockery::mock(OutputStyle::class.'[askQuestion]', [ - new ArrayInput($this->parameters), $this->createABufferedOutputMock(), - ]); - - foreach ($this->test->expectedQuestions as $i => $question) { - $mock->shouldReceive('askQuestion') - ->once() - ->ordered() - ->with(Mockery::on(function ($argument) use ($question) { - if (isset($this->test->expectedChoices[$question[0]])) { - $this->test->expectedChoices[$question[0]]['actual'] = $argument->getAutocompleterValues(); - } - - return $argument->getQuestion() == $question[0]; - })) - ->andReturnUsing(function () use ($question, $i) { - unset($this->test->expectedQuestions[$i]); - - return $question[1]; - }); - } - - $this->app->bind(OutputStyle::class, function () use ($mock) { - return $mock; - }); - - return $mock; - } - - /** - * Create a mock for the buffered output. - * - * @return \Mockery\MockInterface - */ - private function createABufferedOutputMock() - { - $mock = Mockery::mock(BufferedOutput::class.'[doWrite]') - ->shouldAllowMockingProtectedMethods() - ->shouldIgnoreMissing(); - - foreach ($this->test->expectedOutput as $i => $output) { - $mock->shouldReceive('doWrite') - ->once() - ->ordered() - ->with($output, Mockery::any()) - ->andReturnUsing(function () use ($i) { - unset($this->test->expectedOutput[$i]); - }); - } - - foreach ($this->test->expectedOutputSubstrings as $i => $text) { - $mock->shouldReceive('doWrite') - ->atLeast() - ->times(0) - ->withArgs(fn ($output) => str_contains($output, $text)) - ->andReturnUsing(function () use ($i) { - unset($this->test->expectedOutputSubstrings[$i]); - }); - } - - foreach ($this->test->unexpectedOutput as $output => $displayed) { - $mock->shouldReceive('doWrite') - ->atLeast() - ->times(0) - ->ordered() - ->with($output, Mockery::any()) - ->andReturnUsing(function () use ($output) { - $this->test->unexpectedOutput[$output] = true; - }); - } - - foreach ($this->test->unexpectedOutputSubstrings as $text => $displayed) { - $mock->shouldReceive('doWrite') - ->atLeast() - ->times(0) - ->withArgs(fn ($output) => str_contains($output, $text)) - ->andReturnUsing(function () use ($text) { - $this->test->unexpectedOutputSubstrings[$text] = true; - }); - } - - return $mock; - } - - /** - * Flush the expectations from the test case. - * - * @return void - */ - protected function flushExpectations() - { - $this->test->expectedOutput = []; - $this->test->expectedOutputSubstrings = []; - $this->test->unexpectedOutput = []; - $this->test->unexpectedOutputSubstrings = []; - $this->test->expectedTables = []; - $this->test->expectedQuestions = []; - $this->test->expectedChoices = []; - } - - /** - * Handle the object's destruction. - * - * @return void - */ - public function __destruct() - { - if ($this->hasExecuted) { - return; - } - - $this->run(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/TestComponent.php b/framework-9.50.2/src/Illuminate/Testing/TestComponent.php deleted file mode 100644 index 4a80551..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/TestComponent.php +++ /dev/null @@ -1,166 +0,0 @@ -component = $component; - - $this->rendered = $view->render(); - } - - /** - * Assert that the given string is contained within the rendered component. - * - * @param string $value - * @param bool $escape - * @return $this - */ - public function assertSee($value, $escape = true) - { - $value = $escape ? e($value) : $value; - - PHPUnit::assertStringContainsString((string) $value, $this->rendered); - - return $this; - } - - /** - * Assert that the given strings are contained in order within the rendered component. - * - * @param array $values - * @param bool $escape - * @return $this - */ - public function assertSeeInOrder(array $values, $escape = true) - { - $values = $escape ? array_map('e', $values) : $values; - - PHPUnit::assertThat($values, new SeeInOrder($this->rendered)); - - return $this; - } - - /** - * Assert that the given string is contained within the rendered component text. - * - * @param string $value - * @param bool $escape - * @return $this - */ - public function assertSeeText($value, $escape = true) - { - $value = $escape ? e($value) : $value; - - PHPUnit::assertStringContainsString((string) $value, strip_tags($this->rendered)); - - return $this; - } - - /** - * Assert that the given strings are contained in order within the rendered component text. - * - * @param array $values - * @param bool $escape - * @return $this - */ - public function assertSeeTextInOrder(array $values, $escape = true) - { - $values = $escape ? array_map('e', $values) : $values; - - PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->rendered))); - - return $this; - } - - /** - * Assert that the given string is not contained within the rendered component. - * - * @param string $value - * @param bool $escape - * @return $this - */ - public function assertDontSee($value, $escape = true) - { - $value = $escape ? e($value) : $value; - - PHPUnit::assertStringNotContainsString((string) $value, $this->rendered); - - return $this; - } - - /** - * Assert that the given string is not contained within the rendered component text. - * - * @param string $value - * @param bool $escape - * @return $this - */ - public function assertDontSeeText($value, $escape = true) - { - $value = $escape ? e($value) : $value; - - PHPUnit::assertStringNotContainsString((string) $value, strip_tags($this->rendered)); - - return $this; - } - - /** - * Get the string contents of the rendered component. - * - * @return string - */ - public function __toString() - { - return $this->rendered; - } - - /** - * Dynamically access properties on the underlying component. - * - * @param string $attribute - * @return mixed - */ - public function __get($attribute) - { - return $this->component->{$attribute}; - } - - /** - * Dynamically call methods on the underlying component. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->component->{$method}(...$parameters); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/TestResponse.php b/framework-9.50.2/src/Illuminate/Testing/TestResponse.php deleted file mode 100644 index 630fbb8..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/TestResponse.php +++ /dev/null @@ -1,1760 +0,0 @@ -baseResponse = $response; - $this->exceptions = new Collection; - } - - /** - * Create a new TestResponse from another response. - * - * @param \Illuminate\Http\Response $response - * @return static - */ - public static function fromBaseResponse($response) - { - return new static($response); - } - - /** - * Assert that the response has a successful status code. - * - * @return $this - */ - public function assertSuccessful() - { - PHPUnit::assertTrue( - $this->isSuccessful(), - $this->statusMessageWithDetails('>=200, <300', $this->getStatusCode()) - ); - - return $this; - } - - /** - * Assert that the response is a server error. - * - * @return $this - */ - public function assertServerError() - { - PHPUnit::assertTrue( - $this->isServerError(), - $this->statusMessageWithDetails('>=500, < 600', $this->getStatusCode()) - ); - - return $this; - } - - /** - * Assert that the response has the given status code. - * - * @param int $status - * @return $this - */ - public function assertStatus($status) - { - $message = $this->statusMessageWithDetails($status, $actual = $this->getStatusCode()); - - PHPUnit::assertSame($actual, $status, $message); - - return $this; - } - - /** - * Get an assertion message for a status assertion containing extra details when available. - * - * @param string|int $expected - * @param string|int $actual - * @return string - */ - protected function statusMessageWithDetails($expected, $actual) - { - return "Expected response status code [{$expected}] but received {$actual}."; - } - - /** - * Assert whether the response is redirecting to a given URI. - * - * @param string|null $uri - * @return $this - */ - public function assertRedirect($uri = null) - { - PHPUnit::assertTrue( - $this->isRedirect(), - $this->statusMessageWithDetails('201, 301, 302, 303, 307, 308', $this->getStatusCode()), - ); - - if (! is_null($uri)) { - $this->assertLocation($uri); - } - - return $this; - } - - /** - * Assert whether the response is redirecting to a URI that contains the given URI. - * - * @param string $uri - * @return $this - */ - public function assertRedirectContains($uri) - { - PHPUnit::assertTrue( - $this->isRedirect(), - $this->statusMessageWithDetails('201, 301, 302, 303, 307, 308', $this->getStatusCode()), - ); - - PHPUnit::assertTrue( - Str::contains($this->headers->get('Location'), $uri), 'Redirect location ['.$this->headers->get('Location').'] does not contain ['.$uri.'].' - ); - - return $this; - } - - /** - * Assert whether the response is redirecting to a given route. - * - * @param string $name - * @param mixed $parameters - * @return $this - */ - public function assertRedirectToRoute($name, $parameters = []) - { - $uri = route($name, $parameters); - - PHPUnit::assertTrue( - $this->isRedirect(), - $this->statusMessageWithDetails('201, 301, 302, 303, 307, 308', $this->getStatusCode()), - ); - - $request = Request::create($this->headers->get('Location')); - - PHPUnit::assertEquals( - app('url')->to($uri), $request->fullUrl() - ); - - return $this; - } - - /** - * Assert whether the response is redirecting to a given signed route. - * - * @param string|null $name - * @param mixed $parameters - * @return $this - */ - public function assertRedirectToSignedRoute($name = null, $parameters = []) - { - if (! is_null($name)) { - $uri = route($name, $parameters); - } - - PHPUnit::assertTrue( - $this->isRedirect(), - $this->statusMessageWithDetails('201, 301, 302, 303, 307, 308', $this->getStatusCode()), - ); - - $request = Request::create($this->headers->get('Location')); - - PHPUnit::assertTrue( - $request->hasValidSignature(), 'The response is not a redirect to a signed route.' - ); - - if (! is_null($name)) { - $expectedUri = rtrim($request->fullUrlWithQuery([ - 'signature' => null, - 'expires' => null, - ]), '?'); - - PHPUnit::assertEquals( - app('url')->to($uri), $expectedUri - ); - } - - return $this; - } - - /** - * Asserts that the response contains the given header and equals the optional value. - * - * @param string $headerName - * @param mixed $value - * @return $this - */ - public function assertHeader($headerName, $value = null) - { - PHPUnit::assertTrue( - $this->headers->has($headerName), "Header [{$headerName}] not present on response." - ); - - $actual = $this->headers->get($headerName); - - if (! is_null($value)) { - PHPUnit::assertEquals( - $value, $this->headers->get($headerName), - "Header [{$headerName}] was found, but value [{$actual}] does not match [{$value}]." - ); - } - - return $this; - } - - /** - * Asserts that the response does not contain the given header. - * - * @param string $headerName - * @return $this - */ - public function assertHeaderMissing($headerName) - { - PHPUnit::assertFalse( - $this->headers->has($headerName), "Unexpected header [{$headerName}] is present on response." - ); - - return $this; - } - - /** - * Assert that the current location header matches the given URI. - * - * @param string $uri - * @return $this - */ - public function assertLocation($uri) - { - PHPUnit::assertEquals( - app('url')->to($uri), app('url')->to($this->headers->get('Location')) - ); - - return $this; - } - - /** - * Assert that the response offers a file download. - * - * @param string|null $filename - * @return $this - */ - public function assertDownload($filename = null) - { - $contentDisposition = explode(';', $this->headers->get('content-disposition')); - - if (trim($contentDisposition[0]) !== 'attachment') { - PHPUnit::fail( - 'Response does not offer a file download.'.PHP_EOL. - 'Disposition ['.trim($contentDisposition[0]).'] found in header, [attachment] expected.' - ); - } - - if (! is_null($filename)) { - if (isset($contentDisposition[1]) && - trim(explode('=', $contentDisposition[1])[0]) !== 'filename') { - PHPUnit::fail( - 'Unsupported Content-Disposition header provided.'.PHP_EOL. - 'Disposition ['.trim(explode('=', $contentDisposition[1])[0]).'] found in header, [filename] expected.' - ); - } - - $message = "Expected file [{$filename}] is not present in Content-Disposition header."; - - if (! isset($contentDisposition[1])) { - PHPUnit::fail($message); - } else { - PHPUnit::assertSame( - $filename, - isset(explode('=', $contentDisposition[1])[1]) - ? trim(explode('=', $contentDisposition[1])[1], " \"'") - : '', - $message - ); - - return $this; - } - } else { - PHPUnit::assertTrue(true); - - return $this; - } - } - - /** - * Asserts that the response contains the given cookie and equals the optional value. - * - * @param string $cookieName - * @param mixed $value - * @return $this - */ - public function assertPlainCookie($cookieName, $value = null) - { - $this->assertCookie($cookieName, $value, false); - - return $this; - } - - /** - * Asserts that the response contains the given cookie and equals the optional value. - * - * @param string $cookieName - * @param mixed $value - * @param bool $encrypted - * @param bool $unserialize - * @return $this - */ - public function assertCookie($cookieName, $value = null, $encrypted = true, $unserialize = false) - { - PHPUnit::assertNotNull( - $cookie = $this->getCookie($cookieName, $encrypted && ! is_null($value), $unserialize), - "Cookie [{$cookieName}] not present on response." - ); - - if (! $cookie || is_null($value)) { - return $this; - } - - $cookieValue = $cookie->getValue(); - - PHPUnit::assertEquals( - $value, $cookieValue, - "Cookie [{$cookieName}] was found, but value [{$cookieValue}] does not match [{$value}]." - ); - - return $this; - } - - /** - * Asserts that the response contains the given cookie and is expired. - * - * @param string $cookieName - * @return $this - */ - public function assertCookieExpired($cookieName) - { - PHPUnit::assertNotNull( - $cookie = $this->getCookie($cookieName, false), - "Cookie [{$cookieName}] not present on response." - ); - - $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime()); - - PHPUnit::assertTrue( - $cookie->getExpiresTime() !== 0 && $expiresAt->lessThan(Carbon::now()), - "Cookie [{$cookieName}] is not expired, it expires at [{$expiresAt}]." - ); - - return $this; - } - - /** - * Asserts that the response contains the given cookie and is not expired. - * - * @param string $cookieName - * @return $this - */ - public function assertCookieNotExpired($cookieName) - { - PHPUnit::assertNotNull( - $cookie = $this->getCookie($cookieName, false), - "Cookie [{$cookieName}] not present on response." - ); - - $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime()); - - PHPUnit::assertTrue( - $cookie->getExpiresTime() === 0 || $expiresAt->greaterThan(Carbon::now()), - "Cookie [{$cookieName}] is expired, it expired at [{$expiresAt}]." - ); - - return $this; - } - - /** - * Asserts that the response does not contain the given cookie. - * - * @param string $cookieName - * @return $this - */ - public function assertCookieMissing($cookieName) - { - PHPUnit::assertNull( - $this->getCookie($cookieName, false), - "Cookie [{$cookieName}] is present on response." - ); - - return $this; - } - - /** - * Get the given cookie from the response. - * - * @param string $cookieName - * @param bool $decrypt - * @param bool $unserialize - * @return \Symfony\Component\HttpFoundation\Cookie|null - */ - public function getCookie($cookieName, $decrypt = true, $unserialize = false) - { - foreach ($this->headers->getCookies() as $cookie) { - if ($cookie->getName() === $cookieName) { - if (! $decrypt) { - return $cookie; - } - - $decryptedValue = CookieValuePrefix::remove( - app('encrypter')->decrypt($cookie->getValue(), $unserialize) - ); - - return new Cookie( - $cookie->getName(), - $decryptedValue, - $cookie->getExpiresTime(), - $cookie->getPath(), - $cookie->getDomain(), - $cookie->isSecure(), - $cookie->isHttpOnly(), - $cookie->isRaw(), - $cookie->getSameSite() - ); - } - } - } - - /** - * Assert that the given string matches the response content. - * - * @param string $value - * @return $this - */ - public function assertContent($value) - { - PHPUnit::assertSame($value, $this->content()); - - return $this; - } - - /** - * Assert that the given string matches the streamed response content. - * - * @param string $value - * @return $this - */ - public function assertStreamedContent($value) - { - PHPUnit::assertSame($value, $this->streamedContent()); - - return $this; - } - - /** - * Assert that the given string or array of strings are contained within the response. - * - * @param string|array $value - * @param bool $escape - * @return $this - */ - public function assertSee($value, $escape = true) - { - $value = Arr::wrap($value); - - $values = $escape ? array_map('e', $value) : $value; - - foreach ($values as $value) { - PHPUnit::assertStringContainsString((string) $value, $this->getContent()); - } - - return $this; - } - - /** - * Assert that the given strings are contained in order within the response. - * - * @param array $values - * @param bool $escape - * @return $this - */ - public function assertSeeInOrder(array $values, $escape = true) - { - $values = $escape ? array_map('e', $values) : $values; - - PHPUnit::assertThat($values, new SeeInOrder($this->getContent())); - - return $this; - } - - /** - * Assert that the given string or array of strings are contained within the response text. - * - * @param string|array $value - * @param bool $escape - * @return $this - */ - public function assertSeeText($value, $escape = true) - { - $value = Arr::wrap($value); - - $values = $escape ? array_map('e', $value) : $value; - - $content = strip_tags($this->getContent()); - - foreach ($values as $value) { - PHPUnit::assertStringContainsString((string) $value, $content); - } - - return $this; - } - - /** - * Assert that the given strings are contained in order within the response text. - * - * @param array $values - * @param bool $escape - * @return $this - */ - public function assertSeeTextInOrder(array $values, $escape = true) - { - $values = $escape ? array_map('e', $values) : $values; - - PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->getContent()))); - - return $this; - } - - /** - * Assert that the given string or array of strings are not contained within the response. - * - * @param string|array $value - * @param bool $escape - * @return $this - */ - public function assertDontSee($value, $escape = true) - { - $value = Arr::wrap($value); - - $values = $escape ? array_map('e', $value) : $value; - - foreach ($values as $value) { - PHPUnit::assertStringNotContainsString((string) $value, $this->getContent()); - } - - return $this; - } - - /** - * Assert that the given string or array of strings are not contained within the response text. - * - * @param string|array $value - * @param bool $escape - * @return $this - */ - public function assertDontSeeText($value, $escape = true) - { - $value = Arr::wrap($value); - - $values = $escape ? array_map('e', $value) : $value; - - $content = strip_tags($this->getContent()); - - foreach ($values as $value) { - PHPUnit::assertStringNotContainsString((string) $value, $content); - } - - return $this; - } - - /** - * Assert that the response is a superset of the given JSON. - * - * @param array|callable $value - * @param bool $strict - * @return $this - */ - public function assertJson($value, $strict = false) - { - $json = $this->decodeResponseJson(); - - if (is_array($value)) { - $json->assertSubset($value, $strict); - } else { - $assert = AssertableJson::fromAssertableJsonString($json); - - $value($assert); - - if (Arr::isAssoc($assert->toArray())) { - $assert->interacted(); - } - } - - return $this; - } - - /** - * Assert that the expected value and type exists at the given path in the response. - * - * @param string $path - * @param mixed $expect - * @return $this - */ - public function assertJsonPath($path, $expect) - { - $this->decodeResponseJson()->assertPath($path, $expect); - - return $this; - } - - /** - * Assert that the response has the exact given JSON. - * - * @param array $data - * @return $this - */ - public function assertExactJson(array $data) - { - $this->decodeResponseJson()->assertExact($data); - - return $this; - } - - /** - * Assert that the response has the similar JSON as given. - * - * @param array $data - * @return $this - */ - public function assertSimilarJson(array $data) - { - $this->decodeResponseJson()->assertSimilar($data); - - return $this; - } - - /** - * Assert that the response contains the given JSON fragment. - * - * @param array $data - * @return $this - */ - public function assertJsonFragment(array $data) - { - $this->decodeResponseJson()->assertFragment($data); - - return $this; - } - - /** - * Assert that the response does not contain the given JSON fragment. - * - * @param array $data - * @param bool $exact - * @return $this - */ - public function assertJsonMissing(array $data, $exact = false) - { - $this->decodeResponseJson()->assertMissing($data, $exact); - - return $this; - } - - /** - * Assert that the response does not contain the exact JSON fragment. - * - * @param array $data - * @return $this - */ - public function assertJsonMissingExact(array $data) - { - $this->decodeResponseJson()->assertMissingExact($data); - - return $this; - } - - /** - * Assert that the response does not contain the given path. - * - * @param string $path - * @return $this - */ - public function assertJsonMissingPath(string $path) - { - $this->decodeResponseJson()->assertMissingPath($path); - - return $this; - } - - /** - * Assert that the response has a given JSON structure. - * - * @param array|null $structure - * @param array|null $responseData - * @return $this - */ - public function assertJsonStructure(array $structure = null, $responseData = null) - { - $this->decodeResponseJson()->assertStructure($structure, $responseData); - - return $this; - } - - /** - * Assert that the response JSON has the expected count of items at the given key. - * - * @param int $count - * @param string|null $key - * @return $this - */ - public function assertJsonCount(int $count, $key = null) - { - $this->decodeResponseJson()->assertCount($count, $key); - - return $this; - } - - /** - * Assert that the response has the given JSON validation errors. - * - * @param string|array $errors - * @param string $responseKey - * @return $this - */ - public function assertJsonValidationErrors($errors, $responseKey = 'errors') - { - $errors = Arr::wrap($errors); - - PHPUnit::assertNotEmpty($errors, 'No validation errors were provided.'); - - $jsonErrors = Arr::get($this->json(), $responseKey) ?? []; - - $errorMessage = $jsonErrors - ? 'Response has the following JSON validation errors:'. - PHP_EOL.PHP_EOL.json_encode($jsonErrors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE).PHP_EOL - : 'Response does not have JSON validation errors.'; - - foreach ($errors as $key => $value) { - if (is_int($key)) { - $this->assertJsonValidationErrorFor($value, $responseKey); - - continue; - } - - $this->assertJsonValidationErrorFor($key, $responseKey); - - foreach (Arr::wrap($value) as $expectedMessage) { - $errorMissing = true; - - foreach (Arr::wrap($jsonErrors[$key]) as $jsonErrorMessage) { - if (Str::contains($jsonErrorMessage, $expectedMessage)) { - $errorMissing = false; - - break; - } - } - } - - if ($errorMissing) { - PHPUnit::fail( - "Failed to find a validation error in the response for key and message: '$key' => '$expectedMessage'".PHP_EOL.PHP_EOL.$errorMessage - ); - } - } - - return $this; - } - - /** - * Assert the response has any JSON validation errors for the given key. - * - * @param string $key - * @param string $responseKey - * @return $this - */ - public function assertJsonValidationErrorFor($key, $responseKey = 'errors') - { - $jsonErrors = Arr::get($this->json(), $responseKey) ?? []; - - $errorMessage = $jsonErrors - ? 'Response has the following JSON validation errors:'. - PHP_EOL.PHP_EOL.json_encode($jsonErrors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE).PHP_EOL - : 'Response does not have JSON validation errors.'; - - PHPUnit::assertArrayHasKey( - $key, - $jsonErrors, - "Failed to find a validation error in the response for key: '{$key}'".PHP_EOL.PHP_EOL.$errorMessage - ); - - return $this; - } - - /** - * Assert that the response has no JSON validation errors for the given keys. - * - * @param string|array|null $keys - * @param string $responseKey - * @return $this - */ - public function assertJsonMissingValidationErrors($keys = null, $responseKey = 'errors') - { - if ($this->getContent() === '') { - PHPUnit::assertTrue(true); - - return $this; - } - - $json = $this->json(); - - if (! Arr::has($json, $responseKey)) { - PHPUnit::assertTrue(true); - - return $this; - } - - $errors = Arr::get($json, $responseKey, []); - - if (is_null($keys) && count($errors) > 0) { - PHPUnit::fail( - 'Response has unexpected validation errors: '.PHP_EOL.PHP_EOL. - json_encode($errors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) - ); - } - - foreach (Arr::wrap($keys) as $key) { - PHPUnit::assertFalse( - isset($errors[$key]), - "Found unexpected validation error for key: '{$key}'" - ); - } - - return $this; - } - - /** - * Assert that the given key is a JSON array. - * - * @param $key - * @return $this - */ - public function assertJsonIsArray($key = null) - { - $data = $this->json($key); - - $encodedData = json_encode($data); - - PHPUnit::assertTrue( - is_array($data) - && str_starts_with($encodedData, '[') - && str_ends_with($encodedData, ']') - ); - - return $this; - } - - /** - * Assert that the given key is a JSON object. - * - * @param $key - * @return $this - */ - public function assertJsonIsObject($key = null) - { - $data = $this->json($key); - - $encodedData = json_encode($data); - - PHPUnit::assertTrue( - is_array($data) - && str_starts_with($encodedData, '{') - && str_ends_with($encodedData, '}') - ); - - return $this; - } - - /** - * Validate and return the decoded response JSON. - * - * @return \Illuminate\Testing\AssertableJsonString - * - * @throws \Throwable - */ - public function decodeResponseJson() - { - $testJson = new AssertableJsonString($this->getContent()); - - $decodedResponse = $testJson->json(); - - if (is_null($decodedResponse) || $decodedResponse === false) { - if ($this->exception) { - throw $this->exception; - } else { - PHPUnit::fail('Invalid JSON was returned from the route.'); - } - } - - return $testJson; - } - - /** - * Validate and return the decoded response JSON. - * - * @param string|null $key - * @return mixed - */ - public function json($key = null) - { - return $this->decodeResponseJson()->json($key); - } - - /** - * Get the JSON decoded body of the response as a collection. - * - * @param string|null $key - * @return \Illuminate\Support\Collection - */ - public function collect($key = null) - { - return Collection::make($this->json($key)); - } - - /** - * Assert that the response view equals the given value. - * - * @param string $value - * @return $this - */ - public function assertViewIs($value) - { - $this->ensureResponseHasView(); - - PHPUnit::assertEquals($value, $this->original->name()); - - return $this; - } - - /** - * Assert that the response view has a given piece of bound data. - * - * @param string|array $key - * @param mixed $value - * @return $this - */ - public function assertViewHas($key, $value = null) - { - if (is_array($key)) { - return $this->assertViewHasAll($key); - } - - $this->ensureResponseHasView(); - - if (is_null($value)) { - PHPUnit::assertTrue(Arr::has($this->original->gatherData(), $key)); - } elseif ($value instanceof Closure) { - PHPUnit::assertTrue($value(Arr::get($this->original->gatherData(), $key))); - } elseif ($value instanceof Model) { - PHPUnit::assertTrue($value->is(Arr::get($this->original->gatherData(), $key))); - } elseif ($value instanceof EloquentCollection) { - $actual = Arr::get($this->original->gatherData(), $key); - - PHPUnit::assertInstanceOf(EloquentCollection::class, $actual); - PHPUnit::assertSameSize($value, $actual); - - $value->each(fn ($item, $index) => PHPUnit::assertTrue($actual->get($index)->is($item))); - } else { - PHPUnit::assertEquals($value, Arr::get($this->original->gatherData(), $key)); - } - - return $this; - } - - /** - * Assert that the response view has a given list of bound data. - * - * @param array $bindings - * @return $this - */ - public function assertViewHasAll(array $bindings) - { - foreach ($bindings as $key => $value) { - if (is_int($key)) { - $this->assertViewHas($value); - } else { - $this->assertViewHas($key, $value); - } - } - - return $this; - } - - /** - * Get a piece of data from the original view. - * - * @param string $key - * @return mixed - */ - public function viewData($key) - { - $this->ensureResponseHasView(); - - return $this->original->gatherData()[$key]; - } - - /** - * Assert that the response view is missing a piece of bound data. - * - * @param string $key - * @return $this - */ - public function assertViewMissing($key) - { - $this->ensureResponseHasView(); - - PHPUnit::assertFalse(Arr::has($this->original->gatherData(), $key)); - - return $this; - } - - /** - * Ensure that the response has a view as its original content. - * - * @return $this - */ - protected function ensureResponseHasView() - { - if (! $this->responseHasView()) { - return PHPUnit::fail('The response is not a view.'); - } - - return $this; - } - - /** - * Determine if the original response is a view. - * - * @return bool - */ - protected function responseHasView() - { - return isset($this->original) && $this->original instanceof View; - } - - /** - * Assert that the given keys do not have validation errors. - * - * @param string|array|null $keys - * @param string $errorBag - * @param string $responseKey - * @return $this - */ - public function assertValid($keys = null, $errorBag = 'default', $responseKey = 'errors') - { - if ($this->baseResponse->headers->get('Content-Type') === 'application/json') { - return $this->assertJsonMissingValidationErrors($keys, $responseKey); - } - - if ($this->session()->get('errors')) { - $errors = $this->session()->get('errors')->getBag($errorBag)->getMessages(); - } else { - $errors = []; - } - - if (empty($errors)) { - PHPUnit::assertTrue(true); - - return $this; - } - - if (is_null($keys) && count($errors) > 0) { - PHPUnit::fail( - 'Response has unexpected validation errors: '.PHP_EOL.PHP_EOL. - json_encode($errors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) - ); - } - - foreach (Arr::wrap($keys) as $key) { - PHPUnit::assertFalse( - isset($errors[$key]), - "Found unexpected validation error for key: '{$key}'" - ); - } - - return $this; - } - - /** - * Assert that the response has the given validation errors. - * - * @param string|array|null $errors - * @param string $errorBag - * @param string $responseKey - * @return $this - */ - public function assertInvalid($errors = null, - $errorBag = 'default', - $responseKey = 'errors') - { - if ($this->baseResponse->headers->get('Content-Type') === 'application/json') { - return $this->assertJsonValidationErrors($errors, $responseKey); - } - - $this->assertSessionHas('errors'); - - $sessionErrors = $this->session()->get('errors')->getBag($errorBag)->getMessages(); - - $errorMessage = $sessionErrors - ? 'Response has the following validation errors in the session:'. - PHP_EOL.PHP_EOL.json_encode($sessionErrors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE).PHP_EOL - : 'Response does not have validation errors in the session.'; - - foreach (Arr::wrap($errors) as $key => $value) { - PHPUnit::assertArrayHasKey( - (is_int($key)) ? $value : $key, - $sessionErrors, - "Failed to find a validation error in session for key: '{$value}'".PHP_EOL.PHP_EOL.$errorMessage - ); - - if (! is_int($key)) { - $hasError = false; - - foreach (Arr::wrap($sessionErrors[$key]) as $sessionErrorMessage) { - if (Str::contains($sessionErrorMessage, $value)) { - $hasError = true; - - break; - } - } - - if (! $hasError) { - PHPUnit::fail( - "Failed to find a validation error for key and message: '$key' => '$value'".PHP_EOL.PHP_EOL.$errorMessage - ); - } - } - } - - return $this; - } - - /** - * Assert that the session has a given value. - * - * @param string|array $key - * @param mixed $value - * @return $this - */ - public function assertSessionHas($key, $value = null) - { - if (is_array($key)) { - return $this->assertSessionHasAll($key); - } - - if (is_null($value)) { - PHPUnit::assertTrue( - $this->session()->has($key), - "Session is missing expected key [{$key}]." - ); - } elseif ($value instanceof Closure) { - PHPUnit::assertTrue($value($this->session()->get($key))); - } else { - PHPUnit::assertEquals($value, $this->session()->get($key)); - } - - return $this; - } - - /** - * Assert that the session has a given list of values. - * - * @param array $bindings - * @return $this - */ - public function assertSessionHasAll(array $bindings) - { - foreach ($bindings as $key => $value) { - if (is_int($key)) { - $this->assertSessionHas($value); - } else { - $this->assertSessionHas($key, $value); - } - } - - return $this; - } - - /** - * Assert that the session has a given value in the flashed input array. - * - * @param string|array $key - * @param mixed $value - * @return $this - */ - public function assertSessionHasInput($key, $value = null) - { - if (is_array($key)) { - foreach ($key as $k => $v) { - if (is_int($k)) { - $this->assertSessionHasInput($v); - } else { - $this->assertSessionHasInput($k, $v); - } - } - - return $this; - } - - if (is_null($value)) { - PHPUnit::assertTrue( - $this->session()->hasOldInput($key), - "Session is missing expected key [{$key}]." - ); - } elseif ($value instanceof Closure) { - PHPUnit::assertTrue($value($this->session()->getOldInput($key))); - } else { - PHPUnit::assertEquals($value, $this->session()->getOldInput($key)); - } - - return $this; - } - - /** - * Assert that the session has the given errors. - * - * @param string|array $keys - * @param mixed $format - * @param string $errorBag - * @return $this - */ - public function assertSessionHasErrors($keys = [], $format = null, $errorBag = 'default') - { - $this->assertSessionHas('errors'); - - $keys = (array) $keys; - - $errors = $this->session()->get('errors')->getBag($errorBag); - - foreach ($keys as $key => $value) { - if (is_int($key)) { - PHPUnit::assertTrue($errors->has($value), "Session missing error: $value"); - } else { - PHPUnit::assertContains(is_bool($value) ? (string) $value : $value, $errors->get($key, $format)); - } - } - - return $this; - } - - /** - * Assert that the session is missing the given errors. - * - * @param string|array $keys - * @param string|null $format - * @param string $errorBag - * @return $this - */ - public function assertSessionDoesntHaveErrors($keys = [], $format = null, $errorBag = 'default') - { - $keys = (array) $keys; - - if (empty($keys)) { - return $this->assertSessionHasNoErrors(); - } - - if (is_null($this->session()->get('errors'))) { - PHPUnit::assertTrue(true); - - return $this; - } - - $errors = $this->session()->get('errors')->getBag($errorBag); - - foreach ($keys as $key => $value) { - if (is_int($key)) { - PHPUnit::assertFalse($errors->has($value), "Session has unexpected error: $value"); - } else { - PHPUnit::assertNotContains($value, $errors->get($key, $format)); - } - } - - return $this; - } - - /** - * Assert that the session has no errors. - * - * @return $this - */ - public function assertSessionHasNoErrors() - { - $hasErrors = $this->session()->has('errors'); - - PHPUnit::assertFalse( - $hasErrors, - 'Session has unexpected errors: '.PHP_EOL.PHP_EOL. - json_encode((function () use ($hasErrors) { - $errors = []; - - $sessionErrors = $this->session()->get('errors'); - - if ($hasErrors && is_a($sessionErrors, ViewErrorBag::class)) { - foreach ($sessionErrors->getBags() as $bag => $messages) { - if (is_a($messages, MessageBag::class)) { - $errors[$bag] = $messages->all(); - } - } - } - - return $errors; - })(), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), - ); - - return $this; - } - - /** - * Assert that the session has the given errors. - * - * @param string $errorBag - * @param string|array $keys - * @param mixed $format - * @return $this - */ - public function assertSessionHasErrorsIn($errorBag, $keys = [], $format = null) - { - return $this->assertSessionHasErrors($keys, $format, $errorBag); - } - - /** - * Assert that the session does not have a given key. - * - * @param string|array $key - * @return $this - */ - public function assertSessionMissing($key) - { - if (is_array($key)) { - foreach ($key as $value) { - $this->assertSessionMissing($value); - } - } else { - PHPUnit::assertFalse( - $this->session()->has($key), - "Session has unexpected key [{$key}]." - ); - } - - return $this; - } - - /** - * Get the current session store. - * - * @return \Illuminate\Session\Store - */ - protected function session() - { - $session = app('session.store'); - - if (! $session->isStarted()) { - $session->start(); - } - - return $session; - } - - /** - * Dump the content from the response and end the script. - * - * @return never - */ - public function dd() - { - $this->dump(); - - exit(1); - } - - /** - * Dump the headers from the response and end the script. - * - * @return never - */ - public function ddHeaders() - { - $this->dumpHeaders(); - - exit(1); - } - - /** - * Dump the session from the response and end the script. - * - * @param string|array $keys - * @return never - */ - public function ddSession($keys = []) - { - $this->dumpSession($keys); - - exit(1); - } - - /** - * Dump the content from the response. - * - * @param string|null $key - * @return $this - */ - public function dump($key = null) - { - $content = $this->getContent(); - - $json = json_decode($content); - - if (json_last_error() === JSON_ERROR_NONE) { - $content = $json; - } - - if (! is_null($key)) { - dump(data_get($content, $key)); - } else { - dump($content); - } - - return $this; - } - - /** - * Dump the headers from the response. - * - * @return $this - */ - public function dumpHeaders() - { - dump($this->headers->all()); - - return $this; - } - - /** - * Dump the session from the response. - * - * @param string|array $keys - * @return $this - */ - public function dumpSession($keys = []) - { - $keys = (array) $keys; - - if (empty($keys)) { - dump($this->session()->all()); - } else { - dump($this->session()->only($keys)); - } - - return $this; - } - - /** - * Get the streamed content from the response. - * - * @return string - */ - public function streamedContent() - { - if (! is_null($this->streamedContent)) { - return $this->streamedContent; - } - - if (! $this->baseResponse instanceof StreamedResponse) { - PHPUnit::fail('The response is not a streamed response.'); - } - - ob_start(function (string $buffer): string { - $this->streamedContent .= $buffer; - - return ''; - }); - - $this->sendContent(); - - ob_end_clean(); - - return $this->streamedContent; - } - - /** - * Set the previous exceptions on the response. - * - * @param \Illuminate\Support\Collection $exceptions - * @return $this - */ - public function withExceptions(Collection $exceptions) - { - $this->exceptions = $exceptions; - - return $this; - } - - /** - * This method is called when test method did not execute successfully. - * - * @param \Throwable $exception - * @return \Throwable - */ - public function transformNotSuccessfulException($exception) - { - if (! $exception instanceof ExpectationFailedException) { - return $exception; - } - - if ($lastException = $this->exceptions->last()) { - return $this->appendExceptionToException($lastException, $exception); - } - - if ($this->baseResponse instanceof RedirectResponse) { - $session = $this->baseResponse->getSession(); - - if (! is_null($session) && $session->has('errors')) { - return $this->appendErrorsToException($session->get('errors')->all(), $exception); - } - } - - if ($this->baseResponse->headers->get('Content-Type') === 'application/json') { - $testJson = new AssertableJsonString($this->getContent()); - - if (isset($testJson['errors'])) { - return $this->appendErrorsToException($testJson->json(), $exception, true); - } - } - - return $exception; - } - - /** - * Append an exception to the message of another exception. - * - * @param \Throwable $exceptionToAppend - * @param \Throwable $exception - * @return \Throwable - */ - protected function appendExceptionToException($exceptionToAppend, $exception) - { - $exceptionMessage = $exceptionToAppend->getMessage(); - - $exceptionToAppend = (string) $exceptionToAppend; - - $message = <<<"EOF" - The following exception occurred during the last request: - - $exceptionToAppend - - ---------------------------------------------------------------------------------- - - $exceptionMessage - EOF; - - return $this->appendMessageToException($message, $exception); - } - - /** - * Append errors to an exception message. - * - * @param array $errors - * @param \Throwable $exception - * @param bool $json - * @return \Throwable - */ - protected function appendErrorsToException($errors, $exception, $json = false) - { - $errors = $json - ? json_encode($errors, JSON_PRETTY_PRINT) - : implode(PHP_EOL, Arr::flatten($errors)); - - // JSON error messages may already contain the errors, so we shouldn't duplicate them... - if (str_contains($exception->getMessage(), $errors)) { - return $exception; - } - - $message = <<<"EOF" - The following errors occurred during the last request: - - $errors - EOF; - - return $this->appendMessageToException($message, $exception); - } - - /** - * Append a message to an exception. - * - * @param string $message - * @param \Throwable $exception - * @return \Throwable - */ - protected function appendMessageToException($message, $exception) - { - $property = new ReflectionProperty($exception, 'message'); - - $property->setAccessible(true); - - $property->setValue( - $exception, - $exception->getMessage().PHP_EOL.PHP_EOL.$message.PHP_EOL - ); - - return $exception; - } - - /** - * Dynamically access base response parameters. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->baseResponse->{$key}; - } - - /** - * Proxy isset() checks to the underlying base response. - * - * @param string $key - * @return mixed - */ - public function __isset($key) - { - return isset($this->baseResponse->{$key}); - } - - /** - * Determine if the given offset exists. - * - * @param string $offset - * @return bool - */ - public function offsetExists($offset): bool - { - return $this->responseHasView() - ? isset($this->original->gatherData()[$offset]) - : isset($this->json()[$offset]); - } - - /** - * Get the value for a given offset. - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset): mixed - { - return $this->responseHasView() - ? $this->viewData($offset) - : $this->json()[$offset]; - } - - /** - * Set the value at the given offset. - * - * @param string $offset - * @param mixed $value - * @return void - * - * @throws \LogicException - */ - public function offsetSet($offset, $value): void - { - throw new LogicException('Response data may not be mutated using array access.'); - } - - /** - * Unset the value at the given offset. - * - * @param string $offset - * @return void - * - * @throws \LogicException - */ - public function offsetUnset($offset): void - { - throw new LogicException('Response data may not be mutated using array access.'); - } - - /** - * Handle dynamic calls into macros or pass missing methods to the base response. - * - * @param string $method - * @param array $args - * @return mixed - */ - public function __call($method, $args) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $args); - } - - return $this->baseResponse->{$method}(...$args); - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/TestView.php b/framework-9.50.2/src/Illuminate/Testing/TestView.php deleted file mode 100644 index 137b41e..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/TestView.php +++ /dev/null @@ -1,214 +0,0 @@ -view = $view; - $this->rendered = $view->render(); - } - - /** - * Assert that the response view has a given piece of bound data. - * - * @param string|array $key - * @param mixed $value - * @return $this - */ - public function assertViewHas($key, $value = null) - { - if (is_array($key)) { - return $this->assertViewHasAll($key); - } - - if (is_null($value)) { - PHPUnit::assertTrue(Arr::has($this->view->gatherData(), $key)); - } elseif ($value instanceof Closure) { - PHPUnit::assertTrue($value(Arr::get($this->view->gatherData(), $key))); - } elseif ($value instanceof Model) { - PHPUnit::assertTrue($value->is(Arr::get($this->view->gatherData(), $key))); - } elseif ($value instanceof Collection) { - $actual = Arr::get($this->view->gatherData(), $key); - - PHPUnit::assertInstanceOf(Collection::class, $actual); - PHPUnit::assertSameSize($value, $actual); - - $value->each(fn ($item, $index) => PHPUnit::assertTrue($actual->get($index)->is($item))); - } else { - PHPUnit::assertEquals($value, Arr::get($this->view->gatherData(), $key)); - } - - return $this; - } - - /** - * Assert that the response view has a given list of bound data. - * - * @param array $bindings - * @return $this - */ - public function assertViewHasAll(array $bindings) - { - foreach ($bindings as $key => $value) { - if (is_int($key)) { - $this->assertViewHas($value); - } else { - $this->assertViewHas($key, $value); - } - } - - return $this; - } - - /** - * Assert that the response view is missing a piece of bound data. - * - * @param string $key - * @return $this - */ - public function assertViewMissing($key) - { - PHPUnit::assertFalse(Arr::has($this->view->gatherData(), $key)); - - return $this; - } - - /** - * Assert that the given string is contained within the view. - * - * @param string $value - * @param bool $escape - * @return $this - */ - public function assertSee($value, $escape = true) - { - $value = $escape ? e($value) : $value; - - PHPUnit::assertStringContainsString((string) $value, $this->rendered); - - return $this; - } - - /** - * Assert that the given strings are contained in order within the view. - * - * @param array $values - * @param bool $escape - * @return $this - */ - public function assertSeeInOrder(array $values, $escape = true) - { - $values = $escape ? array_map('e', $values) : $values; - - PHPUnit::assertThat($values, new SeeInOrder($this->rendered)); - - return $this; - } - - /** - * Assert that the given string is contained within the view text. - * - * @param string $value - * @param bool $escape - * @return $this - */ - public function assertSeeText($value, $escape = true) - { - $value = $escape ? e($value) : $value; - - PHPUnit::assertStringContainsString((string) $value, strip_tags($this->rendered)); - - return $this; - } - - /** - * Assert that the given strings are contained in order within the view text. - * - * @param array $values - * @param bool $escape - * @return $this - */ - public function assertSeeTextInOrder(array $values, $escape = true) - { - $values = $escape ? array_map('e', $values) : $values; - - PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->rendered))); - - return $this; - } - - /** - * Assert that the given string is not contained within the view. - * - * @param string $value - * @param bool $escape - * @return $this - */ - public function assertDontSee($value, $escape = true) - { - $value = $escape ? e($value) : $value; - - PHPUnit::assertStringNotContainsString((string) $value, $this->rendered); - - return $this; - } - - /** - * Assert that the given string is not contained within the view text. - * - * @param string $value - * @param bool $escape - * @return $this - */ - public function assertDontSeeText($value, $escape = true) - { - $value = $escape ? e($value) : $value; - - PHPUnit::assertStringNotContainsString((string) $value, strip_tags($this->rendered)); - - return $this; - } - - /** - * Get the string contents of the rendered view. - * - * @return string - */ - public function __toString() - { - return $this->rendered; - } -} diff --git a/framework-9.50.2/src/Illuminate/Testing/composer.json b/framework-9.50.2/src/Illuminate/Testing/composer.json deleted file mode 100644 index 7fae381..0000000 --- a/framework-9.50.2/src/Illuminate/Testing/composer.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "illuminate/testing", - "description": "The Illuminate Testing package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Testing\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "brianium/paratest": "Required to run tests in parallel (^6.0).", - "illuminate/console": "Required to assert console commands (^9.0).", - "illuminate/database": "Required to assert databases (^9.0).", - "illuminate/http": "Required to assert responses (^9.0).", - "mockery/mockery": "Required to use mocking (^1.5.1).", - "phpunit/phpunit": "Required to use assertions and run tests (^9.5.8)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Translation/ArrayLoader.php b/framework-9.50.2/src/Illuminate/Translation/ArrayLoader.php deleted file mode 100644 index 117e044..0000000 --- a/framework-9.50.2/src/Illuminate/Translation/ArrayLoader.php +++ /dev/null @@ -1,81 +0,0 @@ -messages[$namespace][$locale][$group] ?? []; - } - - /** - * Add a new namespace to the loader. - * - * @param string $namespace - * @param string $hint - * @return void - */ - public function addNamespace($namespace, $hint) - { - // - } - - /** - * Add a new JSON path to the loader. - * - * @param string $path - * @return void - */ - public function addJsonPath($path) - { - // - } - - /** - * Add messages to the loader. - * - * @param string $locale - * @param string $group - * @param array $messages - * @param string|null $namespace - * @return $this - */ - public function addMessages($locale, $group, array $messages, $namespace = null) - { - $namespace = $namespace ?: '*'; - - $this->messages[$namespace][$locale][$group] = $messages; - - return $this; - } - - /** - * Get an array of all the registered namespaces. - * - * @return array - */ - public function namespaces() - { - return []; - } -} diff --git a/framework-9.50.2/src/Illuminate/Translation/FileLoader.php b/framework-9.50.2/src/Illuminate/Translation/FileLoader.php deleted file mode 100755 index f359a8e..0000000 --- a/framework-9.50.2/src/Illuminate/Translation/FileLoader.php +++ /dev/null @@ -1,197 +0,0 @@ -path = $path; - $this->files = $files; - } - - /** - * Load the messages for the given locale. - * - * @param string $locale - * @param string $group - * @param string|null $namespace - * @return array - */ - public function load($locale, $group, $namespace = null) - { - if ($group === '*' && $namespace === '*') { - return $this->loadJsonPaths($locale); - } - - if (is_null($namespace) || $namespace === '*') { - return $this->loadPath($this->path, $locale, $group); - } - - return $this->loadNamespaced($locale, $group, $namespace); - } - - /** - * Load a namespaced translation group. - * - * @param string $locale - * @param string $group - * @param string $namespace - * @return array - */ - protected function loadNamespaced($locale, $group, $namespace) - { - if (isset($this->hints[$namespace])) { - $lines = $this->loadPath($this->hints[$namespace], $locale, $group); - - return $this->loadNamespaceOverrides($lines, $locale, $group, $namespace); - } - - return []; - } - - /** - * Load a local namespaced translation group for overrides. - * - * @param array $lines - * @param string $locale - * @param string $group - * @param string $namespace - * @return array - */ - protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace) - { - $file = "{$this->path}/vendor/{$namespace}/{$locale}/{$group}.php"; - - if ($this->files->exists($file)) { - return array_replace_recursive($lines, $this->files->getRequire($file)); - } - - return $lines; - } - - /** - * Load a locale from a given path. - * - * @param string $path - * @param string $locale - * @param string $group - * @return array - */ - protected function loadPath($path, $locale, $group) - { - if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) { - return $this->files->getRequire($full); - } - - return []; - } - - /** - * Load a locale from the given JSON file path. - * - * @param string $locale - * @return array - * - * @throws \RuntimeException - */ - protected function loadJsonPaths($locale) - { - return collect(array_merge($this->jsonPaths, [$this->path])) - ->reduce(function ($output, $path) use ($locale) { - if ($this->files->exists($full = "{$path}/{$locale}.json")) { - $decoded = json_decode($this->files->get($full), true); - - if (is_null($decoded) || json_last_error() !== JSON_ERROR_NONE) { - throw new RuntimeException("Translation file [{$full}] contains an invalid JSON structure."); - } - - $output = array_merge($output, $decoded); - } - - return $output; - }, []); - } - - /** - * Add a new namespace to the loader. - * - * @param string $namespace - * @param string $hint - * @return void - */ - public function addNamespace($namespace, $hint) - { - $this->hints[$namespace] = $hint; - } - - /** - * Get an array of all the registered namespaces. - * - * @return array - */ - public function namespaces() - { - return $this->hints; - } - - /** - * Add a new JSON path to the loader. - * - * @param string $path - * @return void - */ - public function addJsonPath($path) - { - $this->jsonPaths[] = $path; - } - - /** - * Get an array of all the registered paths to JSON translation files. - * - * @return array - */ - public function jsonPaths() - { - return $this->jsonPaths; - } -} diff --git a/framework-9.50.2/src/Illuminate/Translation/LICENSE.md b/framework-9.50.2/src/Illuminate/Translation/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Translation/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Translation/MessageSelector.php b/framework-9.50.2/src/Illuminate/Translation/MessageSelector.php deleted file mode 100755 index 37c9b31..0000000 --- a/framework-9.50.2/src/Illuminate/Translation/MessageSelector.php +++ /dev/null @@ -1,410 +0,0 @@ -extract($segments, $number)) !== null) { - return trim($value); - } - - $segments = $this->stripConditions($segments); - - $pluralIndex = $this->getPluralIndex($locale, $number); - - if (count($segments) === 1 || ! isset($segments[$pluralIndex])) { - return $segments[0]; - } - - return $segments[$pluralIndex]; - } - - /** - * Extract a translation string using inline conditions. - * - * @param array $segments - * @param int $number - * @return mixed - */ - private function extract($segments, $number) - { - foreach ($segments as $part) { - if (! is_null($line = $this->extractFromString($part, $number))) { - return $line; - } - } - } - - /** - * Get the translation string if the condition matches. - * - * @param string $part - * @param int $number - * @return mixed - */ - private function extractFromString($part, $number) - { - preg_match('/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s', $part, $matches); - - if (count($matches) !== 3) { - return null; - } - - $condition = $matches[1]; - - $value = $matches[2]; - - if (str_contains($condition, ',')) { - [$from, $to] = explode(',', $condition, 2); - - if ($to === '*' && $number >= $from) { - return $value; - } elseif ($from === '*' && $number <= $to) { - return $value; - } elseif ($number >= $from && $number <= $to) { - return $value; - } - } - - return $condition == $number ? $value : null; - } - - /** - * Strip the inline conditions from each segment, just leaving the text. - * - * @param array $segments - * @return array - */ - private function stripConditions($segments) - { - return collect($segments)->map(function ($part) { - return preg_replace('/^[\{\[]([^\[\]\{\}]*)[\}\]]/', '', $part); - })->all(); - } - - /** - * Get the index to use for pluralization. - * - * The plural rules are derived from code of the Zend Framework (2010-09-25), which - * is subject to the new BSD license (https://framework.zend.com/license) - * Copyright (c) 2005-2010 - Zend Technologies USA Inc. (http://www.zend.com) - * - * @param string $locale - * @param int $number - * @return int - */ - public function getPluralIndex($locale, $number) - { - switch ($locale) { - case 'az': - case 'az_AZ': - case 'bo': - case 'bo_CN': - case 'bo_IN': - case 'dz': - case 'dz_BT': - case 'id': - case 'id_ID': - case 'ja': - case 'ja_JP': - case 'jv': - case 'ka': - case 'ka_GE': - case 'km': - case 'km_KH': - case 'kn': - case 'kn_IN': - case 'ko': - case 'ko_KR': - case 'ms': - case 'ms_MY': - case 'th': - case 'th_TH': - case 'tr': - case 'tr_CY': - case 'tr_TR': - case 'vi': - case 'vi_VN': - case 'zh': - case 'zh_CN': - case 'zh_HK': - case 'zh_SG': - case 'zh_TW': - return 0; - case 'af': - case 'af_ZA': - case 'bn': - case 'bn_BD': - case 'bn_IN': - case 'bg': - case 'bg_BG': - case 'ca': - case 'ca_AD': - case 'ca_ES': - case 'ca_FR': - case 'ca_IT': - case 'da': - case 'da_DK': - case 'de': - case 'de_AT': - case 'de_BE': - case 'de_CH': - case 'de_DE': - case 'de_LI': - case 'de_LU': - case 'el': - case 'el_CY': - case 'el_GR': - case 'en': - case 'en_AG': - case 'en_AU': - case 'en_BW': - case 'en_CA': - case 'en_DK': - case 'en_GB': - case 'en_HK': - case 'en_IE': - case 'en_IN': - case 'en_NG': - case 'en_NZ': - case 'en_PH': - case 'en_SG': - case 'en_US': - case 'en_ZA': - case 'en_ZM': - case 'en_ZW': - case 'eo': - case 'eo_US': - case 'es': - case 'es_AR': - case 'es_BO': - case 'es_CL': - case 'es_CO': - case 'es_CR': - case 'es_CU': - case 'es_DO': - case 'es_EC': - case 'es_ES': - case 'es_GT': - case 'es_HN': - case 'es_MX': - case 'es_NI': - case 'es_PA': - case 'es_PE': - case 'es_PR': - case 'es_PY': - case 'es_SV': - case 'es_US': - case 'es_UY': - case 'es_VE': - case 'et': - case 'et_EE': - case 'eu': - case 'eu_ES': - case 'eu_FR': - case 'fa': - case 'fa_IR': - case 'fi': - case 'fi_FI': - case 'fo': - case 'fo_FO': - case 'fur': - case 'fur_IT': - case 'fy': - case 'fy_DE': - case 'fy_NL': - case 'gl': - case 'gl_ES': - case 'gu': - case 'gu_IN': - case 'ha': - case 'ha_NG': - case 'he': - case 'he_IL': - case 'hu': - case 'hu_HU': - case 'is': - case 'is_IS': - case 'it': - case 'it_CH': - case 'it_IT': - case 'ku': - case 'ku_TR': - case 'lb': - case 'lb_LU': - case 'ml': - case 'ml_IN': - case 'mn': - case 'mn_MN': - case 'mr': - case 'mr_IN': - case 'nah': - case 'nb': - case 'nb_NO': - case 'ne': - case 'ne_NP': - case 'nl': - case 'nl_AW': - case 'nl_BE': - case 'nl_NL': - case 'nn': - case 'nn_NO': - case 'no': - case 'om': - case 'om_ET': - case 'om_KE': - case 'or': - case 'or_IN': - case 'pa': - case 'pa_IN': - case 'pa_PK': - case 'pap': - case 'pap_AN': - case 'pap_AW': - case 'pap_CW': - case 'ps': - case 'ps_AF': - case 'pt': - case 'pt_BR': - case 'pt_PT': - case 'so': - case 'so_DJ': - case 'so_ET': - case 'so_KE': - case 'so_SO': - case 'sq': - case 'sq_AL': - case 'sq_MK': - case 'sv': - case 'sv_FI': - case 'sv_SE': - case 'sw': - case 'sw_KE': - case 'sw_TZ': - case 'ta': - case 'ta_IN': - case 'ta_LK': - case 'te': - case 'te_IN': - case 'tk': - case 'tk_TM': - case 'ur': - case 'ur_IN': - case 'ur_PK': - case 'zu': - case 'zu_ZA': - return ($number == 1) ? 0 : 1; - case 'am': - case 'am_ET': - case 'bh': - case 'fil': - case 'fil_PH': - case 'fr': - case 'fr_BE': - case 'fr_CA': - case 'fr_CH': - case 'fr_FR': - case 'fr_LU': - case 'gun': - case 'hi': - case 'hi_IN': - case 'hy': - case 'hy_AM': - case 'ln': - case 'ln_CD': - case 'mg': - case 'mg_MG': - case 'nso': - case 'nso_ZA': - case 'ti': - case 'ti_ER': - case 'ti_ET': - case 'wa': - case 'wa_BE': - case 'xbr': - return (($number == 0) || ($number == 1)) ? 0 : 1; - case 'be': - case 'be_BY': - case 'bs': - case 'bs_BA': - case 'hr': - case 'hr_HR': - case 'ru': - case 'ru_RU': - case 'ru_UA': - case 'sr': - case 'sr_ME': - case 'sr_RS': - case 'uk': - case 'uk_UA': - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - case 'cs': - case 'cs_CZ': - case 'sk': - case 'sk_SK': - return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); - case 'ga': - case 'ga_IE': - return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); - case 'lt': - case 'lt_LT': - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - case 'sl': - case 'sl_SI': - return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); - case 'mk': - case 'mk_MK': - return ($number % 10 == 1) ? 0 : 1; - case 'mt': - case 'mt_MT': - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); - case 'lv': - case 'lv_LV': - return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); - case 'pl': - case 'pl_PL': - return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); - case 'cy': - case 'cy_GB': - return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); - case 'ro': - case 'ro_RO': - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); - case 'ar': - case 'ar_AE': - case 'ar_BH': - case 'ar_DZ': - case 'ar_EG': - case 'ar_IN': - case 'ar_IQ': - case 'ar_JO': - case 'ar_KW': - case 'ar_LB': - case 'ar_LY': - case 'ar_MA': - case 'ar_OM': - case 'ar_QA': - case 'ar_SA': - case 'ar_SD': - case 'ar_SS': - case 'ar_SY': - case 'ar_TN': - case 'ar_YE': - return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); - default: - return 0; - } - } -} diff --git a/framework-9.50.2/src/Illuminate/Translation/PotentiallyTranslatedString.php b/framework-9.50.2/src/Illuminate/Translation/PotentiallyTranslatedString.php deleted file mode 100644 index f46db35..0000000 --- a/framework-9.50.2/src/Illuminate/Translation/PotentiallyTranslatedString.php +++ /dev/null @@ -1,101 +0,0 @@ -string = $string; - - $this->translator = $translator; - } - - /** - * Translate the string. - * - * @param array $replace - * @param string|null $locale - * @return $this - */ - public function translate($replace = [], $locale = null) - { - $this->translation = $this->translator->get($this->string, $replace, $locale); - - return $this; - } - - /** - * Translates the string based on a count. - * - * @param \Countable|int|array $number - * @param array $replace - * @param string|null $locale - * @return $this - */ - public function translateChoice($number, array $replace = [], $locale = null) - { - $this->translation = $this->translator->choice($this->string, $number, $replace, $locale); - - return $this; - } - - /** - * Get the original string. - * - * @return string - */ - public function original() - { - return $this->string; - } - - /** - * Get the potentially translated string. - * - * @return string - */ - public function __toString() - { - return $this->translation ?? $this->string; - } - - /** - * Get the potentially translated string. - * - * @return string - */ - public function toString() - { - return (string) $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Translation/TranslationServiceProvider.php b/framework-9.50.2/src/Illuminate/Translation/TranslationServiceProvider.php deleted file mode 100755 index 2305535..0000000 --- a/framework-9.50.2/src/Illuminate/Translation/TranslationServiceProvider.php +++ /dev/null @@ -1,56 +0,0 @@ -registerLoader(); - - $this->app->singleton('translator', function ($app) { - $loader = $app['translation.loader']; - - // When registering the translator component, we'll need to set the default - // locale as well as the fallback locale. So, we'll grab the application - // configuration so we can easily get both of these values from there. - $locale = $app->getLocale(); - - $trans = new Translator($loader, $locale); - - $trans->setFallback($app->getFallbackLocale()); - - return $trans; - }); - } - - /** - * Register the translation line loader. - * - * @return void - */ - protected function registerLoader() - { - $this->app->singleton('translation.loader', function ($app) { - return new FileLoader($app['files'], $app['path.lang']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['translator', 'translation.loader']; - } -} diff --git a/framework-9.50.2/src/Illuminate/Translation/Translator.php b/framework-9.50.2/src/Illuminate/Translation/Translator.php deleted file mode 100755 index ae07414..0000000 --- a/framework-9.50.2/src/Illuminate/Translation/Translator.php +++ /dev/null @@ -1,486 +0,0 @@ -loader = $loader; - - $this->setLocale($locale); - } - - /** - * Determine if a translation exists for a given locale. - * - * @param string $key - * @param string|null $locale - * @return bool - */ - public function hasForLocale($key, $locale = null) - { - return $this->has($key, $locale, false); - } - - /** - * Determine if a translation exists. - * - * @param string $key - * @param string|null $locale - * @param bool $fallback - * @return bool - */ - public function has($key, $locale = null, $fallback = true) - { - return $this->get($key, [], $locale, $fallback) !== $key; - } - - /** - * Get the translation for the given key. - * - * @param string $key - * @param array $replace - * @param string|null $locale - * @param bool $fallback - * @return string|array - */ - public function get($key, array $replace = [], $locale = null, $fallback = true) - { - $locale = $locale ?: $this->locale; - - // For JSON translations, there is only one file per locale, so we will simply load - // that file and then we will be ready to check the array for the key. These are - // only one level deep so we do not need to do any fancy searching through it. - $this->load('*', '*', $locale); - - $line = $this->loaded['*']['*'][$locale][$key] ?? null; - - // If we can't find a translation for the JSON key, we will attempt to translate it - // using the typical translation file. This way developers can always just use a - // helper such as __ instead of having to pick between trans or __ with views. - if (! isset($line)) { - [$namespace, $group, $item] = $this->parseKey($key); - - // Here we will get the locale that should be used for the language line. If one - // was not passed, we will use the default locales which was given to us when - // the translator was instantiated. Then, we can load the lines and return. - $locales = $fallback ? $this->localeArray($locale) : [$locale]; - - foreach ($locales as $locale) { - if (! is_null($line = $this->getLine( - $namespace, $group, $locale, $item, $replace - ))) { - return $line; - } - } - } - - // If the line doesn't exist, we will return back the key which was requested as - // that will be quick to spot in the UI if language keys are wrong or missing - // from the application's language files. Otherwise we can return the line. - return $this->makeReplacements($line ?: $key, $replace); - } - - /** - * Get a translation according to an integer value. - * - * @param string $key - * @param \Countable|int|array $number - * @param array $replace - * @param string|null $locale - * @return string - */ - public function choice($key, $number, array $replace = [], $locale = null) - { - $line = $this->get( - $key, $replace, $locale = $this->localeForChoice($locale) - ); - - // If the given "number" is actually an array or countable we will simply count the - // number of elements in an instance. This allows developers to pass an array of - // items without having to count it on their end first which gives bad syntax. - if (is_countable($number)) { - $number = count($number); - } - - $replace['count'] = $number; - - return $this->makeReplacements( - $this->getSelector()->choose($line, $number, $locale), $replace - ); - } - - /** - * Get the proper locale for a choice operation. - * - * @param string|null $locale - * @return string - */ - protected function localeForChoice($locale) - { - return $locale ?: $this->locale ?: $this->fallback; - } - - /** - * Retrieve a language line out the loaded array. - * - * @param string $namespace - * @param string $group - * @param string $locale - * @param string $item - * @param array $replace - * @return string|array|null - */ - protected function getLine($namespace, $group, $locale, $item, array $replace) - { - $this->load($namespace, $group, $locale); - - $line = Arr::get($this->loaded[$namespace][$group][$locale], $item); - - if (is_string($line)) { - return $this->makeReplacements($line, $replace); - } elseif (is_array($line) && count($line) > 0) { - array_walk_recursive($line, function (&$value, $key) use ($replace) { - $value = $this->makeReplacements($value, $replace); - }); - - return $line; - } - } - - /** - * Make the place-holder replacements on a line. - * - * @param string $line - * @param array $replace - * @return string - */ - protected function makeReplacements($line, array $replace) - { - if (empty($replace)) { - return $line; - } - - $shouldReplace = []; - - foreach ($replace as $key => $value) { - if (is_object($value) && isset($this->stringableHandlers[get_class($value)])) { - $value = call_user_func($this->stringableHandlers[get_class($value)], $value); - } - - $shouldReplace[':'.Str::ucfirst($key ?? '')] = Str::ucfirst($value ?? ''); - $shouldReplace[':'.Str::upper($key ?? '')] = Str::upper($value ?? ''); - $shouldReplace[':'.$key] = $value; - } - - return strtr($line, $shouldReplace); - } - - /** - * Add translation lines to the given locale. - * - * @param array $lines - * @param string $locale - * @param string $namespace - * @return void - */ - public function addLines(array $lines, $locale, $namespace = '*') - { - foreach ($lines as $key => $value) { - [$group, $item] = explode('.', $key, 2); - - Arr::set($this->loaded, "$namespace.$group.$locale.$item", $value); - } - } - - /** - * Load the specified language group. - * - * @param string $namespace - * @param string $group - * @param string $locale - * @return void - */ - public function load($namespace, $group, $locale) - { - if ($this->isLoaded($namespace, $group, $locale)) { - return; - } - - // The loader is responsible for returning the array of language lines for the - // given namespace, group, and locale. We'll set the lines in this array of - // lines that have already been loaded so that we can easily access them. - $lines = $this->loader->load($locale, $group, $namespace); - - $this->loaded[$namespace][$group][$locale] = $lines; - } - - /** - * Determine if the given group has been loaded. - * - * @param string $namespace - * @param string $group - * @param string $locale - * @return bool - */ - protected function isLoaded($namespace, $group, $locale) - { - return isset($this->loaded[$namespace][$group][$locale]); - } - - /** - * Add a new namespace to the loader. - * - * @param string $namespace - * @param string $hint - * @return void - */ - public function addNamespace($namespace, $hint) - { - $this->loader->addNamespace($namespace, $hint); - } - - /** - * Add a new JSON path to the loader. - * - * @param string $path - * @return void - */ - public function addJsonPath($path) - { - $this->loader->addJsonPath($path); - } - - /** - * Parse a key into namespace, group, and item. - * - * @param string $key - * @return array - */ - public function parseKey($key) - { - $segments = parent::parseKey($key); - - if (is_null($segments[0])) { - $segments[0] = '*'; - } - - return $segments; - } - - /** - * Get the array of locales to be checked. - * - * @param string|null $locale - * @return array - */ - protected function localeArray($locale) - { - $locales = array_filter([$locale ?: $this->locale, $this->fallback]); - - return call_user_func($this->determineLocalesUsing ?: fn () => $locales, $locales); - } - - /** - * Specify a callback that should be invoked to determined the applicable locale array. - * - * @param callable $callback - * @return void - */ - public function determineLocalesUsing($callback) - { - $this->determineLocalesUsing = $callback; - } - - /** - * Get the message selector instance. - * - * @return \Illuminate\Translation\MessageSelector - */ - public function getSelector() - { - if (! isset($this->selector)) { - $this->selector = new MessageSelector; - } - - return $this->selector; - } - - /** - * Set the message selector instance. - * - * @param \Illuminate\Translation\MessageSelector $selector - * @return void - */ - public function setSelector(MessageSelector $selector) - { - $this->selector = $selector; - } - - /** - * Get the language line loader implementation. - * - * @return \Illuminate\Contracts\Translation\Loader - */ - public function getLoader() - { - return $this->loader; - } - - /** - * Get the default locale being used. - * - * @return string - */ - public function locale() - { - return $this->getLocale(); - } - - /** - * Get the default locale being used. - * - * @return string - */ - public function getLocale() - { - return $this->locale; - } - - /** - * Set the default locale. - * - * @param string $locale - * @return void - * - * @throws \InvalidArgumentException - */ - public function setLocale($locale) - { - if (Str::contains($locale, ['/', '\\'])) { - throw new InvalidArgumentException('Invalid characters present in locale.'); - } - - $this->locale = $locale; - } - - /** - * Get the fallback locale being used. - * - * @return string - */ - public function getFallback() - { - return $this->fallback; - } - - /** - * Set the fallback locale being used. - * - * @param string $fallback - * @return void - */ - public function setFallback($fallback) - { - $this->fallback = $fallback; - } - - /** - * Set the loaded translation groups. - * - * @param array $loaded - * @return void - */ - public function setLoaded(array $loaded) - { - $this->loaded = $loaded; - } - - /** - * Add a handler to be executed in order to format a given class to a string during translation replacements. - * - * @param callable|string $class - * @param callable|null $handler - * @return void - */ - public function stringable($class, $handler = null) - { - if ($class instanceof Closure) { - [$class, $handler] = [ - $this->firstClosureParameterType($class), - $class, - ]; - } - - $this->stringableHandlers[$class] = $handler; - } -} diff --git a/framework-9.50.2/src/Illuminate/Translation/composer.json b/framework-9.50.2/src/Illuminate/Translation/composer.json deleted file mode 100755 index fc6bd26..0000000 --- a/framework-9.50.2/src/Illuminate/Translation/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "illuminate/translation", - "description": "The Illuminate Translation package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "illuminate/collections": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/filesystem": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Translation\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/Validation/ClosureValidationRule.php b/framework-9.50.2/src/Illuminate/Validation/ClosureValidationRule.php deleted file mode 100644 index 8f247fc..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/ClosureValidationRule.php +++ /dev/null @@ -1,70 +0,0 @@ -callback = $callback; - } - - /** - * Determine if the validation rule passes. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function passes($attribute, $value) - { - $this->failed = false; - - $this->callback->__invoke($attribute, $value, function ($message) { - $this->failed = true; - - $this->message = $message; - }); - - return ! $this->failed; - } - - /** - * Get the validation error message. - * - * @return string - */ - public function message() - { - return $this->message; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Concerns/FilterEmailValidation.php b/framework-9.50.2/src/Illuminate/Validation/Concerns/FilterEmailValidation.php deleted file mode 100644 index 84ed212..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Concerns/FilterEmailValidation.php +++ /dev/null @@ -1,72 +0,0 @@ -flags = $flags; - } - - /** - * Create a new instance which allows any unicode characters in local-part. - * - * @return static - */ - public static function unicode() - { - return new static(FILTER_FLAG_EMAIL_UNICODE); - } - - /** - * Returns true if the given email is valid. - * - * @param string $email - * @param \Egulias\EmailValidator\EmailLexer $emailLexer - * @return bool - */ - public function isValid(string $email, EmailLexer $emailLexer): bool - { - return is_null($this->flags) - ? filter_var($email, FILTER_VALIDATE_EMAIL) !== false - : filter_var($email, FILTER_VALIDATE_EMAIL, $this->flags) !== false; - } - - /** - * Returns the validation error. - * - * @return \Egulias\EmailValidator\Result\InvalidEmail|null - */ - public function getError(): ?InvalidEmail - { - return null; - } - - /** - * Returns the validation warnings. - * - * @return \Egulias\EmailValidator\Warning\Warning[] - */ - public function getWarnings(): array - { - return []; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Concerns/FormatsMessages.php b/framework-9.50.2/src/Illuminate/Validation/Concerns/FormatsMessages.php deleted file mode 100644 index 17d0a46..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Concerns/FormatsMessages.php +++ /dev/null @@ -1,520 +0,0 @@ -replacePlaceholderInString($attribute); - - $inlineMessage = $this->getInlineMessage($attribute, $rule); - - // First we will retrieve the custom message for the validation rule if one - // exists. If a custom validation message is being used we'll return the - // custom message, otherwise we'll keep searching for a valid message. - if (! is_null($inlineMessage)) { - return $inlineMessage; - } - - $lowerRule = Str::snake($rule); - - $customKey = "validation.custom.{$attribute}.{$lowerRule}"; - - $customMessage = $this->getCustomMessageFromTranslator( - in_array($rule, $this->sizeRules) - ? [$customKey.".{$this->getAttributeType($attribute)}", $customKey] - : $customKey - ); - - // First we check for a custom defined validation message for the attribute - // and rule. This allows the developer to specify specific messages for - // only some attributes and rules that need to get specially formed. - if ($customMessage !== $customKey) { - return $customMessage; - } - - // If the rule being validated is a "size" rule, we will need to gather the - // specific error message for the type of attribute being validated such - // as a number, file or string which all have different message types. - elseif (in_array($rule, $this->sizeRules)) { - return $this->getSizeMessage($attributeWithPlaceholders, $rule); - } - - // Finally, if no developer specified messages have been set, and no other - // special messages apply for this rule, we will just pull the default - // messages out of the translator service for this validation rule. - $key = "validation.{$lowerRule}"; - - if ($key !== ($value = $this->translator->get($key))) { - return $value; - } - - return $this->getFromLocalArray( - $attribute, $lowerRule, $this->fallbackMessages - ) ?: $key; - } - - /** - * Get the proper inline error message for standard and size rules. - * - * @param string $attribute - * @param string $rule - * @return string|null - */ - protected function getInlineMessage($attribute, $rule) - { - $inlineEntry = $this->getFromLocalArray($attribute, Str::snake($rule)); - - return is_array($inlineEntry) && in_array($rule, $this->sizeRules) - ? $inlineEntry[$this->getAttributeType($attribute)] - : $inlineEntry; - } - - /** - * Get the inline message for a rule if it exists. - * - * @param string $attribute - * @param string $lowerRule - * @param array|null $source - * @return string|null - */ - protected function getFromLocalArray($attribute, $lowerRule, $source = null) - { - $source = $source ?: $this->customMessages; - - $keys = ["{$attribute}.{$lowerRule}", $lowerRule, $attribute]; - - // First we will check for a custom message for an attribute specific rule - // message for the fields, then we will check for a general custom line - // that is not attribute specific. If we find either we'll return it. - foreach ($keys as $key) { - foreach (array_keys($source) as $sourceKey) { - if (str_contains($sourceKey, '*')) { - $pattern = str_replace('\*', '([^.]*)', preg_quote($sourceKey, '#')); - - if (preg_match('#^'.$pattern.'\z#u', $key) === 1) { - $message = $source[$sourceKey]; - - if (is_array($message) && isset($message[$lowerRule])) { - return $message[$lowerRule]; - } - - return $message; - } - - continue; - } - - if (Str::is($sourceKey, $key)) { - $message = $source[$sourceKey]; - - if ($sourceKey === $attribute && is_array($message) && isset($message[$lowerRule])) { - return $message[$lowerRule]; - } - - return $message; - } - } - } - } - - /** - * Get the custom error message from the translator. - * - * @param array|string $keys - * @return string - */ - protected function getCustomMessageFromTranslator($keys) - { - foreach (Arr::wrap($keys) as $key) { - if (($message = $this->translator->get($key)) !== $key) { - return $message; - } - - // If an exact match was not found for the key, we will collapse all of these - // messages and loop through them and try to find a wildcard match for the - // given key. Otherwise, we will simply return the key's value back out. - $shortKey = preg_replace( - '/^validation\.custom\./', '', $key - ); - - $message = $this->getWildcardCustomMessages(Arr::dot( - (array) $this->translator->get('validation.custom') - ), $shortKey, $key); - - if ($message !== $key) { - return $message; - } - } - - return Arr::last(Arr::wrap($keys)); - } - - /** - * Check the given messages for a wildcard key. - * - * @param array $messages - * @param string $search - * @param string $default - * @return string - */ - protected function getWildcardCustomMessages($messages, $search, $default) - { - foreach ($messages as $key => $message) { - if ($search === $key || (Str::contains($key, ['*']) && Str::is($key, $search))) { - return $message; - } - } - - return $default; - } - - /** - * Get the proper error message for an attribute and size rule. - * - * @param string $attribute - * @param string $rule - * @return string - */ - protected function getSizeMessage($attribute, $rule) - { - $lowerRule = Str::snake($rule); - - // There are three different types of size validations. The attribute may be - // either a number, file, or string so we will check a few things to know - // which type of value it is and return the correct line for that type. - $type = $this->getAttributeType($attribute); - - $key = "validation.{$lowerRule}.{$type}"; - - return $this->translator->get($key); - } - - /** - * Get the data type of the given attribute. - * - * @param string $attribute - * @return string - */ - protected function getAttributeType($attribute) - { - // We assume that the attributes present in the file array are files so that - // means that if the attribute does not have a numeric rule and the files - // list doesn't have it we'll just consider it a string by elimination. - if ($this->hasRule($attribute, $this->numericRules)) { - return 'numeric'; - } elseif ($this->hasRule($attribute, ['Array'])) { - return 'array'; - } elseif ($this->getValue($attribute) instanceof UploadedFile) { - return 'file'; - } - - return 'string'; - } - - /** - * Replace all error message place-holders with actual values. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - public function makeReplacements($message, $attribute, $rule, $parameters) - { - $message = $this->replaceAttributePlaceholder( - $message, $this->getDisplayableAttribute($attribute) - ); - - $message = $this->replaceInputPlaceholder($message, $attribute); - $message = $this->replaceIndexPlaceholder($message, $attribute); - $message = $this->replacePositionPlaceholder($message, $attribute); - - if (isset($this->replacers[Str::snake($rule)])) { - return $this->callReplacer($message, $attribute, Str::snake($rule), $parameters, $this); - } elseif (method_exists($this, $replacer = "replace{$rule}")) { - return $this->$replacer($message, $attribute, $rule, $parameters); - } - - return $message; - } - - /** - * Get the displayable name of the attribute. - * - * @param string $attribute - * @return string - */ - public function getDisplayableAttribute($attribute) - { - $primaryAttribute = $this->getPrimaryAttribute($attribute); - - $expectedAttributes = $attribute != $primaryAttribute - ? [$attribute, $primaryAttribute] : [$attribute]; - - foreach ($expectedAttributes as $name) { - // The developer may dynamically specify the array of custom attributes on this - // validator instance. If the attribute exists in this array it is used over - // the other ways of pulling the attribute name for this given attributes. - if (isset($this->customAttributes[$name])) { - return $this->customAttributes[$name]; - } - - // We allow for a developer to specify language lines for any attribute in this - // application, which allows flexibility for displaying a unique displayable - // version of the attribute name instead of the name used in an HTTP POST. - if ($line = $this->getAttributeFromTranslations($name)) { - return $line; - } - } - - // When no language line has been specified for the attribute and it is also - // an implicit attribute we will display the raw attribute's name and not - // modify it with any of these replacements before we display the name. - if (isset($this->implicitAttributes[$primaryAttribute])) { - return ($formatter = $this->implicitAttributesFormatter) - ? $formatter($attribute) - : $attribute; - } - - return str_replace('_', ' ', Str::snake($attribute)); - } - - /** - * Get the given attribute from the attribute translations. - * - * @param string $name - * @return string - */ - protected function getAttributeFromTranslations($name) - { - return Arr::get($this->translator->get('validation.attributes'), $name); - } - - /** - * Replace the :attribute placeholder in the given message. - * - * @param string $message - * @param string $value - * @return string - */ - protected function replaceAttributePlaceholder($message, $value) - { - return str_replace( - [':attribute', ':ATTRIBUTE', ':Attribute'], - [$value, Str::upper($value), Str::ucfirst($value)], - $message - ); - } - - /** - * Replace the :index placeholder in the given message. - * - * @param string $message - * @param string $attribute - * @return string - */ - protected function replaceIndexPlaceholder($message, $attribute) - { - return $this->replaceIndexOrPositionPlaceholder( - $message, $attribute, 'index' - ); - } - - /** - * Replace the :position placeholder in the given message. - * - * @param string $message - * @param string $attribute - * @return string - */ - protected function replacePositionPlaceholder($message, $attribute) - { - return $this->replaceIndexOrPositionPlaceholder( - $message, $attribute, 'position', fn ($segment) => $segment + 1 - ); - } - - /** - * Replace the :index or :position placeholder in the given message. - * - * @param string $message - * @param string $attribute - * @param string $placeholder - * @param \Closure|null $modifier - * @return string - */ - protected function replaceIndexOrPositionPlaceholder($message, $attribute, $placeholder, Closure $modifier = null) - { - $segments = explode('.', $attribute); - - $modifier ??= fn ($value) => $value; - - $numericIndex = 1; - - foreach ($segments as $segment) { - if (is_numeric($segment)) { - if ($numericIndex === 1) { - $message = str_ireplace(':'.$placeholder, $modifier((int) $segment), $message); - } - - $message = str_ireplace( - ':'.$this->numberToIndexOrPositionWord($numericIndex).'-'.$placeholder, - $modifier((int) $segment), - $message - ); - - $numericIndex++; - } - } - - return $message; - } - - /** - * Get the word for a index or position segment. - * - * @param int $value - * @return string - */ - protected function numberToIndexOrPositionWord(int $value) - { - return [ - 1 => 'first', - 2 => 'second', - 3 => 'third', - 4 => 'fourth', - 5 => 'fifth', - 6 => 'sixth', - 7 => 'seventh', - 8 => 'eighth', - 9 => 'ninth', - 10 => 'tenth', - ][(int) $value] ?? 'other'; - } - - /** - * Replace the :input placeholder in the given message. - * - * @param string $message - * @param string $attribute - * @return string - */ - protected function replaceInputPlaceholder($message, $attribute) - { - $actualValue = $this->getValue($attribute); - - if (is_scalar($actualValue) || is_null($actualValue)) { - $message = str_replace(':input', $this->getDisplayableValue($attribute, $actualValue), $message); - } - - return $message; - } - - /** - * Get the displayable name of the value. - * - * @param string $attribute - * @param mixed $value - * @return string - */ - public function getDisplayableValue($attribute, $value) - { - if (isset($this->customValues[$attribute][$value])) { - return $this->customValues[$attribute][$value]; - } - - $key = "validation.values.{$attribute}.{$value}"; - - if (($line = $this->translator->get($key)) !== $key) { - return $line; - } - - if (is_bool($value)) { - return $value ? 'true' : 'false'; - } - - if (is_null($value)) { - return 'empty'; - } - - return (string) $value; - } - - /** - * Transform an array of attributes to their displayable form. - * - * @param array $values - * @return array - */ - protected function getAttributeList(array $values) - { - $attributes = []; - - // For each attribute in the list we will simply get its displayable form as - // this is convenient when replacing lists of parameters like some of the - // replacement functions do when formatting out the validation message. - foreach ($values as $key => $value) { - $attributes[$key] = $this->getDisplayableAttribute($value); - } - - return $attributes; - } - - /** - * Call a custom validator message replacer. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @param \Illuminate\Validation\Validator $validator - * @return string|null - */ - protected function callReplacer($message, $attribute, $rule, $parameters, $validator) - { - $callback = $this->replacers[$rule]; - - if ($callback instanceof Closure) { - return $callback(...func_get_args()); - } elseif (is_string($callback)) { - return $this->callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters, $validator); - } - } - - /** - * Call a class based validator message replacer. - * - * @param string $callback - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @param \Illuminate\Validation\Validator $validator - * @return string - */ - protected function callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters, $validator) - { - [$class, $method] = Str::parseCallback($callback, 'replace'); - - return $this->container->make($class)->{$method}(...array_slice(func_get_args(), 1)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Concerns/ReplacesAttributes.php b/framework-9.50.2/src/Illuminate/Validation/Concerns/ReplacesAttributes.php deleted file mode 100644 index cb37e46..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Concerns/ReplacesAttributes.php +++ /dev/null @@ -1,790 +0,0 @@ - $parameters - * @return string - */ - protected function replaceAcceptedIf($message, $attribute, $rule, $parameters) - { - $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0])); - - $parameters[0] = $this->getDisplayableAttribute($parameters[0]); - - return str_replace([':other', ':value'], $parameters, $message); - } - - /** - * Replace all place-holders for the declined_if rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDeclinedIf($message, $attribute, $rule, $parameters) - { - $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0])); - - $parameters[0] = $this->getDisplayableAttribute($parameters[0]); - - return str_replace([':other', ':value'], $parameters, $message); - } - - /** - * Replace all place-holders for the between rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceBetween($message, $attribute, $rule, $parameters) - { - return str_replace([':min', ':max'], $parameters, $message); - } - - /** - * Replace all place-holders for the date_format rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDateFormat($message, $attribute, $rule, $parameters) - { - return str_replace(':format', $parameters[0], $message); - } - - /** - * Replace all place-holders for the decimal rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDecimal($message, $attribute, $rule, $parameters) - { - return str_replace( - ':decimal', - isset($parameters[1]) - ? $parameters[0].'-'.$parameters[1] - : $parameters[0], - $message - ); - } - - /** - * Replace all place-holders for the different rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDifferent($message, $attribute, $rule, $parameters) - { - return $this->replaceSame($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the digits rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDigits($message, $attribute, $rule, $parameters) - { - return str_replace(':digits', $parameters[0], $message); - } - - /** - * Replace all place-holders for the digits (between) rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDigitsBetween($message, $attribute, $rule, $parameters) - { - return $this->replaceBetween($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the min rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMin($message, $attribute, $rule, $parameters) - { - return str_replace(':min', $parameters[0], $message); - } - - /** - * Replace all place-holders for the min digits rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMinDigits($message, $attribute, $rule, $parameters) - { - return str_replace(':min', $parameters[0], $message); - } - - /** - * Replace all place-holders for the max rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMax($message, $attribute, $rule, $parameters) - { - return str_replace(':max', $parameters[0], $message); - } - - /** - * Replace all place-holders for the max digits rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMaxDigits($message, $attribute, $rule, $parameters) - { - return str_replace(':max', $parameters[0], $message); - } - - /** - * Replace all place-holders for the missing_if rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMissingIf($message, $attribute, $rule, $parameters) - { - $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0])); - - $parameters[0] = $this->getDisplayableAttribute($parameters[0]); - - return str_replace([':other', ':value'], $parameters, $message); - } - - /** - * Replace all place-holders for the missing_unless rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMissingUnless($message, $attribute, $rule, $parameters) - { - return $this->replaceMissingIf($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the missing_with rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMissingWith($message, $attribute, $rule, $parameters) - { - return str_replace(':values', implode(' / ', $this->getAttributeList($parameters)), $message); - } - - /** - * Replace all place-holders for the missing_with_all rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMissingWithAll($message, $attribute, $rule, $parameters) - { - return $this->replaceMissingWith($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the multiple_of rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMultipleOf($message, $attribute, $rule, $parameters) - { - return str_replace(':value', $parameters[0] ?? '', $message); - } - - /** - * Replace all place-holders for the in rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceIn($message, $attribute, $rule, $parameters) - { - foreach ($parameters as &$parameter) { - $parameter = $this->getDisplayableValue($attribute, $parameter); - } - - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the not_in rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceNotIn($message, $attribute, $rule, $parameters) - { - return $this->replaceIn($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the in_array rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceInArray($message, $attribute, $rule, $parameters) - { - return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); - } - - /** - * Replace all place-holders for the required_array_keys rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredArrayKeys($message, $attribute, $rule, $parameters) - { - foreach ($parameters as &$parameter) { - $parameter = $this->getDisplayableValue($attribute, $parameter); - } - - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the mimetypes rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMimetypes($message, $attribute, $rule, $parameters) - { - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the mimes rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceMimes($message, $attribute, $rule, $parameters) - { - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the required_with rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredWith($message, $attribute, $rule, $parameters) - { - return str_replace(':values', implode(' / ', $this->getAttributeList($parameters)), $message); - } - - /** - * Replace all place-holders for the required_with_all rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredWithAll($message, $attribute, $rule, $parameters) - { - return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the required_without rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredWithout($message, $attribute, $rule, $parameters) - { - return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the required_without_all rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters) - { - return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the size rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceSize($message, $attribute, $rule, $parameters) - { - return str_replace(':size', $parameters[0], $message); - } - - /** - * Replace all place-holders for the gt rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceGt($message, $attribute, $rule, $parameters) - { - if (is_null($value = $this->getValue($parameters[0]))) { - return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message); - } - - return str_replace(':value', $this->getSize($attribute, $value), $message); - } - - /** - * Replace all place-holders for the lt rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceLt($message, $attribute, $rule, $parameters) - { - if (is_null($value = $this->getValue($parameters[0]))) { - return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message); - } - - return str_replace(':value', $this->getSize($attribute, $value), $message); - } - - /** - * Replace all place-holders for the gte rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceGte($message, $attribute, $rule, $parameters) - { - if (is_null($value = $this->getValue($parameters[0]))) { - return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message); - } - - return str_replace(':value', $this->getSize($attribute, $value), $message); - } - - /** - * Replace all place-holders for the lte rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceLte($message, $attribute, $rule, $parameters) - { - if (is_null($value = $this->getValue($parameters[0]))) { - return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message); - } - - return str_replace(':value', $this->getSize($attribute, $value), $message); - } - - /** - * Replace all place-holders for the required_if rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredIf($message, $attribute, $rule, $parameters) - { - $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0])); - - $parameters[0] = $this->getDisplayableAttribute($parameters[0]); - - return str_replace([':other', ':value'], $parameters, $message); - } - - /** - * Replace all place-holders for the required_if_accepted rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredIfAccepted($message, $attribute, $rule, $parameters) - { - $parameters[0] = $this->getDisplayableAttribute($parameters[0]); - - return str_replace([':other'], $parameters, $message); - } - - /** - * Replace all place-holders for the required_unless rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceRequiredUnless($message, $attribute, $rule, $parameters) - { - $other = $this->getDisplayableAttribute($parameters[0]); - - $values = []; - - foreach (array_slice($parameters, 1) as $value) { - $values[] = $this->getDisplayableValue($parameters[0], $value); - } - - return str_replace([':other', ':values'], [$other, implode(', ', $values)], $message); - } - - /** - * Replace all place-holders for the prohibited_if rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceProhibitedIf($message, $attribute, $rule, $parameters) - { - $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0])); - - $parameters[0] = $this->getDisplayableAttribute($parameters[0]); - - return str_replace([':other', ':value'], $parameters, $message); - } - - /** - * Replace all place-holders for the prohibited_unless rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceProhibitedUnless($message, $attribute, $rule, $parameters) - { - $other = $this->getDisplayableAttribute($parameters[0]); - - $values = []; - - foreach (array_slice($parameters, 1) as $value) { - $values[] = $this->getDisplayableValue($parameters[0], $value); - } - - return str_replace([':other', ':values'], [$other, implode(', ', $values)], $message); - } - - /** - * Replace all place-holders for the prohibited_with rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceProhibits($message, $attribute, $rule, $parameters) - { - return str_replace(':other', implode(' / ', $this->getAttributeList($parameters)), $message); - } - - /** - * Replace all place-holders for the same rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceSame($message, $attribute, $rule, $parameters) - { - return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); - } - - /** - * Replace all place-holders for the before rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceBefore($message, $attribute, $rule, $parameters) - { - if (! strtotime($parameters[0])) { - return str_replace(':date', $this->getDisplayableAttribute($parameters[0]), $message); - } - - return str_replace(':date', $this->getDisplayableValue($attribute, $parameters[0]), $message); - } - - /** - * Replace all place-holders for the before_or_equal rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceBeforeOrEqual($message, $attribute, $rule, $parameters) - { - return $this->replaceBefore($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the after rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceAfter($message, $attribute, $rule, $parameters) - { - return $this->replaceBefore($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the after_or_equal rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceAfterOrEqual($message, $attribute, $rule, $parameters) - { - return $this->replaceBefore($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the date_equals rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDateEquals($message, $attribute, $rule, $parameters) - { - return $this->replaceBefore($message, $attribute, $rule, $parameters); - } - - /** - * Replace all place-holders for the dimensions rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDimensions($message, $attribute, $rule, $parameters) - { - $parameters = $this->parseNamedParameters($parameters); - - if (is_array($parameters)) { - foreach ($parameters as $key => $value) { - $message = str_replace(':'.$key, $value, $message); - } - } - - return $message; - } - - /** - * Replace all place-holders for the ends_with rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceEndsWith($message, $attribute, $rule, $parameters) - { - foreach ($parameters as &$parameter) { - $parameter = $this->getDisplayableValue($attribute, $parameter); - } - - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the doesnt_end_with rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDoesntEndWith($message, $attribute, $rule, $parameters) - { - foreach ($parameters as &$parameter) { - $parameter = $this->getDisplayableValue($attribute, $parameter); - } - - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the starts_with rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceStartsWith($message, $attribute, $rule, $parameters) - { - foreach ($parameters as &$parameter) { - $parameter = $this->getDisplayableValue($attribute, $parameter); - } - - return str_replace(':values', implode(', ', $parameters), $message); - } - - /** - * Replace all place-holders for the doesnt_start_with rule. - * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return string - */ - protected function replaceDoesntStartWith($message, $attribute, $rule, $parameters) - { - foreach ($parameters as &$parameter) { - $parameter = $this->getDisplayableValue($attribute, $parameter); - } - - return str_replace(':values', implode(', ', $parameters), $message); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/framework-9.50.2/src/Illuminate/Validation/Concerns/ValidatesAttributes.php deleted file mode 100644 index aebd8f1..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ /dev/null @@ -1,2478 +0,0 @@ -validateRequired($attribute, $value) && in_array($value, $acceptable, true); - } - - /** - * Validate that an attribute was "accepted" when another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateAcceptedIf($attribute, $value, $parameters) - { - $acceptable = ['yes', 'on', '1', 1, true, 'true']; - - $this->requireParameterCount(2, $parameters, 'accepted_if'); - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - if (in_array($other, $values, is_bool($other) || is_null($other))) { - return $this->validateRequired($attribute, $value) && in_array($value, $acceptable, true); - } - - return true; - } - - /** - * Validate that an attribute was "declined". - * - * This validation rule implies the attribute is "required". - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateDeclined($attribute, $value) - { - $acceptable = ['no', 'off', '0', 0, false, 'false']; - - return $this->validateRequired($attribute, $value) && in_array($value, $acceptable, true); - } - - /** - * Validate that an attribute was "declined" when another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateDeclinedIf($attribute, $value, $parameters) - { - $acceptable = ['no', 'off', '0', 0, false, 'false']; - - $this->requireParameterCount(2, $parameters, 'declined_if'); - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - if (in_array($other, $values, is_bool($other) || is_null($other))) { - return $this->validateRequired($attribute, $value) && in_array($value, $acceptable, true); - } - - return true; - } - - /** - * Validate that an attribute is an active URL. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateActiveUrl($attribute, $value) - { - if (! is_string($value)) { - return false; - } - - if ($url = parse_url($value, PHP_URL_HOST)) { - try { - $records = $this->getDnsRecords($url.'.', DNS_A | DNS_AAAA); - - if (is_array($records) && count($records) > 0) { - return true; - } - } catch (Exception $e) { - return false; - } - } - - return false; - } - - /** - * Get the DNS records for the given hostname. - * - * @param string $hostname - * @param int $type - * @return array|false - */ - protected function getDnsRecords($hostname, $type) - { - return dns_get_record($hostname, $type); - } - - /** - * Validate that an attribute is 7 bit ASCII. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateAscii($attribute, $value) - { - return Str::isAscii($value); - } - - /** - * "Break" on first validation fail. - * - * Always returns true, just lets us put "bail" in rules. - * - * @return bool - */ - public function validateBail() - { - return true; - } - - /** - * Validate the date is before a given date. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateBefore($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'before'); - - return $this->compareDates($attribute, $value, $parameters, '<'); - } - - /** - * Validate the date is before or equal a given date. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateBeforeOrEqual($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'before_or_equal'); - - return $this->compareDates($attribute, $value, $parameters, '<='); - } - - /** - * Validate the date is after a given date. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateAfter($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'after'); - - return $this->compareDates($attribute, $value, $parameters, '>'); - } - - /** - * Validate the date is equal or after a given date. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateAfterOrEqual($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'after_or_equal'); - - return $this->compareDates($attribute, $value, $parameters, '>='); - } - - /** - * Compare a given date against another using an operator. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @param string $operator - * @return bool - */ - protected function compareDates($attribute, $value, $parameters, $operator) - { - if (! is_string($value) && ! is_numeric($value) && ! $value instanceof DateTimeInterface) { - return false; - } - - if ($format = $this->getDateFormat($attribute)) { - return $this->checkDateTimeOrder($format, $value, $parameters[0], $operator); - } - - if (! $date = $this->getDateTimestamp($parameters[0])) { - $date = $this->getDateTimestamp($this->getValue($parameters[0])); - } - - return $this->compare($this->getDateTimestamp($value), $date, $operator); - } - - /** - * Get the date format for an attribute if it has one. - * - * @param string $attribute - * @return string|null - */ - protected function getDateFormat($attribute) - { - if ($result = $this->getRule($attribute, 'DateFormat')) { - return $result[1][0]; - } - } - - /** - * Get the date timestamp. - * - * @param mixed $value - * @return int - */ - protected function getDateTimestamp($value) - { - $date = is_null($value) ? null : $this->getDateTime($value); - - return $date ? $date->getTimestamp() : null; - } - - /** - * Given two date/time strings, check that one is after the other. - * - * @param string $format - * @param string $first - * @param string $second - * @param string $operator - * @return bool - */ - protected function checkDateTimeOrder($format, $first, $second, $operator) - { - $firstDate = $this->getDateTimeWithOptionalFormat($format, $first); - - if (! $secondDate = $this->getDateTimeWithOptionalFormat($format, $second)) { - if (is_null($second = $this->getValue($second))) { - return true; - } - - $secondDate = $this->getDateTimeWithOptionalFormat($format, $second); - } - - return ($firstDate && $secondDate) && $this->compare($firstDate, $secondDate, $operator); - } - - /** - * Get a DateTime instance from a string. - * - * @param string $format - * @param string $value - * @return \DateTime|null - */ - protected function getDateTimeWithOptionalFormat($format, $value) - { - if ($date = DateTime::createFromFormat('!'.$format, $value)) { - return $date; - } - - return $this->getDateTime($value); - } - - /** - * Get a DateTime instance from a string with no format. - * - * @param string $value - * @return \DateTime|null - */ - protected function getDateTime($value) - { - try { - return @Date::parse($value) ?: null; - } catch (Exception $e) { - // - } - } - - /** - * Validate that an attribute contains only alphabetic characters. - * If the 'ascii' option is passed, validate that an attribute contains only ascii alphabetic characters. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateAlpha($attribute, $value, $parameters) - { - if (isset($parameters[0]) && $parameters[0] === 'ascii') { - return is_string($value) && preg_match('/\A[a-zA-Z]+\z/u', $value); - } - - return is_string($value) && preg_match('/\A[\pL\pM]+\z/u', $value); - } - - /** - * Validate that an attribute contains only alpha-numeric characters, dashes, and underscores. - * If the 'ascii' option is passed, validate that an attribute contains only ascii alpha-numeric characters, - * dashes, and underscores. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateAlphaDash($attribute, $value, $parameters) - { - if (! is_string($value) && ! is_numeric($value)) { - return false; - } - - if (isset($parameters[0]) && $parameters[0] === 'ascii') { - return preg_match('/\A[a-zA-Z0-9_-]+\z/u', $value) > 0; - } - - return preg_match('/\A[\pL\pM\pN_-]+\z/u', $value) > 0; - } - - /** - * Validate that an attribute contains only alpha-numeric characters. - * If the 'ascii' option is passed, validate that an attribute contains only ascii alpha-numeric characters. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateAlphaNum($attribute, $value, $parameters) - { - if (! is_string($value) && ! is_numeric($value)) { - return false; - } - - if (isset($parameters[0]) && $parameters[0] === 'ascii') { - return preg_match('/\A[a-zA-Z0-9]+\z/u', $value) > 0; - } - - return preg_match('/\A[\pL\pM\pN]+\z/u', $value) > 0; - } - - /** - * Validate that an attribute is an array. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateArray($attribute, $value, $parameters = []) - { - if (! is_array($value)) { - return false; - } - - if (empty($parameters)) { - return true; - } - - return empty(array_diff_key($value, array_fill_keys($parameters, ''))); - } - - /** - * Validate that an array has all of the given keys. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateRequiredArrayKeys($attribute, $value, $parameters) - { - if (! is_array($value)) { - return false; - } - - foreach ($parameters as $param) { - if (! Arr::exists($value, $param)) { - return false; - } - } - - return true; - } - - /** - * Validate the size of an attribute is between a set of values. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateBetween($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'between'); - - return with( - BigNumber::of($this->getSize($attribute, $value)), - fn ($size) => $size->isGreaterThanOrEqualTo($this->trim($parameters[0])) && $size->isLessThanOrEqualTo($this->trim($parameters[1])) - ); - } - - /** - * Validate that an attribute is a boolean. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateBoolean($attribute, $value) - { - $acceptable = [true, false, 0, 1, '0', '1']; - - return in_array($value, $acceptable, true); - } - - /** - * Validate that an attribute has a matching confirmation. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateConfirmed($attribute, $value) - { - return $this->validateSame($attribute, $value, [$attribute.'_confirmation']); - } - - /** - * Validate that the password of the currently authenticated user matches the given value. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function validateCurrentPassword($attribute, $value, $parameters) - { - $auth = $this->container->make('auth'); - $hasher = $this->container->make('hash'); - - $guard = $auth->guard(Arr::first($parameters)); - - if ($guard->guest()) { - return false; - } - - return $hasher->check($value, $guard->user()->getAuthPassword()); - } - - /** - * Validate that an attribute is a valid date. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateDate($attribute, $value) - { - if ($value instanceof DateTimeInterface) { - return true; - } - - try { - if ((! is_string($value) && ! is_numeric($value)) || strtotime($value) === false) { - return false; - } - } catch (Exception $e) { - return false; - } - - $date = date_parse($value); - - return checkdate($date['month'], $date['day'], $date['year']); - } - - /** - * Validate that an attribute matches a date format. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDateFormat($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'date_format'); - - if (! is_string($value) && ! is_numeric($value)) { - return false; - } - - foreach ($parameters as $format) { - $date = DateTime::createFromFormat('!'.$format, $value); - - if ($date && $date->format($format) == $value) { - return true; - } - } - - return false; - } - - /** - * Validate that an attribute is equal to another date. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDateEquals($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'date_equals'); - - return $this->compareDates($attribute, $value, $parameters, '='); - } - - /** - * Validate that an attribute has a given number of decimal places. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDecimal($attribute, $value, $parameters) - { - if (! $this->validateNumeric($attribute, $value)) { - return false; - } - - $this->requireParameterCount(1, $parameters, 'decimal'); - - $matches = []; - - preg_match('/^[+-]?\d*.(\d*)$/', $value, $matches); - - $decimals = strlen(end($matches)); - - if (! isset($parameters[1])) { - return $decimals == $parameters[0]; - } - - return $decimals >= $parameters[0] && - $decimals <= $parameters[1]; - } - - /** - * Validate that an attribute is different from another attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDifferent($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'different'); - - foreach ($parameters as $parameter) { - if (Arr::has($this->data, $parameter)) { - $other = Arr::get($this->data, $parameter); - - if ($value === $other) { - return false; - } - } - } - - return true; - } - - /** - * Validate that an attribute has a given number of digits. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDigits($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'digits'); - - return ! preg_match('/[^0-9]/', $value) - && strlen((string) $value) == $parameters[0]; - } - - /** - * Validate that an attribute is between a given number of digits. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDigitsBetween($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'digits_between'); - - $length = strlen((string) $value); - - return ! preg_match('/[^0-9]/', $value) - && $length >= $parameters[0] && $length <= $parameters[1]; - } - - /** - * Validate the dimensions of an image matches the given values. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDimensions($attribute, $value, $parameters) - { - if ($this->isValidFileInstance($value) && in_array($value->getMimeType(), ['image/svg+xml', 'image/svg'])) { - return true; - } - - if (! $this->isValidFileInstance($value) || ! $sizeDetails = @getimagesize($value->getRealPath())) { - return false; - } - - $this->requireParameterCount(1, $parameters, 'dimensions'); - - [$width, $height] = $sizeDetails; - - $parameters = $this->parseNamedParameters($parameters); - - if ($this->failsBasicDimensionChecks($parameters, $width, $height) || - $this->failsRatioCheck($parameters, $width, $height)) { - return false; - } - - return true; - } - - /** - * Test if the given width and height fail any conditions. - * - * @param array $parameters - * @param int $width - * @param int $height - * @return bool - */ - protected function failsBasicDimensionChecks($parameters, $width, $height) - { - return (isset($parameters['width']) && $parameters['width'] != $width) || - (isset($parameters['min_width']) && $parameters['min_width'] > $width) || - (isset($parameters['max_width']) && $parameters['max_width'] < $width) || - (isset($parameters['height']) && $parameters['height'] != $height) || - (isset($parameters['min_height']) && $parameters['min_height'] > $height) || - (isset($parameters['max_height']) && $parameters['max_height'] < $height); - } - - /** - * Determine if the given parameters fail a dimension ratio check. - * - * @param array $parameters - * @param int $width - * @param int $height - * @return bool - */ - protected function failsRatioCheck($parameters, $width, $height) - { - if (! isset($parameters['ratio'])) { - return false; - } - - [$numerator, $denominator] = array_replace( - [1, 1], array_filter(sscanf($parameters['ratio'], '%f/%d')) - ); - - $precision = 1 / (max($width, $height) + 1); - - return abs($numerator / $denominator - $width / $height) > $precision; - } - - /** - * Validate an attribute is unique among other values. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDistinct($attribute, $value, $parameters) - { - $data = Arr::except($this->getDistinctValues($attribute), $attribute); - - if (in_array('ignore_case', $parameters)) { - return empty(preg_grep('/^'.preg_quote($value, '/').'$/iu', $data)); - } - - return ! in_array($value, array_values($data), in_array('strict', $parameters)); - } - - /** - * Get the values to distinct between. - * - * @param string $attribute - * @return array - */ - protected function getDistinctValues($attribute) - { - $attributeName = $this->getPrimaryAttribute($attribute); - - if (! property_exists($this, 'distinctValues')) { - return $this->extractDistinctValues($attributeName); - } - - if (! array_key_exists($attributeName, $this->distinctValues)) { - $this->distinctValues[$attributeName] = $this->extractDistinctValues($attributeName); - } - - return $this->distinctValues[$attributeName]; - } - - /** - * Extract the distinct values from the data. - * - * @param string $attribute - * @return array - */ - protected function extractDistinctValues($attribute) - { - $attributeData = ValidationData::extractDataFromPath( - ValidationData::getLeadingExplicitAttributePath($attribute), $this->data - ); - - $pattern = str_replace('\*', '[^.]+', preg_quote($attribute, '#')); - - return Arr::where(Arr::dot($attributeData), function ($value, $key) use ($pattern) { - return (bool) preg_match('#^'.$pattern.'\z#u', $key); - }); - } - - /** - * Validate that an attribute is a valid e-mail address. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateEmail($attribute, $value, $parameters) - { - if (! is_string($value) && ! (is_object($value) && method_exists($value, '__toString'))) { - return false; - } - - $validations = collect($parameters) - ->unique() - ->map(fn ($validation) => match (true) { - $validation === 'strict' => new NoRFCWarningsValidation(), - $validation === 'dns' => new DNSCheckValidation(), - $validation === 'spoof' => new SpoofCheckValidation(), - $validation === 'filter' => new FilterEmailValidation(), - $validation === 'filter_unicode' => FilterEmailValidation::unicode(), - is_string($validation) && class_exists($validation) => $this->container->make($validation), - default => new RFCValidation(), - }) - ->values() - ->all() ?: [new RFCValidation]; - - return (new EmailValidator)->isValid($value, new MultipleValidationWithAnd($validations)); - } - - /** - * Validate the existence of an attribute value in a database table. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateExists($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'exists'); - - [$connection, $table] = $this->parseTable($parameters[0]); - - // The second parameter position holds the name of the column that should be - // verified as existing. If this parameter is not specified we will guess - // that the columns being "verified" shares the given attribute's name. - $column = $this->getQueryColumn($parameters, $attribute); - - $expected = is_array($value) ? count(array_unique($value)) : 1; - - return $this->getExistCount( - $connection, $table, $column, $value, $parameters - ) >= $expected; - } - - /** - * Get the number of records that exist in storage. - * - * @param mixed $connection - * @param string $table - * @param string $column - * @param mixed $value - * @param array $parameters - * @return int - */ - protected function getExistCount($connection, $table, $column, $value, $parameters) - { - $verifier = $this->getPresenceVerifier($connection); - - $extra = $this->getExtraConditions( - array_values(array_slice($parameters, 2)) - ); - - if ($this->currentRule instanceof Exists) { - $extra = array_merge($extra, $this->currentRule->queryCallbacks()); - } - - return is_array($value) - ? $verifier->getMultiCount($table, $column, $value, $extra) - : $verifier->getCount($table, $column, $value, null, null, $extra); - } - - /** - * Validate the uniqueness of an attribute value on a given database table. - * - * If a database column is not specified, the attribute will be used. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateUnique($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'unique'); - - [$connection, $table, $idColumn] = $this->parseTable($parameters[0]); - - // The second parameter position holds the name of the column that needs to - // be verified as unique. If this parameter isn't specified we will just - // assume that this column to be verified shares the attribute's name. - $column = $this->getQueryColumn($parameters, $attribute); - - $id = null; - - if (isset($parameters[2])) { - [$idColumn, $id] = $this->getUniqueIds($idColumn, $parameters); - - if (! is_null($id)) { - $id = stripslashes($id); - } - } - - // The presence verifier is responsible for counting rows within this store - // mechanism which might be a relational database or any other permanent - // data store like Redis, etc. We will use it to determine uniqueness. - $verifier = $this->getPresenceVerifier($connection); - - $extra = $this->getUniqueExtra($parameters); - - if ($this->currentRule instanceof Unique) { - $extra = array_merge($extra, $this->currentRule->queryCallbacks()); - } - - return $verifier->getCount( - $table, $column, $value, $id, $idColumn, $extra - ) == 0; - } - - /** - * Get the excluded ID column and value for the unique rule. - * - * @param string|null $idColumn - * @param array $parameters - * @return array - */ - protected function getUniqueIds($idColumn, $parameters) - { - $idColumn ??= $parameters[3] ?? 'id'; - - return [$idColumn, $this->prepareUniqueId($parameters[2])]; - } - - /** - * Prepare the given ID for querying. - * - * @param mixed $id - * @return int - */ - protected function prepareUniqueId($id) - { - if (preg_match('/\[(.*)\]/', $id, $matches)) { - $id = $this->getValue($matches[1]); - } - - if (strtolower($id) === 'null') { - $id = null; - } - - if (filter_var($id, FILTER_VALIDATE_INT) !== false) { - $id = (int) $id; - } - - return $id; - } - - /** - * Get the extra conditions for a unique rule. - * - * @param array $parameters - * @return array - */ - protected function getUniqueExtra($parameters) - { - if (isset($parameters[4])) { - return $this->getExtraConditions(array_slice($parameters, 4)); - } - - return []; - } - - /** - * Parse the connection / table for the unique / exists rules. - * - * @param string $table - * @return array - */ - public function parseTable($table) - { - [$connection, $table] = str_contains($table, '.') ? explode('.', $table, 2) : [null, $table]; - - if (str_contains($table, '\\') && class_exists($table) && is_a($table, Model::class, true)) { - $model = new $table; - - $table = $model->getTable(); - $connection ??= $model->getConnectionName(); - - if (str_contains($table, '.') && Str::startsWith($table, $connection)) { - $connection = null; - } - - $idColumn = $model->getKeyName(); - } - - return [$connection, $table, $idColumn ?? null]; - } - - /** - * Get the column name for an exists / unique query. - * - * @param array $parameters - * @param string $attribute - * @return bool - */ - public function getQueryColumn($parameters, $attribute) - { - return isset($parameters[1]) && $parameters[1] !== 'NULL' - ? $parameters[1] : $this->guessColumnForQuery($attribute); - } - - /** - * Guess the database column from the given attribute name. - * - * @param string $attribute - * @return string - */ - public function guessColumnForQuery($attribute) - { - if (in_array($attribute, Arr::collapse($this->implicitAttributes)) - && ! is_numeric($last = last(explode('.', $attribute)))) { - return $last; - } - - return $attribute; - } - - /** - * Get the extra conditions for a unique / exists rule. - * - * @param array $segments - * @return array - */ - protected function getExtraConditions(array $segments) - { - $extra = []; - - $count = count($segments); - - for ($i = 0; $i < $count; $i += 2) { - $extra[$segments[$i]] = $segments[$i + 1]; - } - - return $extra; - } - - /** - * Validate the given value is a valid file. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateFile($attribute, $value) - { - return $this->isValidFileInstance($value); - } - - /** - * Validate the given attribute is filled if it is present. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateFilled($attribute, $value) - { - if (Arr::has($this->data, $attribute)) { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute is greater than another attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateGt($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'gt'); - - $comparedToValue = $this->getValue($parameters[0]); - - $this->shouldBeNumeric($attribute, 'Gt'); - - if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { - return BigNumber::of($this->getSize($attribute, $value))->isGreaterThan($this->trim($parameters[0])); - } - - if (is_numeric($parameters[0])) { - return false; - } - - if ($this->hasRule($attribute, $this->numericRules) && is_numeric($value) && is_numeric($comparedToValue)) { - return BigNumber::of($this->trim($value))->isGreaterThan($this->trim($comparedToValue)); - } - - if (! $this->isSameType($value, $comparedToValue)) { - return false; - } - - return $this->getSize($attribute, $value) > $this->getSize($attribute, $comparedToValue); - } - - /** - * Validate that an attribute is less than another attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateLt($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'lt'); - - $comparedToValue = $this->getValue($parameters[0]); - - $this->shouldBeNumeric($attribute, 'Lt'); - - if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { - return BigNumber::of($this->getSize($attribute, $value))->isLessThan($this->trim($parameters[0])); - } - - if (is_numeric($parameters[0])) { - return false; - } - - if ($this->hasRule($attribute, $this->numericRules) && is_numeric($value) && is_numeric($comparedToValue)) { - return BigNumber::of($this->trim($value))->isLessThan($this->trim($comparedToValue)); - } - - if (! $this->isSameType($value, $comparedToValue)) { - return false; - } - - return $this->getSize($attribute, $value) < $this->getSize($attribute, $comparedToValue); - } - - /** - * Validate that an attribute is greater than or equal another attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateGte($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'gte'); - - $comparedToValue = $this->getValue($parameters[0]); - - $this->shouldBeNumeric($attribute, 'Gte'); - - if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { - return BigNumber::of($this->getSize($attribute, $value))->isGreaterThanOrEqualTo($this->trim($parameters[0])); - } - - if (is_numeric($parameters[0])) { - return false; - } - - if ($this->hasRule($attribute, $this->numericRules) && is_numeric($value) && is_numeric($comparedToValue)) { - return BigNumber::of($this->trim($value))->isGreaterThanOrEqualTo($this->trim($comparedToValue)); - } - - if (! $this->isSameType($value, $comparedToValue)) { - return false; - } - - return $this->getSize($attribute, $value) >= $this->getSize($attribute, $comparedToValue); - } - - /** - * Validate that an attribute is less than or equal another attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateLte($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'lte'); - - $comparedToValue = $this->getValue($parameters[0]); - - $this->shouldBeNumeric($attribute, 'Lte'); - - if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { - return BigNumber::of($this->getSize($attribute, $value))->isLessThanOrEqualTo($this->trim($parameters[0])); - } - - if (is_numeric($parameters[0])) { - return false; - } - - if ($this->hasRule($attribute, $this->numericRules) && is_numeric($value) && is_numeric($comparedToValue)) { - return BigNumber::of($this->trim($value))->isLessThanOrEqualTo($this->trim($comparedToValue)); - } - - if (! $this->isSameType($value, $comparedToValue)) { - return false; - } - - return $this->getSize($attribute, $value) <= $this->getSize($attribute, $comparedToValue); - } - - /** - * Validate that an attribute is lowercase. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateLowercase($attribute, $value, $parameters) - { - return Str::lower($value) === $value; - } - - /** - * Validate that an attribute is uppercase. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateUppercase($attribute, $value, $parameters) - { - return Str::upper($value) === $value; - } - - /** - * Validate the MIME type of a file is an image MIME type. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateImage($attribute, $value) - { - return $this->validateMimes($attribute, $value, ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp']); - } - - /** - * Validate an attribute is contained within a list of values. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateIn($attribute, $value, $parameters) - { - if (is_array($value) && $this->hasRule($attribute, 'Array')) { - foreach ($value as $element) { - if (is_array($element)) { - return false; - } - } - - return count(array_diff($value, $parameters)) === 0; - } - - return ! is_array($value) && in_array((string) $value, $parameters); - } - - /** - * Validate that the values of an attribute are in another attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateInArray($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'in_array'); - - $explicitPath = ValidationData::getLeadingExplicitAttributePath($parameters[0]); - - $attributeData = ValidationData::extractDataFromPath($explicitPath, $this->data); - - $otherValues = Arr::where(Arr::dot($attributeData), function ($value, $key) use ($parameters) { - return Str::is($parameters[0], $key); - }); - - return in_array($value, $otherValues); - } - - /** - * Validate that an attribute is an integer. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateInteger($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_INT) !== false; - } - - /** - * Validate that an attribute is a valid IP. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateIp($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_IP) !== false; - } - - /** - * Validate that an attribute is a valid IPv4. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateIpv4($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; - } - - /** - * Validate that an attribute is a valid IPv6. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateIpv6($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; - } - - /** - * Validate that an attribute is a valid MAC address. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateMacAddress($attribute, $value) - { - return filter_var($value, FILTER_VALIDATE_MAC) !== false; - } - - /** - * Validate the attribute is a valid JSON string. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateJson($attribute, $value) - { - if (is_array($value)) { - return false; - } - - if (! is_scalar($value) && ! is_null($value) && ! method_exists($value, '__toString')) { - return false; - } - - json_decode($value); - - return json_last_error() === JSON_ERROR_NONE; - } - - /** - * Validate the size of an attribute is less than a maximum value. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMax($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'max'); - - if ($value instanceof UploadedFile && ! $value->isValid()) { - return false; - } - - return BigNumber::of($this->getSize($attribute, $value))->isLessThanOrEqualTo($this->trim($parameters[0])); - } - - /** - * Validate that an attribute has a maximum number of digits. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMaxDigits($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'max'); - - $length = strlen((string) $value); - - return ! preg_match('/[^0-9]/', $value) && $length <= $parameters[0]; - } - - /** - * Validate the guessed extension of a file upload is in a set of file extensions. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMimes($attribute, $value, $parameters) - { - if (! $this->isValidFileInstance($value)) { - return false; - } - - if ($this->shouldBlockPhpUpload($value, $parameters)) { - return false; - } - - if (in_array('jpg', $parameters) || in_array('jpeg', $parameters)) { - $parameters = array_unique(array_merge($parameters, ['jpg', 'jpeg'])); - } - - return $value->getPath() !== '' && in_array($value->guessExtension(), $parameters); - } - - /** - * Validate the MIME type of a file upload attribute is in a set of MIME types. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMimetypes($attribute, $value, $parameters) - { - if (! $this->isValidFileInstance($value)) { - return false; - } - - if ($this->shouldBlockPhpUpload($value, $parameters)) { - return false; - } - - return $value->getPath() !== '' && - (in_array($value->getMimeType(), $parameters) || - in_array(explode('/', $value->getMimeType())[0].'/*', $parameters)); - } - - /** - * Check if PHP uploads are explicitly allowed. - * - * @param mixed $value - * @param array $parameters - * @return bool - */ - protected function shouldBlockPhpUpload($value, $parameters) - { - if (in_array('php', $parameters)) { - return false; - } - - $phpExtensions = [ - 'php', 'php3', 'php4', 'php5', 'php7', 'php8', 'phtml', 'phar', - ]; - - return ($value instanceof UploadedFile) - ? in_array(trim(strtolower($value->getClientOriginalExtension())), $phpExtensions) - : in_array(trim(strtolower($value->getExtension())), $phpExtensions); - } - - /** - * Validate the size of an attribute is greater than a minimum value. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMin($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'min'); - - return BigNumber::of($this->getSize($attribute, $value))->isGreaterThanOrEqualTo($this->trim($parameters[0])); - } - - /** - * Validate that an attribute has a minimum number of digits. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMinDigits($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'min'); - - $length = strlen((string) $value); - - return ! preg_match('/[^0-9]/', $value) && $length >= $parameters[0]; - } - - /** - * Validate that an attribute is missing. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMissing($attribute, $value, $parameters) - { - return ! Arr::has($this->data, $attribute); - } - - /** - * Validate that an attribute is missing when another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMissingIf($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'missing_if'); - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - if (in_array($other, $values, is_bool($other) || is_null($other))) { - return $this->validateMissing($attribute, $value, $parameters); - } - - return true; - } - - /** - * Validate that an attribute is missing unless another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMissingUnless($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'missing_unless'); - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - if (! in_array($other, $values, is_bool($other) || is_null($other))) { - return $this->validateMissing($attribute, $value, $parameters); - } - - return true; - } - - /** - * Validate that an attribute is missing when any given attribute is present. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMissingWith($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'missing_with'); - - if (Arr::hasAny($this->data, $parameters)) { - return $this->validateMissing($attribute, $value, $parameters); - } - - return true; - } - - /** - * Validate that an attribute is missing when all given attributes are present. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMissingWithAll($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'missing_with'); - - if (Arr::has($this->data, $parameters)) { - return $this->validateMissing($attribute, $value, $parameters); - } - - return true; - } - - /** - * Validate the value of an attribute is a multiple of a given value. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateMultipleOf($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'multiple_of'); - - if (! $this->validateNumeric($attribute, $value) || ! $this->validateNumeric($attribute, $parameters[0])) { - return false; - } - - try { - $numerator = BigDecimal::of($this->trim($value)); - $denominator = BigDecimal::of($this->trim($parameters[0])); - - if ($numerator->isZero() && $denominator->isZero()) { - return false; - } - - if ($numerator->isZero()) { - return true; - } - - if ($denominator->isZero()) { - return false; - } - - return $numerator->remainder($denominator)->isZero(); - } catch (BrickMathException $e) { - throw new MathException('An error occurred while handling the multiple_of input values.', previous: $e); - } - } - - /** - * "Indicate" validation should pass if value is null. - * - * Always returns true, just lets us put "nullable" in rules. - * - * @return bool - */ - public function validateNullable() - { - return true; - } - - /** - * Validate an attribute is not contained within a list of values. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateNotIn($attribute, $value, $parameters) - { - return ! $this->validateIn($attribute, $value, $parameters); - } - - /** - * Validate that an attribute is numeric. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateNumeric($attribute, $value) - { - return is_numeric($value); - } - - /** - * Validate that an attribute exists even if not filled. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validatePresent($attribute, $value) - { - return Arr::has($this->data, $attribute); - } - - /** - * Validate that an attribute passes a regular expression check. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateRegex($attribute, $value, $parameters) - { - if (! is_string($value) && ! is_numeric($value)) { - return false; - } - - $this->requireParameterCount(1, $parameters, 'regex'); - - return preg_match($parameters[0], $value) > 0; - } - - /** - * Validate that an attribute does not pass a regular expression check. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateNotRegex($attribute, $value, $parameters) - { - if (! is_string($value) && ! is_numeric($value)) { - return false; - } - - $this->requireParameterCount(1, $parameters, 'not_regex'); - - return preg_match($parameters[0], $value) < 1; - } - - /** - * Validate that a required attribute exists. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateRequired($attribute, $value) - { - if (is_null($value)) { - return false; - } elseif (is_string($value) && trim($value) === '') { - return false; - } elseif (is_countable($value) && count($value) < 1) { - return false; - } elseif ($value instanceof File) { - return (string) $value->getPath() !== ''; - } - - return true; - } - - /** - * Validate that an attribute exists when another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateRequiredIf($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'required_if'); - - if (! Arr::has($this->data, $parameters[0])) { - return true; - } - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - if (in_array($other, $values, is_bool($other) || is_null($other))) { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute exists when another attribute was "accepted". - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateRequiredIfAccepted($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'required_if_accepted'); - - if ($this->validateAccepted($parameters[0], $this->getValue($parameters[0]))) { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute does not exist or is an empty string. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateProhibited($attribute, $value) - { - return ! $this->validateRequired($attribute, $value); - } - - /** - * Validate that an attribute does not exist when another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateProhibitedIf($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'prohibited_if'); - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - if (in_array($other, $values, is_bool($other) || is_null($other))) { - return ! $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute does not exist unless another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateProhibitedUnless($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'prohibited_unless'); - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - if (! in_array($other, $values, is_bool($other) || is_null($other))) { - return ! $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that other attributes do not exist when this attribute exists. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateProhibits($attribute, $value, $parameters) - { - if ($this->validateRequired($attribute, $value)) { - foreach ($parameters as $parameter) { - if ($this->validateRequired($parameter, Arr::get($this->data, $parameter))) { - return false; - } - } - } - - return true; - } - - /** - * Indicate that an attribute is excluded. - * - * @return bool - */ - public function validateExclude() - { - return false; - } - - /** - * Indicate that an attribute should be excluded when another attribute has a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateExcludeIf($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'exclude_if'); - - if (! Arr::has($this->data, $parameters[0])) { - return true; - } - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - return ! in_array($other, $values, is_bool($other) || is_null($other)); - } - - /** - * Indicate that an attribute should be excluded when another attribute does not have a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateExcludeUnless($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'exclude_unless'); - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - return in_array($other, $values, is_bool($other) || is_null($other)); - } - - /** - * Validate that an attribute exists when another attribute does not have a given value. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateRequiredUnless($attribute, $value, $parameters) - { - $this->requireParameterCount(2, $parameters, 'required_unless'); - - [$values, $other] = $this->parseDependentRuleParameters($parameters); - - if (! in_array($other, $values, is_bool($other) || is_null($other))) { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Indicate that an attribute should be excluded when another attribute presents. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateExcludeWith($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'exclude_with'); - - if (! Arr::has($this->data, $parameters[0])) { - return true; - } - - return false; - } - - /** - * Indicate that an attribute should be excluded when another attribute is missing. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateExcludeWithout($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'exclude_without'); - - if ($this->anyFailingRequired($parameters)) { - return false; - } - - return true; - } - - /** - * Prepare the values and the other value for validation. - * - * @param array $parameters - * @return array - */ - public function parseDependentRuleParameters($parameters) - { - $other = Arr::get($this->data, $parameters[0]); - - $values = array_slice($parameters, 1); - - if ($this->shouldConvertToBoolean($parameters[0]) || is_bool($other)) { - $values = $this->convertValuesToBoolean($values); - } - - if (is_null($other)) { - $values = $this->convertValuesToNull($values); - } - - return [$values, $other]; - } - - /** - * Check if parameter should be converted to boolean. - * - * @param string $parameter - * @return bool - */ - protected function shouldConvertToBoolean($parameter) - { - return in_array('boolean', Arr::get($this->rules, $parameter, [])); - } - - /** - * Convert the given values to boolean if they are string "true" / "false". - * - * @param array $values - * @return array - */ - protected function convertValuesToBoolean($values) - { - return array_map(function ($value) { - if ($value === 'true') { - return true; - } elseif ($value === 'false') { - return false; - } - - return $value; - }, $values); - } - - /** - * Convert the given values to null if they are string "null". - * - * @param array $values - * @return array - */ - protected function convertValuesToNull($values) - { - return array_map(function ($value) { - return Str::lower($value) === 'null' ? null : $value; - }, $values); - } - - /** - * Validate that an attribute exists when any other attribute exists. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateRequiredWith($attribute, $value, $parameters) - { - if (! $this->allFailingRequired($parameters)) { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute exists when all other attributes exist. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateRequiredWithAll($attribute, $value, $parameters) - { - if (! $this->anyFailingRequired($parameters)) { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute exists when another attribute does not. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateRequiredWithout($attribute, $value, $parameters) - { - if ($this->anyFailingRequired($parameters)) { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Validate that an attribute exists when all other attributes do not. - * - * @param string $attribute - * @param mixed $value - * @param mixed $parameters - * @return bool - */ - public function validateRequiredWithoutAll($attribute, $value, $parameters) - { - if ($this->allFailingRequired($parameters)) { - return $this->validateRequired($attribute, $value); - } - - return true; - } - - /** - * Determine if any of the given attributes fail the required test. - * - * @param array $attributes - * @return bool - */ - protected function anyFailingRequired(array $attributes) - { - foreach ($attributes as $key) { - if (! $this->validateRequired($key, $this->getValue($key))) { - return true; - } - } - - return false; - } - - /** - * Determine if all of the given attributes fail the required test. - * - * @param array $attributes - * @return bool - */ - protected function allFailingRequired(array $attributes) - { - foreach ($attributes as $key) { - if ($this->validateRequired($key, $this->getValue($key))) { - return false; - } - } - - return true; - } - - /** - * Validate that two attributes match. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateSame($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'same'); - - $other = Arr::get($this->data, $parameters[0]); - - return $value === $other; - } - - /** - * Validate the size of an attribute. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateSize($attribute, $value, $parameters) - { - $this->requireParameterCount(1, $parameters, 'size'); - - return BigNumber::of($this->getSize($attribute, $value))->isEqualTo($this->trim($parameters[0])); - } - - /** - * "Validate" optional attributes. - * - * Always returns true, just lets us put sometimes in rules. - * - * @return bool - */ - public function validateSometimes() - { - return true; - } - - /** - * Validate the attribute starts with a given substring. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateStartsWith($attribute, $value, $parameters) - { - return Str::startsWith($value, $parameters); - } - - /** - * Validate the attribute does not start with a given substring. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDoesntStartWith($attribute, $value, $parameters) - { - return ! Str::startsWith($value, $parameters); - } - - /** - * Validate the attribute ends with a given substring. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateEndsWith($attribute, $value, $parameters) - { - return Str::endsWith($value, $parameters); - } - - /** - * Validate the attribute does not end with a given substring. - * - * @param string $attribute - * @param mixed $value - * @param array $parameters - * @return bool - */ - public function validateDoesntEndWith($attribute, $value, $parameters) - { - return ! Str::endsWith($value, $parameters); - } - - /** - * Validate that an attribute is a string. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateString($attribute, $value) - { - return is_string($value); - } - - /** - * Validate that an attribute is a valid timezone. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateTimezone($attribute, $value) - { - return in_array($value, timezone_identifiers_list(), true); - } - - /** - * Validate that an attribute is a valid URL. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateUrl($attribute, $value) - { - if (! is_string($value)) { - return false; - } - - /* - * This pattern is derived from Symfony\Component\Validator\Constraints\UrlValidator (5.0.7). - * - * (c) Fabien Potencier http://symfony.com - */ - $pattern = '~^ - (aaa|aaas|about|acap|acct|acd|acr|adiumxtra|adt|afp|afs|aim|amss|android|appdata|apt|ark|attachment|aw|barion|beshare|bitcoin|bitcoincash|blob|bolo|browserext|calculator|callto|cap|cast|casts|chrome|chrome-extension|cid|coap|coap\+tcp|coap\+ws|coaps|coaps\+tcp|coaps\+ws|com-eventbrite-attendee|content|conti|crid|cvs|dab|data|dav|diaspora|dict|did|dis|dlna-playcontainer|dlna-playsingle|dns|dntp|dpp|drm|drop|dtn|dvb|ed2k|elsi|example|facetime|fax|feed|feedready|file|filesystem|finger|first-run-pen-experience|fish|fm|ftp|fuchsia-pkg|geo|gg|git|gizmoproject|go|gopher|graph|gtalk|h323|ham|hcap|hcp|http|https|hxxp|hxxps|hydrazone|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris\.beep|iris\.lwz|iris\.xpc|iris\.xpcs|isostore|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|leaptofrogans|lorawan|lvlt|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|mongodb|moz|ms-access|ms-browser-extension|ms-calculator|ms-drive-to|ms-enrollment|ms-excel|ms-eyecontrolspeech|ms-gamebarservices|ms-gamingoverlay|ms-getoffice|ms-help|ms-infopath|ms-inputapp|ms-lockscreencomponent-config|ms-media-stream-id|ms-mixedrealitycapture|ms-mobileplans|ms-officeapp|ms-people|ms-project|ms-powerpoint|ms-publisher|ms-restoretabcompanion|ms-screenclip|ms-screensketch|ms-search|ms-search-repair|ms-secondary-screen-controller|ms-secondary-screen-setup|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-connectabledevices|ms-settings-displays-topology|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|ms-spd|ms-sttoverlay|ms-transit-to|ms-useractivityset|ms-virtualtouchpad|ms-visio|ms-walk-to|ms-whiteboard|ms-whiteboard-cmd|ms-word|msnim|msrp|msrps|mss|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|ocf|oid|onenote|onenote-cmd|opaquelocktoken|openpgp4fpr|pack|palm|paparazzi|payto|pkcs11|platform|pop|pres|prospero|proxy|pwid|psyc|pttp|qb|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|s3|secondlife|service|session|sftp|sgn|shttp|sieve|simpleledger|sip|sips|skype|smb|sms|smtp|snews|snmp|soap\.beep|soap\.beeps|soldat|spiffe|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|tg|things|thismessage|tip|tn3270|tool|ts3server|turn|turns|tv|udp|unreal|urn|ut2004|v-event|vemmi|ventrilo|videotex|vnc|view-source|wais|webcal|wpid|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc\.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s):// # protocol - (((?:[\_\.\pL\pN-]|%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%[0-9A-Fa-f]{2})+)@)? # basic auth - ( - ([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name - | # or - \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address - | # or - \[ - (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) - \] # an IPv6 address - ) - (:[0-9]+)? # a port (optional) - (?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%[0-9A-Fa-f]{2})* )* # a path - (?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%[0-9A-Fa-f]{2})* )? # a query (optional) - (?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%[0-9A-Fa-f]{2})* )? # a fragment (optional) - $~ixu'; - - return preg_match($pattern, $value) > 0; - } - - /** - * Validate that an attribute is a valid ULID. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateUlid($attribute, $value) - { - return Str::isUlid($value); - } - - /** - * Validate that an attribute is a valid UUID. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function validateUuid($attribute, $value) - { - return Str::isUuid($value); - } - - /** - * Get the size of an attribute. - * - * @param string $attribute - * @param mixed $value - * @return int|float|string - */ - protected function getSize($attribute, $value) - { - $hasNumeric = $this->hasRule($attribute, $this->numericRules); - - // This method will determine if the attribute is a number, string, or file and - // return the proper size accordingly. If it is a number, then number itself - // is the size. If it is a file, we take kilobytes, and for a string the - // entire length of the string will be considered the attribute size. - if (is_numeric($value) && $hasNumeric) { - return $this->trim($value); - } elseif (is_array($value)) { - return count($value); - } elseif ($value instanceof File) { - return $value->getSize() / 1024; - } - - return mb_strlen($value ?? ''); - } - - /** - * Check that the given value is a valid file instance. - * - * @param mixed $value - * @return bool - */ - public function isValidFileInstance($value) - { - if ($value instanceof UploadedFile && ! $value->isValid()) { - return false; - } - - return $value instanceof File; - } - - /** - * Determine if a comparison passes between the given values. - * - * @param mixed $first - * @param mixed $second - * @param string $operator - * @return bool - * - * @throws \InvalidArgumentException - */ - protected function compare($first, $second, $operator) - { - return match ($operator) { - '<' => $first < $second, - '>' => $first > $second, - '<=' => $first <= $second, - '>=' => $first >= $second, - '=' => $first == $second, - default => throw new InvalidArgumentException, - }; - } - - /** - * Parse named parameters to $key => $value items. - * - * @param array $parameters - * @return array - */ - public function parseNamedParameters($parameters) - { - return array_reduce($parameters, function ($result, $item) { - [$key, $value] = array_pad(explode('=', $item, 2), 2, null); - - $result[$key] = $value; - - return $result; - }); - } - - /** - * Require a certain number of parameters to be present. - * - * @param int $count - * @param array $parameters - * @param string $rule - * @return void - * - * @throws \InvalidArgumentException - */ - public function requireParameterCount($count, $parameters, $rule) - { - if (count($parameters) < $count) { - throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters."); - } - } - - /** - * Check if the parameters are of the same type. - * - * @param mixed $first - * @param mixed $second - * @return bool - */ - protected function isSameType($first, $second) - { - return gettype($first) == gettype($second); - } - - /** - * Adds the existing rule to the numericRules array if the attribute's value is numeric. - * - * @param string $attribute - * @param string $rule - * @return void - */ - protected function shouldBeNumeric($attribute, $rule) - { - if (is_numeric($this->getValue($attribute))) { - $this->numericRules[] = $rule; - } - } - - /** - * Trim the value if it is a string. - * - * @param mixed $value - * @return mixed - */ - protected function trim($value) - { - return is_string($value) ? trim($value) : $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/ConditionalRules.php b/framework-9.50.2/src/Illuminate/Validation/ConditionalRules.php deleted file mode 100644 index 02f8e21..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/ConditionalRules.php +++ /dev/null @@ -1,83 +0,0 @@ -condition = $condition; - $this->rules = $rules; - $this->defaultRules = $defaultRules; - } - - /** - * Determine if the conditional rules should be added. - * - * @param array $data - * @return bool - */ - public function passes(array $data = []) - { - return is_callable($this->condition) - ? call_user_func($this->condition, new Fluent($data)) - : $this->condition; - } - - /** - * Get the rules. - * - * @param array $data - * @return array - */ - public function rules(array $data = []) - { - return is_string($this->rules) - ? explode('|', $this->rules) - : value($this->rules, new Fluent($data)); - } - - /** - * Get the default rules. - * - * @param array $data - * @return array - */ - public function defaultRules(array $data = []) - { - return is_string($this->defaultRules) - ? explode('|', $this->defaultRules) - : value($this->defaultRules, new Fluent($data)); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/DatabasePresenceVerifier.php b/framework-9.50.2/src/Illuminate/Validation/DatabasePresenceVerifier.php deleted file mode 100755 index 9229f06..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/DatabasePresenceVerifier.php +++ /dev/null @@ -1,137 +0,0 @@ -db = $db; - } - - /** - * Count the number of objects in a collection having the given value. - * - * @param string $collection - * @param string $column - * @param string $value - * @param int|null $excludeId - * @param string|null $idColumn - * @param array $extra - * @return int - */ - public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = []) - { - $query = $this->table($collection)->where($column, '=', $value); - - if (! is_null($excludeId) && $excludeId !== 'NULL') { - $query->where($idColumn ?: 'id', '<>', $excludeId); - } - - return $this->addConditions($query, $extra)->count(); - } - - /** - * Count the number of objects in a collection with the given values. - * - * @param string $collection - * @param string $column - * @param array $values - * @param array $extra - * @return int - */ - public function getMultiCount($collection, $column, array $values, array $extra = []) - { - $query = $this->table($collection)->whereIn($column, $values); - - return $this->addConditions($query, $extra)->distinct()->count($column); - } - - /** - * Add the given conditions to the query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $conditions - * @return \Illuminate\Database\Query\Builder - */ - protected function addConditions($query, $conditions) - { - foreach ($conditions as $key => $value) { - if ($value instanceof Closure) { - $query->where(function ($query) use ($value) { - $value($query); - }); - } else { - $this->addWhere($query, $key, $value); - } - } - - return $query; - } - - /** - * Add a "where" clause to the given query. - * - * @param \Illuminate\Database\Query\Builder $query - * @param string $key - * @param string $extraValue - * @return void - */ - protected function addWhere($query, $key, $extraValue) - { - if ($extraValue === 'NULL') { - $query->whereNull($key); - } elseif ($extraValue === 'NOT_NULL') { - $query->whereNotNull($key); - } elseif (str_starts_with($extraValue, '!')) { - $query->where($key, '!=', mb_substr($extraValue, 1)); - } else { - $query->where($key, $extraValue); - } - } - - /** - * Get a query builder for the given table. - * - * @param string $table - * @return \Illuminate\Database\Query\Builder - */ - protected function table($table) - { - return $this->db->connection($this->connection)->table($table)->useWritePdo(); - } - - /** - * Set the connection to be used. - * - * @param string $connection - * @return void - */ - public function setConnection($connection) - { - $this->connection = $connection; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/DatabasePresenceVerifierInterface.php b/framework-9.50.2/src/Illuminate/Validation/DatabasePresenceVerifierInterface.php deleted file mode 100755 index 4b70ee0..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/DatabasePresenceVerifierInterface.php +++ /dev/null @@ -1,14 +0,0 @@ - - */ - 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 = []; - - /** - * Indicates that unvalidated array keys should be excluded, even if the parent array was validated. - * - * @var bool - */ - protected $excludeUnvalidatedArrayKeys = true; - - /** - * 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|null $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 = []) - { - $validator = $this->resolve( - $data, $rules, $messages, $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. - 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); - } - - $validator->excludeUnvalidatedArrayKeys = $this->excludeUnvalidatedArrayKeys; - - $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 array - * - * @throws \Illuminate\Validation\ValidationException - */ - public function validate(array $data, array $rules, array $messages = [], array $customAttributes = []) - { - return $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're run even if the attributes aren't in an - // array of data which is given to a validator instance 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|null $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|null $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|null $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; - } - - /** - * Indicate that unvalidated array keys should be included in validated data when the parent array is validated. - * - * @return void - */ - public function includeUnvalidatedArrayKeys() - { - $this->excludeUnvalidatedArrayKeys = false; - } - - /** - * Indicate that unvalidated array keys should be excluded from the validated data, even if the parent array was validated. - * - * @return void - */ - public function excludeUnvalidatedArrayKeys() - { - $this->excludeUnvalidatedArrayKeys = true; - } - - /** - * 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; - } - - /** - * Get the container instance used by the validation factory. - * - * @return \Illuminate\Contracts\Container\Container|null - */ - public function getContainer() - { - return $this->container; - } - - /** - * Set the container instance used by the validation factory. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return $this - */ - public function setContainer(Container $container) - { - $this->container = $container; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/InvokableValidationRule.php b/framework-9.50.2/src/Illuminate/Validation/InvokableValidationRule.php deleted file mode 100644 index 97eb233..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/InvokableValidationRule.php +++ /dev/null @@ -1,199 +0,0 @@ -invokable = $invokable; - } - - /** - * Create a new implicit or explicit Invokable validation rule. - * - * @param \Illuminate\Contracts\Validation\InvokableRule $invokable - * @return \Illuminate\Contracts\Validation\Rule - */ - public static function make($invokable) - { - if ($invokable->implicit ?? false) { - return new class($invokable) extends InvokableValidationRule implements ImplicitRule - { - // - }; - } - - return new InvokableValidationRule($invokable); - } - - /** - * Determine if the validation rule passes. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function passes($attribute, $value) - { - $this->failed = false; - - if ($this->invokable instanceof DataAwareRule) { - $this->invokable->setData($this->validator->getData()); - } - - if ($this->invokable instanceof ValidatorAwareRule) { - $this->invokable->setValidator($this->validator); - } - - $this->invokable->__invoke($attribute, $value, function ($attribute, $message = null) { - $this->failed = true; - - return $this->pendingPotentiallyTranslatedString($attribute, $message); - }); - - return ! $this->failed; - } - - /** - * Get the underlying invokable rule. - * - * @return \Illuminate\Contracts\Validation\InvokableRule - */ - public function invokable() - { - return $this->invokable; - } - - /** - * Get the validation error messages. - * - * @return array - */ - public function message() - { - return $this->messages; - } - - /** - * Set the data under validation. - * - * @param array $data - * @return $this - */ - public function setData($data) - { - $this->data = $data; - - return $this; - } - - /** - * Set the current validator. - * - * @param \Illuminate\Validation\Validator $validator - * @return $this - */ - public function setValidator($validator) - { - $this->validator = $validator; - - return $this; - } - - /** - * Create a pending potentially translated string. - * - * @param string $attribute - * @param string|null $message - * @return \Illuminate\Translation\PotentiallyTranslatedString - */ - protected function pendingPotentiallyTranslatedString($attribute, $message) - { - $destructor = $message === null - ? fn ($message) => $this->messages[] = $message - : fn ($message) => $this->messages[$attribute] = $message; - - return new class($message ?? $attribute, $this->validator->getTranslator(), $destructor) extends PotentiallyTranslatedString - { - /** - * The callback to call when the object destructs. - * - * @var \Closure - */ - protected $destructor; - - /** - * Create a new pending potentially translated string. - * - * @param string $message - * @param \Illuminate\Contracts\Translation\Translator $translator - * @param \Closure $destructor - */ - public function __construct($message, $translator, $destructor) - { - parent::__construct($message, $translator); - - $this->destructor = $destructor; - } - - /** - * Handle the object's destruction. - * - * @return void - */ - public function __destruct() - { - ($this->destructor)($this->toString()); - } - }; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/LICENSE.md b/framework-9.50.2/src/Illuminate/Validation/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/Validation/NestedRules.php b/framework-9.50.2/src/Illuminate/Validation/NestedRules.php deleted file mode 100644 index 7a18fe1..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/NestedRules.php +++ /dev/null @@ -1,55 +0,0 @@ -callback = $callback; - } - - /** - * Compile the callback into an array of rules. - * - * @param string $attribute - * @param mixed $value - * @param mixed $data - * @return \stdClass - */ - public function compile($attribute, $value, $data = null) - { - $rules = call_user_func($this->callback, $value, $attribute, $data); - - $parser = new ValidationRuleParser( - Arr::undot(Arr::wrap($data)) - ); - - if (is_array($rules) && Arr::isAssoc($rules)) { - $nested = []; - - foreach ($rules as $key => $rule) { - $nested[$attribute.'.'.$key] = $rule; - } - - return $parser->explode($nested); - } - - return $parser->explode([$attribute => $rules]); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/NotPwnedVerifier.php b/framework-9.50.2/src/Illuminate/Validation/NotPwnedVerifier.php deleted file mode 100644 index 1a3511e..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/NotPwnedVerifier.php +++ /dev/null @@ -1,104 +0,0 @@ -factory = $factory; - $this->timeout = $timeout ?? 30; - } - - /** - * Verify that the given data has not been compromised in public breaches. - * - * @param array $data - * @return bool - */ - public function verify($data) - { - $value = $data['value']; - $threshold = $data['threshold']; - - if (empty($value = (string) $value)) { - return false; - } - - [$hash, $hashPrefix] = $this->getHash($value); - - return ! $this->search($hashPrefix) - ->contains(function ($line) use ($hash, $hashPrefix, $threshold) { - [$hashSuffix, $count] = explode(':', $line); - - return $hashPrefix.$hashSuffix == $hash && $count > $threshold; - }); - } - - /** - * Get the hash and its first 5 chars. - * - * @param string $value - * @return array - */ - protected function getHash($value) - { - $hash = strtoupper(sha1((string) $value)); - - $hashPrefix = substr($hash, 0, 5); - - return [$hash, $hashPrefix]; - } - - /** - * Search by the given hash prefix and returns all occurrences of leaked passwords. - * - * @param string $hashPrefix - * @return \Illuminate\Support\Collection - */ - protected function search($hashPrefix) - { - try { - $response = $this->factory->withHeaders([ - 'Add-Padding' => true, - ])->timeout($this->timeout)->get( - 'https://api.pwnedpasswords.com/range/'.$hashPrefix - ); - } catch (Exception $e) { - report($e); - } - - $body = (isset($response) && $response->successful()) - ? $response->body() - : ''; - - return Str::of($body)->trim()->explode("\n")->filter(function ($line) { - return str_contains($line, ':'); - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/PresenceVerifierInterface.php b/framework-9.50.2/src/Illuminate/Validation/PresenceVerifierInterface.php deleted file mode 100755 index da58a12..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/PresenceVerifierInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -toArray(); - } - - return new In(is_array($values) ? $values : func_get_args()); - } - - /** - * Get a not_in constraint builder instance. - * - * @param \Illuminate\Contracts\Support\Arrayable|array|string $values - * @return \Illuminate\Validation\Rules\NotIn - */ - public static function notIn($values) - { - if ($values instanceof Arrayable) { - $values = $values->toArray(); - } - - return new NotIn(is_array($values) ? $values : func_get_args()); - } - - /** - * Get a required_if constraint builder instance. - * - * @param callable|bool $callback - * @return \Illuminate\Validation\Rules\RequiredIf - */ - public static function requiredIf($callback) - { - return new RequiredIf($callback); - } - - /** - * Get a exclude_if constraint builder instance. - * - * @param callable|bool $callback - * @return \Illuminate\Validation\Rules\ExcludeIf - */ - public static function excludeIf($callback) - { - return new ExcludeIf($callback); - } - - /** - * Get a prohibited_if constraint builder instance. - * - * @param callable|bool $callback - * @return \Illuminate\Validation\Rules\ProhibitedIf - */ - public static function prohibitedIf($callback) - { - return new ProhibitedIf($callback); - } - - /** - * Get an enum constraint builder instance. - * - * @param string $type - * @return \Illuminate\Validation\Rules\Enum - */ - public static function enum($type) - { - return new Enum($type); - } - - /** - * Get a file constraint builder instance. - * - * @return \Illuminate\Validation\Rules\File - */ - public static function file() - { - return new File; - } - - /** - * Get an image file constraint builder instance. - * - * @return \Illuminate\Validation\Rules\ImageFile - */ - public static function imageFile() - { - return new ImageFile; - } - - /** - * Get a dimensions constraint builder instance. - * - * @param array $constraints - * @return \Illuminate\Validation\Rules\Dimensions - */ - public static function dimensions(array $constraints = []) - { - return new Dimensions($constraints); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/DatabaseRule.php b/framework-9.50.2/src/Illuminate/Validation/Rules/DatabaseRule.php deleted file mode 100644 index c523bec..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/DatabaseRule.php +++ /dev/null @@ -1,232 +0,0 @@ -column = $column; - - $this->table = $this->resolveTableName($table); - } - - /** - * Resolves the name of the table from the given string. - * - * @param string $table - * @return string - */ - public function resolveTableName($table) - { - if (! str_contains($table, '\\') || ! class_exists($table)) { - return $table; - } - - if (is_subclass_of($table, Model::class)) { - $model = new $table; - - if (str_contains($model->getTable(), '.')) { - return $table; - } - - return implode('.', array_map(function (string $part) { - return trim($part, '.'); - }, array_filter([$model->getConnectionName(), $model->getTable()]))); - } - - return $table; - } - - /** - * Set a "where" constraint on the query. - * - * @param \Closure|string $column - * @param \Illuminate\Contracts\Support\Arrayable|array|string|int|null $value - * @return $this - */ - public function where($column, $value = null) - { - if ($value instanceof Arrayable || is_array($value)) { - return $this->whereIn($column, $value); - } - - if ($column instanceof Closure) { - return $this->using($column); - } - - if (is_null($value)) { - return $this->whereNull($column); - } - - $this->wheres[] = compact('column', 'value'); - - return $this; - } - - /** - * Set a "where not" constraint on the query. - * - * @param string $column - * @param \Illuminate\Contracts\Support\Arrayable|array|string $value - * @return $this - */ - public function whereNot($column, $value) - { - if ($value instanceof Arrayable || is_array($value)) { - return $this->whereNotIn($column, $value); - } - - return $this->where($column, '!'.$value); - } - - /** - * Set a "where null" constraint on the query. - * - * @param string $column - * @return $this - */ - public function whereNull($column) - { - return $this->where($column, 'NULL'); - } - - /** - * Set a "where not null" constraint on the query. - * - * @param string $column - * @return $this - */ - public function whereNotNull($column) - { - return $this->where($column, 'NOT_NULL'); - } - - /** - * Set a "where in" constraint on the query. - * - * @param string $column - * @param \Illuminate\Contracts\Support\Arrayable|array $values - * @return $this - */ - public function whereIn($column, $values) - { - return $this->where(function ($query) use ($column, $values) { - $query->whereIn($column, $values); - }); - } - - /** - * Set a "where not in" constraint on the query. - * - * @param string $column - * @param \Illuminate\Contracts\Support\Arrayable|array $values - * @return $this - */ - public function whereNotIn($column, $values) - { - return $this->where(function ($query) use ($column, $values) { - $query->whereNotIn($column, $values); - }); - } - - /** - * Ignore soft deleted models during the existence check. - * - * @param string $deletedAtColumn - * @return $this - */ - public function withoutTrashed($deletedAtColumn = 'deleted_at') - { - $this->whereNull($deletedAtColumn); - - return $this; - } - - /** - * Only include soft deleted models during the existence check. - * - * @param string $deletedAtColumn - * @return $this - */ - public function onlyTrashed($deletedAtColumn = 'deleted_at') - { - $this->whereNotNull($deletedAtColumn); - - return $this; - } - - /** - * Register a custom query callback. - * - * @param \Closure $callback - * @return $this - */ - public function using(Closure $callback) - { - $this->using[] = $callback; - - return $this; - } - - /** - * Get the custom query callbacks for the rule. - * - * @return array - */ - public function queryCallbacks() - { - return $this->using; - } - - /** - * Format the where clauses. - * - * @return string - */ - protected function formatWheres() - { - return collect($this->wheres)->map(function ($where) { - return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; - })->implode(','); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/Dimensions.php b/framework-9.50.2/src/Illuminate/Validation/Rules/Dimensions.php deleted file mode 100644 index 624cbcb..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/Dimensions.php +++ /dev/null @@ -1,135 +0,0 @@ -constraints = $constraints; - } - - /** - * Set the "width" constraint. - * - * @param int $value - * @return $this - */ - public function width($value) - { - $this->constraints['width'] = $value; - - return $this; - } - - /** - * Set the "height" constraint. - * - * @param int $value - * @return $this - */ - public function height($value) - { - $this->constraints['height'] = $value; - - return $this; - } - - /** - * Set the "min width" constraint. - * - * @param int $value - * @return $this - */ - public function minWidth($value) - { - $this->constraints['min_width'] = $value; - - return $this; - } - - /** - * Set the "min height" constraint. - * - * @param int $value - * @return $this - */ - public function minHeight($value) - { - $this->constraints['min_height'] = $value; - - return $this; - } - - /** - * Set the "max width" constraint. - * - * @param int $value - * @return $this - */ - public function maxWidth($value) - { - $this->constraints['max_width'] = $value; - - return $this; - } - - /** - * Set the "max height" constraint. - * - * @param int $value - * @return $this - */ - public function maxHeight($value) - { - $this->constraints['max_height'] = $value; - - return $this; - } - - /** - * Set the "ratio" constraint. - * - * @param float $value - * @return $this - */ - public function ratio($value) - { - $this->constraints['ratio'] = $value; - - return $this; - } - - /** - * Convert the rule to a validation string. - * - * @return string - */ - public function __toString() - { - $result = ''; - - foreach ($this->constraints as $key => $value) { - $result .= "$key=$value,"; - } - - return 'dimensions:'.substr($result, 0, -1); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/Enum.php b/framework-9.50.2/src/Illuminate/Validation/Rules/Enum.php deleted file mode 100644 index a519e58..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/Enum.php +++ /dev/null @@ -1,65 +0,0 @@ -type = $type; - } - - /** - * Determine if the validation rule passes. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function passes($attribute, $value) - { - if ($value instanceof $this->type) { - return true; - } - - if (is_null($value) || ! function_exists('enum_exists') || ! enum_exists($this->type) || ! method_exists($this->type, 'tryFrom')) { - return false; - } - - try { - return ! is_null($this->type::tryFrom($value)); - } catch (TypeError $e) { - return false; - } - } - - /** - * Get the validation error message. - * - * @return array - */ - public function message() - { - $message = trans('validation.enum'); - - return $message === 'validation.enum' - ? ['The selected :attribute is invalid.'] - : $message; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/ExcludeIf.php b/framework-9.50.2/src/Illuminate/Validation/Rules/ExcludeIf.php deleted file mode 100644 index 2fff3d7..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/ExcludeIf.php +++ /dev/null @@ -1,47 +0,0 @@ -condition = $condition; - } else { - throw new InvalidArgumentException('The provided condition must be a callable or boolean.'); - } - } - - /** - * Convert the rule to a validation string. - * - * @return string - */ - public function __toString() - { - if (is_callable($this->condition)) { - return call_user_func($this->condition) ? 'exclude' : ''; - } - - return $this->condition ? 'exclude' : ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/Exists.php b/framework-9.50.2/src/Illuminate/Validation/Rules/Exists.php deleted file mode 100644 index e6dac83..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/Exists.php +++ /dev/null @@ -1,24 +0,0 @@ -table, - $this->column, - $this->formatWheres() - ), ','); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/File.php b/framework-9.50.2/src/Illuminate/Validation/Rules/File.php deleted file mode 100644 index c97f68e..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/File.php +++ /dev/null @@ -1,329 +0,0 @@ - $mimetypes - * @return static - */ - public static function types($mimetypes) - { - return tap(new static(), fn ($file) => $file->allowedMimetypes = (array) $mimetypes); - } - - /** - * Indicate that the uploaded file should be exactly a certain size in kilobytes. - * - * @param int $kilobytes - * @return $this - */ - public function size($kilobytes) - { - $this->minimumFileSize = $kilobytes; - $this->maximumFileSize = $kilobytes; - - return $this; - } - - /** - * Indicate that the uploaded file should be between a minimum and maximum size in kilobytes. - * - * @param int $minKilobytes - * @param int $maxKilobytes - * @return $this - */ - public function between($minKilobytes, $maxKilobytes) - { - $this->minimumFileSize = $minKilobytes; - $this->maximumFileSize = $maxKilobytes; - - return $this; - } - - /** - * Indicate that the uploaded file should be no less than the given number of kilobytes. - * - * @param int $kilobytes - * @return $this - */ - public function min($kilobytes) - { - $this->minimumFileSize = $kilobytes; - - return $this; - } - - /** - * Indicate that the uploaded file should be no more than the given number of kilobytes. - * - * @param int $kilobytes - * @return $this - */ - public function max($kilobytes) - { - $this->maximumFileSize = $kilobytes; - - return $this; - } - - /** - * Specify additional validation rules that should be merged with the default rules during validation. - * - * @param string|array $rules - * @return $this - */ - public function rules($rules) - { - $this->customRules = array_merge($this->customRules, Arr::wrap($rules)); - - return $this; - } - - /** - * Determine if the validation rule passes. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function passes($attribute, $value) - { - $this->messages = []; - - $validator = Validator::make( - $this->data, - [$attribute => $this->buildValidationRules()], - $this->validator->customMessages, - $this->validator->customAttributes - ); - - if ($validator->fails()) { - return $this->fail($validator->messages()->all()); - } - - return true; - } - - /** - * Build the array of underlying validation rules based on the current state. - * - * @return array - */ - protected function buildValidationRules() - { - $rules = ['file']; - - $rules = array_merge($rules, $this->buildMimetypes()); - - $rules[] = match (true) { - is_null($this->minimumFileSize) && is_null($this->maximumFileSize) => null, - is_null($this->maximumFileSize) => "min:{$this->minimumFileSize}", - is_null($this->minimumFileSize) => "max:{$this->maximumFileSize}", - $this->minimumFileSize !== $this->maximumFileSize => "between:{$this->minimumFileSize},{$this->maximumFileSize}", - default => "size:{$this->minimumFileSize}", - }; - - return array_merge(array_filter($rules), $this->customRules); - } - - /** - * Separate the given mimetypes from extensions and return an array of correct rules to validate against. - * - * @return array - */ - protected function buildMimetypes() - { - if (count($this->allowedMimetypes) === 0) { - return []; - } - - $rules = []; - - $mimetypes = array_filter( - $this->allowedMimetypes, - fn ($type) => str_contains($type, '/') - ); - - $mimes = array_diff($this->allowedMimetypes, $mimetypes); - - if (count($mimetypes) > 0) { - $rules[] = 'mimetypes:'.implode(',', $mimetypes); - } - - if (count($mimes) > 0) { - $rules[] = 'mimes:'.implode(',', $mimes); - } - - return $rules; - } - - /** - * Adds the given failures, and return false. - * - * @param array|string $messages - * @return bool - */ - protected function fail($messages) - { - $messages = collect(Arr::wrap($messages))->map(function ($message) { - return $this->validator->getTranslator()->get($message); - })->all(); - - $this->messages = array_merge($this->messages, $messages); - - return false; - } - - /** - * Get the validation error message. - * - * @return array - */ - public function message() - { - return $this->messages; - } - - /** - * Set the current validator. - * - * @param \Illuminate\Contracts\Validation\Validator $validator - * @return $this - */ - public function setValidator($validator) - { - $this->validator = $validator; - - return $this; - } - - /** - * Set the current data under validation. - * - * @param array $data - * @return $this - */ - public function setData($data) - { - $this->data = $data; - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/ImageFile.php b/framework-9.50.2/src/Illuminate/Validation/Rules/ImageFile.php deleted file mode 100644 index 2cee97e..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/ImageFile.php +++ /dev/null @@ -1,28 +0,0 @@ -rules('image'); - } - - /** - * The dimension constraints for the uploaded file. - * - * @param \Illuminate\Validation\Rules\Dimensions $dimensions - */ - public function dimensions($dimensions) - { - $this->rules($dimensions); - - return $this; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/In.php b/framework-9.50.2/src/Illuminate/Validation/Rules/In.php deleted file mode 100644 index cc45b33..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/In.php +++ /dev/null @@ -1,47 +0,0 @@ -values = $values; - } - - /** - * Convert the rule to a validation string. - * - * @return string - * - * @see \Illuminate\Validation\ValidationRuleParser::parseParameters - */ - public function __toString() - { - $values = array_map(function ($value) { - return '"'.str_replace('"', '""', $value).'"'; - }, $this->values); - - return $this->rule.':'.implode(',', $values); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/NotIn.php b/framework-9.50.2/src/Illuminate/Validation/Rules/NotIn.php deleted file mode 100644 index 5701da6..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/NotIn.php +++ /dev/null @@ -1,45 +0,0 @@ -values = $values; - } - - /** - * Convert the rule to a validation string. - * - * @return string - */ - public function __toString() - { - $values = array_map(function ($value) { - return '"'.str_replace('"', '""', $value).'"'; - }, $this->values); - - return $this->rule.':'.implode(',', $values); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/Password.php b/framework-9.50.2/src/Illuminate/Validation/Rules/Password.php deleted file mode 100644 index fe0e190..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/Password.php +++ /dev/null @@ -1,395 +0,0 @@ -min = max((int) $min, 1); - } - - /** - * Set the default callback to be used for determining a password's default rules. - * - * If no arguments are passed, the default password rule configuration will be returned. - * - * @param static|callable|null $callback - * @return static|null - */ - public static function defaults($callback = null) - { - if (is_null($callback)) { - return static::default(); - } - - if (! is_callable($callback) && ! $callback instanceof static) { - throw new InvalidArgumentException('The given callback should be callable or an instance of '.static::class); - } - - static::$defaultCallback = $callback; - } - - /** - * Get the default configuration of the password rule. - * - * @return static - */ - public static function default() - { - $password = is_callable(static::$defaultCallback) - ? call_user_func(static::$defaultCallback) - : static::$defaultCallback; - - return $password instanceof Rule ? $password : static::min(8); - } - - /** - * Get the default configuration of the password rule and mark the field as required. - * - * @return array - */ - public static function required() - { - return ['required', static::default()]; - } - - /** - * Get the default configuration of the password rule and mark the field as sometimes being required. - * - * @return array - */ - public static function sometimes() - { - return ['sometimes', static::default()]; - } - - /** - * Set the performing validator. - * - * @param \Illuminate\Contracts\Validation\Validator $validator - * @return $this - */ - public function setValidator($validator) - { - $this->validator = $validator; - - return $this; - } - - /** - * Set the data under validation. - * - * @param array $data - * @return $this - */ - public function setData($data) - { - $this->data = $data; - - return $this; - } - - /** - * Sets the minimum size of the password. - * - * @param int $size - * @return $this - */ - public static function min($size) - { - return new static($size); - } - - /** - * Ensures the password has not been compromised in data leaks. - * - * @param int $threshold - * @return $this - */ - public function uncompromised($threshold = 0) - { - $this->uncompromised = true; - - $this->compromisedThreshold = $threshold; - - return $this; - } - - /** - * Makes the password require at least one uppercase and one lowercase letter. - * - * @return $this - */ - public function mixedCase() - { - $this->mixedCase = true; - - return $this; - } - - /** - * Makes the password require at least one letter. - * - * @return $this - */ - public function letters() - { - $this->letters = true; - - return $this; - } - - /** - * Makes the password require at least one number. - * - * @return $this - */ - public function numbers() - { - $this->numbers = true; - - return $this; - } - - /** - * Makes the password require at least one symbol. - * - * @return $this - */ - public function symbols() - { - $this->symbols = true; - - return $this; - } - - /** - * Specify additional validation rules that should be merged with the default rules during validation. - * - * @param string|array $rules - * @return $this - */ - public function rules($rules) - { - $this->customRules = Arr::wrap($rules); - - return $this; - } - - /** - * Determine if the validation rule passes. - * - * @param string $attribute - * @param mixed $value - * @return bool - */ - public function passes($attribute, $value) - { - $this->messages = []; - - $validator = Validator::make( - $this->data, - [$attribute => array_merge(['string', 'min:'.$this->min], $this->customRules)], - $this->validator->customMessages, - $this->validator->customAttributes - )->after(function ($validator) use ($attribute, $value) { - if (! is_string($value)) { - return; - } - - if ($this->mixedCase && ! preg_match('/(\p{Ll}+.*\p{Lu})|(\p{Lu}+.*\p{Ll})/u', $value)) { - $validator->errors()->add( - $attribute, - $this->getErrorMessage('validation.password.mixed') - ); - } - - if ($this->letters && ! preg_match('/\pL/u', $value)) { - $validator->errors()->add( - $attribute, - $this->getErrorMessage('validation.password.letters') - ); - } - - if ($this->symbols && ! preg_match('/\p{Z}|\p{S}|\p{P}/u', $value)) { - $validator->errors()->add( - $attribute, - $this->getErrorMessage('validation.password.symbols') - ); - } - - if ($this->numbers && ! preg_match('/\pN/u', $value)) { - $validator->errors()->add( - $attribute, - $this->getErrorMessage('validation.password.numbers') - ); - } - }); - - if ($validator->fails()) { - return $this->fail($validator->messages()->all()); - } - - if ($this->uncompromised && ! Container::getInstance()->make(UncompromisedVerifier::class)->verify([ - 'value' => $value, - 'threshold' => $this->compromisedThreshold, - ])) { - return $this->fail($this->getErrorMessage('validation.password.uncompromised')); - } - - return true; - } - - /** - * Get the validation error message. - * - * @return array - */ - public function message() - { - return $this->messages; - } - - /** - * Get the translated password error message. - * - * @param string $key - * @return string - */ - protected function getErrorMessage($key) - { - if (($message = $this->validator->getTranslator()->get($key)) !== $key) { - return $message; - } - - $messages = [ - 'validation.password.mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.', - 'validation.password.letters' => 'The :attribute must contain at least one letter.', - 'validation.password.symbols' => 'The :attribute must contain at least one symbol.', - 'validation.password.numbers' => 'The :attribute must contain at least one number.', - 'validation.password.uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', - ]; - - return $messages[$key]; - } - - /** - * Adds the given failures, and return false. - * - * @param array|string $messages - * @return bool - */ - protected function fail($messages) - { - $messages = collect(Arr::wrap($messages))->map(function ($message) { - return $this->validator->getTranslator()->get($message); - })->all(); - - $this->messages = array_merge($this->messages, $messages); - - return false; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/ProhibitedIf.php b/framework-9.50.2/src/Illuminate/Validation/Rules/ProhibitedIf.php deleted file mode 100644 index fdc35cd..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/ProhibitedIf.php +++ /dev/null @@ -1,47 +0,0 @@ -condition = $condition; - } else { - throw new InvalidArgumentException('The provided condition must be a callable or boolean.'); - } - } - - /** - * Convert the rule to a validation string. - * - * @return string - */ - public function __toString() - { - if (is_callable($this->condition)) { - return call_user_func($this->condition) ? 'prohibited' : ''; - } - - return $this->condition ? 'prohibited' : ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/RequiredIf.php b/framework-9.50.2/src/Illuminate/Validation/Rules/RequiredIf.php deleted file mode 100644 index a1ab749..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/RequiredIf.php +++ /dev/null @@ -1,44 +0,0 @@ -condition = $condition; - } else { - throw new InvalidArgumentException('The provided condition must be a callable or boolean.'); - } - } - - /** - * Convert the rule to a validation string. - * - * @return string - */ - public function __toString() - { - if (is_callable($this->condition)) { - return call_user_func($this->condition) ? 'required' : ''; - } - - return $this->condition ? 'required' : ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Rules/Unique.php b/framework-9.50.2/src/Illuminate/Validation/Rules/Unique.php deleted file mode 100644 index 1f4e867..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Rules/Unique.php +++ /dev/null @@ -1,75 +0,0 @@ -ignoreModel($id, $idColumn); - } - - $this->ignore = $id; - $this->idColumn = $idColumn ?? 'id'; - - return $this; - } - - /** - * Ignore the given model during the unique check. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param string|null $idColumn - * @return $this - */ - public function ignoreModel($model, $idColumn = null) - { - $this->idColumn = $idColumn ?? $model->getKeyName(); - $this->ignore = $model->{$this->idColumn}; - - return $this; - } - - /** - * Convert the rule to a validation string. - * - * @return string - */ - public function __toString() - { - return rtrim(sprintf('unique:%s,%s,%s,%s,%s', - $this->table, - $this->column, - $this->ignore ? '"'.addslashes($this->ignore).'"' : 'NULL', - $this->idColumn, - $this->formatWheres() - ), ','); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/UnauthorizedException.php b/framework-9.50.2/src/Illuminate/Validation/UnauthorizedException.php deleted file mode 100644 index ea8a6ec..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/UnauthorizedException.php +++ /dev/null @@ -1,10 +0,0 @@ -prepareForValidation(); - - if (! $this->passesAuthorization()) { - $this->failedAuthorization(); - } - - $instance = $this->getValidatorInstance(); - - if ($this->isPrecognitive()) { - $instance->after(Precognition::afterValidationHook($this)); - } - - if ($instance->fails()) { - $this->failedValidation($instance); - } - - $this->passedValidation(); - } - - /** - * Prepare the data for validation. - * - * @return void - */ - protected function prepareForValidation() - { - // - } - - /** - * Get the validator instance for the request. - * - * @return \Illuminate\Validation\Validator - */ - protected function getValidatorInstance() - { - return $this->validator(); - } - - /** - * Handle a passed validation attempt. - * - * @return void - */ - protected function passedValidation() - { - // - } - - /** - * Handle a failed validation attempt. - * - * @param \Illuminate\Validation\Validator $validator - * @return void - * - * @throws \Illuminate\Validation\ValidationException - */ - protected function failedValidation(Validator $validator) - { - throw new ValidationException($validator); - } - - /** - * Determine if the request passes the authorization check. - * - * @return bool - */ - protected function passesAuthorization() - { - if (method_exists($this, 'authorize')) { - return $this->authorize(); - } - - return true; - } - - /** - * Handle a failed authorization attempt. - * - * @return void - * - * @throws \Illuminate\Validation\UnauthorizedException - */ - protected function failedAuthorization() - { - throw new UnauthorizedException; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/ValidationData.php b/framework-9.50.2/src/Illuminate/Validation/ValidationData.php deleted file mode 100644 index 8d4962d..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/ValidationData.php +++ /dev/null @@ -1,112 +0,0 @@ - $value) { - if ((bool) preg_match('/^'.$pattern.'/', $key, $matches)) { - $keys[] = $matches[0]; - } - } - - $keys = array_unique($keys); - - $data = []; - - foreach ($keys as $key) { - $data[$key] = Arr::get($masterData, $key); - } - - return $data; - } - - /** - * Extract data based on the given dot-notated path. - * - * Used to extract a sub-section of the data for faster iteration. - * - * @param string $attribute - * @param array $masterData - * @return array - */ - public static function extractDataFromPath($attribute, $masterData) - { - $results = []; - - $value = Arr::get($masterData, $attribute, '__missing__'); - - if ($value !== '__missing__') { - Arr::set($results, $attribute, $value); - } - - return $results; - } - - /** - * Get the explicit part of the attribute name. - * - * E.g. 'foo.bar.*.baz' -> 'foo.bar' - * - * Allows us to not spin through all of the flattened data for some operations. - * - * @param string $attribute - * @return string - */ - public static function getLeadingExplicitAttributePath($attribute) - { - return rtrim(explode('*', $attribute)[0], '.') ?: null; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/ValidationException.php b/framework-9.50.2/src/Illuminate/Validation/ValidationException.php deleted file mode 100644 index 31f6f1f..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/ValidationException.php +++ /dev/null @@ -1,163 +0,0 @@ -response = $response; - $this->errorBag = $errorBag; - $this->validator = $validator; - } - - /** - * Create a new validation exception from a plain array of messages. - * - * @param array $messages - * @return static - */ - public static function withMessages(array $messages) - { - return new static(tap(ValidatorFacade::make([], []), function ($validator) use ($messages) { - foreach ($messages as $key => $value) { - foreach (Arr::wrap($value) as $message) { - $validator->errors()->add($key, $message); - } - } - })); - } - - /** - * Create an error message summary from the validation errors. - * - * @param \Illuminate\Contracts\Validation\Validator $validator - * @return string - */ - protected static function summarize($validator) - { - $messages = $validator->errors()->all(); - - if (! count($messages) || ! is_string($messages[0])) { - return $validator->getTranslator()->get('The given data was invalid.'); - } - - $message = array_shift($messages); - - if ($count = count($messages)) { - $pluralized = $count === 1 ? 'error' : 'errors'; - - $message .= ' '.$validator->getTranslator()->get("(and :count more $pluralized)", compact('count')); - } - - return $message; - } - - /** - * Get all of the validation error messages. - * - * @return array - */ - public function errors() - { - return $this->validator->errors()->messages(); - } - - /** - * Set the HTTP status code to be used for the response. - * - * @param int $status - * @return $this - */ - public function status($status) - { - $this->status = $status; - - return $this; - } - - /** - * Set the error bag on the exception. - * - * @param string $errorBag - * @return $this - */ - public function errorBag($errorBag) - { - $this->errorBag = $errorBag; - - return $this; - } - - /** - * Set the URL to redirect to on a validation error. - * - * @param string $url - * @return $this - */ - public function redirectTo($url) - { - $this->redirectTo = $url; - - return $this; - } - - /** - * Get the underlying response instance. - * - * @return \Symfony\Component\HttpFoundation\Response|null - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/ValidationRuleParser.php b/framework-9.50.2/src/Illuminate/Validation/ValidationRuleParser.php deleted file mode 100644 index f34d0a7..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/ValidationRuleParser.php +++ /dev/null @@ -1,341 +0,0 @@ -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, $key); - } - } - - return $rules; - } - - /** - * Explode the explicit rule into an array if necessary. - * - * @param mixed $rule - * @param string $attribute - * @return array - */ - protected function explodeExplicitRule($rule, $attribute) - { - if (is_string($rule)) { - return explode('|', $rule); - } - - if (is_object($rule)) { - return Arr::wrap($this->prepareRule($rule, $attribute)); - } - - return array_map( - [$this, 'prepareRule'], - $rule, - array_fill((int) array_key_first($rule), count($rule), $attribute) - ); - } - - /** - * Prepare the given rule for the Validator. - * - * @param mixed $rule - * @param string $attribute - * @return mixed - */ - protected function prepareRule($rule, $attribute) - { - if ($rule instanceof Closure) { - $rule = new ClosureValidationRule($rule); - } - - if ($rule instanceof InvokableRule) { - $rule = InvokableValidationRule::make($rule); - } - - if (! is_object($rule) || - $rule instanceof RuleContract || - ($rule instanceof Exists && $rule->queryCallbacks()) || - ($rule instanceof Unique && $rule->queryCallbacks())) { - return $rule; - } - - if ($rule instanceof NestedRules) { - return $rule->compile( - $attribute, $this->data[$attribute] ?? null, Arr::dot($this->data) - )->rules[$attribute]; - } - - 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) { - if ($rule instanceof NestedRules) { - $compiled = $rule->compile($key, $value, $data); - - $this->implicitAttributes = array_merge_recursive( - $compiled->implicitAttributes, - $this->implicitAttributes, - [$attribute => [$key]] - ); - - $results = $this->mergeRules($results, $compiled->rules); - } else { - $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], $attribute) : [], $merge - ); - - return $results; - } - - /** - * Extract the rule name and parameters from a rule. - * - * @param array|string $rule - * @return array - */ - public static function parse($rule) - { - if ($rule instanceof RuleContract || $rule instanceof NestedRules) { - return [$rule, []]; - } - - if (is_array($rule)) { - $rule = static::parseArrayRule($rule); - } else { - $rule = static::parseStringRule($rule); - } - - $rule[0] = static::normalizeRule($rule[0]); - - return $rule; - } - - /** - * Parse an array based rule. - * - * @param array $rule - * @return array - */ - protected static function parseArrayRule(array $rule) - { - return [Str::studly(trim(Arr::get($rule, 0, ''))), array_slice($rule, 1)]; - } - - /** - * Parse a string based rule. - * - * @param string $rule - * @return array - */ - protected static function parseStringRule($rule) - { - $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 (str_contains($rule, ':')) { - [$rule, $parameter] = explode(':', $rule, 2); - - $parameters = static::parseParameters($rule, $parameter); - } - - return [Str::studly(trim($rule)), $parameters]; - } - - /** - * Parse a parameter list. - * - * @param string $rule - * @param string $parameter - * @return array - */ - protected static function parseParameters($rule, $parameter) - { - return static::ruleIsRegex($rule) ? [$parameter] : str_getcsv($parameter); - } - - /** - * Determine if the rule is a regular expression. - * - * @param string $rule - * @return bool - */ - protected static function ruleIsRegex($rule) - { - return in_array(strtolower($rule), ['regex', 'not_regex', 'notregex'], true); - } - - /** - * Normalizes a rule so that we can accept short types. - * - * @param string $rule - * @return string - */ - protected static function normalizeRule($rule) - { - return match ($rule) { - 'Int' => 'Integer', - 'Bool' => 'Boolean', - default => $rule, - }; - } - - /** - * Expand and conditional rules in the given array of rules. - * - * @param array $rules - * @param array $data - * @return array - */ - public static function filterConditionalRules($rules, array $data = []) - { - return collect($rules)->mapWithKeys(function ($attributeRules, $attribute) use ($data) { - if (! is_array($attributeRules) && - ! $attributeRules instanceof ConditionalRules) { - return [$attribute => $attributeRules]; - } - - if ($attributeRules instanceof ConditionalRules) { - return [$attribute => $attributeRules->passes($data) - ? array_filter($attributeRules->rules($data)) - : array_filter($attributeRules->defaultRules($data)), ]; - } - - return [$attribute => collect($attributeRules)->map(function ($rule) use ($data) { - if (! $rule instanceof ConditionalRules) { - return [$rule]; - } - - return $rule->passes($data) ? $rule->rules($data) : $rule->defaultRules($data); - })->filter()->flatten(1)->values()->all()]; - })->all(); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/ValidationServiceProvider.php b/framework-9.50.2/src/Illuminate/Validation/ValidationServiceProvider.php deleted file mode 100755 index 936235f..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/ValidationServiceProvider.php +++ /dev/null @@ -1,80 +0,0 @@ -registerPresenceVerifier(); - $this->registerUncompromisedVerifier(); - $this->registerValidationFactory(); - } - - /** - * Register the validation factory. - * - * @return void - */ - protected function registerValidationFactory() - { - $this->app->singleton('validator', function ($app) { - $validator = new Factory($app['translator'], $app); - - // The validation presence verifier is responsible for determining the existence of - // values in a given data collection which is typically a relational database or - // other persistent data stores. It is used to check for "uniqueness" as well. - if (isset($app['db'], $app['validation.presence'])) { - $validator->setPresenceVerifier($app['validation.presence']); - } - - return $validator; - }); - } - - /** - * Register the database presence verifier. - * - * @return void - */ - protected function registerPresenceVerifier() - { - $this->app->singleton('validation.presence', function ($app) { - return new DatabasePresenceVerifier($app['db']); - }); - } - - /** - * Register the uncompromised password verifier. - * - * @return void - */ - protected function registerUncompromisedVerifier() - { - $this->app->singleton(UncompromisedVerifier::class, function ($app) { - return new NotPwnedVerifier($app[HttpFactory::class]); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'validator', 'validation.presence', - ]; - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/Validator.php b/framework-9.50.2/src/Illuminate/Validation/Validator.php deleted file mode 100755 index d065503..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/Validator.php +++ /dev/null @@ -1,1559 +0,0 @@ -dotPlaceholder = Str::random(); - - $this->initialRules = $rules; - $this->translator = $translator; - $this->customMessages = $messages; - $this->data = $this->parseData($data); - $this->customAttributes = $customAttributes; - - $this->setRules($rules); - } - - /** - * Parse the data array, converting dots and asterisks. - * - * @param array $data - * @return array - */ - public function parseData(array $data) - { - $newData = []; - - foreach ($data as $key => $value) { - if (is_array($value)) { - $value = $this->parseData($value); - } - - $key = str_replace( - ['.', '*'], - [$this->dotPlaceholder, '__asterisk__'], - $key - ); - - $newData[$key] = $value; - } - - return $newData; - } - - /** - * Replace the placeholders used in data keys. - * - * @param array $data - * @return array - */ - protected function replacePlaceholders($data) - { - $originalData = []; - - foreach ($data as $key => $value) { - $originalData[$this->replacePlaceholderInString($key)] = is_array($value) - ? $this->replacePlaceholders($value) - : $value; - } - - return $originalData; - } - - /** - * Replace the placeholders in the given string. - * - * @param string $value - * @return string - */ - protected function replacePlaceholderInString(string $value) - { - return str_replace( - [$this->dotPlaceholder, '__asterisk__'], - ['.', '*'], - $value - ); - } - - /** - * Add an after validation callback. - * - * @param callable|string $callback - * @return $this - */ - public function after($callback) - { - $this->after[] = fn () => $callback($this); - - return $this; - } - - /** - * Determine if the data passes the validation rules. - * - * @return bool - */ - public function passes() - { - $this->messages = new MessageBag; - - [$this->distinctValues, $this->failedRules] = [[], []]; - - // We'll spin through each rule, validating the attributes attached to that - // rule. Any error messages will be added to the containers with each of - // the other error messages, returning true if we don't have messages. - foreach ($this->rules as $attribute => $rules) { - if ($this->shouldBeExcluded($attribute)) { - $this->removeAttribute($attribute); - - continue; - } - - if ($this->stopOnFirstFailure && $this->messages->isNotEmpty()) { - break; - } - - foreach ($rules as $rule) { - $this->validateAttribute($attribute, $rule); - - if ($this->shouldBeExcluded($attribute)) { - $this->removeAttribute($attribute); - - break; - } - - if ($this->shouldStopValidating($attribute)) { - break; - } - } - } - - // Here we will spin through all of the "after" hooks on this validator and - // fire them off. This gives the callbacks a chance to perform all kinds - // of other validation that needs to get wrapped up in this operation. - foreach ($this->after as $after) { - $after(); - } - - return $this->messages->isEmpty(); - } - - /** - * Determine if the data fails the validation rules. - * - * @return bool - */ - public function fails() - { - return ! $this->passes(); - } - - /** - * Determine if the attribute should be excluded. - * - * @param string $attribute - * @return bool - */ - protected function shouldBeExcluded($attribute) - { - foreach ($this->excludeAttributes as $excludeAttribute) { - if ($attribute === $excludeAttribute || - Str::startsWith($attribute, $excludeAttribute.'.')) { - return true; - } - } - - return false; - } - - /** - * Remove the given attribute. - * - * @param string $attribute - * @return void - */ - protected function removeAttribute($attribute) - { - Arr::forget($this->data, $attribute); - Arr::forget($this->rules, $attribute); - } - - /** - * Run the validator's rules against its data. - * - * @return array - * - * @throws \Illuminate\Validation\ValidationException - */ - public function validate() - { - throw_if($this->fails(), $this->exception, $this); - - return $this->validated(); - } - - /** - * Run the validator's rules against its data. - * - * @param string $errorBag - * @return array - * - * @throws \Illuminate\Validation\ValidationException - */ - public function validateWithBag(string $errorBag) - { - try { - return $this->validate(); - } catch (ValidationException $e) { - $e->errorBag = $errorBag; - - throw $e; - } - } - - /** - * Get a validated input container for the validated input. - * - * @param array|null $keys - * @return \Illuminate\Support\ValidatedInput|array - */ - public function safe(array $keys = null) - { - return is_array($keys) - ? (new ValidatedInput($this->validated()))->only($keys) - : new ValidatedInput($this->validated()); - } - - /** - * Get the attributes and values that were validated. - * - * @return array - * - * @throws \Illuminate\Validation\ValidationException - */ - public function validated() - { - throw_if($this->invalid(), $this->exception, $this); - - $results = []; - - $missingValue = new stdClass; - - foreach ($this->getRules() as $key => $rules) { - if ($this->excludeUnvalidatedArrayKeys && - in_array('array', $rules) && - ! empty(preg_grep('/^'.preg_quote($key, '/').'\.+/', array_keys($this->getRules())))) { - continue; - } - - $value = data_get($this->getData(), $key, $missingValue); - - if ($value !== $missingValue) { - Arr::set($results, $key, $value); - } - } - - return $this->replacePlaceholders($results); - } - - /** - * Validate a given attribute against a rule. - * - * @param string $attribute - * @param string $rule - * @return void - */ - protected function validateAttribute($attribute, $rule) - { - $this->currentRule = $rule; - - [$rule, $parameters] = ValidationRuleParser::parse($rule); - - if ($rule === '') { - return; - } - - // First we will get the correct keys for the given attribute in case the field is nested in - // an array. Then we determine if the given rule accepts other field names as parameters. - // If so, we will replace any asterisks found in the parameters with the correct keys. - if ($this->dependsOnOtherFields($rule)) { - $parameters = $this->replaceDotInParameters($parameters); - - if ($keys = $this->getExplicitKeys($attribute)) { - $parameters = $this->replaceAsterisksInParameters($parameters, $keys); - } - } - - $value = $this->getValue($attribute); - - // If the attribute is a file, we will verify that the file upload was actually successful - // and if it wasn't we will add a failure for the attribute. Files may not successfully - // upload if they are too large based on PHP's settings so we will bail in this case. - if ($value instanceof UploadedFile && ! $value->isValid() && - $this->hasRule($attribute, array_merge($this->fileRules, $this->implicitRules)) - ) { - return $this->addFailure($attribute, 'uploaded', []); - } - - // If we have made it this far we will make sure the attribute is validatable and if it is - // we will call the validation method with the attribute. If a method returns false the - // attribute is invalid and we will add a failure message for this failing attribute. - $validatable = $this->isValidatable($rule, $attribute, $value); - - if ($rule instanceof RuleContract) { - return $validatable - ? $this->validateUsingCustomRule($attribute, $value, $rule) - : null; - } - - $method = "validate{$rule}"; - - if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) { - $this->addFailure($attribute, $rule, $parameters); - } - } - - /** - * Determine if the given rule depends on other fields. - * - * @param string $rule - * @return bool - */ - protected function dependsOnOtherFields($rule) - { - return in_array($rule, $this->dependentRules); - } - - /** - * Get the explicit keys from an attribute flattened with dot notation. - * - * E.g. 'foo.1.bar.spark.baz' -> [1, 'spark'] for 'foo.*.bar.*.baz' - * - * @param string $attribute - * @return array - */ - protected function getExplicitKeys($attribute) - { - $pattern = str_replace('\*', '([^\.]+)', preg_quote($this->getPrimaryAttribute($attribute), '/')); - - if (preg_match('/^'.$pattern.'/', $attribute, $keys)) { - array_shift($keys); - - return $keys; - } - - return []; - } - - /** - * Get the primary attribute name. - * - * For example, if "name.0" is given, "name.*" will be returned. - * - * @param string $attribute - * @return string - */ - protected function getPrimaryAttribute($attribute) - { - foreach ($this->implicitAttributes as $unparsed => $parsed) { - if (in_array($attribute, $parsed, true)) { - return $unparsed; - } - } - - return $attribute; - } - - /** - * Replace each field parameter which has an escaped dot with the dot placeholder. - * - * @param array $parameters - * @return array - */ - protected function replaceDotInParameters(array $parameters) - { - return array_map(function ($field) { - return str_replace('\.', $this->dotPlaceholder, $field); - }, $parameters); - } - - /** - * Replace each field parameter which has asterisks with the given keys. - * - * @param array $parameters - * @param array $keys - * @return array - */ - protected function replaceAsterisksInParameters(array $parameters, array $keys) - { - return array_map(function ($field) use ($keys) { - return vsprintf(str_replace('*', '%s', $field), $keys); - }, $parameters); - } - - /** - * Determine if the attribute is validatable. - * - * @param object|string $rule - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function isValidatable($rule, $attribute, $value) - { - if (in_array($rule, $this->excludeRules)) { - return true; - } - - return $this->presentOrRuleIsImplicit($rule, $attribute, $value) && - $this->passesOptionalCheck($attribute) && - $this->isNotNullIfMarkedAsNullable($rule, $attribute) && - $this->hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute); - } - - /** - * Determine if the field is present, or the rule implies required. - * - * @param object|string $rule - * @param string $attribute - * @param mixed $value - * @return bool - */ - protected function presentOrRuleIsImplicit($rule, $attribute, $value) - { - if (is_string($value) && trim($value) === '') { - return $this->isImplicit($rule); - } - - return $this->validatePresent($attribute, $value) || - $this->isImplicit($rule); - } - - /** - * Determine if a given rule implies the attribute is required. - * - * @param object|string $rule - * @return bool - */ - protected function isImplicit($rule) - { - return $rule instanceof ImplicitRule || - in_array($rule, $this->implicitRules); - } - - /** - * Determine if the attribute passes any optional check. - * - * @param string $attribute - * @return bool - */ - protected function passesOptionalCheck($attribute) - { - if (! $this->hasRule($attribute, ['Sometimes'])) { - return true; - } - - $data = ValidationData::initializeAndGatherData($attribute, $this->data); - - return array_key_exists($attribute, $data) - || array_key_exists($attribute, $this->data); - } - - /** - * Determine if the attribute fails the nullable check. - * - * @param string $rule - * @param string $attribute - * @return bool - */ - protected function isNotNullIfMarkedAsNullable($rule, $attribute) - { - if ($this->isImplicit($rule) || ! $this->hasRule($attribute, ['Nullable'])) { - return true; - } - - return ! is_null(Arr::get($this->data, $attribute, 0)); - } - - /** - * Determine if it's a necessary presence validation. - * - * This is to avoid possible database type comparison errors. - * - * @param string $rule - * @param string $attribute - * @return bool - */ - protected function hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute) - { - return in_array($rule, ['Unique', 'Exists']) ? ! $this->messages->has($attribute) : true; - } - - /** - * Validate an attribute using a custom rule object. - * - * @param string $attribute - * @param mixed $value - * @param \Illuminate\Contracts\Validation\Rule $rule - * @return void - */ - protected function validateUsingCustomRule($attribute, $value, $rule) - { - $attribute = $this->replacePlaceholderInString($attribute); - - $value = is_array($value) ? $this->replacePlaceholders($value) : $value; - - if ($rule instanceof ValidatorAwareRule) { - $rule->setValidator($this); - } - - if ($rule instanceof DataAwareRule) { - $rule->setData($this->data); - } - - if (! $rule->passes($attribute, $value)) { - $ruleClass = $rule instanceof InvokableValidationRule ? - get_class($rule->invokable()) : - get_class($rule); - - $this->failedRules[$attribute][$ruleClass] = []; - - $messages = $this->getFromLocalArray($attribute, $ruleClass) ?? $rule->message(); - - $messages = $messages ? (array) $messages : [$ruleClass]; - - foreach ($messages as $key => $message) { - $key = is_string($key) ? $key : $attribute; - - $this->messages->add($key, $this->makeReplacements( - $message, $key, $ruleClass, [] - )); - } - } - } - - /** - * Check if we should stop further validations on a given attribute. - * - * @param string $attribute - * @return bool - */ - protected function shouldStopValidating($attribute) - { - $cleanedAttribute = $this->replacePlaceholderInString($attribute); - - if ($this->hasRule($attribute, ['Bail'])) { - return $this->messages->has($cleanedAttribute); - } - - if (isset($this->failedRules[$cleanedAttribute]) && - array_key_exists('uploaded', $this->failedRules[$cleanedAttribute])) { - return true; - } - - // In case the attribute has any rule that indicates that the field is required - // and that rule already failed then we should stop validation at this point - // as now there is no point in calling other rules with this field empty. - return $this->hasRule($attribute, $this->implicitRules) && - isset($this->failedRules[$cleanedAttribute]) && - array_intersect(array_keys($this->failedRules[$cleanedAttribute]), $this->implicitRules); - } - - /** - * Add a failed rule and error message to the collection. - * - * @param string $attribute - * @param string $rule - * @param array $parameters - * @return void - */ - public function addFailure($attribute, $rule, $parameters = []) - { - if (! $this->messages) { - $this->passes(); - } - - $attributeWithPlaceholders = $attribute; - - $attribute = $this->replacePlaceholderInString($attribute); - - if (in_array($rule, $this->excludeRules)) { - return $this->excludeAttribute($attribute); - } - - $this->messages->add($attribute, $this->makeReplacements( - $this->getMessage($attributeWithPlaceholders, $rule), $attribute, $rule, $parameters - )); - - $this->failedRules[$attribute][$rule] = $parameters; - } - - /** - * Add the given attribute to the list of excluded attributes. - * - * @param string $attribute - * @return void - */ - protected function excludeAttribute(string $attribute) - { - $this->excludeAttributes[] = $attribute; - - $this->excludeAttributes = array_unique($this->excludeAttributes); - } - - /** - * Returns the data which was valid. - * - * @return array - */ - public function valid() - { - if (! $this->messages) { - $this->passes(); - } - - return array_diff_key( - $this->data, $this->attributesThatHaveMessages() - ); - } - - /** - * Returns the data which was invalid. - * - * @return array - */ - public function invalid() - { - if (! $this->messages) { - $this->passes(); - } - - $invalid = array_intersect_key( - $this->data, $this->attributesThatHaveMessages() - ); - - $result = []; - - $failed = Arr::only(Arr::dot($invalid), array_keys($this->failed())); - - foreach ($failed as $key => $failure) { - Arr::set($result, $key, $failure); - } - - return $result; - } - - /** - * Generate an array of all attributes that have messages. - * - * @return array - */ - protected function attributesThatHaveMessages() - { - return collect($this->messages()->toArray())->map(function ($message, $key) { - return explode('.', $key)[0]; - })->unique()->flip()->all(); - } - - /** - * Get the failed validation rules. - * - * @return array - */ - public function failed() - { - return $this->failedRules; - } - - /** - * Get the message container for the validator. - * - * @return \Illuminate\Support\MessageBag - */ - public function messages() - { - if (! $this->messages) { - $this->passes(); - } - - return $this->messages; - } - - /** - * An alternative more semantic shortcut to the message container. - * - * @return \Illuminate\Support\MessageBag - */ - public function errors() - { - return $this->messages(); - } - - /** - * Get the messages for the instance. - * - * @return \Illuminate\Support\MessageBag - */ - public function getMessageBag() - { - return $this->messages(); - } - - /** - * Determine if the given attribute has a rule in the given set. - * - * @param string $attribute - * @param string|array $rules - * @return bool - */ - public function hasRule($attribute, $rules) - { - return ! is_null($this->getRule($attribute, $rules)); - } - - /** - * Get a rule and its parameters for a given attribute. - * - * @param string $attribute - * @param string|array $rules - * @return array|null - */ - protected function getRule($attribute, $rules) - { - if (! array_key_exists($attribute, $this->rules)) { - return; - } - - $rules = (array) $rules; - - foreach ($this->rules[$attribute] as $rule) { - [$rule, $parameters] = ValidationRuleParser::parse($rule); - - if (in_array($rule, $rules)) { - return [$rule, $parameters]; - } - } - } - - /** - * Get the data under validation. - * - * @return array - */ - public function attributes() - { - return $this->getData(); - } - - /** - * Get the data under validation. - * - * @return array - */ - public function getData() - { - return $this->data; - } - - /** - * Set the data under validation. - * - * @param array $data - * @return $this - */ - public function setData(array $data) - { - $this->data = $this->parseData($data); - - $this->setRules($this->initialRules); - - return $this; - } - - /** - * Get the value of a given attribute. - * - * @param string $attribute - * @return mixed - */ - protected function getValue($attribute) - { - return Arr::get($this->data, $attribute); - } - - /** - * Get the validation rules. - * - * @return array - */ - public function getRules() - { - return $this->rules; - } - - /** - * Get the validation rules with key placeholders removed. - * - * @return array - */ - public function getRulesWithoutPlaceholders() - { - return collect($this->rules) - ->mapWithKeys(fn ($value, $key) => [ - str_replace($this->dotPlaceholder, '\\.', $key) => $value, - ]) - ->all(); - } - - /** - * Set the validation rules. - * - * @param array $rules - * @return $this - */ - public function setRules(array $rules) - { - $rules = collect($rules)->mapWithKeys(function ($value, $key) { - return [str_replace('\.', $this->dotPlaceholder, $key) => $value]; - })->toArray(); - - $this->initialRules = $rules; - - $this->rules = []; - - $this->addRules($rules); - - return $this; - } - - /** - * Parse the given rules and merge them into current rules. - * - * @param array $rules - * @return void - */ - public function addRules($rules) - { - // The primary purpose of this parser is to expand any "*" rules to the all - // of the explicit rules needed for the given data. For example the rule - // names.* would get expanded to names.0, names.1, etc. for this data. - $response = (new ValidationRuleParser($this->data)) - ->explode(ValidationRuleParser::filterConditionalRules($rules, $this->data)); - - $this->rules = array_merge_recursive( - $this->rules, $response->rules - ); - - $this->implicitAttributes = array_merge( - $this->implicitAttributes, $response->implicitAttributes - ); - } - - /** - * Add conditions to a given field based on a Closure. - * - * @param string|array $attribute - * @param string|array $rules - * @param callable $callback - * @return $this - */ - public function sometimes($attribute, $rules, callable $callback) - { - $payload = new Fluent($this->data); - - foreach ((array) $attribute as $key) { - $response = (new ValidationRuleParser($this->data))->explode([$key => $rules]); - - $this->implicitAttributes = array_merge($response->implicitAttributes, $this->implicitAttributes); - - foreach ($response->rules as $ruleKey => $ruleValue) { - if ($callback($payload, $this->dataForSometimesIteration($ruleKey, ! str_ends_with($key, '.*')))) { - $this->addRules([$ruleKey => $ruleValue]); - } - } - } - - return $this; - } - - /** - * Get the data that should be injected into the iteration of a wildcard "sometimes" callback. - * - * @param string $attribute - * @return \Illuminate\Support\Fluent|array|mixed - */ - private function dataForSometimesIteration(string $attribute, $removeLastSegmentOfAttribute) - { - $lastSegmentOfAttribute = strrchr($attribute, '.'); - - $attribute = $lastSegmentOfAttribute && $removeLastSegmentOfAttribute - ? Str::replaceLast($lastSegmentOfAttribute, '', $attribute) - : $attribute; - - return is_array($data = data_get($this->data, $attribute)) - ? new Fluent($data) - : $data; - } - - /** - * Instruct the validator to stop validating after the first rule failure. - * - * @param bool $stopOnFirstFailure - * @return $this - */ - public function stopOnFirstFailure($stopOnFirstFailure = true) - { - $this->stopOnFirstFailure = $stopOnFirstFailure; - - return $this; - } - - /** - * Register an array of custom validator extensions. - * - * @param array $extensions - * @return void - */ - public function addExtensions(array $extensions) - { - if ($extensions) { - $keys = array_map([Str::class, 'snake'], array_keys($extensions)); - - $extensions = array_combine($keys, array_values($extensions)); - } - - $this->extensions = array_merge($this->extensions, $extensions); - } - - /** - * Register an array of custom implicit validator extensions. - * - * @param array $extensions - * @return void - */ - public function addImplicitExtensions(array $extensions) - { - $this->addExtensions($extensions); - - foreach ($extensions as $rule => $extension) { - $this->implicitRules[] = Str::studly($rule); - } - } - - /** - * Register an array of custom dependent validator extensions. - * - * @param array $extensions - * @return void - */ - public function addDependentExtensions(array $extensions) - { - $this->addExtensions($extensions); - - foreach ($extensions as $rule => $extension) { - $this->dependentRules[] = Str::studly($rule); - } - } - - /** - * Register a custom validator extension. - * - * @param string $rule - * @param \Closure|string $extension - * @return void - */ - public function addExtension($rule, $extension) - { - $this->extensions[Str::snake($rule)] = $extension; - } - - /** - * Register a custom implicit validator extension. - * - * @param string $rule - * @param \Closure|string $extension - * @return void - */ - public function addImplicitExtension($rule, $extension) - { - $this->addExtension($rule, $extension); - - $this->implicitRules[] = Str::studly($rule); - } - - /** - * Register a custom dependent validator extension. - * - * @param string $rule - * @param \Closure|string $extension - * @return void - */ - public function addDependentExtension($rule, $extension) - { - $this->addExtension($rule, $extension); - - $this->dependentRules[] = Str::studly($rule); - } - - /** - * Register an array of custom validator message replacers. - * - * @param array $replacers - * @return void - */ - public function addReplacers(array $replacers) - { - if ($replacers) { - $keys = array_map([Str::class, 'snake'], array_keys($replacers)); - - $replacers = array_combine($keys, array_values($replacers)); - } - - $this->replacers = array_merge($this->replacers, $replacers); - } - - /** - * Register a custom validator message replacer. - * - * @param string $rule - * @param \Closure|string $replacer - * @return void - */ - public function addReplacer($rule, $replacer) - { - $this->replacers[Str::snake($rule)] = $replacer; - } - - /** - * Set the custom messages for the validator. - * - * @param array $messages - * @return $this - */ - public function setCustomMessages(array $messages) - { - $this->customMessages = array_merge($this->customMessages, $messages); - - return $this; - } - - /** - * Set the custom attributes on the validator. - * - * @param array $attributes - * @return $this - */ - public function setAttributeNames(array $attributes) - { - $this->customAttributes = $attributes; - - return $this; - } - - /** - * Add custom attributes to the validator. - * - * @param array $customAttributes - * @return $this - */ - public function addCustomAttributes(array $customAttributes) - { - $this->customAttributes = array_merge($this->customAttributes, $customAttributes); - - return $this; - } - - /** - * Set the callback that used to format an implicit attribute. - * - * @param callable|null $formatter - * @return $this - */ - public function setImplicitAttributesFormatter(callable $formatter = null) - { - $this->implicitAttributesFormatter = $formatter; - - return $this; - } - - /** - * Set the custom values on the validator. - * - * @param array $values - * @return $this - */ - public function setValueNames(array $values) - { - $this->customValues = $values; - - return $this; - } - - /** - * Add the custom values for the validator. - * - * @param array $customValues - * @return $this - */ - public function addCustomValues(array $customValues) - { - $this->customValues = array_merge($this->customValues, $customValues); - - return $this; - } - - /** - * Set the fallback messages for the validator. - * - * @param array $messages - * @return void - */ - public function setFallbackMessages(array $messages) - { - $this->fallbackMessages = $messages; - } - - /** - * Get the Presence Verifier implementation. - * - * @param string|null $connection - * @return \Illuminate\Validation\PresenceVerifierInterface - * - * @throws \RuntimeException - */ - public function getPresenceVerifier($connection = null) - { - if (! isset($this->presenceVerifier)) { - throw new RuntimeException('Presence verifier has not been set.'); - } - - if ($this->presenceVerifier instanceof DatabasePresenceVerifierInterface) { - $this->presenceVerifier->setConnection($connection); - } - - return $this->presenceVerifier; - } - - /** - * Set the Presence Verifier implementation. - * - * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier - * @return void - */ - public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) - { - $this->presenceVerifier = $presenceVerifier; - } - - /** - * Set the exception to throw upon failed validation. - * - * @param string $exception - * @return $this - * - * @throws \InvalidArgumentException - */ - public function setException($exception) - { - if (! is_a($exception, ValidationException::class, true)) { - throw new InvalidArgumentException( - sprintf('Exception [%s] is invalid. It must extend [%s].', $exception, ValidationException::class) - ); - } - - $this->exception = $exception; - - return $this; - } - - /** - * Get the Translator implementation. - * - * @return \Illuminate\Contracts\Translation\Translator - */ - public function getTranslator() - { - return $this->translator; - } - - /** - * Set the Translator implementation. - * - * @param \Illuminate\Contracts\Translation\Translator $translator - * @return void - */ - public function setTranslator(Translator $translator) - { - $this->translator = $translator; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } - - /** - * Call a custom validator extension. - * - * @param string $rule - * @param array $parameters - * @return bool|null - */ - protected function callExtension($rule, $parameters) - { - $callback = $this->extensions[$rule]; - - if (is_callable($callback)) { - return $callback(...array_values($parameters)); - } elseif (is_string($callback)) { - return $this->callClassBasedExtension($callback, $parameters); - } - } - - /** - * Call a class based validator extension. - * - * @param string $callback - * @param array $parameters - * @return bool - */ - protected function callClassBasedExtension($callback, $parameters) - { - [$class, $method] = Str::parseCallback($callback, 'validate'); - - return $this->container->make($class)->{$method}(...array_values($parameters)); - } - - /** - * Handle dynamic calls to class methods. - * - * @param string $method - * @param array $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - $rule = Str::snake(substr($method, 8)); - - if (isset($this->extensions[$rule])) { - return $this->callExtension($rule, $parameters); - } - - throw new BadMethodCallException(sprintf( - 'Method %s::%s does not exist.', static::class, $method - )); - } -} diff --git a/framework-9.50.2/src/Illuminate/Validation/composer.json b/framework-9.50.2/src/Illuminate/Validation/composer.json deleted file mode 100755 index cbf66c6..0000000 --- a/framework-9.50.2/src/Illuminate/Validation/composer.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "illuminate/validation", - "description": "The Illuminate Validation package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "brick/math": "^0.9.3|^0.10.2|^0.11", - "egulias/email-validator": "^3.2.1|^4.0", - "illuminate/collections": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0", - "illuminate/translation": "^9.0", - "symfony/http-foundation": "^6.0", - "symfony/mime": "^6.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\Validation\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "suggest": { - "illuminate/database": "Required to use the database presence verifier (^9.0)." - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/framework-9.50.2/src/Illuminate/View/AnonymousComponent.php b/framework-9.50.2/src/Illuminate/View/AnonymousComponent.php deleted file mode 100644 index eba6436..0000000 --- a/framework-9.50.2/src/Illuminate/View/AnonymousComponent.php +++ /dev/null @@ -1,60 +0,0 @@ -view = $view; - $this->data = $data; - } - - /** - * Get the view / view contents that represent the component. - * - * @return string - */ - public function render() - { - return $this->view; - } - - /** - * Get the data that should be supplied to the view. - * - * @return array - */ - public function data() - { - $this->attributes = $this->attributes ?: $this->newAttributeBag(); - - return array_merge( - ($this->data['attributes'] ?? null)?->getAttributes() ?: [], - $this->attributes->getAttributes(), - $this->data, - ['attributes' => $this->attributes] - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/AppendableAttributeValue.php b/framework-9.50.2/src/Illuminate/View/AppendableAttributeValue.php deleted file mode 100644 index f275801..0000000 --- a/framework-9.50.2/src/Illuminate/View/AppendableAttributeValue.php +++ /dev/null @@ -1,34 +0,0 @@ -value = $value; - } - - /** - * Get the string value. - * - * @return string - */ - public function __toString() - { - return (string) $this->value; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/BladeCompiler.php b/framework-9.50.2/src/Illuminate/View/Compilers/BladeCompiler.php deleted file mode 100644 index bf4f43d..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/BladeCompiler.php +++ /dev/null @@ -1,1001 +0,0 @@ -setPath($path); - } - - if (! is_null($this->cachePath)) { - $contents = $this->compileString($this->files->get($this->getPath())); - - if (! empty($this->getPath())) { - $contents = $this->appendFilePath($contents); - } - - $this->ensureCompiledDirectoryExists( - $compiledPath = $this->getCompiledPath($this->getPath()) - ); - - $this->files->put($compiledPath, $contents); - } - } - - /** - * Append the file path to the compiled string. - * - * @param string $contents - * @return string - */ - protected function appendFilePath($contents) - { - $tokens = $this->getOpenAndClosingPhpTokens($contents); - - if ($tokens->isNotEmpty() && $tokens->last() !== T_CLOSE_TAG) { - $contents .= ' ?>'; - } - - return $contents."getPath()} ENDPATH**/ ?>"; - } - - /** - * Get the open and closing PHP tag tokens from the given string. - * - * @param string $contents - * @return \Illuminate\Support\Collection - */ - protected function getOpenAndClosingPhpTokens($contents) - { - return collect(token_get_all($contents)) - ->pluck(0) - ->filter(function ($token) { - return in_array($token, [T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG]); - }); - } - - /** - * Get the path currently being compiled. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Set the path currently being compiled. - * - * @param string $path - * @return void - */ - public function setPath($path) - { - $this->path = $path; - } - - /** - * Compile the given Blade template contents. - * - * @param string $value - * @return string - */ - public function compileString($value) - { - [$this->footer, $result] = [[], '']; - - // First we will compile the Blade component tags. This is a precompile style - // step which compiles the component Blade tags into @component directives - // that may be used by Blade. Then we should call any other precompilers. - $value = $this->compileComponentTags( - $this->compileComments($this->storeUncompiledBlocks($value)) - ); - - foreach ($this->precompilers as $precompiler) { - $value = $precompiler($value); - } - - // Here we will loop through all of the tokens returned by the Zend lexer and - // parse each one into the corresponding valid PHP. We will then have this - // template as the correctly rendered PHP that can be rendered natively. - foreach (token_get_all($value) as $token) { - $result .= is_array($token) ? $this->parseToken($token) : $token; - } - - if (! empty($this->rawBlocks)) { - $result = $this->restoreRawContent($result); - } - - // If there are any footer lines that need to get added to a template we will - // add them here at the end of the template. This gets used mainly for the - // template inheritance via the extends keyword that should be appended. - if (count($this->footer) > 0) { - $result = $this->addFooters($result); - } - - if (! empty($this->echoHandlers)) { - $result = $this->addBladeCompilerVariable($result); - } - - return str_replace( - ['##BEGIN-COMPONENT-CLASS##', '##END-COMPONENT-CLASS##'], - '', - $result); - } - - /** - * Evaluate and render a Blade string to HTML. - * - * @param string $string - * @param array $data - * @param bool $deleteCachedView - * @return string - */ - public static function render($string, $data = [], $deleteCachedView = false) - { - $component = new class($string) extends Component - { - protected $template; - - public function __construct($template) - { - $this->template = $template; - } - - public function render() - { - return $this->template; - } - }; - - $view = Container::getInstance() - ->make(ViewFactory::class) - ->make($component->resolveView(), $data); - - return tap($view->render(), function () use ($view, $deleteCachedView) { - if ($deleteCachedView) { - unlink($view->getPath()); - } - }); - } - - /** - * Render a component instance to HTML. - * - * @param \Illuminate\View\Component $component - * @return string - */ - public static function renderComponent(Component $component) - { - $data = $component->data(); - - $view = value($component->resolveView(), $data); - - if ($view instanceof View) { - return $view->with($data)->render(); - } elseif ($view instanceof Htmlable) { - return $view->toHtml(); - } else { - return Container::getInstance() - ->make(ViewFactory::class) - ->make($view, $data) - ->render(); - } - } - - /** - * Store the blocks that do not receive compilation. - * - * @param string $value - * @return string - */ - protected function storeUncompiledBlocks($value) - { - if (str_contains($value, '@verbatim')) { - $value = $this->storeVerbatimBlocks($value); - } - - if (str_contains($value, '@php')) { - $value = $this->storePhpBlocks($value); - } - - return $value; - } - - /** - * Store the verbatim blocks and replace them with a temporary placeholder. - * - * @param string $value - * @return string - */ - protected function storeVerbatimBlocks($value) - { - return preg_replace_callback('/(?storeRawBlock($matches[1]); - }, $value); - } - - /** - * Store the PHP blocks and replace them with a temporary placeholder. - * - * @param string $value - * @return string - */ - protected function storePhpBlocks($value) - { - return preg_replace_callback('/(?storeRawBlock(""); - }, $value); - } - - /** - * Store a raw block and return a unique raw placeholder. - * - * @param string $value - * @return string - */ - protected function storeRawBlock($value) - { - return $this->getRawPlaceholder( - array_push($this->rawBlocks, $value) - 1 - ); - } - - /** - * Compile the component tags. - * - * @param string $value - * @return string - */ - protected function compileComponentTags($value) - { - if (! $this->compilesComponentTags) { - return $value; - } - - return (new ComponentTagCompiler( - $this->classComponentAliases, $this->classComponentNamespaces, $this - ))->compile($value); - } - - /** - * Replace the raw placeholders with the original code stored in the raw blocks. - * - * @param string $result - * @return string - */ - protected function restoreRawContent($result) - { - $result = preg_replace_callback('/'.$this->getRawPlaceholder('(\d+)').'/', function ($matches) { - return $this->rawBlocks[$matches[1]]; - }, $result); - - $this->rawBlocks = []; - - return $result; - } - - /** - * Get a placeholder to temporarily mark the position of raw blocks. - * - * @param int|string $replace - * @return string - */ - protected function getRawPlaceholder($replace) - { - return str_replace('#', $replace, '@__raw_block_#__@'); - } - - /** - * Add the stored footers onto the given content. - * - * @param string $result - * @return string - */ - protected function addFooters($result) - { - return ltrim($result, "\n") - ."\n".implode("\n", array_reverse($this->footer)); - } - - /** - * Parse the tokens from the template. - * - * @param array $token - * @return string - */ - protected function parseToken($token) - { - [$id, $content] = $token; - - if ($id == T_INLINE_HTML) { - foreach ($this->compilers as $type) { - $content = $this->{"compile{$type}"}($content); - } - } - - return $content; - } - - /** - * Execute the user defined extensions. - * - * @param string $value - * @return string - */ - protected function compileExtensions($value) - { - foreach ($this->extensions as $compiler) { - $value = $compiler($value, $this); - } - - return $value; - } - - /** - * Compile Blade statements that start with "@". - * - * @param string $template - * @return string - */ - protected function compileStatements($template) - { - preg_match_all('/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( [\S\s]*? ) \))?/x', $template, $matches); - - $offset = 0; - - for ($i = 0; isset($matches[0][$i]); $i++) { - $match = [ - $matches[0][$i], - $matches[1][$i], - $matches[2][$i], - $matches[3][$i] ?: null, - $matches[4][$i] ?: null, - ]; - - // Here we check to see if we have properly found the closing parenthesis by - // regex pattern or not, and will recursively continue on to the next ")" - // then check again until the tokenizer confirms we find the right one. - while (isset($match[4]) && - Str::endsWith($match[0], ')') && - ! $this->hasEvenNumberOfParentheses($match[0])) { - if (($after = Str::after($template, $match[0])) === $template) { - break; - } - - $rest = Str::before($after, ')'); - - if (isset($matches[0][$i + 1]) && Str::contains($rest.')', $matches[0][$i + 1])) { - unset($matches[0][$i + 1]); - $i++; - } - - $match[0] = $match[0].$rest.')'; - $match[3] = $match[3].$rest.')'; - $match[4] = $match[4].$rest; - } - - [$template, $offset] = $this->replaceFirstStatement( - $match[0], - $this->compileStatement($match), - $template, - $offset - ); - } - - return $template; - } - - /** - * Replace the first match for a statement compilation operation. - * - * @param string $search - * @param string $replace - * @param string $subject - * @param int $offset - * @return array - */ - protected function replaceFirstStatement($search, $replace, $subject, $offset) - { - $search = (string) $search; - - if ($search === '') { - return $subject; - } - - $position = strpos($subject, $search, $offset); - - if ($position !== false) { - return [ - substr_replace($subject, $replace, $position, strlen($search)), - $position + strlen($replace), - ]; - } - - return [$subject, 0]; - } - - /** - * Determine if the given expression has the same number of opening and closing parentheses. - * - * @param string $expression - * @return bool - */ - protected function hasEvenNumberOfParentheses(string $expression) - { - $tokens = token_get_all('customDirectives[$match[1]])) { - $match[0] = $this->callCustomDirective($match[1], Arr::get($match, 3)); - } elseif (method_exists($this, $method = 'compile'.ucfirst($match[1]))) { - $match[0] = $this->$method(Arr::get($match, 3)); - } else { - return $match[0]; - } - - return isset($match[3]) ? $match[0] : $match[0].$match[2]; - } - - /** - * Call the given directive with the given value. - * - * @param string $name - * @param string|null $value - * @return string - */ - protected function callCustomDirective($name, $value) - { - $value ??= ''; - - if (str_starts_with($value, '(') && str_ends_with($value, ')')) { - $value = Str::substr($value, 1, -1); - } - - return call_user_func($this->customDirectives[$name], trim($value)); - } - - /** - * Strip the parentheses from the given expression. - * - * @param string $expression - * @return string - */ - public function stripParentheses($expression) - { - if (Str::startsWith($expression, '(')) { - $expression = substr($expression, 1, -1); - } - - return $expression; - } - - /** - * Register a custom Blade compiler. - * - * @param callable $compiler - * @return void - */ - public function extend(callable $compiler) - { - $this->extensions[] = $compiler; - } - - /** - * Get the extensions used by the compiler. - * - * @return array - */ - public function getExtensions() - { - return $this->extensions; - } - - /** - * Register an "if" statement directive. - * - * @param string $name - * @param callable $callback - * @return void - */ - public function if($name, callable $callback) - { - $this->conditions[$name] = $callback; - - $this->directive($name, function ($expression) use ($name) { - return $expression !== '' - ? "" - : ""; - }); - - $this->directive('unless'.$name, function ($expression) use ($name) { - return $expression !== '' - ? "" - : ""; - }); - - $this->directive('else'.$name, function ($expression) use ($name) { - return $expression !== '' - ? "" - : ""; - }); - - $this->directive('end'.$name, function () { - return ''; - }); - } - - /** - * Check the result of a condition. - * - * @param string $name - * @param array ...$parameters - * @return bool - */ - public function check($name, ...$parameters) - { - return call_user_func($this->conditions[$name], ...$parameters); - } - - /** - * Register a class-based component alias directive. - * - * @param string $class - * @param string|null $alias - * @param string $prefix - * @return void - */ - public function component($class, $alias = null, $prefix = '') - { - if (! is_null($alias) && str_contains($alias, '\\')) { - [$class, $alias] = [$alias, $class]; - } - - if (is_null($alias)) { - $alias = str_contains($class, '\\View\\Components\\') - ? collect(explode('\\', Str::after($class, '\\View\\Components\\')))->map(function ($segment) { - return Str::kebab($segment); - })->implode(':') - : Str::kebab(class_basename($class)); - } - - if (! empty($prefix)) { - $alias = $prefix.'-'.$alias; - } - - $this->classComponentAliases[$alias] = $class; - } - - /** - * Register an array of class-based components. - * - * @param array $components - * @param string $prefix - * @return void - */ - public function components(array $components, $prefix = '') - { - foreach ($components as $key => $value) { - if (is_numeric($key)) { - $this->component($value, null, $prefix); - } else { - $this->component($key, $value, $prefix); - } - } - } - - /** - * Get the registered class component aliases. - * - * @return array - */ - public function getClassComponentAliases() - { - return $this->classComponentAliases; - } - - /** - * Register a new anonymous component path. - * - * @param string $path - * @param string|null $prefix - * @return void - */ - public function anonymousComponentPath(string $path, string $prefix = null) - { - $prefixHash = md5($prefix ?: $path); - - $this->anonymousComponentPaths[] = [ - 'path' => $path, - 'prefix' => $prefix, - 'prefixHash' => $prefixHash, - ]; - - Container::getInstance() - ->make(ViewFactory::class) - ->addNamespace($prefixHash, $path); - } - - /** - * Register an anonymous component namespace. - * - * @param string $directory - * @param string|null $prefix - * @return void - */ - public function anonymousComponentNamespace(string $directory, string $prefix = null) - { - $prefix ??= $directory; - - $this->anonymousComponentNamespaces[$prefix] = Str::of($directory) - ->replace('/', '.') - ->trim('. ') - ->toString(); - } - - /** - * Register a class-based component namespace. - * - * @param string $namespace - * @param string $prefix - * @return void - */ - public function componentNamespace($namespace, $prefix) - { - $this->classComponentNamespaces[$prefix] = $namespace; - } - - /** - * Get the registered anonymous component paths. - * - * @return array - */ - public function getAnonymousComponentPaths() - { - return $this->anonymousComponentPaths; - } - - /** - * Get the registered anonymous component namespaces. - * - * @return array - */ - public function getAnonymousComponentNamespaces() - { - return $this->anonymousComponentNamespaces; - } - - /** - * Get the registered class component namespaces. - * - * @return array - */ - public function getClassComponentNamespaces() - { - return $this->classComponentNamespaces; - } - - /** - * Register a component alias directive. - * - * @param string $path - * @param string|null $alias - * @return void - */ - public function aliasComponent($path, $alias = null) - { - $alias = $alias ?: Arr::last(explode('.', $path)); - - $this->directive($alias, function ($expression) use ($path) { - return $expression - ? "startComponent('{$path}', {$expression}); ?>" - : "startComponent('{$path}'); ?>"; - }); - - $this->directive('end'.$alias, function ($expression) { - return 'renderComponent(); ?>'; - }); - } - - /** - * Register an include alias directive. - * - * @param string $path - * @param string|null $alias - * @return void - */ - public function include($path, $alias = null) - { - $this->aliasInclude($path, $alias); - } - - /** - * Register an include alias directive. - * - * @param string $path - * @param string|null $alias - * @return void - */ - public function aliasInclude($path, $alias = null) - { - $alias = $alias ?: Arr::last(explode('.', $path)); - - $this->directive($alias, function ($expression) use ($path) { - $expression = $this->stripParentheses($expression) ?: '[]'; - - return "make('{$path}', {$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; - }); - } - - /** - * Register a handler for custom directives. - * - * @param string $name - * @param callable $handler - * @return void - * - * @throws \InvalidArgumentException - */ - public function directive($name, callable $handler) - { - if (! preg_match('/^\w+(?:::\w+)?$/x', $name)) { - throw new InvalidArgumentException("The directive name [{$name}] is not valid. Directive names must only contain alphanumeric characters and underscores."); - } - - $this->customDirectives[$name] = $handler; - } - - /** - * Get the list of custom directives. - * - * @return array - */ - public function getCustomDirectives() - { - return $this->customDirectives; - } - - /** - * Register a new precompiler. - * - * @param callable $precompiler - * @return void - */ - public function precompiler(callable $precompiler) - { - $this->precompilers[] = $precompiler; - } - - /** - * Set the echo format to be used by the compiler. - * - * @param string $format - * @return void - */ - public function setEchoFormat($format) - { - $this->echoFormat = $format; - } - - /** - * Set the "echo" format to double encode entities. - * - * @return void - */ - public function withDoubleEncoding() - { - $this->setEchoFormat('e(%s, true)'); - } - - /** - * Set the "echo" format to not double encode entities. - * - * @return void - */ - public function withoutDoubleEncoding() - { - $this->setEchoFormat('e(%s, false)'); - } - - /** - * Indicate that component tags should not be compiled. - * - * @return void - */ - public function withoutComponentTags() - { - $this->compilesComponentTags = false; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Compiler.php b/framework-9.50.2/src/Illuminate/View/Compilers/Compiler.php deleted file mode 100755 index 90c5d60..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Compiler.php +++ /dev/null @@ -1,124 +0,0 @@ -files = $files; - $this->cachePath = $cachePath; - $this->basePath = $basePath; - $this->shouldCache = $shouldCache; - $this->compiledExtension = $compiledExtension; - } - - /** - * Get the path to the compiled version of a view. - * - * @param string $path - * @return string - */ - public function getCompiledPath($path) - { - return $this->cachePath.'/'.sha1('v2'.Str::after($path, $this->basePath)).'.'.$this->compiledExtension; - } - - /** - * Determine if the view at the given path is expired. - * - * @param string $path - * @return bool - */ - public function isExpired($path) - { - if (! $this->shouldCache) { - return true; - } - - $compiled = $this->getCompiledPath($path); - - // If the compiled file doesn't exist we will indicate that the view is expired - // so that it can be re-compiled. Else, we will verify the last modification - // of the views is less than the modification times of the compiled views. - if (! $this->files->exists($compiled)) { - return true; - } - - return $this->files->lastModified($path) >= - $this->files->lastModified($compiled); - } - - /** - * Create the compiled file directory if necessary. - * - * @param string $path - * @return void - */ - protected function ensureCompiledDirectoryExists($path) - { - if (! $this->files->exists(dirname($path))) { - $this->files->makeDirectory(dirname($path), 0777, true, true); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/CompilerInterface.php b/framework-9.50.2/src/Illuminate/View/Compilers/CompilerInterface.php deleted file mode 100755 index dfcb023..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/CompilerInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @author Taylor Otwell - */ -class ComponentTagCompiler -{ - /** - * The Blade compiler instance. - * - * @var \Illuminate\View\Compilers\BladeCompiler - */ - protected $blade; - - /** - * The component class aliases. - * - * @var array - */ - protected $aliases = []; - - /** - * The component class namespaces. - * - * @var array - */ - protected $namespaces = []; - - /** - * The "bind:" attributes that have been compiled for the current component. - * - * @var array - */ - protected $boundAttributes = []; - - /** - * Create a new component tag compiler. - * - * @param array $aliases - * @param array $namespaces - * @param \Illuminate\View\Compilers\BladeCompiler|null $blade - * @return void - */ - public function __construct(array $aliases = [], array $namespaces = [], ?BladeCompiler $blade = null) - { - $this->aliases = $aliases; - $this->namespaces = $namespaces; - - $this->blade = $blade ?: new BladeCompiler(new Filesystem, sys_get_temp_dir()); - } - - /** - * Compile the component and slot tags within the given string. - * - * @param string $value - * @return string - */ - public function compile(string $value) - { - $value = $this->compileSlots($value); - - return $this->compileTags($value); - } - - /** - * Compile the tags within the given string. - * - * @param string $value - * @return string - * - * @throws \InvalidArgumentException - */ - public function compileTags(string $value) - { - $value = $this->compileSelfClosingTags($value); - $value = $this->compileOpeningTags($value); - $value = $this->compileClosingTags($value); - - return $value; - } - - /** - * Compile the opening tags within the given string. - * - * @param string $value - * @return string - * - * @throws \InvalidArgumentException - */ - protected function compileOpeningTags(string $value) - { - $pattern = "/ - < - \s* - x[-\:]([\w\-\:\.]*) - (? - (?: - \s+ - (?: - (?: - @(?:class)(\( (?: (?>[^()]+) | (?-1) )* \)) - ) - | - (?: - @(?:style)(\( (?: (?>[^()]+) | (?-1) )* \)) - ) - | - (?: - \{\{\s*\\\$attributes(?:[^}]+?)?\s*\}\} - ) - | - (?: - (\:\\\$)(\w+) - ) - | - (?: - [\w\-:.@]+ - ( - = - (?: - \\\"[^\\\"]*\\\" - | - \'[^\']*\' - | - [^\'\\\"=<>]+ - ) - )? - ) - ) - )* - \s* - ) - (? - /x"; - - return preg_replace_callback($pattern, function (array $matches) { - $this->boundAttributes = []; - - $attributes = $this->getAttributesFromAttributeString($matches['attributes']); - - return $this->componentString($matches[1], $attributes); - }, $value); - } - - /** - * Compile the self-closing tags within the given string. - * - * @param string $value - * @return string - * - * @throws \InvalidArgumentException - */ - protected function compileSelfClosingTags(string $value) - { - $pattern = "/ - < - \s* - x[-\:]([\w\-\:\.]*) - \s* - (? - (?: - \s+ - (?: - (?: - @(?:class)(\( (?: (?>[^()]+) | (?-1) )* \)) - ) - | - (?: - @(?:style)(\( (?: (?>[^()]+) | (?-1) )* \)) - ) - | - (?: - \{\{\s*\\\$attributes(?:[^}]+?)?\s*\}\} - ) - | - (?: - (\:\\\$)(\w+) - ) - | - (?: - [\w\-:.@]+ - ( - = - (?: - \\\"[^\\\"]*\\\" - | - \'[^\']*\' - | - [^\'\\\"=<>]+ - ) - )? - ) - ) - )* - \s* - ) - \/> - /x"; - - return preg_replace_callback($pattern, function (array $matches) { - $this->boundAttributes = []; - - $attributes = $this->getAttributesFromAttributeString($matches['attributes']); - - return $this->componentString($matches[1], $attributes)."\n@endComponentClass##END-COMPONENT-CLASS##"; - }, $value); - } - - /** - * Compile the Blade component string for the given component and attributes. - * - * @param string $component - * @param array $attributes - * @return string - * - * @throws \InvalidArgumentException - */ - protected function componentString(string $component, array $attributes) - { - $class = $this->componentClass($component); - - [$data, $attributes] = $this->partitionDataAndAttributes($class, $attributes); - - $data = $data->mapWithKeys(function ($value, $key) { - return [Str::camel($key) => $value]; - }); - - // If the component doesn't exist as a class, we'll assume it's a class-less - // component and pass the component as a view parameter to the data so it - // can be accessed within the component and we can render out the view. - if (! class_exists($class)) { - $view = Str::startsWith($component, 'mail::') - ? "\$__env->getContainer()->make(Illuminate\\View\\Factory::class)->make('{$component}')" - : "'$class'"; - - $parameters = [ - 'view' => $view, - 'data' => '['.$this->attributesToString($data->all(), $escapeBound = false).']', - ]; - - $class = AnonymousComponent::class; - } else { - $parameters = $data->all(); - } - - return "##BEGIN-COMPONENT-CLASS##@component('{$class}', '{$component}', [".$this->attributesToString($parameters, $escapeBound = false).']) -getConstructor()): ?> -except(collect($constructor->getParameters())->map->getName()->all()); ?> - -withAttributes(['.$this->attributesToString($attributes->all(), $escapeAttributes = $class !== DynamicComponent::class).']); ?>'; - } - - /** - * Get the component class for a given component alias. - * - * @param string $component - * @return string - * - * @throws \InvalidArgumentException - */ - public function componentClass(string $component) - { - $viewFactory = Container::getInstance()->make(Factory::class); - - if (isset($this->aliases[$component])) { - if (class_exists($alias = $this->aliases[$component])) { - return $alias; - } - - if ($viewFactory->exists($alias)) { - return $alias; - } - - throw new InvalidArgumentException( - "Unable to locate class or view [{$alias}] for component [{$component}]." - ); - } - - if ($class = $this->findClassByComponent($component)) { - return $class; - } - - if (class_exists($class = $this->guessClassName($component))) { - return $class; - } - - if (! is_null($guess = $this->guessAnonymousComponentUsingNamespaces($viewFactory, $component)) || - ! is_null($guess = $this->guessAnonymousComponentUsingPaths($viewFactory, $component))) { - return $guess; - } - - if (Str::startsWith($component, 'mail::')) { - return $component; - } - - throw new InvalidArgumentException( - "Unable to locate a class or view for component [{$component}]." - ); - } - - /** - * Attempt to find an anonymous component using the registered anonymous component paths. - * - * @param \Illuminate\Contracts\View\Factory $viewFactory - * @param string $component - * @return string|null - */ - protected function guessAnonymousComponentUsingPaths(Factory $viewFactory, string $component) - { - $delimiter = ViewFinderInterface::HINT_PATH_DELIMITER; - - foreach ($this->blade->getAnonymousComponentPaths() as $path) { - try { - if (str_contains($component, $delimiter) && - ! str_starts_with($component, $path['prefix'].$delimiter)) { - continue; - } - - $formattedComponent = str_starts_with($component, $path['prefix'].$delimiter) - ? Str::after($component, $delimiter) - : $component; - - if (! is_null($guess = match (true) { - $viewFactory->exists($guess = $path['prefixHash'].$delimiter.$formattedComponent) => $guess, - $viewFactory->exists($guess = $path['prefixHash'].$delimiter.$formattedComponent.'.index') => $guess, - default => null, - })) { - return $guess; - } - } catch (InvalidArgumentException $e) { - // - } - } - } - - /** - * Attempt to find an anonymous component using the registered anonymous component namespaces. - * - * @param \Illuminate\Contracts\View\Factory $viewFactory - * @param string $component - * @return string|null - */ - protected function guessAnonymousComponentUsingNamespaces(Factory $viewFactory, string $component) - { - return collect($this->blade->getAnonymousComponentNamespaces()) - ->filter(function ($directory, $prefix) use ($component) { - return Str::startsWith($component, $prefix.'::'); - }) - ->prepend('components', $component) - ->reduce(function ($carry, $directory, $prefix) use ($component, $viewFactory) { - if (! is_null($carry)) { - return $carry; - } - - $componentName = Str::after($component, $prefix.'::'); - - if ($viewFactory->exists($view = $this->guessViewName($componentName, $directory))) { - return $view; - } - - if ($viewFactory->exists($view = $this->guessViewName($componentName, $directory).'.index')) { - return $view; - } - }); - } - - /** - * Find the class for the given component using the registered namespaces. - * - * @param string $component - * @return string|null - */ - public function findClassByComponent(string $component) - { - $segments = explode('::', $component); - - $prefix = $segments[0]; - - if (! isset($this->namespaces[$prefix], $segments[1])) { - return; - } - - if (class_exists($class = $this->namespaces[$prefix].'\\'.$this->formatClassName($segments[1]))) { - return $class; - } - } - - /** - * Guess the class name for the given component. - * - * @param string $component - * @return string - */ - public function guessClassName(string $component) - { - $namespace = Container::getInstance() - ->make(Application::class) - ->getNamespace(); - - $class = $this->formatClassName($component); - - return $namespace.'View\\Components\\'.$class; - } - - /** - * Format the class name for the given component. - * - * @param string $component - * @return string - */ - public function formatClassName(string $component) - { - $componentPieces = array_map(function ($componentPiece) { - return ucfirst(Str::camel($componentPiece)); - }, explode('.', $component)); - - return implode('\\', $componentPieces); - } - - /** - * Guess the view name for the given component. - * - * @param string $name - * @param string $prefix - * @return string - */ - public function guessViewName($name, $prefix = 'components.') - { - if (! Str::endsWith($prefix, '.')) { - $prefix .= '.'; - } - - $delimiter = ViewFinderInterface::HINT_PATH_DELIMITER; - - if (str_contains($name, $delimiter)) { - return Str::replaceFirst($delimiter, $delimiter.$prefix, $name); - } - - return $prefix.$name; - } - - /** - * Partition the data and extra attributes from the given array of attributes. - * - * @param string $class - * @param array $attributes - * @return array - */ - public function partitionDataAndAttributes($class, array $attributes) - { - // If the class doesn't exist, we'll assume it is a class-less component and - // return all of the attributes as both data and attributes since we have - // now way to partition them. The user can exclude attributes manually. - if (! class_exists($class)) { - return [collect($attributes), collect($attributes)]; - } - - $constructor = (new ReflectionClass($class))->getConstructor(); - - $parameterNames = $constructor - ? collect($constructor->getParameters())->map->getName()->all() - : []; - - return collect($attributes)->partition(function ($value, $key) use ($parameterNames) { - return in_array(Str::camel($key), $parameterNames); - })->all(); - } - - /** - * Compile the closing tags within the given string. - * - * @param string $value - * @return string - */ - protected function compileClosingTags(string $value) - { - return preg_replace("/<\/\s*x[-\:][\w\-\:\.]*\s*>/", ' @endComponentClass##END-COMPONENT-CLASS##', $value); - } - - /** - * Compile the slot tags within the given string. - * - * @param string $value - * @return string - */ - public function compileSlots(string $value) - { - $pattern = "/ - < - \s* - x[\-\:]slot - (?:\:(?\w+(?:-\w+)*))? - (?:\s+(:?)name=(?(\"[^\"]+\"|\\\'[^\\\']+\\\'|[^\s>]+)))? - (? - (?: - \s+ - (?: - (?: - @(?:class)(\( (?: (?>[^()]+) | (?-1) )* \)) - ) - | - (?: - @(?:style)(\( (?: (?>[^()]+) | (?-1) )* \)) - ) - | - (?: - \{\{\s*\\\$attributes(?:[^}]+?)?\s*\}\} - ) - | - (?: - [\w\-:.@]+ - ( - = - (?: - \\\"[^\\\"]*\\\" - | - \'[^\']*\' - | - [^\'\\\"=<>]+ - ) - )? - ) - ) - )* - \s* - ) - (? - /x"; - - $value = preg_replace_callback($pattern, function ($matches) { - $name = $this->stripQuotes($matches['inlineName'] ?: $matches['name']); - - if (Str::contains($name, '-') && ! empty($matches['inlineName'])) { - $name = Str::camel($name); - } - - if ($matches[2] !== ':') { - $name = "'{$name}'"; - } - - $this->boundAttributes = []; - - $attributes = $this->getAttributesFromAttributeString($matches['attributes']); - - return " @slot({$name}, null, [".$this->attributesToString($attributes).']) '; - }, $value); - - return preg_replace('/<\/\s*x[\-\:]slot[^>]*>/', ' @endslot', $value); - } - - /** - * Get an array of attributes from the given attribute string. - * - * @param string $attributeString - * @return array - */ - protected function getAttributesFromAttributeString(string $attributeString) - { - $attributeString = $this->parseShortAttributeSyntax($attributeString); - $attributeString = $this->parseAttributeBag($attributeString); - $attributeString = $this->parseComponentTagClassStatements($attributeString); - $attributeString = $this->parseComponentTagStyleStatements($attributeString); - $attributeString = $this->parseBindAttributes($attributeString); - - $pattern = '/ - (?[\w\-:.@]+) - ( - = - (? - ( - \"[^\"]+\" - | - \\\'[^\\\']+\\\' - | - [^\s>]+ - ) - ) - )? - /x'; - - if (! preg_match_all($pattern, $attributeString, $matches, PREG_SET_ORDER)) { - return []; - } - - return collect($matches)->mapWithKeys(function ($match) { - $attribute = $match['attribute']; - $value = $match['value'] ?? null; - - if (is_null($value)) { - $value = 'true'; - - $attribute = Str::start($attribute, 'bind:'); - } - - $value = $this->stripQuotes($value); - - if (str_starts_with($attribute, 'bind:')) { - $attribute = Str::after($attribute, 'bind:'); - - $this->boundAttributes[$attribute] = true; - } else { - $value = "'".$this->compileAttributeEchos($value)."'"; - } - - if (str_starts_with($attribute, '::')) { - $attribute = substr($attribute, 1); - } - - return [$attribute => $value]; - })->toArray(); - } - - /** - * Parses a short attribute syntax like :$foo into a fully-qualified syntax like :foo="$foo". - * - * @param string $value - * @return string - */ - protected function parseShortAttributeSyntax(string $value) - { - $pattern = "/\s\:\\\$(\w+)/x"; - - return preg_replace_callback($pattern, function (array $matches) { - return " :{$matches[1]}=\"\${$matches[1]}\""; - }, $value); - } - - /** - * Parse the attribute bag in a given attribute string into its fully-qualified syntax. - * - * @param string $attributeString - * @return string - */ - protected function parseAttributeBag(string $attributeString) - { - $pattern = "/ - (?:^|\s+) # start of the string or whitespace between attributes - \{\{\s*(\\\$attributes(?:[^}]+?(?[^()]+) | (?2) )* \))/x', function ($match) { - if ($match[1] === 'class') { - $match[2] = str_replace('"', "'", $match[2]); - - return ":class=\"\Illuminate\Support\Arr::toCssClasses{$match[2]}\""; - } - - return $match[0]; - }, $attributeString - ); - } - - /** - * Parse @style statements in a given attribute string into their fully-qualified syntax. - * - * @param string $attributeString - * @return string - */ - protected function parseComponentTagStyleStatements(string $attributeString) - { - return preg_replace_callback( - '/@(style)(\( ( (?>[^()]+) | (?2) )* \))/x', function ($match) { - if ($match[1] === 'style') { - $match[2] = str_replace('"', "'", $match[2]); - - return ":style=\"\Illuminate\Support\Arr::toCssStyles{$match[2]}\""; - } - - return $match[0]; - }, $attributeString - ); - } - - /** - * Parse the "bind" attributes in a given attribute string into their fully-qualified syntax. - * - * @param string $attributeString - * @return string - */ - protected function parseBindAttributes(string $attributeString) - { - $pattern = "/ - (?:^|\s+) # start of the string or whitespace between attributes - :(?!:) # attribute needs to start with a single colon - ([\w\-:.@]+) # match the actual attribute name - = # only match attributes that have a value - /xm"; - - return preg_replace($pattern, ' bind:$1=', $attributeString); - } - - /** - * Compile any Blade echo statements that are present in the attribute string. - * - * These echo statements need to be converted to string concatenation statements. - * - * @param string $attributeString - * @return string - */ - protected function compileAttributeEchos(string $attributeString) - { - $value = $this->blade->compileEchos($attributeString); - - $value = $this->escapeSingleQuotesOutsideOfPhpBlocks($value); - - $value = str_replace('', '.\'', $value); - - return $value; - } - - /** - * Escape the single quotes in the given string that are outside of PHP blocks. - * - * @param string $value - * @return string - */ - protected function escapeSingleQuotesOutsideOfPhpBlocks(string $value) - { - return collect(token_get_all($value))->map(function ($token) { - if (! is_array($token)) { - return $token; - } - - return $token[0] === T_INLINE_HTML - ? str_replace("'", "\\'", $token[1]) - : $token[1]; - })->implode(''); - } - - /** - * Convert an array of attributes to a string. - * - * @param array $attributes - * @param bool $escapeBound - * @return string - */ - protected function attributesToString(array $attributes, $escapeBound = true) - { - return collect($attributes) - ->map(function (string $value, string $attribute) use ($escapeBound) { - return $escapeBound && isset($this->boundAttributes[$attribute]) && $value !== 'true' && ! is_numeric($value) - ? "'{$attribute}' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute({$value})" - : "'{$attribute}' => {$value}"; - }) - ->implode(','); - } - - /** - * Strip any quotes from the given string. - * - * @param string $value - * @return string - */ - public function stripQuotes(string $value) - { - return Str::startsWith($value, ['"', '\'']) - ? substr($value, 1, -1) - : $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesAuthorizations.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesAuthorizations.php deleted file mode 100644 index 4f96998..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesAuthorizations.php +++ /dev/null @@ -1,102 +0,0 @@ -check{$expression}): ?>"; - } - - /** - * Compile the cannot statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileCannot($expression) - { - return "denies{$expression}): ?>"; - } - - /** - * Compile the canany statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileCanany($expression) - { - return "any{$expression}): ?>"; - } - - /** - * Compile the else-can statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileElsecan($expression) - { - return "check{$expression}): ?>"; - } - - /** - * Compile the else-cannot statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileElsecannot($expression) - { - return "denies{$expression}): ?>"; - } - - /** - * Compile the else-canany statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileElsecanany($expression) - { - return "any{$expression}): ?>"; - } - - /** - * Compile the end-can statements into valid PHP. - * - * @return string - */ - protected function compileEndcan() - { - return ''; - } - - /** - * Compile the end-cannot statements into valid PHP. - * - * @return string - */ - protected function compileEndcannot() - { - return ''; - } - - /** - * Compile the end-canany statements into valid PHP. - * - * @return string - */ - protected function compileEndcanany() - { - return ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesClasses.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesClasses.php deleted file mode 100644 index b3dbbcd..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesClasses.php +++ /dev/null @@ -1,19 +0,0 @@ -\""; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesComments.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesComments.php deleted file mode 100644 index 104a9c8..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesComments.php +++ /dev/null @@ -1,19 +0,0 @@ -contentTags[0], $this->contentTags[1]); - - return preg_replace($pattern, '', $value); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php deleted file mode 100644 index de565c6..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php +++ /dev/null @@ -1,198 +0,0 @@ -startComponent{$expression}; ?>"; - } - - /** - * Get a new component hash for a component name. - * - * @param string $component - * @return string - */ - public static function newComponentHash(string $component) - { - static::$componentHashStack[] = $hash = sha1($component); - - return $hash; - } - - /** - * Compile a class component opening. - * - * @param string $component - * @param string $alias - * @param string $data - * @param string $hash - * @return string - */ - public static function compileClassComponentOpening(string $component, string $alias, string $data, string $hash) - { - return implode("\n", [ - '', - 'getIterator() : [])); ?>', - 'withName('.$alias.'); ?>', - 'shouldRender()): ?>', - 'startComponent($component->resolveView(), $component->data()); ?>', - ]); - } - - /** - * Compile the end-component statements into valid PHP. - * - * @return string - */ - protected function compileEndComponent() - { - return 'renderComponent(); ?>'; - } - - /** - * Compile the end-component statements into valid PHP. - * - * @return string - */ - public function compileEndComponentClass() - { - $hash = array_pop(static::$componentHashStack); - - return $this->compileEndComponent()."\n".implode("\n", [ - '', - '', - '', - '', - '', - ]); - } - - /** - * Compile the slot statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileSlot($expression) - { - return "slot{$expression}; ?>"; - } - - /** - * Compile the end-slot statements into valid PHP. - * - * @return string - */ - protected function compileEndSlot() - { - return 'endSlot(); ?>'; - } - - /** - * Compile the component-first statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileComponentFirst($expression) - { - return "startComponentFirst{$expression}; ?>"; - } - - /** - * Compile the end-component-first statements into valid PHP. - * - * @return string - */ - protected function compileEndComponentFirst() - { - return $this->compileEndComponent(); - } - - /** - * Compile the prop statement into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileProps($expression) - { - return " -onlyProps{$expression} as \$__key => \$__value) { - \$\$__key = \$\$__key ?? \$__value; -} ?> -exceptProps{$expression}; ?> - \$__value) { - \$\$__key = \$\$__key ?? \$__value; -} ?> - - \$__value) { - if (array_key_exists(\$__key, \$__defined_vars)) unset(\$\$__key); -} ?> -"; - } - - /** - * Compile the aware statement into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileAware($expression) - { - return " \$__value) { - \$__consumeVariable = is_string(\$__key) ? \$__key : \$__value; - \$\$__consumeVariable = is_string(\$__key) ? \$__env->getConsumableComponentData(\$__key, \$__value) : \$__env->getConsumableComponentData(\$__value); -} ?>"; - } - - /** - * Sanitize the given component attribute value. - * - * @param mixed $value - * @return mixed - */ - public static function sanitizeComponentAttribute($value) - { - if ($value instanceof CanBeEscapedWhenCastToString) { - return $value->escapeWhenCastingToString(); - } - - return is_string($value) || - (is_object($value) && ! $value instanceof ComponentAttributeBag && method_exists($value, '__toString')) - ? e($value) - : $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php deleted file mode 100644 index 2b1c0e8..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php +++ /dev/null @@ -1,385 +0,0 @@ -guard{$guard}->check()): ?>"; - } - - /** - * Compile the else-auth statements into valid PHP. - * - * @param string|null $guard - * @return string - */ - protected function compileElseAuth($guard = null) - { - $guard = is_null($guard) ? '()' : $guard; - - return "guard{$guard}->check()): ?>"; - } - - /** - * Compile the end-auth statements into valid PHP. - * - * @return string - */ - protected function compileEndAuth() - { - return ''; - } - - /** - * Compile the env statements into valid PHP. - * - * @param string $environments - * @return string - */ - protected function compileEnv($environments) - { - return "environment{$environments}): ?>"; - } - - /** - * Compile the end-env statements into valid PHP. - * - * @return string - */ - protected function compileEndEnv() - { - return ''; - } - - /** - * Compile the production statements into valid PHP. - * - * @return string - */ - protected function compileProduction() - { - return "environment('production')): ?>"; - } - - /** - * Compile the end-production statements into valid PHP. - * - * @return string - */ - protected function compileEndProduction() - { - return ''; - } - - /** - * Compile the if-guest statements into valid PHP. - * - * @param string|null $guard - * @return string - */ - protected function compileGuest($guard = null) - { - $guard = is_null($guard) ? '()' : $guard; - - return "guard{$guard}->guest()): ?>"; - } - - /** - * Compile the else-guest statements into valid PHP. - * - * @param string|null $guard - * @return string - */ - protected function compileElseGuest($guard = null) - { - $guard = is_null($guard) ? '()' : $guard; - - return "guard{$guard}->guest()): ?>"; - } - - /** - * Compile the end-guest statements into valid PHP. - * - * @return string - */ - protected function compileEndGuest() - { - return ''; - } - - /** - * Compile the has-section statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileHasSection($expression) - { - return "yieldContent{$expression}))): ?>"; - } - - /** - * Compile the section-missing statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileSectionMissing($expression) - { - return "yieldContent{$expression}))): ?>"; - } - - /** - * Compile the if statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileIf($expression) - { - return ""; - } - - /** - * Compile the unless statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileUnless($expression) - { - return ""; - } - - /** - * Compile the else-if statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileElseif($expression) - { - return ""; - } - - /** - * Compile the else statements into valid PHP. - * - * @return string - */ - protected function compileElse() - { - return ''; - } - - /** - * Compile the end-if statements into valid PHP. - * - * @return string - */ - protected function compileEndif() - { - return ''; - } - - /** - * Compile the end-unless statements into valid PHP. - * - * @return string - */ - protected function compileEndunless() - { - return ''; - } - - /** - * Compile the if-isset statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileIsset($expression) - { - return ""; - } - - /** - * Compile the end-isset statements into valid PHP. - * - * @return string - */ - protected function compileEndIsset() - { - return ''; - } - - /** - * Compile the switch statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileSwitch($expression) - { - $this->firstCaseInSwitch = true; - - return "firstCaseInSwitch) { - $this->firstCaseInSwitch = false; - - return "case {$expression}: ?>"; - } - - return ""; - } - - /** - * Compile the default statements in switch case into valid PHP. - * - * @return string - */ - protected function compileDefault() - { - return ''; - } - - /** - * Compile the end switch statements into valid PHP. - * - * @return string - */ - protected function compileEndSwitch() - { - return ''; - } - - /** - * Compile a once block into valid PHP. - * - * @param string|null $id - * @return string - */ - protected function compileOnce($id = null) - { - $id = $id ? $this->stripParentheses($id) : "'".(string) Str::uuid()."'"; - - return 'hasRenderedOnce('.$id.')): $__env->markAsRenderedOnce('.$id.'); ?>'; - } - - /** - * Compile an end-once block into valid PHP. - * - * @return string - */ - public function compileEndOnce() - { - return ''; - } - - /** - * Compile a selected block into valid PHP. - * - * @param string $condition - * @return string - */ - protected function compileSelected($condition) - { - return ""; - } - - /** - * Compile a checked block into valid PHP. - * - * @param string $condition - * @return string - */ - protected function compileChecked($condition) - { - return ""; - } - - /** - * Compile a disabled block into valid PHP. - * - * @param string $condition - * @return string - */ - protected function compileDisabled($condition) - { - return ""; - } - - /** - * Compile a required block into valid PHP. - * - * @param string $condition - * @return string - */ - protected function compileRequired($condition) - { - return ""; - } - - /** - * Compile a readonly block into valid PHP. - * - * @param string $condition - * @return string - */ - protected function compileReadonly($condition) - { - return ""; - } - - /** - * Compile the push statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compilePushIf($expression) - { - $parts = explode(',', $this->stripParentheses($expression), 2); - - return "startPush({$parts[1]}); ?>"; - } - - /** - * Compile the end-push statements into valid PHP. - * - * @return string - */ - protected function compileEndPushIf() - { - return 'stopPush(); endif; ?>'; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php deleted file mode 100644 index 37f1cbc..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php +++ /dev/null @@ -1,167 +0,0 @@ -firstClosureParameterType($class), $class]; - } - - $this->echoHandlers[$class] = $handler; - } - - /** - * Compile Blade echos into valid PHP. - * - * @param string $value - * @return string - */ - public function compileEchos($value) - { - foreach ($this->getEchoMethods() as $method) { - $value = $this->$method($value); - } - - return $value; - } - - /** - * Get the echo methods in the proper order for compilation. - * - * @return array - */ - protected function getEchoMethods() - { - return [ - 'compileRawEchos', - 'compileEscapedEchos', - 'compileRegularEchos', - ]; - } - - /** - * Compile the "raw" echo statements. - * - * @param string $value - * @return string - */ - protected function compileRawEchos($value) - { - $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->rawTags[0], $this->rawTags[1]); - - $callback = function ($matches) { - $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; - - return $matches[1] - ? substr($matches[0], 1) - : "wrapInEchoHandler($matches[2])}; ?>{$whitespace}"; - }; - - return preg_replace_callback($pattern, $callback, $value); - } - - /** - * Compile the "regular" echo statements. - * - * @param string $value - * @return string - */ - protected function compileRegularEchos($value) - { - $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]); - - $callback = function ($matches) { - $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; - - $wrapped = sprintf($this->echoFormat, $this->wrapInEchoHandler($matches[2])); - - return $matches[1] ? substr($matches[0], 1) : "{$whitespace}"; - }; - - return preg_replace_callback($pattern, $callback, $value); - } - - /** - * Compile the escaped echo statements. - * - * @param string $value - * @return string - */ - protected function compileEscapedEchos($value) - { - $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->escapedTags[0], $this->escapedTags[1]); - - $callback = function ($matches) { - $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; - - return $matches[1] - ? $matches[0] - : "wrapInEchoHandler($matches[2])}); ?>{$whitespace}"; - }; - - return preg_replace_callback($pattern, $callback, $value); - } - - /** - * Add an instance of the blade echo handler to the start of the compiled string. - * - * @param string $result - * @return string - */ - protected function addBladeCompilerVariable($result) - { - return "".$result; - } - - /** - * Wrap the echoable value in an echo handler if applicable. - * - * @param string $value - * @return string - */ - protected function wrapInEchoHandler($value) - { - $value = Str::of($value) - ->trim() - ->when(str_ends_with($value, ';'), function ($str) { - return $str->beforeLast(';'); - }); - - return empty($this->echoHandlers) ? $value : '$__bladeCompiler->applyEchoHandler('.$value.')'; - } - - /** - * Apply the echo handler for the value if it exists. - * - * @param string $value - * @return string - */ - public function applyEchoHandler($value) - { - if (is_object($value) && isset($this->echoHandlers[get_class($value)])) { - return call_user_func($this->echoHandlers[get_class($value)], $value); - } - - return $value; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesErrors.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesErrors.php deleted file mode 100644 index 77edc4b..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesErrors.php +++ /dev/null @@ -1,37 +0,0 @@ -stripParentheses($expression); - - return 'getBag($__errorArgs[1] ?? \'default\'); -if ($__bag->has($__errorArgs[0])) : -if (isset($message)) { $__messageOriginal = $message; } -$message = $__bag->first($__errorArgs[0]); ?>'; - } - - /** - * Compile the enderror statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEnderror($expression) - { - return ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesFragments.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesFragments.php deleted file mode 100644 index 607b6dd..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesFragments.php +++ /dev/null @@ -1,36 +0,0 @@ -lastFragment = trim($expression, "()'\" "); - - return "startFragment{$expression}; ?>"; - } - - /** - * Compile the end-fragment statements into valid PHP. - * - * @return string - */ - protected function compileEndfragment() - { - return 'stopFragment(); ?>'; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php deleted file mode 100644 index f217f59..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php +++ /dev/null @@ -1,78 +0,0 @@ -'; - } - - /** - * Compile the "dd" statements into valid PHP. - * - * @param string $arguments - * @return string - */ - protected function compileDd($arguments) - { - return ""; - } - - /** - * Compile the "dump" statements into valid PHP. - * - * @param string $arguments - * @return string - */ - protected function compileDump($arguments) - { - return ""; - } - - /** - * Compile the method statements into valid PHP. - * - * @param string $method - * @return string - */ - protected function compileMethod($method) - { - return ""; - } - - /** - * Compile the "vite" statements into valid PHP. - * - * @param string|null $arguments - * @return string - */ - protected function compileVite($arguments) - { - $arguments ??= '()'; - - $class = Vite::class; - - return ""; - } - - /** - * Compile the "viteReactRefresh" statements into valid PHP. - * - * @return string - */ - protected function compileViteReactRefresh() - { - $class = Vite::class; - - return "reactRefresh(); ?>"; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php deleted file mode 100644 index aa3d4a6..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php +++ /dev/null @@ -1,82 +0,0 @@ -renderEach{$expression}; ?>"; - } - - /** - * Compile the include statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileInclude($expression) - { - $expression = $this->stripParentheses($expression); - - return "make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; - } - - /** - * Compile the include-if statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileIncludeIf($expression) - { - $expression = $this->stripParentheses($expression); - - return "exists({$expression})) echo \$__env->make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; - } - - /** - * Compile the include-when statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileIncludeWhen($expression) - { - $expression = $this->stripParentheses($expression); - - return "renderWhen($expression, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path'])); ?>"; - } - - /** - * Compile the include-unless statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileIncludeUnless($expression) - { - $expression = $this->stripParentheses($expression); - - return "renderUnless($expression, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path'])); ?>"; - } - - /** - * Compile the include-first statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileIncludeFirst($expression) - { - $expression = $this->stripParentheses($expression); - - return "first({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php deleted file mode 100644 index a0d1ccf..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php +++ /dev/null @@ -1,23 +0,0 @@ -"; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesJs.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesJs.php deleted file mode 100644 index 3104057..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesJs.php +++ /dev/null @@ -1,22 +0,0 @@ -toHtml() ?>", - Js::class, $this->stripParentheses($expression) - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesJson.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesJson.php deleted file mode 100644 index cf343e9..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesJson.php +++ /dev/null @@ -1,30 +0,0 @@ -stripParentheses($expression)); - - $options = isset($parts[1]) ? trim($parts[1]) : $this->encodingOptions; - - $depth = isset($parts[2]) ? trim($parts[2]) : 512; - - return ""; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php deleted file mode 100644 index 6540603..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php +++ /dev/null @@ -1,133 +0,0 @@ -stripParentheses($expression); - - $echo = "make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; - - $this->footer[] = $echo; - - return ''; - } - - /** - * Compile the extends-first statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileExtendsFirst($expression) - { - $expression = $this->stripParentheses($expression); - - $echo = "first({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; - - $this->footer[] = $echo; - - return ''; - } - - /** - * Compile the section statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileSection($expression) - { - $this->lastSection = trim($expression, "()'\" "); - - return "startSection{$expression}; ?>"; - } - - /** - * Replace the @parent directive to a placeholder. - * - * @return string - */ - protected function compileParent() - { - $escapedLastSection = strtr($this->lastSection, ['\\' => '\\\\', "'" => "\\'"]); - - return ""; - } - - /** - * Compile the yield statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileYield($expression) - { - return "yieldContent{$expression}; ?>"; - } - - /** - * Compile the show statements into valid PHP. - * - * @return string - */ - protected function compileShow() - { - return 'yieldSection(); ?>'; - } - - /** - * Compile the append statements into valid PHP. - * - * @return string - */ - protected function compileAppend() - { - return 'appendSection(); ?>'; - } - - /** - * Compile the overwrite statements into valid PHP. - * - * @return string - */ - protected function compileOverwrite() - { - return 'stopSection(true); ?>'; - } - - /** - * Compile the stop statements into valid PHP. - * - * @return string - */ - protected function compileStop() - { - return 'stopSection(); ?>'; - } - - /** - * Compile the end-section statements into valid PHP. - * - * @return string - */ - protected function compileEndsection() - { - return 'stopSection(); ?>'; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php deleted file mode 100644 index 209206a..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php +++ /dev/null @@ -1,194 +0,0 @@ -forElseCounter; - - preg_match('/\( *(.+) +as +(.+)\)$/is', $expression ?? '', $matches); - - if (count($matches) === 0) { - throw new ViewCompilationException('Malformed @forelse statement.'); - } - - $iteratee = trim($matches[1]); - - $iteration = trim($matches[2]); - - $initLoop = "\$__currentLoopData = {$iteratee}; \$__env->addLoop(\$__currentLoopData);"; - - $iterateLoop = '$__env->incrementLoopIndices(); $loop = $__env->getLastLoop();'; - - return ""; - } - - /** - * Compile the for-else-empty and empty statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileEmpty($expression) - { - if ($expression) { - return ""; - } - - $empty = '$__empty_'.$this->forElseCounter--; - - return "popLoop(); \$loop = \$__env->getLastLoop(); if ({$empty}): ?>"; - } - - /** - * Compile the end-for-else statements into valid PHP. - * - * @return string - */ - protected function compileEndforelse() - { - return ''; - } - - /** - * Compile the end-empty statements into valid PHP. - * - * @return string - */ - protected function compileEndEmpty() - { - return ''; - } - - /** - * Compile the for statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileFor($expression) - { - return ""; - } - - /** - * Compile the for-each statements into valid PHP. - * - * @param string $expression - * @return string - * - * @throws \Illuminate\Contracts\View\ViewCompilationException - */ - protected function compileForeach($expression) - { - preg_match('/\( *(.+) +as +(.*)\)$/is', $expression ?? '', $matches); - - if (count($matches) === 0) { - throw new ViewCompilationException('Malformed @foreach statement.'); - } - - $iteratee = trim($matches[1]); - - $iteration = trim($matches[2]); - - $initLoop = "\$__currentLoopData = {$iteratee}; \$__env->addLoop(\$__currentLoopData);"; - - $iterateLoop = '$__env->incrementLoopIndices(); $loop = $__env->getLastLoop();'; - - return ""; - } - - /** - * Compile the break statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileBreak($expression) - { - if ($expression) { - preg_match('/\(\s*(-?\d+)\s*\)$/', $expression, $matches); - - return $matches ? '' : ""; - } - - return ''; - } - - /** - * Compile the continue statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileContinue($expression) - { - if ($expression) { - preg_match('/\(\s*(-?\d+)\s*\)$/', $expression, $matches); - - return $matches ? '' : ""; - } - - return ''; - } - - /** - * Compile the end-for statements into valid PHP. - * - * @return string - */ - protected function compileEndfor() - { - return ''; - } - - /** - * Compile the end-for-each statements into valid PHP. - * - * @return string - */ - protected function compileEndforeach() - { - return 'popLoop(); $loop = $__env->getLastLoop(); ?>'; - } - - /** - * Compile the while statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileWhile($expression) - { - return ""; - } - - /** - * Compile the end-while statements into valid PHP. - * - * @return string - */ - protected function compileEndwhile() - { - return ''; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php deleted file mode 100644 index 41c7edf..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php +++ /dev/null @@ -1,32 +0,0 @@ -"; - } - - return '@php'; - } - - /** - * Compile the unset statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileUnset($expression) - { - return ""; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php deleted file mode 100644 index 16ceef3..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php +++ /dev/null @@ -1,117 +0,0 @@ -yieldPushContent{$expression}; ?>"; - } - - /** - * Compile the push statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compilePush($expression) - { - return "startPush{$expression}; ?>"; - } - - /** - * Compile the push-once statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compilePushOnce($expression) - { - $parts = explode(',', $this->stripParentheses($expression), 2); - - [$stack, $id] = [$parts[0], $parts[1] ?? '']; - - $id = trim($id) ?: "'".(string) Str::uuid()."'"; - - return 'hasRenderedOnce('.$id.')): $__env->markAsRenderedOnce('.$id.'); -$__env->startPush('.$stack.'); ?>'; - } - - /** - * Compile the end-push statements into valid PHP. - * - * @return string - */ - protected function compileEndpush() - { - return 'stopPush(); ?>'; - } - - /** - * Compile the end-push-once statements into valid PHP. - * - * @return string - */ - protected function compileEndpushOnce() - { - return 'stopPush(); endif; ?>'; - } - - /** - * Compile the prepend statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compilePrepend($expression) - { - return "startPrepend{$expression}; ?>"; - } - - /** - * Compile the prepend-once statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compilePrependOnce($expression) - { - $parts = explode(',', $this->stripParentheses($expression), 2); - - [$stack, $id] = [$parts[0], $parts[1] ?? '']; - - $id = trim($id) ?: "'".(string) Str::uuid()."'"; - - return 'hasRenderedOnce('.$id.')): $__env->markAsRenderedOnce('.$id.'); -$__env->startPrepend('.$stack.'); ?>'; - } - - /** - * Compile the end-prepend statements into valid PHP. - * - * @return string - */ - protected function compileEndprepend() - { - return 'stopPrepend(); ?>'; - } - - /** - * Compile the end-prepend-once statements into valid PHP. - * - * @return string - */ - protected function compileEndprependOnce() - { - return 'stopPrepend(); endif; ?>'; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesStyles.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesStyles.php deleted file mode 100644 index 6c71506..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesStyles.php +++ /dev/null @@ -1,19 +0,0 @@ -\""; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php b/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php deleted file mode 100644 index 7cbafdb..0000000 --- a/framework-9.50.2/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php +++ /dev/null @@ -1,44 +0,0 @@ -startTranslation(); ?>'; - } elseif ($expression[1] === '[') { - return "startTranslation{$expression}; ?>"; - } - - return "get{$expression}; ?>"; - } - - /** - * Compile the end-lang statements into valid PHP. - * - * @return string - */ - protected function compileEndlang() - { - return 'renderTranslation(); ?>'; - } - - /** - * Compile the choice statements into valid PHP. - * - * @param string $expression - * @return string - */ - protected function compileChoice($expression) - { - return "choice{$expression}; ?>"; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Component.php b/framework-9.50.2/src/Illuminate/View/Component.php deleted file mode 100644 index 9498030..0000000 --- a/framework-9.50.2/src/Illuminate/View/Component.php +++ /dev/null @@ -1,458 +0,0 @@ - - */ - protected static $bladeViewCache = []; - - /** - * The cache of public property names, keyed by class. - * - * @var array - */ - protected static $propertyCache = []; - - /** - * The cache of public method names, keyed by class. - * - * @var array - */ - protected static $methodCache = []; - - /** - * The cache of constructor parameters, keyed by class. - * - * @var array> - */ - protected static $constructorParametersCache = []; - - /** - * Get the view / view contents that represent the component. - * - * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\Support\Htmlable|\Closure|string - */ - abstract public function render(); - - /** - * Resolve the component instance with the given data. - * - * @param array $data - * @return static - */ - public static function resolve($data) - { - if (static::$componentsResolver) { - return call_user_func(static::$componentsResolver, static::class, $data); - } - - $parameters = static::extractConstructorParameters(); - - $dataKeys = array_keys($data); - - if (empty(array_diff($parameters, $dataKeys))) { - return new static(...array_intersect_key($data, array_flip($parameters))); - } - - return Container::getInstance()->make(static::class, $data); - } - - /** - * Extract the constructor parameters for the component. - * - * @return array - */ - protected static function extractConstructorParameters() - { - if (! isset(static::$constructorParametersCache[static::class])) { - $class = new ReflectionClass(static::class); - - $constructor = $class->getConstructor(); - - static::$constructorParametersCache[static::class] = $constructor - ? collect($constructor->getParameters())->map->getName()->all() - : []; - } - - return static::$constructorParametersCache[static::class]; - } - - /** - * Resolve the Blade view or view file that should be used when rendering the component. - * - * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\Support\Htmlable|\Closure|string - */ - public function resolveView() - { - $view = $this->render(); - - if ($view instanceof ViewContract) { - return $view; - } - - if ($view instanceof Htmlable) { - return $view; - } - - $resolver = function ($view) { - return $this->extractBladeViewFromString($view); - }; - - return $view instanceof Closure ? function (array $data = []) use ($view, $resolver) { - return $resolver($view($data)); - } - : $resolver($view); - } - - /** - * Create a Blade view with the raw component string content. - * - * @param string $contents - * @return string - */ - protected function extractBladeViewFromString($contents) - { - $key = sprintf('%s::%s', static::class, $contents); - - if (isset(static::$bladeViewCache[$key])) { - return static::$bladeViewCache[$key]; - } - - if (strlen($contents) <= PHP_MAXPATHLEN && $this->factory()->exists($contents)) { - return static::$bladeViewCache[$key] = $contents; - } - - return static::$bladeViewCache[$key] = $this->createBladeViewFromString($this->factory(), $contents); - } - - /** - * Create a Blade view with the raw component string content. - * - * @param \Illuminate\Contracts\View\Factory $factory - * @param string $contents - * @return string - */ - protected function createBladeViewFromString($factory, $contents) - { - $factory->addNamespace( - '__components', - $directory = Container::getInstance()['config']->get('view.compiled') - ); - - if (! is_file($viewFile = $directory.'/'.sha1($contents).'.blade.php')) { - if (! is_dir($directory)) { - mkdir($directory, 0755, true); - } - - file_put_contents($viewFile, $contents); - } - - return '__components::'.basename($viewFile, '.blade.php'); - } - - /** - * Get the data that should be supplied to the view. - * - * @author Freek Van der Herten - * @author Brent Roose - * - * @return array - */ - public function data() - { - $this->attributes = $this->attributes ?: $this->newAttributeBag(); - - return array_merge($this->extractPublicProperties(), $this->extractPublicMethods()); - } - - /** - * Extract the public properties for the component. - * - * @return array - */ - protected function extractPublicProperties() - { - $class = get_class($this); - - if (! isset(static::$propertyCache[$class])) { - $reflection = new ReflectionClass($this); - - static::$propertyCache[$class] = collect($reflection->getProperties(ReflectionProperty::IS_PUBLIC)) - ->reject(function (ReflectionProperty $property) { - return $property->isStatic(); - }) - ->reject(function (ReflectionProperty $property) { - return $this->shouldIgnore($property->getName()); - }) - ->map(function (ReflectionProperty $property) { - return $property->getName(); - })->all(); - } - - $values = []; - - foreach (static::$propertyCache[$class] as $property) { - $values[$property] = $this->{$property}; - } - - return $values; - } - - /** - * Extract the public methods for the component. - * - * @return array - */ - protected function extractPublicMethods() - { - $class = get_class($this); - - if (! isset(static::$methodCache[$class])) { - $reflection = new ReflectionClass($this); - - static::$methodCache[$class] = collect($reflection->getMethods(ReflectionMethod::IS_PUBLIC)) - ->reject(function (ReflectionMethod $method) { - return $this->shouldIgnore($method->getName()); - }) - ->map(function (ReflectionMethod $method) { - return $method->getName(); - }); - } - - $values = []; - - foreach (static::$methodCache[$class] as $method) { - $values[$method] = $this->createVariableFromMethod(new ReflectionMethod($this, $method)); - } - - return $values; - } - - /** - * Create a callable variable from the given method. - * - * @param \ReflectionMethod $method - * @return mixed - */ - protected function createVariableFromMethod(ReflectionMethod $method) - { - return $method->getNumberOfParameters() === 0 - ? $this->createInvokableVariable($method->getName()) - : Closure::fromCallable([$this, $method->getName()]); - } - - /** - * Create an invokable, toStringable variable for the given component method. - * - * @param string $method - * @return \Illuminate\View\InvokableComponentVariable - */ - protected function createInvokableVariable(string $method) - { - return new InvokableComponentVariable(function () use ($method) { - return $this->{$method}(); - }); - } - - /** - * Determine if the given property / method should be ignored. - * - * @param string $name - * @return bool - */ - protected function shouldIgnore($name) - { - return str_starts_with($name, '__') || - in_array($name, $this->ignoredMethods()); - } - - /** - * Get the methods that should be ignored. - * - * @return array - */ - protected function ignoredMethods() - { - return array_merge([ - 'data', - 'render', - 'resolveView', - 'shouldRender', - 'view', - 'withName', - 'withAttributes', - ], $this->except); - } - - /** - * Set the component alias name. - * - * @param string $name - * @return $this - */ - public function withName($name) - { - $this->componentName = $name; - - return $this; - } - - /** - * Set the extra attributes that the component should make available. - * - * @param array $attributes - * @return $this - */ - public function withAttributes(array $attributes) - { - $this->attributes = $this->attributes ?: $this->newAttributeBag(); - - $this->attributes->setAttributes($attributes); - - return $this; - } - - /** - * Get a new attribute bag instance. - * - * @param array $attributes - * @return \Illuminate\View\ComponentAttributeBag - */ - protected function newAttributeBag(array $attributes = []) - { - return new ComponentAttributeBag($attributes); - } - - /** - * Determine if the component should be rendered. - * - * @return bool - */ - public function shouldRender() - { - return true; - } - - /** - * Get the evaluated view contents for the given view. - * - * @param string|null $view - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @param array $mergeData - * @return \Illuminate\Contracts\View\View - */ - public function view($view, $data = [], $mergeData = []) - { - return $this->factory()->make($view, $data, $mergeData); - } - - /** - * Get the view factory instance. - * - * @return \Illuminate\Contracts\View\Factory - */ - protected function factory() - { - if (is_null(static::$factory)) { - static::$factory = Container::getInstance()->make('view'); - } - - return static::$factory; - } - - /** - * Flush the component's cached state. - * - * @return void - */ - public static function flushCache() - { - static::$bladeViewCache = []; - static::$constructorParametersCache = []; - static::$methodCache = []; - static::$propertyCache = []; - } - - /** - * Forget the component's factory instance. - * - * @return void - */ - public static function forgetFactory() - { - static::$factory = null; - } - - /** - * Forget the component's resolver callback. - * - * @return void - * - * @internal - */ - public static function forgetComponentsResolver() - { - static::$componentsResolver = null; - } - - /** - * Set the callback that should be used to resolve components within views. - * - * @param \Closure(string $component, array $data): Component $resolver - * @return void - * - * @internal - */ - public static function resolveComponentsUsing($resolver) - { - static::$componentsResolver = $resolver; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/ComponentAttributeBag.php b/framework-9.50.2/src/Illuminate/View/ComponentAttributeBag.php deleted file mode 100644 index acf5c3f..0000000 --- a/framework-9.50.2/src/Illuminate/View/ComponentAttributeBag.php +++ /dev/null @@ -1,450 +0,0 @@ -attributes = $attributes; - } - - /** - * Get the first attribute's value. - * - * @param mixed $default - * @return mixed - */ - public function first($default = null) - { - return $this->getIterator()->current() ?? value($default); - } - - /** - * Get a given attribute from the attribute array. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get($key, $default = null) - { - return $this->attributes[$key] ?? value($default); - } - - /** - * Determine if a given attribute exists in the attribute array. - * - * @param string $key - * @return bool - */ - public function has($key) - { - return array_key_exists($key, $this->attributes); - } - - /** - * Determine if a given attribute is missing from the attribute array. - * - * @param string $key - * @return bool - */ - public function missing($key) - { - return ! $this->has($key, $this->attributes); - } - - /** - * Only include the given attribute from the attribute array. - * - * @param mixed $keys - * @return static - */ - public function only($keys) - { - if (is_null($keys)) { - $values = $this->attributes; - } else { - $keys = Arr::wrap($keys); - - $values = Arr::only($this->attributes, $keys); - } - - return new static($values); - } - - /** - * Exclude the given attribute from the attribute array. - * - * @param mixed|array $keys - * @return static - */ - public function except($keys) - { - if (is_null($keys)) { - $values = $this->attributes; - } else { - $keys = Arr::wrap($keys); - - $values = Arr::except($this->attributes, $keys); - } - - return new static($values); - } - - /** - * Filter the attributes, returning a bag of attributes that pass the filter. - * - * @param callable $callback - * @return static - */ - public function filter($callback) - { - return new static(collect($this->attributes)->filter($callback)->all()); - } - - /** - * Return a bag of attributes that have keys starting with the given value / pattern. - * - * @param string|string[] $needles - * @return static - */ - public function whereStartsWith($needles) - { - return $this->filter(function ($value, $key) use ($needles) { - return Str::startsWith($key, $needles); - }); - } - - /** - * Return a bag of attributes with keys that do not start with the given value / pattern. - * - * @param string|string[] $needles - * @return static - */ - public function whereDoesntStartWith($needles) - { - return $this->filter(function ($value, $key) use ($needles) { - return ! Str::startsWith($key, $needles); - }); - } - - /** - * Return a bag of attributes that have keys starting with the given value / pattern. - * - * @param string|string[] $needles - * @return static - */ - public function thatStartWith($needles) - { - return $this->whereStartsWith($needles); - } - - /** - * Only include the given attribute from the attribute array. - * - * @param mixed|array $keys - * @return static - */ - public function onlyProps($keys) - { - return $this->only($this->extractPropNames($keys)); - } - - /** - * Exclude the given attribute from the attribute array. - * - * @param mixed|array $keys - * @return static - */ - public function exceptProps($keys) - { - return $this->except($this->extractPropNames($keys)); - } - - /** - * Extract prop names from given keys. - * - * @param mixed|array $keys - * @return array - */ - protected function extractPropNames($keys) - { - $props = []; - - foreach ($keys as $key => $defaultValue) { - $key = is_numeric($key) ? $defaultValue : $key; - - $props[] = $key; - $props[] = Str::kebab($key); - } - - return $props; - } - - /** - * Conditionally merge classes into the attribute bag. - * - * @param mixed|array $classList - * @return static - */ - public function class($classList) - { - $classList = Arr::wrap($classList); - - return $this->merge(['class' => Arr::toCssClasses($classList)]); - } - - /** - * Conditionally merge styles into the attribute bag. - * - * @param mixed|array $styleList - * @return static - */ - public function style($styleList) - { - $styleList = Arr::wrap($styleList); - - return $this->merge(['style' => Arr::toCssStyles($styleList)]); - } - - /** - * Merge additional attributes / values into the attribute bag. - * - * @param array $attributeDefaults - * @param bool $escape - * @return static - */ - public function merge(array $attributeDefaults = [], $escape = true) - { - $attributeDefaults = array_map(function ($value) use ($escape) { - return $this->shouldEscapeAttributeValue($escape, $value) - ? e($value) - : $value; - }, $attributeDefaults); - - [$appendableAttributes, $nonAppendableAttributes] = collect($this->attributes) - ->partition(function ($value, $key) use ($attributeDefaults) { - return $key === 'class' || $key === 'style' || ( - isset($attributeDefaults[$key]) && - $attributeDefaults[$key] instanceof AppendableAttributeValue - ); - }); - - $attributes = $appendableAttributes->mapWithKeys(function ($value, $key) use ($attributeDefaults, $escape) { - $defaultsValue = isset($attributeDefaults[$key]) && $attributeDefaults[$key] instanceof AppendableAttributeValue - ? $this->resolveAppendableAttributeDefault($attributeDefaults, $key, $escape) - : ($attributeDefaults[$key] ?? ''); - - if ($key === 'style') { - $value = Str::finish($value, ';'); - } - - return [$key => implode(' ', array_unique(array_filter([$defaultsValue, $value])))]; - })->merge($nonAppendableAttributes)->all(); - - return new static(array_merge($attributeDefaults, $attributes)); - } - - /** - * Determine if the specific attribute value should be escaped. - * - * @param bool $escape - * @param mixed $value - * @return bool - */ - protected function shouldEscapeAttributeValue($escape, $value) - { - if (! $escape) { - return false; - } - - return ! is_object($value) && - ! is_null($value) && - ! is_bool($value); - } - - /** - * Create a new appendable attribute value. - * - * @param mixed $value - * @return \Illuminate\View\AppendableAttributeValue - */ - public function prepends($value) - { - return new AppendableAttributeValue($value); - } - - /** - * Resolve an appendable attribute value default value. - * - * @param array $attributeDefaults - * @param string $key - * @param bool $escape - * @return mixed - */ - protected function resolveAppendableAttributeDefault($attributeDefaults, $key, $escape) - { - if ($this->shouldEscapeAttributeValue($escape, $value = $attributeDefaults[$key]->value)) { - $value = e($value); - } - - return $value; - } - - /** - * Get all of the raw attributes. - * - * @return array - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * Set the underlying attributes. - * - * @param array $attributes - * @return void - */ - public function setAttributes(array $attributes) - { - if (isset($attributes['attributes']) && - $attributes['attributes'] instanceof self) { - $parentBag = $attributes['attributes']; - - unset($attributes['attributes']); - - $attributes = $parentBag->merge($attributes, $escape = false)->getAttributes(); - } - - $this->attributes = $attributes; - } - - /** - * Get content as a string of HTML. - * - * @return string - */ - public function toHtml() - { - return (string) $this; - } - - /** - * Merge additional attributes / values into the attribute bag. - * - * @param array $attributeDefaults - * @return \Illuminate\Support\HtmlString - */ - public function __invoke(array $attributeDefaults = []) - { - return new HtmlString((string) $this->merge($attributeDefaults)); - } - - /** - * Determine if the given offset exists. - * - * @param string $offset - * @return bool - */ - public function offsetExists($offset): bool - { - return isset($this->attributes[$offset]); - } - - /** - * Get the value at the given offset. - * - * @param string $offset - * @return mixed - */ - public function offsetGet($offset): mixed - { - return $this->get($offset); - } - - /** - * Set the value at a given offset. - * - * @param string $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset, $value): void - { - $this->attributes[$offset] = $value; - } - - /** - * Remove the value at the given offset. - * - * @param string $offset - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->attributes[$offset]); - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->attributes); - } - - /** - * Implode the attributes into a single HTML ready string. - * - * @return string - */ - public function __toString() - { - $string = ''; - - foreach ($this->attributes as $key => $value) { - if ($value === false || is_null($value)) { - continue; - } - - if ($value === true) { - $value = $key; - } - - $string .= ' '.$key.'="'.str_replace('"', '\\"', trim($value)).'"'; - } - - return trim($string); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/ComponentSlot.php b/framework-9.50.2/src/Illuminate/View/ComponentSlot.php deleted file mode 100644 index 85665ad..0000000 --- a/framework-9.50.2/src/Illuminate/View/ComponentSlot.php +++ /dev/null @@ -1,89 +0,0 @@ -contents = $contents; - - $this->withAttributes($attributes); - } - - /** - * Set the extra attributes that the slot should make available. - * - * @param array $attributes - * @return $this - */ - public function withAttributes(array $attributes) - { - $this->attributes = new ComponentAttributeBag($attributes); - - return $this; - } - - /** - * Get the slot's HTML string. - * - * @return string - */ - public function toHtml() - { - return $this->contents; - } - - /** - * Determine if the slot is empty. - * - * @return bool - */ - public function isEmpty() - { - return $this->contents === ''; - } - - /** - * Determine if the slot is not empty. - * - * @return bool - */ - public function isNotEmpty() - { - return ! $this->isEmpty(); - } - - /** - * Get the slot's HTML string. - * - * @return string - */ - public function __toString() - { - return $this->toHtml(); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesComponents.php b/framework-9.50.2/src/Illuminate/View/Concerns/ManagesComponents.php deleted file mode 100644 index f24908f..0000000 --- a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesComponents.php +++ /dev/null @@ -1,222 +0,0 @@ -componentStack[] = $view; - - $this->componentData[$this->currentComponent()] = $data; - - $this->slots[$this->currentComponent()] = []; - } - } - - /** - * Get the first view that actually exists from the given list, and start a component. - * - * @param array $names - * @param array $data - * @return void - */ - public function startComponentFirst(array $names, array $data = []) - { - $name = Arr::first($names, function ($item) { - return $this->exists($item); - }); - - $this->startComponent($name, $data); - } - - /** - * Render the current component. - * - * @return string - */ - public function renderComponent() - { - $view = array_pop($this->componentStack); - - $this->currentComponentData = array_merge( - $previousComponentData = $this->currentComponentData, - $data = $this->componentData() - ); - - try { - $view = value($view, $data); - - if ($view instanceof View) { - return $view->with($data)->render(); - } elseif ($view instanceof Htmlable) { - return $view->toHtml(); - } else { - return $this->make($view, $data)->render(); - } - } finally { - $this->currentComponentData = $previousComponentData; - } - } - - /** - * Get the data for the given component. - * - * @return array - */ - protected function componentData() - { - $defaultSlot = new HtmlString(trim(ob_get_clean())); - - $slots = array_merge([ - '__default' => $defaultSlot, - ], $this->slots[count($this->componentStack)]); - - return array_merge( - $this->componentData[count($this->componentStack)], - ['slot' => $defaultSlot], - $this->slots[count($this->componentStack)], - ['__laravel_slots' => $slots] - ); - } - - /** - * Get an item from the component data that exists above the current component. - * - * @param string $key - * @param mixed $default - * @return mixed|null - */ - public function getConsumableComponentData($key, $default = null) - { - if (array_key_exists($key, $this->currentComponentData)) { - return $this->currentComponentData[$key]; - } - - $currentComponent = count($this->componentStack); - - if ($currentComponent === 0) { - return value($default); - } - - for ($i = $currentComponent - 1; $i >= 0; $i--) { - $data = $this->componentData[$i] ?? []; - - if (array_key_exists($key, $data)) { - return $data[$key]; - } - } - - return value($default); - } - - /** - * Start the slot rendering process. - * - * @param string $name - * @param string|null $content - * @param array $attributes - * @return void - */ - public function slot($name, $content = null, $attributes = []) - { - if (func_num_args() === 2 || $content !== null) { - $this->slots[$this->currentComponent()][$name] = $content; - } elseif (ob_start()) { - $this->slots[$this->currentComponent()][$name] = ''; - - $this->slotStack[$this->currentComponent()][] = [$name, $attributes]; - } - } - - /** - * Save the slot content for rendering. - * - * @return void - */ - public function endSlot() - { - last($this->componentStack); - - $currentSlot = array_pop( - $this->slotStack[$this->currentComponent()] - ); - - [$currentName, $currentAttributes] = $currentSlot; - - $this->slots[$this->currentComponent()][$currentName] = new ComponentSlot( - trim(ob_get_clean()), $currentAttributes - ); - } - - /** - * Get the index for the current component. - * - * @return int - */ - protected function currentComponent() - { - return count($this->componentStack) - 1; - } - - /** - * Flush all of the component state. - * - * @return void - */ - protected function flushComponents() - { - $this->componentStack = []; - $this->componentData = []; - $this->currentComponentData = []; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesEvents.php b/framework-9.50.2/src/Illuminate/View/Concerns/ManagesEvents.php deleted file mode 100644 index d6cd9d8..0000000 --- a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesEvents.php +++ /dev/null @@ -1,190 +0,0 @@ -addViewEvent($view, $callback, 'creating: '); - } - - return $creators; - } - - /** - * Register multiple view composers via an array. - * - * @param array $composers - * @return array - */ - public function composers(array $composers) - { - $registered = []; - - foreach ($composers as $callback => $views) { - $registered = array_merge($registered, $this->composer($views, $callback)); - } - - return $registered; - } - - /** - * Register a view composer event. - * - * @param array|string $views - * @param \Closure|string $callback - * @return array - */ - public function composer($views, $callback) - { - $composers = []; - - foreach ((array) $views as $view) { - $composers[] = $this->addViewEvent($view, $callback); - } - - return $composers; - } - - /** - * Add an event for a given view. - * - * @param string $view - * @param \Closure|string $callback - * @param string $prefix - * @return \Closure|null - */ - protected function addViewEvent($view, $callback, $prefix = 'composing: ') - { - $view = $this->normalizeName($view); - - if ($callback instanceof Closure) { - $this->addEventListener($prefix.$view, $callback); - - return $callback; - } elseif (is_string($callback)) { - return $this->addClassEvent($view, $callback, $prefix); - } - } - - /** - * Register a class based view composer. - * - * @param string $view - * @param string $class - * @param string $prefix - * @return \Closure - */ - protected function addClassEvent($view, $class, $prefix) - { - $name = $prefix.$view; - - // When registering a class based view "composer", we will simply resolve the - // classes from the application IoC container then call the compose method - // on the instance. This allows for convenient, testable view composers. - $callback = $this->buildClassEventCallback( - $class, $prefix - ); - - $this->addEventListener($name, $callback); - - return $callback; - } - - /** - * Build a class based container callback Closure. - * - * @param string $class - * @param string $prefix - * @return \Closure - */ - protected function buildClassEventCallback($class, $prefix) - { - [$class, $method] = $this->parseClassEvent($class, $prefix); - - // Once we have the class and method name, we can build the Closure to resolve - // the instance out of the IoC container and call the method on it with the - // given arguments that are passed to the Closure as the composer's data. - return function () use ($class, $method) { - return $this->container->make($class)->{$method}(...func_get_args()); - }; - } - - /** - * Parse a class based composer name. - * - * @param string $class - * @param string $prefix - * @return array - */ - protected function parseClassEvent($class, $prefix) - { - return Str::parseCallback($class, $this->classEventMethodForPrefix($prefix)); - } - - /** - * Determine the class event method based on the given prefix. - * - * @param string $prefix - * @return string - */ - protected function classEventMethodForPrefix($prefix) - { - return str_contains($prefix, 'composing') ? 'compose' : 'create'; - } - - /** - * Add a listener to the event dispatcher. - * - * @param string $name - * @param \Closure $callback - * @return void - */ - protected function addEventListener($name, $callback) - { - if (str_contains($name, '*')) { - $callback = function ($name, array $data) use ($callback) { - return $callback($data[0]); - }; - } - - $this->events->listen($name, $callback); - } - - /** - * Call the composer for a given view. - * - * @param \Illuminate\Contracts\View\View $view - * @return void - */ - public function callComposer(ViewContract $view) - { - $this->events->dispatch('composing: '.$view->name(), [$view]); - } - - /** - * Call the creator for a given view. - * - * @param \Illuminate\Contracts\View\View $view - * @return void - */ - public function callCreator(ViewContract $view) - { - $this->events->dispatch('creating: '.$view->name(), [$view]); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesFragments.php b/framework-9.50.2/src/Illuminate/View/Concerns/ManagesFragments.php deleted file mode 100644 index 7273da6..0000000 --- a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesFragments.php +++ /dev/null @@ -1,88 +0,0 @@ -fragmentStack[] = $fragment; - } - } - - /** - * Stop injecting content into a fragment. - * - * @return string - * - * @throws \InvalidArgumentException - */ - public function stopFragment() - { - if (empty($this->fragmentStack)) { - throw new InvalidArgumentException('Cannot end a fragment without first starting one.'); - } - - $last = array_pop($this->fragmentStack); - - $this->fragments[$last] = ob_get_clean(); - - return $this->fragments[$last]; - } - - /** - * Get the contents of a fragment. - * - * @param string $name - * @param string|null $default - * @return mixed - */ - public function getFragment($name, $default = null) - { - return $this->getFragments()[$name] ?? $default; - } - - /** - * Get the entire array of rendered fragments. - * - * @return array - */ - public function getFragments() - { - return $this->fragments; - } - - /** - * Flush all of the fragments. - * - * @return void - */ - public function flushFragments() - { - $this->fragments = []; - $this->fragmentStack = []; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesLayouts.php b/framework-9.50.2/src/Illuminate/View/Concerns/ManagesLayouts.php deleted file mode 100644 index f045126..0000000 --- a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesLayouts.php +++ /dev/null @@ -1,255 +0,0 @@ -sectionStack[] = $section; - } - } else { - $this->extendSection($section, $content instanceof View ? $content : e($content)); - } - } - - /** - * Inject inline content into a section. - * - * @param string $section - * @param string $content - * @return void - */ - public function inject($section, $content) - { - $this->startSection($section, $content); - } - - /** - * Stop injecting content into a section and return its contents. - * - * @return string - */ - public function yieldSection() - { - if (empty($this->sectionStack)) { - return ''; - } - - return $this->yieldContent($this->stopSection()); - } - - /** - * Stop injecting content into a section. - * - * @param bool $overwrite - * @return string - * - * @throws \InvalidArgumentException - */ - public function stopSection($overwrite = false) - { - if (empty($this->sectionStack)) { - throw new InvalidArgumentException('Cannot end a section without first starting one.'); - } - - $last = array_pop($this->sectionStack); - - if ($overwrite) { - $this->sections[$last] = ob_get_clean(); - } else { - $this->extendSection($last, ob_get_clean()); - } - - return $last; - } - - /** - * Stop injecting content into a section and append it. - * - * @return string - * - * @throws \InvalidArgumentException - */ - public function appendSection() - { - if (empty($this->sectionStack)) { - throw new InvalidArgumentException('Cannot end a section without first starting one.'); - } - - $last = array_pop($this->sectionStack); - - if (isset($this->sections[$last])) { - $this->sections[$last] .= ob_get_clean(); - } else { - $this->sections[$last] = ob_get_clean(); - } - - return $last; - } - - /** - * Append content to a given section. - * - * @param string $section - * @param string $content - * @return void - */ - protected function extendSection($section, $content) - { - if (isset($this->sections[$section])) { - $content = str_replace(static::parentPlaceholder($section), $content, $this->sections[$section]); - } - - $this->sections[$section] = $content; - } - - /** - * Get the string contents of a section. - * - * @param string $section - * @param string $default - * @return string - */ - public function yieldContent($section, $default = '') - { - $sectionContent = $default instanceof View ? $default : e($default); - - if (isset($this->sections[$section])) { - $sectionContent = $this->sections[$section]; - } - - $sectionContent = str_replace('@@parent', '--parent--holder--', $sectionContent); - - return str_replace( - '--parent--holder--', '@parent', str_replace(static::parentPlaceholder($section), '', $sectionContent) - ); - } - - /** - * Get the parent placeholder for the current request. - * - * @param string $section - * @return string - */ - public static function parentPlaceholder($section = '') - { - if (! isset(static::$parentPlaceholder[$section])) { - $salt = static::parentPlaceholderSalt(); - - static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($salt.$section).'##'; - } - - return static::$parentPlaceholder[$section]; - } - - /** - * Get the parent placeholder salt. - * - * @return string - */ - protected static function parentPlaceholderSalt() - { - if (! static::$parentPlaceholderSalt) { - return static::$parentPlaceholderSalt = Str::random(40); - } - - return static::$parentPlaceholderSalt; - } - - /** - * Check if section exists. - * - * @param string $name - * @return bool - */ - public function hasSection($name) - { - return array_key_exists($name, $this->sections); - } - - /** - * Check if section does not exist. - * - * @param string $name - * @return bool - */ - public function sectionMissing($name) - { - return ! $this->hasSection($name); - } - - /** - * Get the contents of a section. - * - * @param string $name - * @param string|null $default - * @return mixed - */ - public function getSection($name, $default = null) - { - return $this->getSections()[$name] ?? $default; - } - - /** - * Get the entire array of sections. - * - * @return array - */ - public function getSections() - { - return $this->sections; - } - - /** - * Flush all of the sections. - * - * @return void - */ - public function flushSections() - { - $this->sections = []; - $this->sectionStack = []; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesLoops.php b/framework-9.50.2/src/Illuminate/View/Concerns/ManagesLoops.php deleted file mode 100644 index 95f06c8..0000000 --- a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesLoops.php +++ /dev/null @@ -1,96 +0,0 @@ -loopsStack); - - $this->loopsStack[] = [ - 'iteration' => 0, - 'index' => 0, - 'remaining' => $length ?? null, - 'count' => $length, - 'first' => true, - 'last' => isset($length) ? $length == 1 : null, - 'odd' => false, - 'even' => true, - 'depth' => count($this->loopsStack) + 1, - 'parent' => $parent ? (object) $parent : null, - ]; - } - - /** - * Increment the top loop's indices. - * - * @return void - */ - public function incrementLoopIndices() - { - $loop = $this->loopsStack[$index = count($this->loopsStack) - 1]; - - $this->loopsStack[$index] = array_merge($this->loopsStack[$index], [ - 'iteration' => $loop['iteration'] + 1, - 'index' => $loop['iteration'], - 'first' => $loop['iteration'] == 0, - 'odd' => ! $loop['odd'], - 'even' => ! $loop['even'], - 'remaining' => isset($loop['count']) ? $loop['remaining'] - 1 : null, - 'last' => isset($loop['count']) ? $loop['iteration'] == $loop['count'] - 1 : null, - ]); - } - - /** - * Pop a loop from the top of the loop stack. - * - * @return void - */ - public function popLoop() - { - array_pop($this->loopsStack); - } - - /** - * Get an instance of the last loop in the stack. - * - * @return \stdClass|null - */ - public function getLastLoop() - { - if ($last = Arr::last($this->loopsStack)) { - return (object) $last; - } - } - - /** - * Get the entire loop stack. - * - * @return array - */ - public function getLoopStack() - { - return $this->loopsStack; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesStacks.php b/framework-9.50.2/src/Illuminate/View/Concerns/ManagesStacks.php deleted file mode 100644 index 4e063af..0000000 --- a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesStacks.php +++ /dev/null @@ -1,179 +0,0 @@ -pushStack[] = $section; - } - } else { - $this->extendPush($section, $content); - } - } - - /** - * Stop injecting content into a push section. - * - * @return string - * - * @throws \InvalidArgumentException - */ - public function stopPush() - { - if (empty($this->pushStack)) { - throw new InvalidArgumentException('Cannot end a push stack without first starting one.'); - } - - return tap(array_pop($this->pushStack), function ($last) { - $this->extendPush($last, ob_get_clean()); - }); - } - - /** - * Append content to a given push section. - * - * @param string $section - * @param string $content - * @return void - */ - protected function extendPush($section, $content) - { - if (! isset($this->pushes[$section])) { - $this->pushes[$section] = []; - } - - if (! isset($this->pushes[$section][$this->renderCount])) { - $this->pushes[$section][$this->renderCount] = $content; - } else { - $this->pushes[$section][$this->renderCount] .= $content; - } - } - - /** - * Start prepending content into a push section. - * - * @param string $section - * @param string $content - * @return void - */ - public function startPrepend($section, $content = '') - { - if ($content === '') { - if (ob_start()) { - $this->pushStack[] = $section; - } - } else { - $this->extendPrepend($section, $content); - } - } - - /** - * Stop prepending content into a push section. - * - * @return string - * - * @throws \InvalidArgumentException - */ - public function stopPrepend() - { - if (empty($this->pushStack)) { - throw new InvalidArgumentException('Cannot end a prepend operation without first starting one.'); - } - - return tap(array_pop($this->pushStack), function ($last) { - $this->extendPrepend($last, ob_get_clean()); - }); - } - - /** - * Prepend content to a given stack. - * - * @param string $section - * @param string $content - * @return void - */ - protected function extendPrepend($section, $content) - { - if (! isset($this->prepends[$section])) { - $this->prepends[$section] = []; - } - - if (! isset($this->prepends[$section][$this->renderCount])) { - $this->prepends[$section][$this->renderCount] = $content; - } else { - $this->prepends[$section][$this->renderCount] = $content.$this->prepends[$section][$this->renderCount]; - } - } - - /** - * Get the string contents of a push section. - * - * @param string $section - * @param string $default - * @return string - */ - public function yieldPushContent($section, $default = '') - { - if (! isset($this->pushes[$section]) && ! isset($this->prepends[$section])) { - return $default; - } - - $output = ''; - - if (isset($this->prepends[$section])) { - $output .= implode(array_reverse($this->prepends[$section])); - } - - if (isset($this->pushes[$section])) { - $output .= implode($this->pushes[$section]); - } - - return $output; - } - - /** - * Flush all of the stacks. - * - * @return void - */ - public function flushStacks() - { - $this->pushes = []; - $this->prepends = []; - $this->pushStack = []; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesTranslations.php b/framework-9.50.2/src/Illuminate/View/Concerns/ManagesTranslations.php deleted file mode 100644 index a77fc26..0000000 --- a/framework-9.50.2/src/Illuminate/View/Concerns/ManagesTranslations.php +++ /dev/null @@ -1,38 +0,0 @@ -translationReplacements = $replacements; - } - - /** - * Render the current translation. - * - * @return string - */ - public function renderTranslation() - { - return $this->container->make('translator')->get( - trim(ob_get_clean()), $this->translationReplacements - ); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/DynamicComponent.php b/framework-9.50.2/src/Illuminate/View/DynamicComponent.php deleted file mode 100644 index cea66e7..0000000 --- a/framework-9.50.2/src/Illuminate/View/DynamicComponent.php +++ /dev/null @@ -1,172 +0,0 @@ -component = $component; - } - - /** - * Get the view / contents that represent the component. - * - * @return \Illuminate\Contracts\View\View|string - */ - public function render() - { - $template = <<<'EOF' -getAttributes())->mapWithKeys(function ($value, $key) { return [Illuminate\Support\Str::camel(str_replace([':', '.'], ' ', $key)) => $value]; })->all(), EXTR_SKIP); ?> -{{ props }} - -{{ slots }} -{{ defaultSlot }} - -EOF; - - return function ($data) use ($template) { - $bindings = $this->bindings($class = $this->classForComponent()); - - return str_replace( - [ - '{{ component }}', - '{{ props }}', - '{{ bindings }}', - '{{ attributes }}', - '{{ slots }}', - '{{ defaultSlot }}', - ], - [ - $this->component, - $this->compileProps($bindings), - $this->compileBindings($bindings), - class_exists($class) ? '{{ $attributes }}' : '', - $this->compileSlots($data['__laravel_slots']), - '{{ $slot ?? "" }}', - ], - $template - ); - }; - } - - /** - * Compile the @props directive for the component. - * - * @param array $bindings - * @return string - */ - protected function compileProps(array $bindings) - { - if (empty($bindings)) { - return ''; - } - - return '@props('.'[\''.implode('\',\'', collect($bindings)->map(function ($dataKey) { - return Str::camel($dataKey); - })->all()).'\']'.')'; - } - - /** - * Compile the bindings for the component. - * - * @param array $bindings - * @return string - */ - protected function compileBindings(array $bindings) - { - return collect($bindings)->map(function ($key) { - return ':'.$key.'="$'.Str::camel(str_replace([':', '.'], ' ', $key)).'"'; - })->implode(' '); - } - - /** - * Compile the slots for the component. - * - * @param array $slots - * @return string - */ - protected function compileSlots(array $slots) - { - return collect($slots)->map(function ($slot, $name) { - return $name === '__default' ? null : 'attributes).'>{{ $'.$name.' }}'; - })->filter()->implode(PHP_EOL); - } - - /** - * Get the class for the current component. - * - * @return string - */ - protected function classForComponent() - { - if (isset(static::$componentClasses[$this->component])) { - return static::$componentClasses[$this->component]; - } - - return static::$componentClasses[$this->component] = - $this->compiler()->componentClass($this->component); - } - - /** - * Get the names of the variables that should be bound to the component. - * - * @param string $class - * @return array - */ - protected function bindings(string $class) - { - [$data, $attributes] = $this->compiler()->partitionDataAndAttributes($class, $this->attributes->getAttributes()); - - return array_keys($data->all()); - } - - /** - * Get an instance of the Blade tag compiler. - * - * @return \Illuminate\View\Compilers\ComponentTagCompiler - */ - protected function compiler() - { - if (! static::$compiler) { - static::$compiler = new ComponentTagCompiler( - Container::getInstance()->make('blade.compiler')->getClassComponentAliases(), - Container::getInstance()->make('blade.compiler')->getClassComponentNamespaces(), - Container::getInstance()->make('blade.compiler') - ); - } - - return static::$compiler; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Engines/CompilerEngine.php b/framework-9.50.2/src/Illuminate/View/Engines/CompilerEngine.php deleted file mode 100755 index 97fb097..0000000 --- a/framework-9.50.2/src/Illuminate/View/Engines/CompilerEngine.php +++ /dev/null @@ -1,138 +0,0 @@ - - */ - protected $compiledOrNotExpired = []; - - /** - * Create a new compiler engine instance. - * - * @param \Illuminate\View\Compilers\CompilerInterface $compiler - * @param \Illuminate\Filesystem\Filesystem|null $files - * @return void - */ - public function __construct(CompilerInterface $compiler, Filesystem $files = null) - { - parent::__construct($files ?: new Filesystem); - - $this->compiler = $compiler; - } - - /** - * Get the evaluated contents of the view. - * - * @param string $path - * @param array $data - * @return string - */ - public function get($path, array $data = []) - { - $this->lastCompiled[] = $path; - - // If this given view has expired, which means it has simply been edited since - // it was last compiled, we will re-compile the views so we can evaluate a - // fresh copy of the view. We'll pass the compiler the path of the view. - if (! isset($this->compiledOrNotExpired[$path]) && $this->compiler->isExpired($path)) { - $this->compiler->compile($path); - } - - // Once we have the path to the compiled file, we will evaluate the paths with - // typical PHP just like any other templates. We also keep a stack of views - // which have been rendered for right exception messages to be generated. - - try { - $results = $this->evaluatePath($this->compiler->getCompiledPath($path), $data); - } catch (ViewException $e) { - if (! str($e->getMessage())->contains(['No such file or directory', 'File does not exist at path'])) { - throw $e; - } - - if (! isset($this->compiledOrNotExpired[$path])) { - throw $e; - } - - $this->compiler->compile($path); - - $results = $this->evaluatePath($this->compiler->getCompiledPath($path), $data); - } - - $this->compiledOrNotExpired[$path] = true; - - array_pop($this->lastCompiled); - - return $results; - } - - /** - * Handle a view exception. - * - * @param \Throwable $e - * @param int $obLevel - * @return void - * - * @throws \Throwable - */ - protected function handleViewException(Throwable $e, $obLevel) - { - $e = new ViewException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); - - parent::handleViewException($e, $obLevel); - } - - /** - * Get the exception message for an exception. - * - * @param \Throwable $e - * @return string - */ - protected function getMessage(Throwable $e) - { - return $e->getMessage().' (View: '.realpath(last($this->lastCompiled)).')'; - } - - /** - * Get the compiler implementation. - * - * @return \Illuminate\View\Compilers\CompilerInterface - */ - public function getCompiler() - { - return $this->compiler; - } - - /** - * Clear the cache of views that were compiled or not expired. - * - * @return void - */ - public function forgetCompiledOrNotExpired() - { - $this->compiledOrNotExpired = []; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Engines/Engine.php b/framework-9.50.2/src/Illuminate/View/Engines/Engine.php deleted file mode 100755 index bf5c748..0000000 --- a/framework-9.50.2/src/Illuminate/View/Engines/Engine.php +++ /dev/null @@ -1,23 +0,0 @@ -lastRendered; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Engines/EngineResolver.php b/framework-9.50.2/src/Illuminate/View/Engines/EngineResolver.php deleted file mode 100755 index 6740407..0000000 --- a/framework-9.50.2/src/Illuminate/View/Engines/EngineResolver.php +++ /dev/null @@ -1,71 +0,0 @@ -forget($engine); - - $this->resolvers[$engine] = $resolver; - } - - /** - * Resolve an engine instance by name. - * - * @param string $engine - * @return \Illuminate\Contracts\View\Engine - * - * @throws \InvalidArgumentException - */ - public function resolve($engine) - { - if (isset($this->resolved[$engine])) { - return $this->resolved[$engine]; - } - - if (isset($this->resolvers[$engine])) { - return $this->resolved[$engine] = call_user_func($this->resolvers[$engine]); - } - - throw new InvalidArgumentException("Engine [{$engine}] not found."); - } - - /** - * Remove a resolved engine. - * - * @param string $engine - * @return void - */ - public function forget($engine) - { - unset($this->resolved[$engine]); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Engines/FileEngine.php b/framework-9.50.2/src/Illuminate/View/Engines/FileEngine.php deleted file mode 100644 index 992f675..0000000 --- a/framework-9.50.2/src/Illuminate/View/Engines/FileEngine.php +++ /dev/null @@ -1,39 +0,0 @@ -files = $files; - } - - /** - * Get the evaluated contents of the view. - * - * @param string $path - * @param array $data - * @return string - */ - public function get($path, array $data = []) - { - return $this->files->get($path); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Engines/PhpEngine.php b/framework-9.50.2/src/Illuminate/View/Engines/PhpEngine.php deleted file mode 100755 index 13525ae..0000000 --- a/framework-9.50.2/src/Illuminate/View/Engines/PhpEngine.php +++ /dev/null @@ -1,83 +0,0 @@ -files = $files; - } - - /** - * Get the evaluated contents of the view. - * - * @param string $path - * @param array $data - * @return string - */ - public function get($path, array $data = []) - { - return $this->evaluatePath($path, $data); - } - - /** - * Get the evaluated contents of the view at the given path. - * - * @param string $path - * @param array $data - * @return string - */ - protected function evaluatePath($path, $data) - { - $obLevel = ob_get_level(); - - ob_start(); - - // We'll evaluate the contents of the view inside a try/catch block so we can - // flush out any stray output that might get out before an error occurs or - // an exception is thrown. This prevents any partial views from leaking. - try { - $this->files->getRequire($path, $data); - } catch (Throwable $e) { - $this->handleViewException($e, $obLevel); - } - - return ltrim(ob_get_clean()); - } - - /** - * Handle a view exception. - * - * @param \Throwable $e - * @param int $obLevel - * @return void - * - * @throws \Throwable - */ - protected function handleViewException(Throwable $e, $obLevel) - { - while (ob_get_level() > $obLevel) { - ob_end_clean(); - } - - throw $e; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/Factory.php b/framework-9.50.2/src/Illuminate/View/Factory.php deleted file mode 100755 index 315edc1..0000000 --- a/framework-9.50.2/src/Illuminate/View/Factory.php +++ /dev/null @@ -1,614 +0,0 @@ - 'blade', - 'php' => 'php', - 'css' => 'file', - 'html' => 'file', - ]; - - /** - * The view composer events. - * - * @var array - */ - protected $composers = []; - - /** - * The number of active rendering operations. - * - * @var int - */ - protected $renderCount = 0; - - /** - * The "once" block IDs that have been rendered. - * - * @var array - */ - protected $renderedOnce = []; - - /** - * Create a new view factory instance. - * - * @param \Illuminate\View\Engines\EngineResolver $engines - * @param \Illuminate\View\ViewFinderInterface $finder - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void - */ - public function __construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events) - { - $this->finder = $finder; - $this->events = $events; - $this->engines = $engines; - - $this->share('__env', $this); - } - - /** - * Get the evaluated view contents for the given view. - * - * @param string $path - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @param array $mergeData - * @return \Illuminate\Contracts\View\View - */ - public function file($path, $data = [], $mergeData = []) - { - $data = array_merge($mergeData, $this->parseData($data)); - - return tap($this->viewInstance($path, $path, $data), function ($view) { - $this->callCreator($view); - }); - } - - /** - * Get the evaluated view contents for the given view. - * - * @param string $view - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @param array $mergeData - * @return \Illuminate\Contracts\View\View - */ - public function make($view, $data = [], $mergeData = []) - { - $path = $this->finder->find( - $view = $this->normalizeName($view) - ); - - // Next, we will create the view instance and call the view creator for the view - // which can set any data, etc. Then we will return the view instance back to - // the caller for rendering or performing other view manipulations on this. - $data = array_merge($mergeData, $this->parseData($data)); - - return tap($this->viewInstance($view, $path, $data), function ($view) { - $this->callCreator($view); - }); - } - - /** - * Get the first view that actually exists from the given list. - * - * @param array $views - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @param array $mergeData - * @return \Illuminate\Contracts\View\View - * - * @throws \InvalidArgumentException - */ - public function first(array $views, $data = [], $mergeData = []) - { - $view = Arr::first($views, function ($view) { - return $this->exists($view); - }); - - if (! $view) { - throw new InvalidArgumentException('None of the views in the given array exist.'); - } - - return $this->make($view, $data, $mergeData); - } - - /** - * Get the rendered content of the view based on a given condition. - * - * @param bool $condition - * @param string $view - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @param array $mergeData - * @return string - */ - public function renderWhen($condition, $view, $data = [], $mergeData = []) - { - if (! $condition) { - return ''; - } - - return $this->make($view, $this->parseData($data), $mergeData)->render(); - } - - /** - * Get the rendered content of the view based on the negation of a given condition. - * - * @param bool $condition - * @param string $view - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @param array $mergeData - * @return string - */ - public function renderUnless($condition, $view, $data = [], $mergeData = []) - { - return $this->renderWhen(! $condition, $view, $data, $mergeData); - } - - /** - * Get the rendered contents of a partial from a loop. - * - * @param string $view - * @param array $data - * @param string $iterator - * @param string $empty - * @return string - */ - public function renderEach($view, $data, $iterator, $empty = 'raw|') - { - $result = ''; - - // If is actually data in the array, we will loop through the data and append - // an instance of the partial view to the final result HTML passing in the - // iterated value of this data array, allowing the views to access them. - if (count($data) > 0) { - foreach ($data as $key => $value) { - $result .= $this->make( - $view, ['key' => $key, $iterator => $value] - )->render(); - } - } - - // If there is no data in the array, we will render the contents of the empty - // view. Alternatively, the "empty view" could be a raw string that begins - // with "raw|" for convenience and to let this know that it is a string. - else { - $result = str_starts_with($empty, 'raw|') - ? substr($empty, 4) - : $this->make($empty)->render(); - } - - return $result; - } - - /** - * Normalize a view name. - * - * @param string $name - * @return string - */ - protected function normalizeName($name) - { - return ViewName::normalize($name); - } - - /** - * Parse the given data into a raw array. - * - * @param mixed $data - * @return array - */ - protected function parseData($data) - { - return $data instanceof Arrayable ? $data->toArray() : $data; - } - - /** - * Create a new view instance from the given arguments. - * - * @param string $view - * @param string $path - * @param \Illuminate\Contracts\Support\Arrayable|array $data - * @return \Illuminate\Contracts\View\View - */ - protected function viewInstance($view, $path, $data) - { - return new View($this, $this->getEngineFromPath($path), $view, $path, $data); - } - - /** - * Determine if a given view exists. - * - * @param string $view - * @return bool - */ - public function exists($view) - { - try { - $this->finder->find($view); - } catch (InvalidArgumentException $e) { - return false; - } - - return true; - } - - /** - * Get the appropriate view engine for the given path. - * - * @param string $path - * @return \Illuminate\Contracts\View\Engine - * - * @throws \InvalidArgumentException - */ - public function getEngineFromPath($path) - { - if (! $extension = $this->getExtension($path)) { - throw new InvalidArgumentException("Unrecognized extension in file: {$path}."); - } - - $engine = $this->extensions[$extension]; - - return $this->engines->resolve($engine); - } - - /** - * Get the extension used by the view file. - * - * @param string $path - * @return string|null - */ - protected function getExtension($path) - { - $extensions = array_keys($this->extensions); - - return Arr::first($extensions, function ($value) use ($path) { - return str_ends_with($path, '.'.$value); - }); - } - - /** - * Add a piece of shared data to the environment. - * - * @param array|string $key - * @param mixed|null $value - * @return mixed - */ - public function share($key, $value = null) - { - $keys = is_array($key) ? $key : [$key => $value]; - - foreach ($keys as $key => $value) { - $this->shared[$key] = $value; - } - - return $value; - } - - /** - * Increment the rendering counter. - * - * @return void - */ - public function incrementRender() - { - $this->renderCount++; - } - - /** - * Decrement the rendering counter. - * - * @return void - */ - public function decrementRender() - { - $this->renderCount--; - } - - /** - * Check if there are no active render operations. - * - * @return bool - */ - public function doneRendering() - { - return $this->renderCount == 0; - } - - /** - * Determine if the given once token has been rendered. - * - * @param string $id - * @return bool - */ - public function hasRenderedOnce(string $id) - { - return isset($this->renderedOnce[$id]); - } - - /** - * Mark the given once token as having been rendered. - * - * @param string $id - * @return void - */ - public function markAsRenderedOnce(string $id) - { - $this->renderedOnce[$id] = true; - } - - /** - * Add a location to the array of view locations. - * - * @param string $location - * @return void - */ - public function addLocation($location) - { - $this->finder->addLocation($location); - } - - /** - * Add a new namespace to the loader. - * - * @param string $namespace - * @param string|array $hints - * @return $this - */ - public function addNamespace($namespace, $hints) - { - $this->finder->addNamespace($namespace, $hints); - - return $this; - } - - /** - * Prepend a new namespace to the loader. - * - * @param string $namespace - * @param string|array $hints - * @return $this - */ - public function prependNamespace($namespace, $hints) - { - $this->finder->prependNamespace($namespace, $hints); - - return $this; - } - - /** - * Replace the namespace hints for the given namespace. - * - * @param string $namespace - * @param string|array $hints - * @return $this - */ - public function replaceNamespace($namespace, $hints) - { - $this->finder->replaceNamespace($namespace, $hints); - - return $this; - } - - /** - * Register a valid view extension and its engine. - * - * @param string $extension - * @param string $engine - * @param \Closure|null $resolver - * @return void - */ - public function addExtension($extension, $engine, $resolver = null) - { - $this->finder->addExtension($extension); - - if (isset($resolver)) { - $this->engines->register($engine, $resolver); - } - - unset($this->extensions[$extension]); - - $this->extensions = array_merge([$extension => $engine], $this->extensions); - } - - /** - * Flush all of the factory state like sections and stacks. - * - * @return void - */ - public function flushState() - { - $this->renderCount = 0; - $this->renderedOnce = []; - - $this->flushSections(); - $this->flushStacks(); - $this->flushComponents(); - $this->flushFragments(); - } - - /** - * Flush all of the section contents if done rendering. - * - * @return void - */ - public function flushStateIfDoneRendering() - { - if ($this->doneRendering()) { - $this->flushState(); - } - } - - /** - * Get the extension to engine bindings. - * - * @return array - */ - public function getExtensions() - { - return $this->extensions; - } - - /** - * Get the engine resolver instance. - * - * @return \Illuminate\View\Engines\EngineResolver - */ - public function getEngineResolver() - { - return $this->engines; - } - - /** - * Get the view finder instance. - * - * @return \Illuminate\View\ViewFinderInterface - */ - public function getFinder() - { - return $this->finder; - } - - /** - * Set the view finder instance. - * - * @param \Illuminate\View\ViewFinderInterface $finder - * @return void - */ - public function setFinder(ViewFinderInterface $finder) - { - $this->finder = $finder; - } - - /** - * Flush the cache of views located by the finder. - * - * @return void - */ - public function flushFinderCache() - { - $this->getFinder()->flush(); - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher - */ - public function getDispatcher() - { - return $this->events; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void - */ - public function setDispatcher(Dispatcher $events) - { - $this->events = $events; - } - - /** - * Get the IoC container instance. - * - * @return \Illuminate\Contracts\Container\Container - */ - public function getContainer() - { - return $this->container; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Contracts\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } - - /** - * Get an item from the shared data. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function shared($key, $default = null) - { - return Arr::get($this->shared, $key, $default); - } - - /** - * Get all of the shared data for the environment. - * - * @return array - */ - public function getShared() - { - return $this->shared; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/FileViewFinder.php b/framework-9.50.2/src/Illuminate/View/FileViewFinder.php deleted file mode 100755 index 5502fe5..0000000 --- a/framework-9.50.2/src/Illuminate/View/FileViewFinder.php +++ /dev/null @@ -1,330 +0,0 @@ -files = $files; - $this->paths = array_map([$this, 'resolvePath'], $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) - { - [$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(fn ($extension) => str_replace('.', '/', $name).'.'.$extension, $this->extensions); - } - - /** - * Add a location to the finder. - * - * @param string $location - * @return void - */ - public function addLocation($location) - { - $this->paths[] = $this->resolvePath($location); - } - - /** - * Prepend a location to the finder. - * - * @param string $location - * @return void - */ - public function prependLocation($location) - { - array_unshift($this->paths, $this->resolvePath($location)); - } - - /** - * Resolve the path. - * - * @param string $path - * @return string - */ - protected function resolvePath($path) - { - return realpath($path) ?: $path; - } - - /** - * 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; - } - - /** - * Set the active view paths. - * - * @param array $paths - * @return $this - */ - public function setPaths($paths) - { - $this->paths = $paths; - - return $this; - } - - /** - * Get the active view paths. - * - * @return array - */ - public function getPaths() - { - return $this->paths; - } - - /** - * Get the views that have been located. - * - * @return array - */ - public function getViews() - { - return $this->views; - } - - /** - * 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; - } -} diff --git a/framework-9.50.2/src/Illuminate/View/InvokableComponentVariable.php b/framework-9.50.2/src/Illuminate/View/InvokableComponentVariable.php deleted file mode 100644 index 0d43ae3..0000000 --- a/framework-9.50.2/src/Illuminate/View/InvokableComponentVariable.php +++ /dev/null @@ -1,96 +0,0 @@ -callable = $callable; - } - - /** - * Resolve the displayable value that the class is deferring. - * - * @return \Illuminate\Contracts\Support\Htmlable|string - */ - public function resolveDisplayableValue() - { - return $this->__invoke(); - } - - /** - * Get an interator instance for the variable. - * - * @return \ArrayIterator - */ - public function getIterator(): Traversable - { - $result = $this->__invoke(); - - return new ArrayIterator($result instanceof Enumerable ? $result->all() : $result); - } - - /** - * Dynamically proxy attribute access to the variable. - * - * @param string $key - * @return mixed - */ - public function __get($key) - { - return $this->__invoke()->{$key}; - } - - /** - * Dynamically proxy method access to the variable. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - return $this->__invoke()->{$method}(...$parameters); - } - - /** - * Resolve the variable. - * - * @return mixed - */ - public function __invoke() - { - return call_user_func($this->callable); - } - - /** - * Resolve the variable as a string. - * - * @return mixed - */ - public function __toString() - { - return (string) $this->__invoke(); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/LICENSE.md b/framework-9.50.2/src/Illuminate/View/LICENSE.md deleted file mode 100644 index 79810c8..0000000 --- a/framework-9.50.2/src/Illuminate/View/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Taylor Otwell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/framework-9.50.2/src/Illuminate/View/Middleware/ShareErrorsFromSession.php b/framework-9.50.2/src/Illuminate/View/Middleware/ShareErrorsFromSession.php deleted file mode 100644 index 64015d5..0000000 --- a/framework-9.50.2/src/Illuminate/View/Middleware/ShareErrorsFromSession.php +++ /dev/null @@ -1,51 +0,0 @@ -view = $view; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - // If the current session has an "errors" variable bound to it, we will share - // its value with all view instances so the views can easily access errors - // without having to bind. An empty bag is set when there aren't errors. - $this->view->share( - 'errors', $request->session()->get('errors') ?: new ViewErrorBag - ); - - // Putting the errors in the view for every view allows the developer to just - // assume that some errors are always available, which is convenient since - // they don't have to continually run checks for the presence of errors. - - return $next($request); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/View.php b/framework-9.50.2/src/Illuminate/View/View.php deleted file mode 100755 index efe6fce..0000000 --- a/framework-9.50.2/src/Illuminate/View/View.php +++ /dev/null @@ -1,494 +0,0 @@ -view = $view; - $this->path = $path; - $this->engine = $engine; - $this->factory = $factory; - - $this->data = $data instanceof Arrayable ? $data->toArray() : (array) $data; - } - - /** - * Get the evaluated contents of a given fragment. - * - * @param string $fragment - * @return string - */ - public function fragment($fragment) - { - return $this->render(function () use ($fragment) { - return $this->factory->getFragment($fragment); - }); - } - - /** - * Get the evaluated contents for a given array of fragments. - * - * @param array $fragments - * @return string - */ - public function fragments(array $fragments) - { - return collect($fragments)->map(fn ($f) => $this->fragment($f))->implode(''); - } - - /** - * Get the evaluated contents of a given fragment if the given condition is true. - * - * @param bool $boolean - * @param string $fragment - * @return string - */ - public function fragmentIf($boolean, $fragment) - { - if (value($boolean)) { - return $this->fragment($fragment); - } - - return $this->render(); - } - - /** - * Get the evaluated contents for a given array of fragments if the given condition is true. - * - * @param bool $boolean - * @param array $fragments - * @return string - */ - public function fragmentsIf($boolean, array $fragments) - { - if (value($boolean)) { - return $this->fragments($fragments); - } - - return $this->render(); - } - - /** - * Get the string contents of the view. - * - * @param callable|null $callback - * @return string - * - * @throws \Throwable - */ - public function render(callable $callback = null) - { - try { - $contents = $this->renderContents(); - - $response = isset($callback) ? $callback($this, $contents) : null; - - // Once we have the contents of the view, we will flush the sections if we are - // done rendering all views so that there is nothing left hanging over when - // another view gets rendered in the future by the application developer. - $this->factory->flushStateIfDoneRendering(); - - return ! is_null($response) ? $response : $contents; - } catch (Throwable $e) { - $this->factory->flushState(); - - throw $e; - } - } - - /** - * Get the contents of the view instance. - * - * @return string - */ - protected function renderContents() - { - // We will keep track of the number of views being rendered so we can flush - // the section after the complete rendering operation is done. This will - // clear out the sections for any separate views that may be rendered. - $this->factory->incrementRender(); - - $this->factory->callComposer($this); - - $contents = $this->getContents(); - - // Once we've finished rendering the view, we'll decrement the render count - // so that each section gets flushed out next time a view is created and - // no old sections are staying around in the memory of an environment. - $this->factory->decrementRender(); - - return $contents; - } - - /** - * Get the evaluated contents of the view. - * - * @return string - */ - protected function getContents() - { - return $this->engine->get($this->path, $this->gatherData()); - } - - /** - * Get the data bound to the view instance. - * - * @return array - */ - public function gatherData() - { - $data = array_merge($this->factory->getShared(), $this->data); - - foreach ($data as $key => $value) { - if ($value instanceof Renderable) { - $data[$key] = $value->render(); - } - } - - return $data; - } - - /** - * Get the sections of the rendered view. - * - * @return array - * - * @throws \Throwable - */ - public function renderSections() - { - return $this->render(function () { - return $this->factory->getSections(); - }); - } - - /** - * Add a piece of data to the view. - * - * @param string|array $key - * @param mixed $value - * @return $this - */ - public function with($key, $value = null) - { - if (is_array($key)) { - $this->data = array_merge($this->data, $key); - } else { - $this->data[$key] = $value; - } - - return $this; - } - - /** - * Add a view instance to the view data. - * - * @param string $key - * @param string $view - * @param array $data - * @return $this - */ - public function nest($key, $view, array $data = []) - { - return $this->with($key, $this->factory->make($view, $data)); - } - - /** - * Add validation errors to the view. - * - * @param \Illuminate\Contracts\Support\MessageProvider|array $provider - * @param string $bag - * @return $this - */ - public function withErrors($provider, $bag = 'default') - { - return $this->with('errors', (new ViewErrorBag)->put( - $bag, $this->formatErrors($provider) - )); - } - - /** - * Parse the given errors into an appropriate value. - * - * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider - * @return \Illuminate\Support\MessageBag - */ - protected function formatErrors($provider) - { - return $provider instanceof MessageProvider - ? $provider->getMessageBag() - : new MessageBag((array) $provider); - } - - /** - * Get the name of the view. - * - * @return string - */ - public function name() - { - return $this->getName(); - } - - /** - * Get the name of the view. - * - * @return string - */ - public function getName() - { - return $this->view; - } - - /** - * Get the array of view data. - * - * @return array - */ - public function getData() - { - return $this->data; - } - - /** - * Get the path to the view file. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Set the path to the view. - * - * @param string $path - * @return void - */ - public function setPath($path) - { - $this->path = $path; - } - - /** - * Get the view factory instance. - * - * @return \Illuminate\View\Factory - */ - public function getFactory() - { - return $this->factory; - } - - /** - * Get the view's rendering engine. - * - * @return \Illuminate\Contracts\View\Engine - */ - public function getEngine() - { - return $this->engine; - } - - /** - * Determine if a piece of data is bound. - * - * @param string $key - * @return bool - */ - public function offsetExists($key): bool - { - return array_key_exists($key, $this->data); - } - - /** - * Get a piece of bound data to the view. - * - * @param string $key - * @return mixed - */ - public function offsetGet($key): mixed - { - return $this->data[$key]; - } - - /** - * Set a piece of data on the view. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value): void - { - $this->with($key, $value); - } - - /** - * Unset a piece of data from the view. - * - * @param string $key - * @return void - */ - public function offsetUnset($key): void - { - unset($this->data[$key]); - } - - /** - * Get a piece of data from the view. - * - * @param string $key - * @return mixed - */ - public function &__get($key) - { - return $this->data[$key]; - } - - /** - * Set a piece of data on the view. - * - * @param string $key - * @param mixed $value - * @return void - */ - public function __set($key, $value) - { - $this->with($key, $value); - } - - /** - * Check if a piece of data is bound to the view. - * - * @param string $key - * @return bool - */ - public function __isset($key) - { - return isset($this->data[$key]); - } - - /** - * Remove a piece of bound data from the view. - * - * @param string $key - * @return void - */ - public function __unset($key) - { - unset($this->data[$key]); - } - - /** - * Dynamically bind parameters to the view. - * - * @param string $method - * @param array $parameters - * @return \Illuminate\View\View - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (static::hasMacro($method)) { - return $this->macroCall($method, $parameters); - } - - if (! str_starts_with($method, 'with')) { - throw new BadMethodCallException(sprintf( - 'Method %s::%s does not exist.', static::class, $method - )); - } - - return $this->with(Str::camel(substr($method, 4)), $parameters[0]); - } - - /** - * Get content as a string of HTML. - * - * @return string - */ - public function toHtml() - { - return $this->render(); - } - - /** - * Get the string contents of the view. - * - * @return string - * - * @throws \Throwable - */ - public function __toString() - { - return $this->render(); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/ViewException.php b/framework-9.50.2/src/Illuminate/View/ViewException.php deleted file mode 100644 index 77f9ee6..0000000 --- a/framework-9.50.2/src/Illuminate/View/ViewException.php +++ /dev/null @@ -1,41 +0,0 @@ -getPrevious(); - - if (Reflector::isCallable($reportCallable = [$exception, 'report'])) { - return Container::getInstance()->call($reportCallable); - } - - return false; - } - - /** - * Render the exception into an HTTP response. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response|null - */ - public function render($request) - { - $exception = $this->getPrevious(); - - if ($exception && method_exists($exception, 'render')) { - return $exception->render($request); - } - } -} diff --git a/framework-9.50.2/src/Illuminate/View/ViewFinderInterface.php b/framework-9.50.2/src/Illuminate/View/ViewFinderInterface.php deleted file mode 100755 index 7b8a849..0000000 --- a/framework-9.50.2/src/Illuminate/View/ViewFinderInterface.php +++ /dev/null @@ -1,71 +0,0 @@ -registerFactory(); - $this->registerViewFinder(); - $this->registerBladeCompiler(); - $this->registerEngineResolver(); - - $this->app->terminating(static function () { - Component::flushCache(); - }); - } - - /** - * Register the view environment. - * - * @return void - */ - public function registerFactory() - { - $this->app->singleton('view', function ($app) { - // Next we need to grab the engine resolver instance that will be used by the - // environment. The resolver will be used by an environment to get each of - // the various engine implementations such as plain PHP or Blade engine. - $resolver = $app['view.engine.resolver']; - - $finder = $app['view.finder']; - - $factory = $this->createFactory($resolver, $finder, $app['events']); - - // We will also set the container instance on this view environment since the - // view composers may be classes registered in the container, which allows - // for great testable, flexible composers for the application developer. - $factory->setContainer($app); - - $factory->share('app', $app); - - $app->terminating(static function () { - Component::forgetFactory(); - }); - - return $factory; - }); - } - - /** - * Create a new Factory Instance. - * - * @param \Illuminate\View\Engines\EngineResolver $resolver - * @param \Illuminate\View\ViewFinderInterface $finder - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return \Illuminate\View\Factory - */ - protected function createFactory($resolver, $finder, $events) - { - return new Factory($resolver, $finder, $events); - } - - /** - * Register the view finder implementation. - * - * @return void - */ - public function registerViewFinder() - { - $this->app->bind('view.finder', function ($app) { - return new FileViewFinder($app['files'], $app['config']['view.paths']); - }); - } - - /** - * Register the Blade compiler implementation. - * - * @return void - */ - public function registerBladeCompiler() - { - $this->app->singleton('blade.compiler', function ($app) { - return tap(new BladeCompiler( - $app['files'], - $app['config']['view.compiled'], - $app['config']->get('view.relative_hash', false) ? $app->basePath() : '', - $app['config']->get('view.cache', true), - $app['config']->get('view.compiled_extension', 'php'), - ), function ($blade) { - $blade->component('dynamic-component', DynamicComponent::class); - }); - }); - } - - /** - * Register the engine resolver instance. - * - * @return void - */ - public function registerEngineResolver() - { - $this->app->singleton('view.engine.resolver', function () { - $resolver = new EngineResolver; - - // Next, we will register the various view engines with the resolver so that the - // environment will resolve the engines needed for various views based on the - // extension of view file. We call a method for each of the view's engines. - foreach (['file', 'php', 'blade'] as $engine) { - $this->{'register'.ucfirst($engine).'Engine'}($resolver); - } - - return $resolver; - }); - } - - /** - * Register the file engine implementation. - * - * @param \Illuminate\View\Engines\EngineResolver $resolver - * @return void - */ - public function registerFileEngine($resolver) - { - $resolver->register('file', function () { - return new FileEngine($this->app['files']); - }); - } - - /** - * Register the PHP engine implementation. - * - * @param \Illuminate\View\Engines\EngineResolver $resolver - * @return void - */ - public function registerPhpEngine($resolver) - { - $resolver->register('php', function () { - return new PhpEngine($this->app['files']); - }); - } - - /** - * Register the Blade engine implementation. - * - * @param \Illuminate\View\Engines\EngineResolver $resolver - * @return void - */ - public function registerBladeEngine($resolver) - { - $resolver->register('blade', function () { - $compiler = new CompilerEngine($this->app['blade.compiler'], $this->app['files']); - - $this->app->terminating(static function () use ($compiler) { - $compiler->forgetCompiledOrNotExpired(); - }); - - return $compiler; - }); - } -} diff --git a/framework-9.50.2/src/Illuminate/View/composer.json b/framework-9.50.2/src/Illuminate/View/composer.json deleted file mode 100644 index 7487d55..0000000 --- a/framework-9.50.2/src/Illuminate/View/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "illuminate/view", - "description": "The Illuminate View package.", - "license": "MIT", - "homepage": "https://laravel.com", - "support": { - "issues": "https://github.com/laravel/framework/issues", - "source": "https://github.com/laravel/framework" - }, - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "require": { - "php": "^8.0.2", - "ext-json": "*", - "illuminate/collections": "^9.0", - "illuminate/container": "^9.0", - "illuminate/contracts": "^9.0", - "illuminate/events": "^9.0", - "illuminate/filesystem": "^9.0", - "illuminate/macroable": "^9.0", - "illuminate/support": "^9.0" - }, - "autoload": { - "psr-4": { - "Illuminate\\View\\": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev" -} diff --git a/src/Collect/Support/Enumerable.php b/src/Collect/Support/Enumerable.php index d8b21da..1f0db03 100644 --- a/src/Collect/Support/Enumerable.php +++ b/src/Collect/Support/Enumerable.php @@ -51,11 +51,10 @@ public static function range($from, $to); /** * Wrap the given value in a collection if applicable. * - * @template TWrapKey of array-key * @template TWrapValue * - * @param iterable $value - * @return static + * @param iterable|TWrapValue $value + * @return static */ public static function wrap($value); diff --git a/src/Collect/Support/Traits/EnumeratesValues.php b/src/Collect/Support/Traits/EnumeratesValues.php index 3112a25..25cde22 100644 --- a/src/Collect/Support/Traits/EnumeratesValues.php +++ b/src/Collect/Support/Traits/EnumeratesValues.php @@ -114,11 +114,10 @@ public static function make($items = []) /** * Wrap the given value in a collection if applicable. * - * @template TWrapKey of array-key * @template TWrapValue * - * @param iterable $value - * @return static + * @param iterable|TWrapValue $value + * @return static */ public static function wrap($value) { diff --git a/tests/files/Support/Stringable.php b/tests/files/Support/Stringable.php index 109888c..1ff717e 100644 --- a/tests/files/Support/Stringable.php +++ b/tests/files/Support/Stringable.php @@ -57,7 +57,7 @@ public function afterLast($search) /** * Append the given values to the string. * - * @param array ...$values + * @param string ...$values * @return static */ public function append(...$values) @@ -545,7 +545,7 @@ public function pluralStudly($count = 2) /** * Prepend the given values to the string. * - * @param array ...$values + * @param string ...$values * @return static */ public function prepend(...$values) diff --git a/upgrade.sh b/upgrade.sh index b5be02a..291cc2f 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -61,7 +61,7 @@ function main() fillAliases - # cleanupDir + cleanupDir runTests } @@ -382,7 +382,7 @@ function getCurrentVersionFromGitHub() echo Getting current version from $repository... if [ -z "$requestedVersion" ]; then - collectionVersion=$(git ls-remote $repository --tags v9.50\* | grep tags/ | grep -v {} | cut -d \/ -f 3 | cut -d v -f 2 | grep -v RC | grep -vi beta | sort -t. -k 1,1n -k 2,2n -k 3,3n| tail -1) + collectionVersion=$(git ls-remote $repository --tags v9.51\* | grep tags/ | grep -v {} | cut -d \/ -f 3 | cut -d v -f 2 | grep -v RC | grep -vi beta | sort -t. -k 1,1n -k 2,2n -k 3,3n| tail -1) else collectionVersion=$requestedVersion fi