Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
Merging develop to master in preparation for 1.3.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed May 8, 2018
2 parents 46a7c2a + 9d61bd5 commit f2adf60
Show file tree
Hide file tree
Showing 29 changed files with 380 additions and 382 deletions.
24 changes: 14 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
sudo: false

language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
matrix:
include:
- php: 5.6
- php: 7.0
- php: 7.1
env:
- CS_CHECK=true
- php: 7.2

before_install:
- cp tests/TestConfiguration.php.travis tests/TestConfiguration.php
- composer install --dev
- composer install --no-interaction

script:
- phpunit -c tests/phpunit.xml.dist
- ./vendor/bin/phpunit
- if [[ $CS_CHECK == 'true' ]]; then ./vendor/bin/phpcs ; fi

notifications:
#irc: "irc.freenode.org#zftalk.2"
email: false
24 changes: 20 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,39 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 1.2.1 - TBD
## 1.3.0 - 2018-05-08

### Added

- Nothing.
- [#63](https://github.com/zendframework/ZendService_Apple_Apns/pull/63) adds support for PHP 7.1 and 7.2.

- [#53](https://github.com/zendframework/ZendService_Apple_Apns/pull/53) adds support for the mutable-content Notification field within the `Message` implementation.

- [#48](https://github.com/zendframework/ZendService_Apple_Apns/pull/48) adds two new methods to `ZendService\Apple\Apns\Message\Alert`: `setAction($key)` and `getAction()`.
These allow specifying an action property for notifications.

### Changed

- [#42](https://github.com/zendframework/ZendService_Apple_Apns/pull/42) modifies the allowed character set for tokens to include uppercase A-F.

### Deprecated

- Nothing.

### Removed

- Nothing.
- [#63](https://github.com/zendframework/ZendService_Apple_Apns/pull/63) removes support for PHP 5.3, 5.4, and 5.5.

- [#63](https://github.com/zendframework/ZendService_Apple_Apns/pull/63) removes support for HHVM.

### Fixed

- Nothing.
- [#49](https://github.com/zendframework/ZendService_Apple_Apns/pull/49) fixes how `Message::getPayload()` and `Message::getPayloadJson()` create a
representation of the `aps` key when it is an empty value. With #18, the value was removed,
which was incorrect; it is not rendered as an empty object.

- [#62](https://github.com/zendframework/ZendService_Apple_Apns/pull/62) modifies the `AbstractClient::connect()` method such that it now
restores the previous error handler after catching a socket-related connection exception.

## 1.2.0 - 2015-12-09

Expand Down
18 changes: 9 additions & 9 deletions LICENSE.txt → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Copyright (c) 2005-2014, Zend Technologies USA, Inc.
Copyright (c) 2005-2018, Zend Technologies USA, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of Zend Technologies USA, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
- Neither the name of Zend Technologies USA, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ ZendService\Apple\Apns [![Build Status](https://travis-ci.org/zendframework/Zend
Provides support for Apple push notifications.


## Requirements ##
## Requirements

* PHP >= 5.3.3
* PHP >= 5.6

## Getting Started ##
## Getting Started

Install this library using [Composer](http://getcomposer.org/):

```bash
$ composer require zendframework/zendservice-apple-apns
```

## Documentation ##
## Documentation

The documentation can be found at: http://framework.zend.com/manual/current/en/modules/zendservice.apple.apns.html

50 changes: 32 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
{
"name": "zendframework/zendservice-apple-apns",
"description": "OOP Zend Framework 2 wrapper for Apple Push Notification Service",
"type": "library",
"description": "OOP Zend Framework wrapper for Apple Push Notification Service",
"license": "BSD-3-Clause",
"keywords": [
"zf2",
"zf",
"zendframework",
"apns",
"push",
"notification",
"apple"
],
"homepage": "http://packages.zendframework.com/",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/zendframework/ZendService_Apple_Apns/issues",
"source": "https://github.com/zendframework/ZendService_Apple_Apns",
"rss": "https://github.com/zendframework/ZendService_Apple_Apns/releases.atom",
"chat": "https://zendframework-slack.herokuapp.com",
"forum": "https://discourse.zendframework.com/c/questions/components"
},
"require": {
"php": "^5.6 || ^7.0",
"zendframework/zend-json": "^2.0 || ^3.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.5",
"zendframework/zend-coding-standard": "~1.0.0"
},
"autoload": {
"psr-0": {
"ZendService\\Apple\\Apns\\": "library/",
"ZendService\\Apple\\Exception\\": "library/"
"psr-4": {
"ZendService\\Apple\\": "src/"
}
},
"repositories": [
{
"type": "composer",
"url": "https://packages.zendframework.com/"
"autoload-dev": {
"psr-4": {
"ZendServiceTest\\Apple\\": "test/"
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zend-json": "^2.0|^3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev",
"dev-develop": "1.4.x-dev"
}
}
}
7 changes: 7 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<ruleset name="Zend Framework Coding Standard">
<rule ref="./vendor/zendframework/zend-coding-standard/ruleset.xml"/>

<file>src</file>
<file>test</file>
</ruleset>
17 changes: 17 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="ZendService Apple Apns Test Suite">
<directory>./test</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract class AbstractClient
* APNS URIs
* @var array
*/
protected $uris = array();
protected $uris = [];

/**
* Is Connected
Expand Down Expand Up @@ -59,19 +59,19 @@ public function open($environment, $certificate, $passPhrase = null)
throw new Exception\RuntimeException('Connection has already been opened and must be closed');
}

if (!array_key_exists($environment, $this->uris)) {
if (! array_key_exists($environment, $this->uris)) {
throw new Exception\InvalidArgumentException('Environment must be one of PRODUCTION_URI or SANDBOX_URI');
}

if (!is_string($certificate) || !file_exists($certificate)) {
if (! is_string($certificate) || ! file_exists($certificate)) {
throw new Exception\InvalidArgumentException('Certificate must be a valid path to a APNS certificate');
}

$sslOptions = array(
$sslOptions = [
'local_cert' => $certificate,
);
];
if ($passPhrase !== null) {
if (!is_scalar($passPhrase)) {
if (! is_scalar($passPhrase)) {
throw new Exception\InvalidArgumentException('SSL passphrase must be a scalar');
}
$sslOptions['passphrase'] = $passPhrase;
Expand Down Expand Up @@ -103,12 +103,13 @@ protected function connect($host, array $ssl)
ini_get('default_socket_timeout'),
STREAM_CLIENT_CONNECT,
stream_context_create(
array(
[
'ssl' => $ssl,
)
]
)
);
} catch (StreamSocketClientException $e) {
restore_error_handler();
throw new Exception\RuntimeException(sprintf(
'Unable to connect: %s: %d (%s)',
$host,
Expand All @@ -119,7 +120,7 @@ protected function connect($host, array $ssl)

restore_error_handler();

if (!$this->socket) {
if (! $this->socket) {
throw new Exception\RuntimeException(sprintf(
'Unable to connect: %s: %d (%s)',
$host,
Expand Down Expand Up @@ -166,11 +167,11 @@ public function isConnected()
*/
protected function read($length = 6)
{
if (!$this->isConnected()) {
if (! $this->isConnected()) {
throw new Exception\RuntimeException('You must open the connection prior to reading data');
}
$data = false;
$read = array($this->socket);
$read = [$this->socket];
$null = null;

if (0 < @stream_select($read, $null, $null, 1, 0)) {
Expand All @@ -188,7 +189,7 @@ protected function read($length = 6)
*/
protected function write($payload)
{
if (!$this->isConnected()) {
if (! $this->isConnected()) {
throw new Exception\RuntimeException('You must open the connection prior to writing data');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class Feedback extends AbstractClient
* APNS URIs
* @var array
*/
protected $uris = array(
protected $uris = [
'tls://feedback.sandbox.push.apple.com:2196',
'tls://feedback.push.apple.com:2196'
);
];

/**
* Get Feedback
Expand All @@ -34,11 +34,11 @@ class Feedback extends AbstractClient
*/
public function feedback()
{
if (!$this->isConnected()) {
if (! $this->isConnected()) {
throw new Exception\RuntimeException('You must first open the connection by calling open()');
}

$tokens = array();
$tokens = [];
while ($token = $this->read(38)) {
$tokens[] = new FeedbackResponse($token);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class Message extends AbstractClient
* APNS URIs
* @var array
*/
protected $uris = array(
protected $uris = [
'tls://gateway.sandbox.push.apple.com:2195',
'tls://gateway.push.apple.com:2195',
);
];

/**
* Send Message
Expand All @@ -42,7 +42,7 @@ class Message extends AbstractClient
*/
public function send(ApnsMessage $message)
{
if (!$this->isConnected()) {
if (! $this->isConnected()) {
throw new Exception\RuntimeException('You must first open the connection by calling open()');
}

Expand Down
Loading

0 comments on commit f2adf60

Please sign in to comment.