Menu

## MiddlewareChain
in package
Uses Microable, Containable

MiddlewareChain.php : 17

### Table of Contents

#### Properties

$context : ContainerInterface|Container|null
  Application container context
$macros : array<string|int, mixed>
$app : PioniaApplication
$middlewareContainer : Arrayable
$middlewareStackCopy : Arrayable

#### Methods

__call() : mixed
  Dynamically handle calls to the class.
__callStatic() : mixed
  Dynamically handle calls to the class.
__construct() : mixed
add() : MiddlewareChain
  Add a middleware to the middleware chain
addAfter() : MiddlewareChain
  Add a middleware to the middleware chain after a specific middleware
addAll() : mixed
addBefore() : MiddlewareChain
  Add a middleware before another middleware
all() : mixed
contextArrAdd() : void
contextHas() : bool
  Check if a value exists in the container
contextMake() : mixed
  Make an instance of a class from the container. This will throw an exception if the class is not found
contextMakeSilently() : mixed
  Create an instance of a class without throwing an exception when it fails
flushMacros() : void
  Remove all the macros we had registered
get() : array<string|int, mixed>
  Get the middleware chain
getOrDefault() : mixed
  Get a value from the container or return a default value
getOrFail() : mixed
  Get a value from the container or throw an exception.
getSilently() : mixed
  Get a value from the container or return null instead of throwing an exception
handle() : void
  Run the middleware chain
hasMacro() : bool
  Check if we have a method in the balonables
isAMiddleware() : bool
macro() : void
  Add a new mixable to the macros
middlewareStack() : null|Arrayable
mixin() : void
  Mix another object into the class.
next() : void
  Run the next middleware in the chain
set() : static
  Set a value in the container
asMiddleware() : MiddlewareContract
rail() : void
  Run the middleware chain

### Properties

#### $context

Containable.php : 25

Application container context

`public ContainerInterface|Container|null $context`

#### $macros

Microable.php : 14
`protected static array<string|int, mixed> $macros = []`

#### $app

MiddlewareChain.php : 25
`private PioniaApplication $app`

#### $middlewareContainer

MiddlewareChain.php : 27
`private Arrayable $middlewareContainer`

#### $middlewareStackCopy

MiddlewareChain.php : 28
`private Arrayable $middlewareStackCopy`

### Methods

#### __call()

Microable.php : 101

Dynamically handle calls to the class.

`public __call(string $method, array<string|int, mixed> $parameters) : mixed`

##### Parameters

$method : string
$parameters : array<string|int, mixed>

##### Tags

throws
  BadMethodCallException

#### __callStatic()

Microable.php : 75

Dynamically handle calls to the class.

`public static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed`

##### Parameters

$method : string
$parameters : array<string|int, mixed>

##### Tags

throws
  BadMethodCallException

#### __construct()

MiddlewareChain.php : 51
`public __construct(PioniaApplication $app) : mixed`

##### Parameters

$app : PioniaApplication

#### add()

MiddlewareChain.php : 35

Add a middleware to the middleware chain

`public add(string $middleware) : MiddlewareChain`

##### Parameters

$middleware : string

##### Return values

MiddlewareChain

#### addAfter()

MiddlewareChain.php : 83

Add a middleware to the middleware chain after a specific middleware

`public addAfter(string $middlewareSearch, string $middlewareToInsert) : MiddlewareChain`

##### Parameters

$middlewareSearch : string

  The target middleware in the chain

$middlewareToInsert : string

  The new middleware we are registering

##### Return values

MiddlewareChain

#### addAll()

MiddlewareChain.php : 41
`public addAll(array<string|int, mixed>|Arrayable $middlewares) : mixed`

##### Parameters

$middlewares : array<string|int, mixed>|Arrayable

#### addBefore()

MiddlewareChain.php : 98

Add a middleware before another middleware

`public addBefore(string $middlewareSearch, string $middlewareToInsert) : MiddlewareChain`

##### Parameters

$middlewareSearch : string

  The target middleware in the chain

$middlewareToInsert : string

  The new middleware we are registering

