Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Apache
: 172.26.7.228 | : 52.14.40.148
Cant Read [ /etc/named.conf ]
5.6.40-24+ubuntu18.04.1+deb.sury.org+1
www-data
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
var /
www /
oasis /
aws /
Aws /
[ HOME SHELL ]
Name
Size
Permission
Action
ACMPCA
[ DIR ]
drwxr-sr-x
AccessAnalyzer
[ DIR ]
drwxr-sr-x
Acm
[ DIR ]
drwxr-sr-x
AlexaForBusiness
[ DIR ]
drwxr-sr-x
Amplify
[ DIR ]
drwxr-sr-x
Api
[ DIR ]
drwxr-sr-x
ApiGateway
[ DIR ]
drwxr-sr-x
ApiGatewayManagementApi
[ DIR ]
drwxr-sr-x
ApiGatewayV2
[ DIR ]
drwxr-sr-x
AppConfig
[ DIR ]
drwxr-sr-x
AppMesh
[ DIR ]
drwxr-sr-x
AppSync
[ DIR ]
drwxr-sr-x
ApplicationAutoScaling
[ DIR ]
drwxr-sr-x
ApplicationDiscoveryService
[ DIR ]
drwxr-sr-x
ApplicationInsights
[ DIR ]
drwxr-sr-x
Appstream
[ DIR ]
drwxr-sr-x
Arn
[ DIR ]
drwxr-sr-x
Athena
[ DIR ]
drwxr-sr-x
AugmentedAIRuntime
[ DIR ]
drwxr-sr-x
AutoScaling
[ DIR ]
drwxr-sr-x
AutoScalingPlans
[ DIR ]
drwxr-sr-x
Backup
[ DIR ]
drwxr-sr-x
Batch
[ DIR ]
drwxr-sr-x
Budgets
[ DIR ]
drwxr-sr-x
Chime
[ DIR ]
drwxr-sr-x
ClientSideMonitoring
[ DIR ]
drwxr-sr-x
Cloud9
[ DIR ]
drwxr-sr-x
CloudDirectory
[ DIR ]
drwxr-sr-x
CloudFormation
[ DIR ]
drwxr-sr-x
CloudFront
[ DIR ]
drwxr-sr-x
CloudHSMV2
[ DIR ]
drwxr-sr-x
CloudHsm
[ DIR ]
drwxr-sr-x
CloudSearch
[ DIR ]
drwxr-sr-x
CloudSearchDomain
[ DIR ]
drwxr-sr-x
CloudTrail
[ DIR ]
drwxr-sr-x
CloudWatch
[ DIR ]
drwxr-sr-x
CloudWatchEvents
[ DIR ]
drwxr-sr-x
CloudWatchLogs
[ DIR ]
drwxr-sr-x
CodeBuild
[ DIR ]
drwxr-sr-x
CodeCommit
[ DIR ]
drwxr-sr-x
CodeDeploy
[ DIR ]
drwxr-sr-x
CodeGuruProfiler
[ DIR ]
drwxr-sr-x
CodeGuruReviewer
[ DIR ]
drwxr-sr-x
CodePipeline
[ DIR ]
drwxr-sr-x
CodeStar
[ DIR ]
drwxr-sr-x
CodeStarNotifications
[ DIR ]
drwxr-sr-x
CodeStarconnections
[ DIR ]
drwxr-sr-x
CognitoIdentity
[ DIR ]
drwxr-sr-x
CognitoIdentityProvider
[ DIR ]
drwxr-sr-x
CognitoSync
[ DIR ]
drwxr-sr-x
Comprehend
[ DIR ]
drwxr-sr-x
ComprehendMedical
[ DIR ]
drwxr-sr-x
ComputeOptimizer
[ DIR ]
drwxr-sr-x
ConfigService
[ DIR ]
drwxr-sr-x
Connect
[ DIR ]
drwxr-sr-x
ConnectParticipant
[ DIR ]
drwxr-sr-x
CostExplorer
[ DIR ]
drwxr-sr-x
CostandUsageReportService
[ DIR ]
drwxr-sr-x
Credentials
[ DIR ]
drwxr-sr-x
Crypto
[ DIR ]
drwxr-sr-x
DAX
[ DIR ]
drwxr-sr-x
DLM
[ DIR ]
drwxr-sr-x
DataExchange
[ DIR ]
drwxr-sr-x
DataPipeline
[ DIR ]
drwxr-sr-x
DataSync
[ DIR ]
drwxr-sr-x
DatabaseMigrationService
[ DIR ]
drwxr-sr-x
Detective
[ DIR ]
drwxr-sr-x
DeviceFarm
[ DIR ]
drwxr-sr-x
DirectConnect
[ DIR ]
drwxr-sr-x
DirectoryService
[ DIR ]
drwxr-sr-x
DocDB
[ DIR ]
drwxr-sr-x
DynamoDb
[ DIR ]
drwxr-sr-x
DynamoDbStreams
[ DIR ]
drwxr-sr-x
EBS
[ DIR ]
drwxr-sr-x
EC2InstanceConnect
[ DIR ]
drwxr-sr-x
EKS
[ DIR ]
drwxr-sr-x
Ec2
[ DIR ]
drwxr-sr-x
Ecr
[ DIR ]
drwxr-sr-x
Ecs
[ DIR ]
drwxr-sr-x
Efs
[ DIR ]
drwxr-sr-x
ElastiCache
[ DIR ]
drwxr-sr-x
ElasticBeanstalk
[ DIR ]
drwxr-sr-x
ElasticInference
[ DIR ]
drwxr-sr-x
ElasticLoadBalancing
[ DIR ]
drwxr-sr-x
ElasticLoadBalancingV2
[ DIR ]
drwxr-sr-x
ElasticTranscoder
[ DIR ]
drwxr-sr-x
ElasticsearchService
[ DIR ]
drwxr-sr-x
Emr
[ DIR ]
drwxr-sr-x
Endpoint
[ DIR ]
drwxr-sr-x
EndpointDiscovery
[ DIR ]
drwxr-sr-x
EventBridge
[ DIR ]
drwxr-sr-x
Exception
[ DIR ]
drwxr-sr-x
FMS
[ DIR ]
drwxr-sr-x
FSx
[ DIR ]
drwxr-sr-x
Firehose
[ DIR ]
drwxr-sr-x
ForecastQueryService
[ DIR ]
drwxr-sr-x
ForecastService
[ DIR ]
drwxr-sr-x
FraudDetector
[ DIR ]
drwxr-sr-x
GameLift
[ DIR ]
drwxr-sr-x
Glacier
[ DIR ]
drwxr-sr-x
GlobalAccelerator
[ DIR ]
drwxr-sr-x
Glue
[ DIR ]
drwxr-sr-x
Greengrass
[ DIR ]
drwxr-sr-x
GroundStation
[ DIR ]
drwxr-sr-x
GuardDuty
[ DIR ]
drwxr-sr-x
Handler
[ DIR ]
drwxr-sr-x
Health
[ DIR ]
drwxr-sr-x
Iam
[ DIR ]
drwxr-sr-x
ImportExport
[ DIR ]
drwxr-sr-x
Inspector
[ DIR ]
drwxr-sr-x
IoT1ClickDevicesService
[ DIR ]
drwxr-sr-x
IoT1ClickProjects
[ DIR ]
drwxr-sr-x
IoTAnalytics
[ DIR ]
drwxr-sr-x
IoTEvents
[ DIR ]
drwxr-sr-x
IoTEventsData
[ DIR ]
drwxr-sr-x
IoTJobsDataPlane
[ DIR ]
drwxr-sr-x
IoTSecureTunneling
[ DIR ]
drwxr-sr-x
IoTThingsGraph
[ DIR ]
drwxr-sr-x
Iot
[ DIR ]
drwxr-sr-x
IotDataPlane
[ DIR ]
drwxr-sr-x
Kafka
[ DIR ]
drwxr-sr-x
Kinesis
[ DIR ]
drwxr-sr-x
KinesisAnalytics
[ DIR ]
drwxr-sr-x
KinesisAnalyticsV2
[ DIR ]
drwxr-sr-x
KinesisVideo
[ DIR ]
drwxr-sr-x
KinesisVideoArchivedMedia
[ DIR ]
drwxr-sr-x
KinesisVideoMedia
[ DIR ]
drwxr-sr-x
KinesisVideoSignalingChannels
[ DIR ]
drwxr-sr-x
Kms
[ DIR ]
drwxr-sr-x
LakeFormation
[ DIR ]
drwxr-sr-x
Lambda
[ DIR ]
drwxr-sr-x
LexModelBuildingService
[ DIR ]
drwxr-sr-x
LexRuntimeService
[ DIR ]
drwxr-sr-x
LicenseManager
[ DIR ]
drwxr-sr-x
Lightsail
[ DIR ]
drwxr-sr-x
MQ
[ DIR ]
drwxr-sr-x
MTurk
[ DIR ]
drwxr-sr-x
MachineLearning
[ DIR ]
drwxr-sr-x
Macie
[ DIR ]
drwxr-sr-x
ManagedBlockchain
[ DIR ]
drwxr-sr-x
MarketplaceCatalog
[ DIR ]
drwxr-sr-x
MarketplaceCommerceAnalytics
[ DIR ]
drwxr-sr-x
MarketplaceEntitlementService
[ DIR ]
drwxr-sr-x
MarketplaceMetering
[ DIR ]
drwxr-sr-x
MediaConnect
[ DIR ]
drwxr-sr-x
MediaConvert
[ DIR ]
drwxr-sr-x
MediaLive
[ DIR ]
drwxr-sr-x
MediaPackage
[ DIR ]
drwxr-sr-x
MediaPackageVod
[ DIR ]
drwxr-sr-x
MediaStore
[ DIR ]
drwxr-sr-x
MediaStoreData
[ DIR ]
drwxr-sr-x
MediaTailor
[ DIR ]
drwxr-sr-x
MigrationHub
[ DIR ]
drwxr-sr-x
MigrationHubConfig
[ DIR ]
drwxr-sr-x
Mobile
[ DIR ]
drwxr-sr-x
Multipart
[ DIR ]
drwxr-sr-x
Neptune
[ DIR ]
drwxr-sr-x
NetworkManager
[ DIR ]
drwxr-sr-x
OpsWorks
[ DIR ]
drwxr-sr-x
OpsWorksCM
[ DIR ]
drwxr-sr-x
Organizations
[ DIR ]
drwxr-sr-x
Outposts
[ DIR ]
drwxr-sr-x
PI
[ DIR ]
drwxr-sr-x
Personalize
[ DIR ]
drwxr-sr-x
PersonalizeEvents
[ DIR ]
drwxr-sr-x
PersonalizeRuntime
[ DIR ]
drwxr-sr-x
Pinpoint
[ DIR ]
drwxr-sr-x
PinpointEmail
[ DIR ]
drwxr-sr-x
PinpointSMSVoice
[ DIR ]
drwxr-sr-x
Polly
[ DIR ]
drwxr-sr-x
Pricing
[ DIR ]
drwxr-sr-x
QLDB
[ DIR ]
drwxr-sr-x
QLDBSession
[ DIR ]
drwxr-sr-x
QuickSight
[ DIR ]
drwxr-sr-x
RAM
[ DIR ]
drwxr-sr-x
RDSDataService
[ DIR ]
drwxr-sr-x
Rds
[ DIR ]
drwxr-sr-x
Redshift
[ DIR ]
drwxr-sr-x
Rekognition
[ DIR ]
drwxr-sr-x
ResourceGroups
[ DIR ]
drwxr-sr-x
ResourceGroupsTaggingAPI
[ DIR ]
drwxr-sr-x
RoboMaker
[ DIR ]
drwxr-sr-x
Route53
[ DIR ]
drwxr-sr-x
Route53Domains
[ DIR ]
drwxr-sr-x
Route53Resolver
[ DIR ]
drwxr-sr-x
S3
[ DIR ]
drwxr-sr-x
S3Control
[ DIR ]
drwxr-sr-x
SSO
[ DIR ]
drwxr-sr-x
SSOOIDC
[ DIR ]
drwxr-sr-x
SageMaker
[ DIR ]
drwxr-sr-x
SageMakerRuntime
[ DIR ]
drwxr-sr-x
SavingsPlans
[ DIR ]
drwxr-sr-x
Schemas
[ DIR ]
drwxr-sr-x
SecretsManager
[ DIR ]
drwxr-sr-x
SecurityHub
[ DIR ]
drwxr-sr-x
ServerlessApplicationRepositor...
[ DIR ]
drwxr-sr-x
ServiceCatalog
[ DIR ]
drwxr-sr-x
ServiceDiscovery
[ DIR ]
drwxr-sr-x
ServiceQuotas
[ DIR ]
drwxr-sr-x
Ses
[ DIR ]
drwxr-sr-x
SesV2
[ DIR ]
drwxr-sr-x
Sfn
[ DIR ]
drwxr-sr-x
Shield
[ DIR ]
drwxr-sr-x
Signature
[ DIR ]
drwxr-sr-x
Sms
[ DIR ]
drwxr-sr-x
SnowBall
[ DIR ]
drwxr-sr-x
Sns
[ DIR ]
drwxr-sr-x
Sqs
[ DIR ]
drwxr-sr-x
Ssm
[ DIR ]
drwxr-sr-x
StorageGateway
[ DIR ]
drwxr-sr-x
Sts
[ DIR ]
drwxr-sr-x
Support
[ DIR ]
drwxr-sr-x
Swf
[ DIR ]
drwxr-sr-x
Textract
[ DIR ]
drwxr-sr-x
TranscribeService
[ DIR ]
drwxr-sr-x
Transfer
[ DIR ]
drwxr-sr-x
Translate
[ DIR ]
drwxr-sr-x
WAFV2
[ DIR ]
drwxr-sr-x
Waf
[ DIR ]
drwxr-sr-x
WafRegional
[ DIR ]
drwxr-sr-x
WorkDocs
[ DIR ]
drwxr-sr-x
WorkLink
[ DIR ]
drwxr-sr-x
WorkMail
[ DIR ]
drwxr-sr-x
WorkMailMessageFlow
[ DIR ]
drwxr-sr-x
WorkSpaces
[ DIR ]
drwxr-sr-x
XRay
[ DIR ]
drwxr-sr-x
data
[ DIR ]
drwxr-sr-x
imagebuilder
[ DIR ]
drwxr-sr-x
kendra
[ DIR ]
drwxr-sr-x
signer
[ DIR ]
drwxr-sr-x
AbstractConfigurationProvider....
4.46
KB
-rwxr-xr-x
AwsClient.php
16.58
KB
-rwxr-xr-x
AwsClientInterface.php
5.4
KB
-rwxr-xr-x
AwsClientTrait.php
2.67
KB
-rwxr-xr-x
CacheInterface.php
755
B
-rwxr-xr-x
ClientResolver.php
33.58
KB
-rwxr-xr-x
Command.php
1.39
KB
-rwxr-xr-x
CommandInterface.php
946
B
-rwxr-xr-x
CommandPool.php
5.2
KB
-rwxr-xr-x
ConfigurationProviderInterface...
246
B
-rwxr-xr-x
DoctrineCacheAdapter.php
989
B
-rwxr-xr-x
EndpointParameterMiddleware.ph...
2.73
KB
-rwxr-xr-x
HandlerList.php
13.18
KB
-rwxr-xr-x
HasDataTrait.php
1.11
KB
-rwxr-xr-x
HasMonitoringEventsTrait.php
869
B
-rwxr-xr-x
HashInterface.php
531
B
-rwxr-xr-x
HashingStream.php
1.5
KB
-rwxr-xr-x
History.php
3.81
KB
-rwxr-xr-x
IdempotencyTokenMiddleware.php
3.69
KB
-rwxr-xr-x
JsonCompiler.php
478
B
-rwxr-xr-x
LruArrayCache.php
2.16
KB
-rwxr-xr-x
Middleware.php
12.76
KB
-rwxr-xr-x
MockHandler.php
4.02
KB
-rwxr-xr-x
MonitoringEventsInterface.php
742
B
-rwxr-xr-x
MultiRegionClient.php
7.75
KB
-rwxr-xr-x
PhpHash.php
1.81
KB
-rwxr-xr-x
PresignUrlMiddleware.php
3.28
KB
-rwxr-xr-x
Psr16CacheAdapter.php
572
B
-rwxr-xr-x
PsrCacheAdapter.php
742
B
-rwxr-xr-x
ResponseContainerInterface.php
246
B
-rwxr-xr-x
Result.php
1.14
KB
-rwxr-xr-x
ResultInterface.php
1.34
KB
-rwxr-xr-x
ResultPaginator.php
5.09
KB
-rwxr-xr-x
RetryMiddleware.php
9.99
KB
-rwxr-xr-x
Sdk.php
38.45
KB
-rwxr-xr-x
StreamRequestPayloadMiddleware...
2.57
KB
-rwxr-xr-x
TraceMiddleware.php
10.72
KB
-rwxr-xr-x
Waiter.php
8.32
KB
-rwxr-xr-x
WrappedHttpHandler.php
6.96
KB
-rwxr-xr-x
functions.php
12.6
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : HandlerList.php
<?php namespace Aws; /** * Builds a single handler function from zero or more middleware functions and * a handler. The handler function is then used to send command objects and * return a promise that is resolved with an AWS result object. * * The "front" of the list is invoked before the "end" of the list. You can add * middleware to the front of the list using one of the "prepend" method, and * the end of the list using one of the "append" method. The last function * invoked in a handler list is the handler (a function that does not accept a * next handler but rather is responsible for returning a promise that is * fulfilled with an Aws\ResultInterface object). * * Handlers are ordered using a "step" that describes the step at which the * SDK is when sending a command. The available steps are: * * - init: The command is being initialized, allowing you to do things like add * default options. * - validate: The command is being validated before it is serialized * - build: The command is being serialized into an HTTP request. A middleware * in this step MUST serialize an HTTP request and populate the "@request" * parameter of a command with the request such that it is available to * subsequent middleware. * - sign: The request is being signed and prepared to be sent over the wire. * * Middleware can be registered with a name to allow you to easily add a * middleware before or after another middleware by name. This also allows you * to remove a middleware by name (in addition to removing by instance). */ class HandlerList implements \Countable { const INIT = 'init'; const VALIDATE = 'validate'; const BUILD = 'build'; const SIGN = 'sign'; const ATTEMPT = 'attempt'; /** @var callable */ private $handler; /** @var array */ private $named = []; /** @var array */ private $sorted; /** @var callable|null */ private $interposeFn; /** @var array Steps (in reverse order) */ private $steps = [ self::ATTEMPT => [], self::SIGN => [], self::BUILD => [], self::VALIDATE => [], self::INIT => [], ]; /** * @param callable $handler HTTP handler. */ public function __construct(callable $handler = null) { $this->handler = $handler; } /** * Dumps a string representation of the list. * * @return string */ public function __toString() { $str = ''; $i = 0; foreach (array_reverse($this->steps) as $k => $step) { foreach (array_reverse($step) as $j => $tuple) { $str .= "{$i}) Step: {$k}, "; if ($tuple[1]) { $str .= "Name: {$tuple[1]}, "; } $str .= "Function: " . $this->debugCallable($tuple[0]) . "\n"; $i++; } } if ($this->handler) { $str .= "{$i}) Handler: " . $this->debugCallable($this->handler) . "\n"; } return $str; } /** * Set the HTTP handler that actually returns a response. * * @param callable $handler Function that accepts a request and array of * options and returns a Promise. */ public function setHandler(callable $handler) { $this->handler = $handler; } /** * Returns true if the builder has a handler. * * @return bool */ public function hasHandler() { return (bool) $this->handler; } /** * Append a middleware to the init step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function appendInit(callable $middleware, $name = null) { $this->add(self::INIT, $name, $middleware); } /** * Prepend a middleware to the init step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function prependInit(callable $middleware, $name = null) { $this->add(self::INIT, $name, $middleware, true); } /** * Append a middleware to the validate step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function appendValidate(callable $middleware, $name = null) { $this->add(self::VALIDATE, $name, $middleware); } /** * Prepend a middleware to the validate step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function prependValidate(callable $middleware, $name = null) { $this->add(self::VALIDATE, $name, $middleware, true); } /** * Append a middleware to the build step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function appendBuild(callable $middleware, $name = null) { $this->add(self::BUILD, $name, $middleware); } /** * Prepend a middleware to the build step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function prependBuild(callable $middleware, $name = null) { $this->add(self::BUILD, $name, $middleware, true); } /** * Append a middleware to the sign step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function appendSign(callable $middleware, $name = null) { $this->add(self::SIGN, $name, $middleware); } /** * Prepend a middleware to the sign step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function prependSign(callable $middleware, $name = null) { $this->add(self::SIGN, $name, $middleware, true); } /** * Append a middleware to the attempt step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function appendAttempt(callable $middleware, $name = null) { $this->add(self::ATTEMPT, $name, $middleware); } /** * Prepend a middleware to the attempt step. * * @param callable $middleware Middleware function to add. * @param string $name Name of the middleware. */ public function prependAttempt(callable $middleware, $name = null) { $this->add(self::ATTEMPT, $name, $middleware, true); } /** * Add a middleware before the given middleware by name. * * @param string|callable $findName Add before this * @param string $withName Optional name to give the middleware * @param callable $middleware Middleware to add. */ public function before($findName, $withName, callable $middleware) { $this->splice($findName, $withName, $middleware, true); } /** * Add a middleware after the given middleware by name. * * @param string|callable $findName Add after this * @param string $withName Optional name to give the middleware * @param callable $middleware Middleware to add. */ public function after($findName, $withName, callable $middleware) { $this->splice($findName, $withName, $middleware, false); } /** * Remove a middleware by name or by instance from the list. * * @param string|callable $nameOrInstance Middleware to remove. */ public function remove($nameOrInstance) { if (is_callable($nameOrInstance)) { $this->removeByInstance($nameOrInstance); } elseif (is_string($nameOrInstance)) { $this->removeByName($nameOrInstance); } } /** * Interpose a function between each middleware (e.g., allowing for a trace * through the middleware layers). * * The interpose function is a function that accepts a "step" argument as a * string and a "name" argument string. This function must then return a * function that accepts the next handler in the list. This function must * then return a function that accepts a CommandInterface and optional * RequestInterface and returns a promise that is fulfilled with an * Aws\ResultInterface or rejected with an Aws\Exception\AwsException * object. * * @param callable|null $fn Pass null to remove any previously set function */ public function interpose(callable $fn = null) { $this->sorted = null; $this->interposeFn = $fn; } /** * Compose the middleware and handler into a single callable function. * * @return callable */ public function resolve() { if (!($prev = $this->handler)) { throw new \LogicException('No handler has been specified'); } if ($this->sorted === null) { $this->sortMiddleware(); } foreach ($this->sorted as $fn) { $prev = $fn($prev); } return $prev; } public function count() { return count($this->steps[self::INIT]) + count($this->steps[self::VALIDATE]) + count($this->steps[self::BUILD]) + count($this->steps[self::SIGN]) + count($this->steps[self::ATTEMPT]); } /** * Splices a function into the middleware list at a specific position. * * @param $findName * @param $withName * @param callable $middleware * @param $before */ private function splice($findName, $withName, callable $middleware, $before) { if (!isset($this->named[$findName])) { throw new \InvalidArgumentException("$findName not found"); } $idx = $this->sorted = null; $step = $this->named[$findName]; if ($withName) { $this->named[$withName] = $step; } foreach ($this->steps[$step] as $i => $tuple) { if ($tuple[1] === $findName) { $idx = $i; break; } } $replacement = $before ? [$this->steps[$step][$idx], [$middleware, $withName]] : [[$middleware, $withName], $this->steps[$step][$idx]]; array_splice($this->steps[$step], $idx, 1, $replacement); } /** * Provides a debug string for a given callable. * * @param array|callable $fn Function to write as a string. * * @return string */ private function debugCallable($fn) { if (is_string($fn)) { return "callable({$fn})"; } if (is_array($fn)) { $ele = is_string($fn[0]) ? $fn[0] : get_class($fn[0]); return "callable(['{$ele}', '{$fn[1]}'])"; } return 'callable(' . spl_object_hash($fn) . ')'; } /** * Sort the middleware, and interpose if needed in the sorted list. */ private function sortMiddleware() { $this->sorted = []; if (!$this->interposeFn) { foreach ($this->steps as $step) { foreach ($step as $fn) { $this->sorted[] = $fn[0]; } } return; } $ifn = $this->interposeFn; // Interpose the interposeFn into the handler stack. foreach ($this->steps as $stepName => $step) { foreach ($step as $fn) { $this->sorted[] = $ifn($stepName, $fn[1]); $this->sorted[] = $fn[0]; } } } private function removeByName($name) { if (!isset($this->named[$name])) { return; } $this->sorted = null; $step = $this->named[$name]; $this->steps[$step] = array_values( array_filter( $this->steps[$step], function ($tuple) use ($name) { return $tuple[1] !== $name; } ) ); } private function removeByInstance(callable $fn) { foreach ($this->steps as $k => $step) { foreach ($step as $j => $tuple) { if ($tuple[0] === $fn) { $this->sorted = null; unset($this->named[$this->steps[$k][$j][1]]); unset($this->steps[$k][$j]); } } } } /** * Add a middleware to a step. * * @param string $step Middleware step. * @param string $name Middleware name. * @param callable $middleware Middleware function to add. * @param bool $prepend Prepend instead of append. */ private function add($step, $name, callable $middleware, $prepend = false) { $this->sorted = null; if ($prepend) { $this->steps[$step][] = [$middleware, $name]; } else { array_unshift($this->steps[$step], [$middleware, $name]); } if ($name) { $this->named[$name] = $step; } } }
Close