| 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 |
||
| 26 | public function wsdlMode() |
||
| 27 | { |
||
| 28 | // this wsdl adapted from https://www.w3.org/2001/04/wsws-proceedings/uche/wsdl.html |
||
| 29 | $wsdl = <<<EOD |
||
| 30 | <definitions name="EndorsementSearch" |
||
| 31 | targetNamespace="http://namespaces.snowboard-info.com" |
||
| 32 | xmlns:es="http://www.snowboard-info.com/EndorsementSearch.wsdl" |
||
| 33 | xmlns:esxsd="http://schemas.snowboard-info.com/EndorsementSearch.xsd" |
||
| 34 | xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" |
||
| 35 | xmlns="http://schemas.xmlsoap.org/wsdl/" |
||
| 36 | > |
||
| 37 | |||
| 38 | <!-- omitted types section with content model schema info --> |
||
| 39 | |||
| 40 | <message name="GetEndorsingBoarderRequest"> |
||
| 41 | <part name="body" element="esxsd:GetEndorsingBoarder"/> |
||
| 42 | </message> |
||
| 43 | |||
| 44 | <message name="GetEndorsingBoarderResponse"> |
||
| 45 | <part name="body" element="esxsd:GetEndorsingBoarderResponse"/> |
||
| 46 | </message> |
||
| 47 | |||
| 48 | <portType name="GetEndorsingBoarderPortType"> |
||
| 49 | <operation name="GetEndorsingBoarder"> |
||
| 50 | <input message="es:GetEndorsingBoarderRequest"/> |
||
| 51 | <output message="es:GetEndorsingBoarderResponse"/> |
||
| 52 | </operation> |
||
| 53 | </portType> |
||
| 54 | |||
| 55 | <binding name="EndorsementSearchSoapBinding" |
||
| 56 | type="es:GetEndorsingBoarderPortType"> |
||
| 57 | <soap:binding style="document" |
||
| 58 | transport="http://schemas.xmlsoap.org/soap/http"/> |
||
| 59 | <operation name="GetEndorsingBoarder"> |
||
| 60 | <soap:operation |
||
| 61 | soapAction="http://www.snowboard-info.com/EndorsementSearch"/> |
||
| 62 | <input> |
||
| 63 | <soap:body use="literal" |
||
| 64 | namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> |
||
| 65 | </input> |
||
| 66 | <output> |
||
| 67 | <soap:body use="literal" |
||
| 68 | namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> |
||
| 69 | </output> |
||
| 70 | <fault> |
||
| 71 | <soap:body use="literal" |
||
| 72 | namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> |
||
| 73 | </fault> |
||
| 74 | </operation> |
||
| 75 | </binding> |
||
| 76 | |||
| 77 | <service name="EndorsementSearchService"> |
||
| 78 | <documentation>snowboarding-info.com Endorsement Service</documentation> |
||
| 79 | <port name="GetEndorsingBoarderPort" |
||
| 80 | binding="es:EndorsementSearchSoapBinding"> |
||
| 81 | <soap:address location="http://www.snowboard-info.com/EndorsementSearch"/> |
||
| 82 | </port> |
||
| 83 | </service> |
||
| 84 | |||
| 85 | </definitions> |
||
| 86 | EOD; |
||
| 87 | |||
| 88 | $factory = new Factory(); |
||
| 89 | $handlerMock = new MockHandler([new Response('200', [], $wsdl)]); |
||
| 90 | $handler = new HandlerStack($handlerMock); |
||
| 91 | $clientMock = new Client(['handler' => $handler]); |
||
| 92 | $client = $factory->create($clientMock, new RequestBuilder(), 'wsdl'); |
||
| 93 | $this->assertTrue($client instanceof SoapClient); |
||
| 94 | |||
| 95 | } |
||
| 96 | } |
||
| 97 |