- **booleans** - `true` and `false`.
- **null** - `null`.
-A backslash (``\``) must be escaped by 4 backslashes (``\\\\``) in a string
-and 8 backslashes (``\\\\\\\\``) in a regex::
+A backslash (``\``) must be escaped by 4 backslashes (``\\\\``) in a string and 8 backslashes (``\\\\\\\\``) in a regex::
`"a\\\\b" matches "/^a\\\\\\\\b$/"`
-Control characters (e.g. ``\n``) in expressions are replaced with
-whitespace. To avoid this, escape the sequence with a single backslash
-(e.g. ``\\n``).
+Control characters (e.g. ``\n``) in expressions are replaced with whitespace. To avoid this, escape the sequence with a single backslash (e.g. ``\\n``).
### Supported Operators
* ``>=`` (greater than or equal to)
* ``matches`` (regex match)
- To test if a string does *not* match a regex, use the logical ``not``
- operator in combination with the ``matches`` operator:
+To test if a string does *not* match a regex, use the logical ``not`` operator in combination with the ``matches`` operator:
- 'not ("foo" matches "/bar/")'
+`not ("foo" matches "/bar/")`
- You must use parenthesis because the unary operator ``not`` has precedence
- over the binary operator ``matches``.
+You must use parenthesis because the unary operator ``not`` has precedence over the binary operator ``matches``.
#### Logical Operators
// Error handler based off https://stackoverflow.com/a/48135009/757392
$container['errorHandler'] = function () {
return function(Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, Exception $exception)
- {
- $responseCode = 500;
+ {
+ $responseCode = 500;
if (is_a($exception, 'Friendica\Network\HTTPException')) {
$responseCode = $exception->httpcode;
$errors['message'] = $exception->getMessage();
- $errors['responseCode'] = $responseCode;
+ $errors['responseCode'] = $responseCode;
- return $response
- ->withStatus($responseCode)
- ->withJson($errors);
- };
+ return $response
+ ->withStatus($responseCode)
+ ->withJson($errors);
+ };
};
$container['notFoundHandler'] = function () {
- return function ()
+ return function ()
{
throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('Method not found'));
- };
+ };
};