public function get(): ?array
{ if (null ===
$this->queueEmptiedAt
) { return parent::
get();
} // This is secure because the table name must be a valid identifier:
// https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
$this->
executeStatement(sprintf('LISTEN "%s"',
$this->configuration
['table_name'
]));
if (method_exists($this->driverConnection, 'getNativeConnection'
)) { $wrappedConnection =
$this->driverConnection->
getNativeConnection();
} else { $wrappedConnection =
$this->driverConnection;
while (method_exists($wrappedConnection, 'getWrappedConnection'
)) { $wrappedConnection =
$wrappedConnection->
getWrappedConnection();
} } $notification =
$wrappedConnection->
pgsqlGetNotify(\PDO::FETCH_ASSOC,
$this->configuration
['get_notify_timeout'
]);
if ( // no notifications, or for another table or queue
(false ===
$notification ||
$notification['message'
] !==
$this->configuration
['table_name'
] ||
$notification['payload'
] !==
$this->configuration
['queue_name'
])