Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a514527
Rename class to SIP2Client and adopt PSR-2 formatting and PSR-4 autol…
lordelph Jul 10, 2018
beda827
Refactored SIP2Client to use a socket factory to facilitate testing
lordelph Jul 11, 2018
25f3fcd
Add basic unit test which demonstrates mocking server responses
lordelph Jul 11, 2018
d1b6038
Corrected phpunit.xml to bring it up to date
lordelph Jul 11, 2018
3152fe0
Refactor and expand test suite
lordelph Jul 18, 2018
068883b
Ensure parseHoldResponse copes with optional elements
lordelph Jul 18, 2018
bc21713
Corrected method name
lordelph Jul 18, 2018
fb76cae
Add tests for fee-paid and end-patron-session
lordelph Jul 18, 2018
9656efd
Complete coverage of hold message generation
lordelph Jul 18, 2018
b8b1cb0
Full test coverage
lordelph Jul 19, 2018
3317b34
Fix getMessage to return retried response and minor test coverage adj…
lordelph Jul 19, 2018
05231c7
Add ability to bind to specific outbound IP
lordelph Jul 19, 2018
37141ea
Add support for PSR-3 logger
lordelph Jul 19, 2018
dc34ab5
Rename some member variables for clarity and improve comments on each
lordelph Jul 19, 2018
fa03dbe
Add documentation for all public methods
lordelph Jul 22, 2018
c0c6c6f
Ensure composer and CI only target php7+
lordelph Jul 22, 2018
dda41b6
Only send one code coverage run to scrutinizer
lordelph Jul 22, 2018
4dcd04d
Added experimental outline of broken out request class
lordelph Jul 22, 2018
2e83c23
Flesh out changelog and readme for v2
lordelph Jul 22, 2018
2cc0134
Expand migration section
lordelph Jul 23, 2018
36256de
Merge branch 'v2' into breakout
lordelph Jul 23, 2018
dc8038d
Refactor parsing/request building into separate classes
lordelph Jul 26, 2018
f7bdbbb
Improve and clean up phpdoc comments
lordelph Jul 29, 2018
4fa2188
Improve migration documentation
lordelph Jul 29, 2018
d176f7f
Improve phpdoc comments
lordelph Jul 29, 2018
7c8c7d6
Improve phpdoc comments
lordelph Jul 29, 2018
13405ad
Add setDefault and remove no-longer-required member variables
lordelph Jul 29, 2018
977034b
Add casts to deal with scrutinizer warning
lordelph Jul 29, 2018
2dc8ab1
Add test for setDefault
lordelph Jul 29, 2018
80bc453
Corrected phpdoc comment
lordelph Jul 29, 2018
12d357f
Add constants for request variables
lordelph Jul 29, 2018
20c7779
Update credits and keywords
lordelph Jul 29, 2018
88f27bc
Add date of v2 release
lordelph Jul 29, 2018
b0d9b91
Merge pull request #1 from lordelph/breakout
lordelph Jul 29, 2018
2967495
Allow client to specify timeout for connection
lordelph Aug 1, 2018
883cd8f
Add note about 2.0.1
lordelph Aug 1, 2018
19120d3
Merge pull request #2 from lordelph/timeout
lordelph Aug 1, 2018
5162534
Change namespace to cap60552
lordelph Aug 11, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
/docs export-ignore
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
composer.lock
vendor
.idea
23 changes: 23 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
filter:
excluded_paths: [tests/*]

checks:
php:
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

tools:
external_code_coverage:
timeout: 600
runs: 1
1 change: 1 addition & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preset: psr2
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
dist: trusty
language: php

php:
- 7.0
- 7.1
- 7.2

# This triggers builds to run on the new TravisCI infrastructure.
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false

## Cache composer
cache:
directories:
- $HOME/.composer/cache

before_script:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist

script:
- vendor/bin/phpcs --standard=psr2 src/
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- |
if [[ "$TRAVIS_PHP_VERSION" == '7.0' ]]; then
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
fi
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

All notable changes to `php-sip2` will be documented in this file.

Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## 2.0.1 - 2018-08-01

### Added
- SIP2Client::connect now accepts a timeout parameter, default 15 seconds


## 2.0.0 - 2018-07-29

### Added
- MIT License adopted - prior releases were GPL
- PSR-2 formatting/naming conventions, including change of classname from sip2 to SIP2Client
- PSR-3 logger support
- Classes for each request and response type
- Support for binding to particular interface
- Full unit tests

### Deprecated
- Nothing

### Fixed
- Ensure client properly handles retries in event of CRC failure

### Removed
- original v1 classname changed
- original public methods and variables all removed - see [MIGRATION](MIGRATION.md)

### Security
- Nothing


## 1.0.0 - 2015-11-03

- First release, GPL licensed
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/cap60552/php-sip2).


## Pull Requests

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - Check the code style with ``$ composer check-style`` and fix it with ``$ composer fix-style``.

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **Create feature branches** - Don't ask us to pull from your master branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.


## Running Tests

``` bash
$ composer test
```


**Happy coding**!
27 changes: 27 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- Provide a general summary of the issue in the Title above -->

## Detailed description

Provide a detailed description of the change or addition you are proposing.

Make it clear if the issue is a bug, an enhancement or just a question.

## Context

Why is this change important to you? How would you use it?

How can it benefit other users?

## Possible implementation

Not obligatory, but suggest an idea for implementing addition or change.

## Your environment

Include as many relevant details about the environment you experienced the bug in and how to reproduce it.

* Version used (e.g. PHP 5.6, HHVM 3):
* Operating system and version (e.g. Ubuntu 16.04, Windows 7):
* Link to your project:
* ...
* ...
22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# The MIT License (MIT)

Copyright (c) 2015 John Wohlers <[email protected]>
Copyright (c) 2018 Paul Dixon <[email protected]>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
57 changes: 57 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Migration from v1.0

While this is derived from [cap60552/php-sip2](https://github.com/cap60552/php-sip2)
many changes were made to make the code more easily testable and less complex. As a result,
this isn't a drop-in replacement. Here's the main differences for a typical scenaio:

## Before
```php
// create object
$mysip = new sip2;

// Set host name
$mysip->hostname = 'server.example.com';
$mysip->port = 6002;

// Identify a patron
$mysip->patron = '101010101';
$mysip->patronpwd = '010101';

// connect to SIP server
$result = $mysip->connect();

// Get Charged Items Raw response
$in = $mysip->msgPatronInformation('charged');

// parse the raw response into an array
$result = $mysip->parsePatronInfoResponse( $mysip->get_message($in) );

// extra data from result
$status = $result['fixed']['PatronStatus'];
$name = $result['variable']['AE'];
```

## After
```php
use cap60552\SIP2\SIP2Client;
use cap60552\SIP2\Request\PatronInformationRequest;

// instantiate client, set any defaults used for all requests
$mysip = new SIP2Client;
$mysip->setDefault('PatronIdentifier', '101010101');
$mysip->setDefault('PatronPassword', '010101');

// connect to SIP server
$mysip->connect("server.example.com:6002");

// Get Charged Items Raw response
$request=new PatronInformationRequest();
$request->setType('charged');

$response = $mysip->sendRequest($request);

// extra data from result
$status = $response->getPatronStatus();
$name = $response->getPersonalName();

```
43 changes: 43 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description

Describe your changes in detail.

## Motivation and context

Why is this change required? What problem does it solve?

If it fixes an open issue, please link to the issue here (if you write `fixes #num`
or `closes #num`, the issue will be automatically closed when the pull is accepted.)

## How has this been tested?

Please describe in detail how you tested your changes.

Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.

## Screenshots (if appropriate)

## Types of changes

What types of changes does your code introduce? Put an `x` in all the boxes that apply:
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

Go over all the following points, and put an `x` in all the boxes that apply.

Please, please, please, don't send your pull request until all of the boxes are ticked. Once your pull request is created, it will trigger a build on our [continuous integration](http://www.phptherightway.com/#continuous-integration) server to make sure your [tests and code style pass](https://help.github.com/articles/about-required-status-checks/).

- [ ] I have read the **[CONTRIBUTING](CONTRIBUTING.md)** document.
- [ ] My pull request addresses exactly one patch/feature.
- [ ] I have created a branch for this patch/feature.
- [ ] Each individual commit in the pull request is meaningful.
- [ ] I have added tests to cover my changes.
- [ ] If my change requires a change to the documentation, I have updated it accordingly.

If you're unsure about any of these, don't hesitate to ask. We're here to help!
Loading