Skip to content

Commit

Permalink
Merge pull request #11 from aaharu/php7
Browse files Browse the repository at this point in the history
support php7.2 and higher
  • Loading branch information
aaharu authored Feb 22, 2019
2 parents 9abc38b + fdb044b commit e614dc6
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 93 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ report/
artifacts/
composer.phar
composer.lock
.php_cs.cache
.phpunit.result.cache

.DS_Store
Thumbs.db
Expand Down
4 changes: 2 additions & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build:
environment:
php:
version: '7.1'
version: '7.3'
ini:
'date.timezone': 'Asia/Tokyo'
tests:
Expand All @@ -12,7 +12,7 @@ build:
format: php-clover
project_setup:
before:
- command: php -dalways_populate_raw_post_data=-1 -ddisplay_errors=stderr -S localhost:8000
- command: php -ddisplay_errors=stderr -S localhost:8000
background: true

filter:
Expand Down
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
language: php
php:
- '7.1'
- '7.0'
- '5.6'
- '7.3'
- '7.2'

before_install:
- 'find src -type f -name *.php | xargs php -nl'
- '[[ "$TRAVIS_PHP_VERSION" == "5.3" ]] || php -dalways_populate_raw_post_data=-1 -ddisplay_errors=stderr -S localhost:8000 > /tmp/server.log 2>&1 &'
- 'php -ddisplay_errors=stderr -S localhost:8000 > /tmp/server.log 2>&1 &'

install:
- composer install
Expand Down
23 changes: 18 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,54 @@
# Change Log

## [2.0.0] - 2019-02-23

### Changed

- drop php version less than 7.2

## [1.2.0] - 2017-04-07

### Added

- add .gitattributes
- add compare view's link in changelog
- proxy\_type option.


## [1.1.2] - 2017-01-02

### Fixed

- fix proxy\_port, proxy\_login, proxy\_password options.

### Changed

- refactoring.
- update travis and scrutinizer settings.
- CHANGELOG format.

### Added
- use editorconfig.

- use editorconfig.

## [1.1.1] - 2016-01-30

### Added
- support ssl\_method option.

- support ssl\_method option.

## [1.1.0] - 2016-01-16

### Fixed

- fix CurlSoapClient::\_\_getCookies and CurlSoapClient::\_\_setCookie.

### Added
- support proxy\_host, proxy\_port, proxy\_login, proxy\_password, login, password and authentication options.

- support proxy\_host, proxy\_port, proxy\_login, proxy\_password, login, password and authentication options.

## 1.0.0 - 2014-09-25


[2.0.0]: https://github.com/aaharu/curlsoapclient/compare/1.2.0...2.0.0
[1.2.0]: https://github.com/aaharu/curlsoapclient/compare/1.1.2...1.2.0
[1.1.2]: https://github.com/aaharu/curlsoapclient/compare/1.1.1...1.1.2
[1.1.1]: https://github.com/aaharu/curlsoapclient/compare/1.1.0...1.1.1
Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ A SoapClient wrapper that uses ext-curl.

https://packagist.org/packages/aaharu/curlsoapclient


## Documentation

### Aaharu\\Soap\\CurlSoapClient::CurlSoapClient

This class is extended [SoapClient](http://php.net/manual/class.soapclient.php).
This class is extended [SoapClient](https://secure.php.net/manual/class.soapclient.php).

```php
public CurlSoapClient::CurlSoapClient ( mixed $wsdl [, array $options ] )
Expand Down Expand Up @@ -68,7 +67,7 @@ wsdl mode.
use Aaharu\Soap\CurlSoapClient;

try {
$client = new CurlSoapClient('http://webservices.amazon.com/AWSECommerceService/2013-08-01/AWSECommerceService.wsdl', array('trace' => true));
$client = new CurlSoapClient('http://webservices.amazon.com/AWSECommerceService/2013-08-01/AWSECommerceService.wsdl', ['trace' => true]);
$client->ItemLookup();
} catch (\SoapFault $fault) {
}
Expand All @@ -94,15 +93,23 @@ non-wsdl mode.
```php
use Aaharu\Soap\CurlSoapClient;

$client = new CurlSoapClient(null, array(
$client = new CurlSoapClient(null, [
'location' => 'http://example.com/test/location',
'uri' => 'http://example.com/test/uri',
'redirect_max' => 1,
'exceptions' => false,
));
]);
$client->doSomething();
```

## Installation

```sh
composer require aaharu/curlsoapclient

## for old PHP
# composer require aaharu/curlsoapclient:1.2.0
```

## Contributing

Expand All @@ -116,11 +123,10 @@ composer install

```sh
## running built-in server before execute `composer test`
# php -dalways_populate_raw_post_data=-1 -ddisplay_errors=stderr -S localhost:8000 &
# php -ddisplay_errors=stderr -S localhost:8000 &
composer test
```


## License

Licensed under the MIT License.
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"php": ">=5.3.0",
"php": ">=7.2",
"ext-soap": "*",
"ext-curl": "*"
},
Expand All @@ -22,12 +22,12 @@
}
},
"require-dev": {
"squizlabs/php_codesniffer": "2.*",
"phpunit/phpunit": "4.8.*"
"phpunit/phpunit": "^8.0",
"friendsofphp/php-cs-fixer": "^2.14"
},
"scripts": {
"test": "phpunit",
"format": "phpcs --standard=PSR2 src"
"format": "php-cs-fixer fix --rules=@PSR2 src"
},
"archive": {
"exclude": [
Expand Down
5 changes: 1 addition & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
<phpunit colors="true" bootstrap="tests/bootstrap.php">
<logging>
<log type="coverage-clover" target="report/coverage.clover"/>
<log type="coverage-html" target="report/coverage" charset="UTF-8" highlight="true"/>
<log type="coverage-html" target="report/coverage"/>
</logging>
<testsuites>
<testsuite name="builtin-server-tests">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory suffix=".php">vendor/</directory>
</blacklist>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
Expand Down
11 changes: 6 additions & 5 deletions src/CurlSoapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public function __construct($wsdl, array $options)
$this->curl_timeout = (int)$options['curl_timeout'];
}
if (isset($options['proxy_type']) &&
in_array($options['proxy_type'], array('http', 'socks4', 'socks5'), true)) {
in_array($options['proxy_type'], ['http', 'socks4', 'socks5'], true)) {
$this->proxy_type = $options['proxy_type'];
}
$this->curl = curl_init();
$this->_cookies = array();
$this->_cookies = [];
}

public function __destruct()
Expand Down Expand Up @@ -136,7 +136,7 @@ public function __doRequest($request, $location, $action, $version, $one_way = 0
*/
private function ___configHeader($action, $version)
{
$header = array();
$header = [];
if (isset($this->_keep_alive) && empty($this->_keep_alive)) {
$header[] = 'Connection: close';
} else {
Expand Down Expand Up @@ -240,7 +240,7 @@ private function ___curlCall($location)
curl_setopt($this->curl, CURLOPT_URL, $location);

if (!empty($this->_cookies)) {
$cookies = array();
$cookies = [];
foreach ($this->_cookies as $cookie_name => $cookie_value) {
$cookies[] = $cookie_name . '=' . $cookie_value[0];
}
Expand Down Expand Up @@ -302,7 +302,8 @@ private function ___curlCall($location)
* @param string $response_body server response body
* @return boolean
*/
private function ___isErrorResponse($response_body) {
private function ___isErrorResponse($response_body)
{
$response_length = strlen($response_body);
if ($response_length === 0) {
return true;
Expand Down
Loading

0 comments on commit e614dc6

Please sign in to comment.