PushoverHandler
extends SocketHandler
in package
Sends notifications through the pushover api to mobile phones
Tags
Table of Contents
Properties
- $bubble : mixed
- $formatter : FormatterInterface
- $level : mixed
- $processors : mixed
- $chunkSize : mixed
- $connectionString : mixed
- $connectionTimeout : mixed
- $emergencyLevel : mixed
- $errno : mixed
- $errstr : mixed
- $expire : mixed
- $highPriorityLevel : mixed
- $lastSentBytes : mixed
- $lastWritingAt : mixed
- $parameterNames : array<string|int, mixed>
- All parameters that can be sent to Pushover
- $persistent : mixed
- $resource : mixed
- $retry : mixed
- $sounds : array<string|int, mixed>
- Sounds the api supports by default
- $timeout : mixed
- $title : mixed
- $token : mixed
- $useFormattedMessage : mixed
- $user : mixed
- $users : mixed
- $writingTimeout : mixed
Methods
- __construct() : mixed
- __destruct() : mixed
- close() : mixed
- We will not close a PersistentSocket instance so it can be reused in other requests.
- closeSocket() : mixed
- Close socket, if open
- getBubble() : bool
- Gets the bubbling behavior.
- getChunkSize() : float
- Get current chunk size
- getConnectionString() : string
- Get current connection string
- getConnectionTimeout() : float
- Get current connection timeout setting
- getFormatter() : FormatterInterface
- Gets the formatter.
- getLevel() : int
- Gets minimum logging level at which this handler will be triggered.
- getTimeout() : float
- Get current in-transfer timeout
- getWritingTimeout() : float
- Get current local writing timeout
- handle() : bool
- Handles a record.
- handleBatch() : mixed
- Handles a set of records at once.
- isConnected() : bool
- Check to see if the socket is currently available.
- isHandling() : bool
- Checks whether the given record will be handled by this handler.
- isPersistent() : bool
- Get persistent setting
- popProcessor() : callable
- Removes the processor on top of the stack and returns it.
- pushProcessor() : self
- Adds a processor in the stack.
- reset() : mixed
- setBubble() : self
- Sets the bubbling behavior.
- setChunkSize() : mixed
- Set chunk size. Only has effect during connection in the writing cycle.
- setConnectionTimeout() : mixed
- Set connection timeout. Only has effect before we connect.
- setEmergencyLevel() : mixed
- setFormatter() : self
- Sets the formatter.
- setHighPriorityLevel() : mixed
- setLevel() : self
- Sets minimum logging level at which this handler will be triggered.
- setPersistent() : mixed
- Set socket connection to nbe persistent. It only has effect before the connection is initiated.
- setTimeout() : mixed
- Set write timeout. Only has effect before we connect.
- setWritingTimeout() : mixed
- Set writing timeout. Only has effect during connection in the writing cycle.
- useFormattedMessage() : mixed
- Use the formatted message?
- fsockopen() : mixed
- Wrapper to allow mocking
- fwrite() : mixed
- Wrapper to allow mocking
- generateDataStream() : mixed
- getDefaultFormatter() : FormatterInterface
- Gets the default formatter.
- getResource() : resource|null
- pfsockopen() : mixed
- Wrapper to allow mocking
- processRecord() : array<string|int, mixed>
- Processes a record.
- streamGetMetadata() : mixed
- Wrapper to allow mocking
- streamSetChunkSize() : mixed
- Wrapper to allow mocking
- streamSetTimeout() : mixed
- Wrapper to allow mocking
- write() : void
- Connect (if necessary) and write to the socket
- buildContent() : mixed
- buildHeader() : mixed
- connect() : mixed
- connectIfNotConnected() : mixed
- createSocketResource() : mixed
- setSocketTimeout() : mixed
- setStreamChunkSize() : mixed
- validateTimeout() : mixed
- writeToSocket() : mixed
- writingIsTimedOut() : mixed
Properties
$bubble
protected
mixed
$bubble
= true
$formatter
protected
FormatterInterface
$formatter
$level
protected
mixed
$level
= \Monolog\Logger::DEBUG
$processors
protected
mixed
$processors
= array()
$chunkSize
private
mixed
$chunkSize
= null
$connectionString
private
mixed
$connectionString
$connectionTimeout
private
mixed
$connectionTimeout
$emergencyLevel
private
mixed
$emergencyLevel
$errno
private
mixed
$errno
$errstr
private
mixed
$errstr
$expire
private
mixed
$expire
$highPriorityLevel
private
mixed
$highPriorityLevel
$lastSentBytes
private
mixed
$lastSentBytes
= null
$lastWritingAt
private
mixed
$lastWritingAt
$parameterNames
All parameters that can be sent to Pushover
private
array<string|int, mixed>
$parameterNames
= array('token' => true, 'user' => true, 'message' => true, 'device' => true, 'title' => true, 'url' => true, 'url_title' => true, 'priority' => true, 'timestamp' => true, 'sound' => true, 'retry' => true, 'expire' => true, 'callback' => true)
Tags
$persistent
private
mixed
$persistent
= false
$resource
private
mixed
$resource
$retry
private
mixed
$retry
$sounds
Sounds the api supports by default
private
array<string|int, mixed>
$sounds
= array('pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming', 'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb', 'persistent', 'echo', 'updown', 'none')
Tags
$timeout
private
mixed
$timeout
= 0
$title
private
mixed
$title
$token
private
mixed
$token
$useFormattedMessage
private
mixed
$useFormattedMessage
= false
$user
private
mixed
$user
$users
private
mixed
$users
$writingTimeout
private
mixed
$writingTimeout
= 10
Methods
__construct()
public
__construct(string $token, string|array<string|int, mixed> $users[, string $title = null ][, int $level = Logger::CRITICAL ][, bool $bubble = true ][, bool $useSSL = true ][, int $highPriorityLevel = Logger::CRITICAL ][, int $emergencyLevel = Logger::EMERGENCY ][, int $retry = 30 ][, int $expire = 25200 ]) : mixed
Parameters
- $token : string
-
Pushover api token
- $users : string|array<string|int, mixed>
-
Pushover user id or array of ids the message will be sent to
- $title : string = null
-
Title sent to the Pushover API
- $level : int = Logger::CRITICAL
-
The minimum logging level at which this handler will be triggered
- $bubble : bool = true
-
Whether the messages that are handled can bubble up the stack or not
- $useSSL : bool = true
-
Whether to connect via SSL. Required when pushing messages to users that are not the pushover.net app owner. OpenSSL is required for this option.
- $highPriorityLevel : int = Logger::CRITICAL
-
The minimum logging level at which this handler will start sending "high priority" requests to the Pushover API
- $emergencyLevel : int = Logger::EMERGENCY
-
The minimum logging level at which this handler will start sending "emergency" requests to the Pushover API
- $retry : int = 30
-
The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user.
- $expire : int = 25200
-
The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds).
__destruct()
public
__destruct() : mixed
close()
We will not close a PersistentSocket instance so it can be reused in other requests.
public
close() : mixed
closeSocket()
Close socket, if open
public
closeSocket() : mixed
getBubble()
Gets the bubbling behavior.
public
getBubble() : bool
Return values
bool —true means that this handler allows bubbling. false means that bubbling is not permitted.
getChunkSize()
Get current chunk size
public
getChunkSize() : float
Return values
floatgetConnectionString()
Get current connection string
public
getConnectionString() : string
Return values
stringgetConnectionTimeout()
Get current connection timeout setting
public
getConnectionTimeout() : float
Return values
floatgetFormatter()
Gets the formatter.
public
getFormatter() : FormatterInterface
Return values
FormatterInterfacegetLevel()
Gets minimum logging level at which this handler will be triggered.
public
getLevel() : int
Return values
intgetTimeout()
Get current in-transfer timeout
public
getTimeout() : float
Return values
floatgetWritingTimeout()
Get current local writing timeout
public
getWritingTimeout() : float
Return values
floathandle()
Handles a record.
public
handle(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
-
The record to handle
Return values
bool —true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
handleBatch()
Handles a set of records at once.
public
handleBatch(array<string|int, mixed> $records) : mixed
Parameters
- $records : array<string|int, mixed>
-
The records to handle (an array of record arrays)
isConnected()
Check to see if the socket is currently available.
public
isConnected() : bool
UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details.
Return values
boolisHandling()
Checks whether the given record will be handled by this handler.
public
isHandling(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
-
Partial log record containing only a level key
Return values
boolisPersistent()
Get persistent setting
public
isPersistent() : bool
Return values
boolpopProcessor()
Removes the processor on top of the stack and returns it.
public
popProcessor() : callable
Return values
callablepushProcessor()
Adds a processor in the stack.
public
pushProcessor(mixed $callback) : self
Parameters
- $callback : mixed
Return values
selfreset()
public
reset() : mixed
setBubble()
Sets the bubbling behavior.
public
setBubble(bool $bubble) : self
Parameters
- $bubble : bool
-
true means that this handler allows bubbling. false means that bubbling is not permitted.
Return values
selfsetChunkSize()
Set chunk size. Only has effect during connection in the writing cycle.
public
setChunkSize(float $bytes) : mixed
Parameters
- $bytes : float
setConnectionTimeout()
Set connection timeout. Only has effect before we connect.
public
setConnectionTimeout(float $seconds) : mixed
Parameters
- $seconds : float
Tags
setEmergencyLevel()
public
setEmergencyLevel(mixed $value) : mixed
Parameters
- $value : mixed
setFormatter()
Sets the formatter.
public
setFormatter(FormatterInterface $formatter) : self
Parameters
- $formatter : FormatterInterface
Return values
selfsetHighPriorityLevel()
public
setHighPriorityLevel(mixed $value) : mixed
Parameters
- $value : mixed
setLevel()
Sets minimum logging level at which this handler will be triggered.
public
setLevel(int|string $level) : self
Parameters
- $level : int|string
-
Level or level name
Return values
selfsetPersistent()
Set socket connection to nbe persistent. It only has effect before the connection is initiated.
public
setPersistent(bool $persistent) : mixed
Parameters
- $persistent : bool
setTimeout()
Set write timeout. Only has effect before we connect.
public
setTimeout(float $seconds) : mixed
Parameters
- $seconds : float
Tags
setWritingTimeout()
Set writing timeout. Only has effect during connection in the writing cycle.
public
setWritingTimeout(float $seconds) : mixed
Parameters
- $seconds : float
-
0 for no timeout
useFormattedMessage()
Use the formatted message?
public
useFormattedMessage(bool $value) : mixed
Parameters
- $value : bool
fsockopen()
Wrapper to allow mocking
protected
fsockopen() : mixed
fwrite()
Wrapper to allow mocking
protected
fwrite(mixed $data) : mixed
Parameters
- $data : mixed
generateDataStream()
protected
generateDataStream(mixed $record) : mixed
Parameters
- $record : mixed
getDefaultFormatter()
Gets the default formatter.
protected
getDefaultFormatter() : FormatterInterface
Return values
FormatterInterfacegetResource()
protected
getResource() : resource|null
Return values
resource|nullpfsockopen()
Wrapper to allow mocking
protected
pfsockopen() : mixed
processRecord()
Processes a record.
protected
processRecord(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
Return values
array<string|int, mixed>streamGetMetadata()
Wrapper to allow mocking
protected
streamGetMetadata() : mixed
streamSetChunkSize()
Wrapper to allow mocking
protected
streamSetChunkSize() : mixed
Tags
streamSetTimeout()
Wrapper to allow mocking
protected
streamSetTimeout() : mixed
Tags
write()
Connect (if necessary) and write to the socket
protected
write(array<string|int, mixed> $record) : void
Parameters
- $record : array<string|int, mixed>
buildContent()
private
buildContent(mixed $record) : mixed
Parameters
- $record : mixed
buildHeader()
private
buildHeader(mixed $content) : mixed
Parameters
- $content : mixed
connect()
private
connect() : mixed
connectIfNotConnected()
private
connectIfNotConnected() : mixed
createSocketResource()
private
createSocketResource() : mixed
setSocketTimeout()
private
setSocketTimeout() : mixed
setStreamChunkSize()
private
setStreamChunkSize() : mixed
validateTimeout()
private
validateTimeout(mixed $value) : mixed
Parameters
- $value : mixed
writeToSocket()
private
writeToSocket(mixed $data) : mixed
Parameters
- $data : mixed
writingIsTimedOut()
private
writingIsTimedOut(mixed $sent) : mixed
Parameters
- $sent : mixed