class Config implements ConfigInterface, Arrayable

This class contains Nginx Unit config data

Methods

__construct(object $data, UnitRequest $_unitRequest)

Constructor

void
loadListeners(array $data)

Fill data if listeners key exists

void
loadApplications(array $data)

Fill data if applications key exists

void
loadRoutes(object $rawData)

Fill data if routes key exists

void
loadUpstreams(array $data)

Fill data if upstreams key exists

Listener|null
getListener(string $listener)

No description

Listener|null
getListenerByPort(int $port)

Get listener by port

bool
uploadListener(Listener $listener)

No description

bool
uploadListenerFromFile(string $path, string $listener)

No description

bool
removeListener(Listener $listener)

Remove listener

array
getListeners()

No description

array
getApplications()

Get applications from config

ApplicationAbstract|null
getApplication($applicationName)

Get application from config by name

bool
uploadApplication(ApplicationAbstract $application, string $name = '')

Upload application to Nginx Unit

bool
uploadApplicationFromFile(string $path, string $name)

No description

bool
removeApplication(ApplicationAbstract|string $application)

Remove application from Nginx Unit.

array
getRoutes()

Get routes from config

Route|null
getRoute(string $routeName)

Get route from config by name

bool
removeRoutes()

No description

bool
removeRoute(Route|string $route)

No description

array
getUpstreams()

Get upstreams

bool
uploadUpstream(Upstream $upstream, string $name = '')

No description

bool
uploadUpstreamsFromFile(string $path)

Upload all upstreams from file to Nginx Unit

bool
setAccessLog($path, $format = null)

No description

AccessLog|null
getAccessLog()

Return access log if exists

bool
removeAccessLog()

Remove access log

array
toArray()

Return config as array

Details

at line 55
__construct(object $data, UnitRequest $_unitRequest)

Constructor

Parameters

object $data
UnitRequest $_unitRequest

Exceptions

UnitException

at line 73
void loadListeners(array $data)

Fill data if listeners key exists

Parameters

array $data

Return Value

void

Exceptions

UnitException

at line 100
void loadApplications(array $data)

Fill data if applications key exists

Parameters

array $data

Return Value

void

Exceptions

UnitException

at line 148
void loadRoutes(object $rawData)

Fill data if routes key exists

Parameters

object $rawData

Return Value

void

at line 168
void loadUpstreams(array $data)

Fill data if upstreams key exists

Parameters

array $data

Return Value

void

at line 181
Listener|null getListener(string $listener)

No description

Parameters

string $listener

Return Value

Listener|null

at line 192
Listener|null getListenerByPort(int $port)

Get listener by port

Parameters

int $port

Return Value

Listener|null

at line 206
bool uploadListener(Listener $listener)

No description

Parameters

Listener $listener

Return Value

bool

at line 222
bool uploadListenerFromFile(string $path, string $listener)

No description

Parameters

string $path
string $listener

Return Value

bool

Exceptions

UnitException

at line 250
bool removeListener(Listener $listener)

Remove listener

Parameters

Listener $listener

Return Value

bool

Exceptions

UnitException

at line 263
array getListeners()

No description

Return Value

array

at line 273
array getApplications()

Get applications from config

Return Value

array

at line 284
ApplicationAbstract|null getApplication($applicationName)

Get application from config by name

Parameters

$applicationName

Return Value

ApplicationAbstract|null

at line 289
bool uploadApplication(ApplicationAbstract $application, string $name = '')

Upload application to Nginx Unit

Parameters

ApplicationAbstract $application
string $name

Return Value

bool

at line 312
bool uploadApplicationFromFile(string $path, string $name)

No description

Parameters

string $path
string $name

Return Value

bool

Exceptions

UnitException

at line 342
bool removeApplication(ApplicationAbstract|string $application)

Remove application from Nginx Unit.

Cain receive application name or application object

Parameters

ApplicationAbstract|string $application

Return Value

bool

Exceptions

UnitException

at line 357
array getRoutes()

Get routes from config

Return Value

array

at line 368
Route|null getRoute(string $routeName)

Get route from config by name

Parameters

string $routeName

Return Value

Route|null

at line 376
bool removeRoutes()

No description

Return Value

bool

Exceptions

UnitException

at line 396
bool removeRoute(Route|string $route)

No description

Parameters

Route|string $route

Return Value

bool

at line 408
array getUpstreams()

Get upstreams

Return Value

array

at line 417
bool uploadUpstream(Upstream $upstream, string $name = '')

No description

Parameters

Upstream $upstream
string $name

Return Value

bool

Exceptions

UnitException

at line 437
bool uploadUpstreamsFromFile(string $path)

Upload all upstreams from file to Nginx Unit

Parameters

string $path

Return Value

bool

at line 464
bool setAccessLog($path, $format = null)

No description

Parameters

$path
$format

Return Value

bool

at line 483
AccessLog|null getAccessLog()

Return access log if exists

Return Value

AccessLog|null

at line 490
bool removeAccessLog()

Remove access log

Return Value

bool

at line 507
array toArray()

Return config as array

Return Value

array