| Conditions | 1 |
| Paths | 1 |
| Total Lines | 70 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 25 | public function wsdlMode() |
||
| 26 | { |
||
| 27 | // this wsdl adapted from https://www.w3.org/2001/04/wsws-proceedings/uche/wsdl.html |
||
| 28 | $wsdl = <<<EOD |
||
| 29 | <definitions name="EndorsementSearch" |
||
| 30 | targetNamespace="http://namespaces.snowboard-info.com" |
||
| 31 | xmlns:es="http://www.snowboard-info.com/EndorsementSearch.wsdl" |
||
| 32 | xmlns:esxsd="http://schemas.snowboard-info.com/EndorsementSearch.xsd" |
||
| 33 | xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" |
||
| 34 | xmlns="http://schemas.xmlsoap.org/wsdl/" |
||
| 35 | > |
||
| 36 | |||
| 37 | <!-- omitted types section with content model schema info --> |
||
| 38 | |||
| 39 | <message name="GetEndorsingBoarderRequest"> |
||
| 40 | <part name="body" element="esxsd:GetEndorsingBoarder"/> |
||
| 41 | </message> |
||
| 42 | |||
| 43 | <message name="GetEndorsingBoarderResponse"> |
||
| 44 | <part name="body" element="esxsd:GetEndorsingBoarderResponse"/> |
||
| 45 | </message> |
||
| 46 | |||
| 47 | <portType name="GetEndorsingBoarderPortType"> |
||
| 48 | <operation name="GetEndorsingBoarder"> |
||
| 49 | <input message="es:GetEndorsingBoarderRequest"/> |
||
| 50 | <output message="es:GetEndorsingBoarderResponse"/> |
||
| 51 | </operation> |
||
| 52 | </portType> |
||
| 53 | |||
| 54 | <binding name="EndorsementSearchSoapBinding" |
||
| 55 | type="es:GetEndorsingBoarderPortType"> |
||
| 56 | <soap:binding style="document" |
||
| 57 | transport="http://schemas.xmlsoap.org/soap/http"/> |
||
| 58 | <operation name="GetEndorsingBoarder"> |
||
| 59 | <soap:operation |
||
| 60 | soapAction="http://www.snowboard-info.com/EndorsementSearch"/> |
||
| 61 | <input> |
||
| 62 | <soap:body use="literal" |
||
| 63 | namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> |
||
| 64 | </input> |
||
| 65 | <output> |
||
| 66 | <soap:body use="literal" |
||
| 67 | namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> |
||
| 68 | </output> |
||
| 69 | <fault> |
||
| 70 | <soap:body use="literal" |
||
| 71 | namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> |
||
| 72 | </fault> |
||
| 73 | </operation> |
||
| 74 | </binding> |
||
| 75 | |||
| 76 | <service name="EndorsementSearchService"> |
||
| 77 | <documentation>snowboarding-info.com Endorsement Service</documentation> |
||
| 78 | <port name="GetEndorsingBoarderPort" |
||
| 79 | binding="es:EndorsementSearchSoapBinding"> |
||
| 80 | <soap:address location="http://www.snowboard-info.com/EndorsementSearch"/> |
||
| 81 | </port> |
||
| 82 | </service> |
||
| 83 | |||
| 84 | </definitions> |
||
| 85 | EOD; |
||
| 86 | |||
| 87 | $factory = new Factory(); |
||
| 88 | $handlerMock = new MockHandler([new Response('200', [], $wsdl)]); |
||
| 89 | $handler = new HandlerStack($handlerMock); |
||
| 90 | $clientMock = new Client(['handler' => $handler]); |
||
| 91 | $client = $factory->create($clientMock, 'wsdl'); |
||
| 92 | $this->assertTrue($client instanceof SoapClient); |
||
| 93 | |||
| 94 | } |
||
| 95 | } |
||
| 96 |