Skip to content

Commit e586b1d

Browse files
committed
Merge branch 'develop' into feature/issue-3
2 parents 9b6e7a4 + e00abac commit e586b1d

File tree

6 files changed

+57
-42
lines changed

6 files changed

+57
-42
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# CHANGELOG
22

3+
## 1.0.6
4+
- Pull request #4: Rename $optioName to $optionName
5+
6+
## 1.0.5
7+
- Update readme
8+
9+
## 1.0.4
10+
- Issue #2 - Var name change request from $methoName to $methodName
11+
312
## 1.0.3
413
- Add utility methods **getStreamContext()** and **getStreamContextOptions()** to AbstractSoapClientbase class
514

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Package Base
22
[![Latest Stable Version](https://poser.pugx.org/wsdltophp/packagebase/version.png)](https://packagist.org/packages/wsdltophp/packagebase)
3+
[![Total Downloads](https://poser.pugx.org/wsdltophp/packagebase/downloads)](https://packagist.org/packages/wsdltophp/packagebase)
34
[![Build Status](https://api.travis-ci.org/WsdlToPhp/PackageBase.svg)](https://travis-ci.org/WsdlToPhp/PackageBase)
45
[![PHP 7 ready](http://php7ready.timesplinter.ch/WsdlToPhp/PackageBase/badge.svg)](https://travis-ci.org/WsdlToPhp/PackageBase)
56
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/WsdlToPhp/PackageBase/badges/quality-score.png)](https://scrutinizer-ci.com/g/WsdlToPhp/PackageBase/)
@@ -33,10 +34,10 @@ There is at least/most one method that must be implemented so it's pretty fast t
3334

3435
### StructArrayInterface
3536
#### Description
36-
This interface must be used to define a new ArrayType class. The goal is to provide utility methods around Array Structs defined by the Wsdl in order to ease the handling of its content. Therefore, this interface inherits from our [StructInterface](#structinterface) interface interface plus the native [ArrayAccess](http://php.net/manual/en/class.arrayaccess.php), [Iterator](http://php.net/manual/en/class.iterator.php) and [Countable](http://php.net/manual/en/class.countable.php) PHP interfaces
37+
This interface must be used to define a new ArrayType class. The goal is to provide utility methods around Array Structs defined by the Wsdl in order to ease the handling of its content. Therefore, this interface inherits from our [StructInterface](#structinterface) interface plus the native [ArrayAccess](http://php.net/manual/en/class.arrayaccess.php), [Iterator](http://php.net/manual/en/class.iterator.php) and [Countable](http://php.net/manual/en/class.countable.php) PHP interfaces
3738

3839
#### What has to be implemented?
39-
The only method that must implement would be **getAttributeName** but be aware that it is implemented in every generated ArrayType class so no need to define it. It's just a reminder of what is available in ArrayType classes.
40+
The only method that must be implemented would be **getAttributeName** but be aware that it is implemented in every generated ArrayType class so no need to define it. It's just a reminder of what is available in ArrayType classes.
4041

4142
So, basically, you MUST at least override the methods declared by the PHP interfaces from which this interface inherits
4243

@@ -81,7 +82,7 @@ Here are the methods that must be implemented and why:
8182
- **getSoapClient()**: must return the [SoapClient](http://php.net/manual/en/class.soapclient.php) object that is responsible fo sending the requests.
8283
- **setSoapHeader($nameSpace, $name, $data, $mustUnderstand = false, $actor = null)**: look to [AbstractSoapClientBase](#abstractsoapclientbase) part that details this method. Basically, it allows to define [SoapHeader](http://php.net/manual/en/class.soapheader.php)s for the request
8384
- **getLastError()**: must return the last error, its format is up to you
84-
- **saveLastError($methoName, \SoapFault $soapFault)**: look to [AbstractSoapClientBase](#abstractsoapclientbase) part that details this method. Basically, it must allow to store a catched [Soapfault](http://php.net/manual/en/class.soapfault.php) object when a request has failed
85+
- **saveLastError($methodName, \SoapFault $soapFault)**: look to [AbstractSoapClientBase](#abstractsoapclientbase) part that details this method. Basically, it must allow to store a catched [Soapfault](http://php.net/manual/en/class.soapfault.php) object when a request has failed
8586
- **getResult()**: should return the Soap Web Service response, it's up to you
8687
- **setResult($result)**: must accept any parameter type as it should received the Soap Web Service response
8788

@@ -201,7 +202,7 @@ $items->initInternArray(array(
201202
#### Description
202203
This class is the base class for any ```ServiceType``` class generated by [PackageGenerator](https://github.com/WsdlToPhp/PackageGenerator).
203204
Its goal is to provide utility/handful methods by implementing our [SoapClientInterface](#soapclientinterface) interface.
204-
It's basically a decorator design pattern as the class has the [SoapClient](http://php.net/manual/en/class.soapclient.php) object as a static property in order to be able apply methods on it. It is static property in order to have a singleton between multiple calls. It can be reset by passing true as the second parameter.
205+
It's basically a decorator design pattern as the class has the [SoapClient](http://php.net/manual/en/class.soapclient.php) object as a static property in order to be able to apply methods on it. It is a static property in order to have a singleton between multiple calls (allowing to send cookies automatically between calls). It can be reset by passing true as the second parameter.
205206

206207
#### Usage
207208
Let's say you have this type of generate ```ServiceType``` class:
@@ -241,7 +242,7 @@ Then call any of these base methods:
241242
- **getLastRequestHeaders($asArray = false)**: returns either the HTTP request's headers as a string or as an array (each HTTP header is parsed)
242243
- **getLastResponseHeaders($asArray = false)**: returns either the HTTP response's headers as a string or as an array
243244
- **getLastError**: automatically populated with an error when ```$this->saveLastError(__METHOD__, $soapFault)``` is called
244-
- **getLastErrorForMethod($methoName)** : returns the error associated to the called method. It should return a ```SoapFault``` object
245+
- **getLastErrorForMethod($methodName)** : returns the error associated to the called method. It should return a ```SoapFault``` object
245246
```php
246247
$result = $update->UpdateBulkOrder(new \Api\StructType\ApiUpdateBulkOrder())
247248
if ($result !== false) {

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"name": "Mikaël DELSOL",
1111
"email": "[email protected]",
1212
"role": "Owner"
13+
},
14+
{
15+
"name": "Luke Rodgers",
16+
"email": "[email protected]",
17+
"role": "Contributor"
1318
}
1419
],
1520
"support" : {

src/AbstractSoapClientBase.php

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ public function initSoapClient(array $options)
6767
{
6868
$wsdlOptions = array();
6969
$defaultWsdlOptions = static::getDefaultWsdlOptions();
70-
foreach ($defaultWsdlOptions as $optioName => $optionValue) {
71-
if (array_key_exists($optioName, $options) && !empty($options[$optioName])) {
72-
$wsdlOptions[str_replace(self::OPTION_PREFIX, '', $optioName)] = $options[$optioName];
70+
foreach ($defaultWsdlOptions as $optionName => $optionValue) {
71+
if (array_key_exists($optionName, $options) && !empty($options[$optionName])) {
72+
$wsdlOptions[str_replace(self::OPTION_PREFIX, '', $optionName)] = $options[$optionName];
7373
} elseif (!empty($optionValue)) {
74-
$wsdlOptions[str_replace(self::OPTION_PREFIX, '', $optioName)] = $optionValue;
74+
$wsdlOptions[str_replace(self::OPTION_PREFIX, '', $optionName)] = $optionValue;
7575
}
7676
}
7777
if (array_key_exists(str_replace(self::OPTION_PREFIX, '', self::WSDL_URL), $wsdlOptions)) {
@@ -131,29 +131,30 @@ public function getSoapClientClassName($soapClientClassName = null)
131131
public static function getDefaultWsdlOptions()
132132
{
133133
return array(
134-
self::WSDL_CLASSMAP => null,
135-
self::WSDL_CACHE_WSDL => WSDL_CACHE_NONE,
136-
self::WSDL_COMPRESSION => null,
137-
self::WSDL_CONNECTION_TIMEOUT => null,
138-
self::WSDL_ENCODING => null,
139-
self::WSDL_EXCEPTIONS => true,
140-
self::WSDL_FEATURES => SOAP_SINGLE_ELEMENT_ARRAYS | SOAP_USE_XSI_ARRAY_TYPE,
141-
self::WSDL_LOGIN => null,
142-
self::WSDL_PASSWORD => null,
143-
self::WSDL_SOAP_VERSION => null,
144-
self::WSDL_STREAM_CONTEXT => null,
145-
self::WSDL_TRACE => true,
146-
self::WSDL_TYPEMAP => null,
147-
self::WSDL_URL => null,
148-
self::WSDL_USER_AGENT => null,
149-
self::WSDL_PROXY_HOST => null,
150-
self::WSDL_PROXY_PORT => null,
151-
self::WSDL_PROXY_LOGIN => null,
152-
self::WSDL_PROXY_PASSWORD => null,
153-
self::WSDL_LOCAL_CERT => null,
154-
self::WSDL_PASSPHRASE => null,
155-
self::WSDL_AUTHENTICATION => null,
156-
self::WSDL_SSL_METHOD => null);
134+
self::WSDL_CLASSMAP => null,
135+
self::WSDL_CACHE_WSDL => WSDL_CACHE_NONE,
136+
self::WSDL_COMPRESSION => null,
137+
self::WSDL_CONNECTION_TIMEOUT => null,
138+
self::WSDL_ENCODING => null,
139+
self::WSDL_EXCEPTIONS => true,
140+
self::WSDL_FEATURES => SOAP_SINGLE_ELEMENT_ARRAYS | SOAP_USE_XSI_ARRAY_TYPE,
141+
self::WSDL_LOGIN => null,
142+
self::WSDL_PASSWORD => null,
143+
self::WSDL_SOAP_VERSION => null,
144+
self::WSDL_STREAM_CONTEXT => null,
145+
self::WSDL_TRACE => true,
146+
self::WSDL_TYPEMAP => null,
147+
self::WSDL_URL => null,
148+
self::WSDL_USER_AGENT => null,
149+
self::WSDL_PROXY_HOST => null,
150+
self::WSDL_PROXY_PORT => null,
151+
self::WSDL_PROXY_LOGIN => null,
152+
self::WSDL_PROXY_PASSWORD => null,
153+
self::WSDL_LOCAL_CERT => null,
154+
self::WSDL_PASSPHRASE => null,
155+
self::WSDL_AUTHENTICATION => null,
156+
self::WSDL_SSL_METHOD => null,
157+
);
157158
}
158159
/**
159160
* Allows to set the SoapClient location to call
@@ -410,23 +411,23 @@ private function setLastError($lastError)
410411
}
411412
/**
412413
* Method saving the last error returned by the SoapClient
413-
* @param string $methoName the method called when the error occurred
414+
* @param string $methodName the method called when the error occurred
414415
* @param \SoapFault $soapFault l'objet de l'erreur
415416
* @return AbstractSoapClientBase
416417
*/
417-
public function saveLastError($methoName, \SoapFault $soapFault)
418+
public function saveLastError($methodName, \SoapFault $soapFault)
418419
{
419-
$this->lastError[$methoName] = $soapFault;
420+
$this->lastError[$methodName] = $soapFault;
420421
return $this;
421422
}
422423
/**
423424
* Method getting the last error for a certain method
424-
* @param string $methoName method name to get error from
425+
* @param string $methodName method name to get error from
425426
* @return \SoapFault|null
426427
*/
427-
public function getLastErrorForMethod($methoName)
428+
public function getLastErrorForMethod($methodName)
428429
{
429-
return array_key_exists($methoName, $this->lastError) ? $this->lastError[$methoName] : null;
430+
return array_key_exists($methodName, $this->lastError) ? $this->lastError[$methodName] : null;
430431
}
431432
/**
432433
* Method returning current result from Soap call

src/SoapClientInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ public function setSoapHeader($nameSpace, $name, $data, $mustUnderstand = false,
163163
public function getLastError();
164164
/**
165165
* Method saving the last error returned by the SoapClient
166-
* @param string $methoName the method called when the error occurred
166+
* @param string $methodName the method called when the error occurred
167167
* @param \SoapFault $soapFault l'objet de l'erreur
168168
* @return SoapClientInterface
169169
*/
170-
public function saveLastError($methoName, \SoapFault $soapFault);
170+
public function saveLastError($methodName, \SoapFault $soapFault);
171171
/**
172172
* Method returning current result from Soap call
173173
* @return mixed

tests/SoapClientTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace WsdlToPhp\PackageBase\Tests;
44

5-
65
use WsdlToPhp\PackageBase\Utils;
76
use WsdlToPhp\PackageBase\Tests\SoapClient;
87

@@ -326,7 +325,7 @@ public function testGetStreamContext()
326325
/**
327326
*
328327
*/
329-
public function testGetStreamContextAsNill()
328+
public function testGetStreamContextAsNull()
330329
{
331330
$soapClient = new SoapClient(array(
332331
SoapClient::WSDL_URL => __DIR__ . '/resources/bingsearch.wsdl',

0 commit comments

Comments
 (0)