@@ -74,7 +74,7 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | public function add(array $data) |
| 76 | 76 | { |
| 77 | - $data = $this->resolve($data, function (OptionsResolver $resolver) { |
|
| 77 | + $data = $this->resolve($data, function(OptionsResolver $resolver) { |
|
| 78 | 78 | $resolver |
| 79 | 79 | ->setRequired('device_type') |
| 80 | 80 | ->setAllowedTypes('device_type', 'int') |
@@ -57,8 +57,8 @@ |
||
| 57 | 57 | public function getAll($limit = self::NOTIFICATIONS_LIMIT, $offset = 0) |
| 58 | 58 | { |
| 59 | 59 | return $this->api->request('GET', '/notifications?' . http_build_query([ |
| 60 | - 'limit' => max(0, min(self::NOTIFICATIONS_LIMIT, filter_var($limit, FILTER_VALIDATE_INT))), |
|
| 61 | - 'offset' => max(0, min(self::NOTIFICATIONS_LIMIT, filter_var($offset, FILTER_VALIDATE_INT))), |
|
| 60 | + 'limit' => max(0, min(self::NOTIFICATIONS_LIMIT, filter_var($limit, FILTER_VALIDATE_INT))), |
|
| 61 | + 'offset' => max(0, min(self::NOTIFICATIONS_LIMIT, filter_var($offset, FILTER_VALIDATE_INT))), |
|
| 62 | 62 | ]), [ |
| 63 | 63 | 'headers' => [ |
| 64 | 64 | 'Authorization' => 'Basic ' . $this->api->getConfig()->getApplicationAuthKey(), |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | ->setAllowedTypes('app_ids', 'array') |
| 184 | 184 | ->setDefined('tags') |
| 185 | 185 | ->setAllowedTypes('tags', 'array') |
| 186 | - ->setNormalizer('tags', function (Options $options, array $value) { |
|
| 186 | + ->setNormalizer('tags', function(Options $options, array $value) { |
|
| 187 | 187 | $tags = []; |
| 188 | 188 | |
| 189 | 189 | foreach ($value as $tag) { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | ->setAllowedTypes('data', 'array') |
| 220 | 220 | ->setDefined('buttons') |
| 221 | 221 | ->setAllowedTypes('buttons', 'array') |
| 222 | - ->setNormalizer('buttons', function (Options $options, array $value) { |
|
| 222 | + ->setNormalizer('buttons', function(Options $options, array $value) { |
|
| 223 | 223 | $buttons = []; |
| 224 | 224 | |
| 225 | 225 | foreach ($value as $button) { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | ->setAllowedTypes('chrome_web_icon', 'string') |
| 257 | 257 | ->setDefined('url') |
| 258 | 258 | ->setAllowedTypes('url', 'string') |
| 259 | - ->setAllowedValues('url', function ($value) { |
|
| 259 | + ->setAllowedValues('url', function($value) { |
|
| 260 | 260 | // https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/UrlValidator.php |
| 261 | 261 | $pattern = '~^(http|https)://(([\pL\pN-]+:)?([\pL\pN-]+)@)?(([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?)|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[(?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))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,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::))))\])(:[0-9]+)?(/?|/\S+)$~ixu'; |
| 262 | 262 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | }) |
| 265 | 265 | ->setDefined('send_after') |
| 266 | 266 | ->setAllowedTypes('send_after', '\DateTime') |
| 267 | - ->setNormalizer('send_after', function (Options $options, \DateTime $value) { |
|
| 267 | + ->setNormalizer('send_after', function(Options $options, \DateTime $value) { |
|
| 268 | 268 | //Fri May 02 2014 00:00:00 GMT-0700 (PDT) |
| 269 | 269 | return $value->format('D M d Y H:i:s eO (T)'); |
| 270 | 270 | }) |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | ->setAllowedValues('delayed_option', ['timezone', 'last-active']) |
| 274 | 274 | ->setDefined('delivery_time_of_day') |
| 275 | 275 | ->setAllowedTypes('delivery_time_of_day', '\DateTime') |
| 276 | - ->setNormalizer('delivery_time_of_day', function (Options $options, \DateTime $value) { |
|
| 276 | + ->setNormalizer('delivery_time_of_day', function(Options $options, \DateTime $value) { |
|
| 277 | 277 | return $value->format('g:iA'); |
| 278 | 278 | }) |
| 279 | 279 | ->setDefined('android_led_color') |