##### Tags

throws
  Exception

##### Return values

MiddlewareChain

#### all()

MiddlewareChain.php : 46
`public all() : mixed`

#### contextArrAdd()

Containable.php : 117
`public contextArrAdd(string $contextKey, array<string|int, mixed> $dataToAdd) : void`

##### Parameters

$contextKey : string
$dataToAdd : array<string|int, mixed>

#### contextHas()

Containable.php : 33

Check if a value exists in the container

`public contextHas(string $key) : bool`

##### Parameters

$key : string

##### Return values

bool

#### contextMake()

Containable.php : 92

Make an instance of a class from the container. This will throw an exception if the class is not found

`public contextMake(string $name[, array<string|int, mixed> $parameters = [] ]) : mixed`

##### Parameters

$name : string
$parameters : array<string|int, mixed> = []

##### Tags

throws
  DependencyException
throws
  NotFoundException

#### contextMakeSilently()

Containable.php : 103

Create an instance of a class without throwing an exception when it fails

`public contextMakeSilently(string $name[, array<string|int, mixed> $parameters = [] ]) : mixed`

##### Parameters

$name : string
$parameters : array<string|int, mixed> = []

#### flushMacros()

Microable.php : 61

Remove all the macros we had registered

`public static flushMacros() : void`

#### get()

MiddlewareChain.php : 63

Get the middleware chain

`public get() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### getOrDefault()

Containable.php : 65

Get a value from the container or return a default value

`public getOrDefault(string $key, mixed $default) : mixed`

##### Parameters

$key : string
$default : mixed

#### getOrFail()

Containable.php : 82

Get a value from the container or throw an exception.

`public getOrFail(string $key) : mixed`

##### Parameters

$key : string

##### Tags

see
  PioniaApplication::resolve()

  for similar functionality on the application instance

throws
  ContainerExceptionInterface
throws
  DependencyException
throws
  NotFoundException
throws
  NotFoundExceptionInterface

#### getSilently()

Containable.php : 50

Get a value from the container or return null instead of throwing an exception

`public getSilently(mixed $key) : mixed`

##### Parameters

$key : mixed

#### handle()

MiddlewareChain.php : 117

Run the middleware chain

`public handle(Request $request[, Response|null $response = null ]) : void`

Dispatches events before and after the middleware chain is run

##### Parameters

$request : Request
$response : Response|null = null

#### hasMacro()

Microable.php : 53

Check if we have a method in the balonables

`public static hasMacro(string $name) : bool`

##### Parameters

$name : string

##### Return values

bool

#### isAMiddleware()

MiddlewareChain.php : 169
`public isAMiddleware(mixed $class) : bool`

##### Parameters

$class : mixed

##### Return values

bool

#### macro()

Microable.php : 22

Add a new mixable to the macros

`public static macro(string $key, $value) : void`

##### Parameters

$key : string
$value :

#### middlewareStack()

MiddlewareChain.php : 71
`public middlewareStack() : null|Arrayable`

##### Return values

null|Arrayable

#### mixin()

Microable.php : 35

Mix another object into the class.

`public static mixin(object $mixin[, bool $replace = true ]) : void`

##### Parameters

$mixin : object
$replace : bool = true

##### Tags

throws
  ReflectionException

#### next()

MiddlewareChain.php : 163

Run the next middleware in the chain

`public next(Request $request, Response|null $response, MiddlewareChain $chain) : void`

##### Parameters

$request : Request
$response : Response|null
$chain : MiddlewareChain

#### set()

Containable.php : 41

Set a value in the container

`public set(string $name, mixed $value) : static`

##### Parameters

$name : string
$value : mixed

##### Return values

static

#### asMiddleware()

MiddlewareChain.php : 174
`private asMiddleware(mixed $klass) : MiddlewareContract`

##### Parameters

$klass : mixed

##### Return values

MiddlewareContract

#### rail()

MiddlewareChain.php : 145

Run the middleware chain

`private rail(Request $request[, Response|null $response = null ]) : void`

##### Parameters

$request : Request
$response : Response|null = null

## Search results