From 7de7ee9c6c4d4d03bb49a91320e173256a7e5e51 Mon Sep 17 00:00:00 2001 From: Andreas Schamberger Date: Sat, 17 Dec 2011 16:25:49 +0100 Subject: [PATCH] CS fixes --- src/BeSimple/SoapCommon/Helper.php | 2 + src/BeSimple/SoapCommon/Mime/MultiPart.php | 5 ++ src/BeSimple/SoapCommon/Mime/Parser.php | 3 + src/BeSimple/SoapCommon/Mime/Part.php | 4 +- src/BeSimple/SoapCommon/Mime/PartHeader.php | 4 ++ src/BeSimple/SoapCommon/SoapKernel.php | 63 ++++++++++--------- src/BeSimple/SoapCommon/SoapMessage.php | 12 ++-- src/BeSimple/SoapCommon/SoapRequest.php | 4 +- src/BeSimple/SoapCommon/SoapRequestFilter.php | 7 +++ src/BeSimple/SoapCommon/SoapResponse.php | 4 +- .../SoapCommon/SoapResponseFilter.php | 7 +++ src/BeSimple/SoapCommon/WsSecurityKey.php | 2 + src/BeSimple/SoapCommon/WsdlHandler.php | 2 + 13 files changed, 83 insertions(+), 36 deletions(-) diff --git a/src/BeSimple/SoapCommon/Helper.php b/src/BeSimple/SoapCommon/Helper.php index 19185ed..c33a9df 100644 --- a/src/BeSimple/SoapCommon/Helper.php +++ b/src/BeSimple/SoapCommon/Helper.php @@ -191,6 +191,7 @@ class Helper * Get SOAP namespace for the given $version. * * @param int $version SOAP_1_1|SOAP_1_2 + * * @return string */ public static function getSoapNamespace($version) @@ -206,6 +207,7 @@ class Helper * Get SOAP version from namespace URI. * * @param string $namespace NS_SOAP_1_1|NS_SOAP_1_2 + * * @return int SOAP_1_1|SOAP_1_2 */ public static function getSoapVersionFromNamespace($namespace) diff --git a/src/BeSimple/SoapCommon/Mime/MultiPart.php b/src/BeSimple/SoapCommon/Mime/MultiPart.php index 1a3b7e1..1b8ffa3 100644 --- a/src/BeSimple/SoapCommon/Mime/MultiPart.php +++ b/src/BeSimple/SoapCommon/Mime/MultiPart.php @@ -46,6 +46,7 @@ class MultiPart extends PartHeader * Construct new mime object. * * @param string $boundary Boundary string + * * @return void */ public function __construct($boundary = null) @@ -64,6 +65,7 @@ class MultiPart extends PartHeader * Get mime message of this object (without headers). * * @param boolean $withHeaders Returned mime message contains headers + * * @return string */ public function getMimeMessage($withHeaders = false) @@ -106,6 +108,7 @@ class MultiPart extends PartHeader * * @param \BeSimple\SoapCommon\Mime\Part $part Part that is added * @param boolean $isMain Is the given part the main part of mime message + * * @return void */ public function addPart(Part $part, $isMain = false) @@ -124,6 +127,7 @@ class MultiPart extends PartHeader * parameter. * * @param string $contentId Content id of desired part + * * @return \BeSimple\SoapCommon\Mime\Part|null */ public function getPart($contentId = null) @@ -141,6 +145,7 @@ class MultiPart extends PartHeader * Get all parts. * * @param boolean $includeMainPart Should main part be in result set + * * @return array(\BeSimple\SoapCommon\Mime\Part) */ public function getParts($includeMainPart = false) diff --git a/src/BeSimple/SoapCommon/Mime/Parser.php b/src/BeSimple/SoapCommon/Mime/Parser.php index ab41b97..1c5fe5f 100644 --- a/src/BeSimple/SoapCommon/Mime/Parser.php +++ b/src/BeSimple/SoapCommon/Mime/Parser.php @@ -24,6 +24,7 @@ class Parser * * @param string $mimeMessage Mime message string * @param array(string=>string) $headers Array of header elements (e.g. coming from http request) + * * @return \BeSimple\SoapCommon\Mime\MultiPart */ public static function parseMimeMessage($mimeMessage, array $headers = array()) @@ -133,6 +134,7 @@ class Parser * @param \BeSimple\SoapCommon\Mime\PartHeader $part Header part * @param string $headerName Header name * @param string $headerValue Header value + * * @return null */ private static function parseContentTypeHeader(PartHeader $part, $headerName, $headerValue) @@ -165,6 +167,7 @@ class Parser * * @param \BeSimple\SoapCommon\Mime\Part $part Part to add content * @param string $content Content to decode + * * @return null */ private static function decodeContent(Part $part, $content) diff --git a/src/BeSimple/SoapCommon/Mime/Part.php b/src/BeSimple/SoapCommon/Mime/Part.php index 88a2ca7..48aa438 100644 --- a/src/BeSimple/SoapCommon/Mime/Part.php +++ b/src/BeSimple/SoapCommon/Mime/Part.php @@ -68,6 +68,7 @@ class Part extends PartHeader * @param string $charset Charset * @param string $encoding Encoding * @param string $contentId Content id + * * @return void */ public function __construct($content = null, $contentType = 'application/octet-stream', $charset = null, $encoding = self::ENCODING_BINARY, $contentId = null) @@ -76,7 +77,7 @@ class Part extends PartHeader $this->setHeader('Content-Type', $contentType); if (!is_null($charset)) { $this->setHeader('Content-Type', 'charset', $charset); - } else { // if (substr($contentType, 0, 4) == 'text') { + } else { $this->setHeader('Content-Type', 'charset', 'utf-8'); } $this->setHeader('Content-Transfer-Encoding', $encoding); @@ -110,6 +111,7 @@ class Part extends PartHeader * Set mime content. * * @param mixed $content Content to set + * * @return void */ public function setContent($content) diff --git a/src/BeSimple/SoapCommon/Mime/PartHeader.php b/src/BeSimple/SoapCommon/Mime/PartHeader.php index 8e78bea..ff0dcfc 100644 --- a/src/BeSimple/SoapCommon/Mime/PartHeader.php +++ b/src/BeSimple/SoapCommon/Mime/PartHeader.php @@ -32,6 +32,7 @@ abstract class PartHeader * @param string $name Header name * @param string $value Header value * @param string $subValue Is sub value? + * * @return void */ public function setHeader($name, $value, $subValue = null) @@ -57,6 +58,7 @@ abstract class PartHeader * * @param string $name Header name * @param string $subValue Sub value name + * * @return mixed|array(mixed) */ public function getHeader($name, $subValue = null) @@ -104,6 +106,7 @@ abstract class PartHeader * Generates a header field value from the given value paramater. * * @param array(string=>string)|string $value Header value + * * @return string */ protected function generateHeaderFieldValue($value) @@ -129,6 +132,7 @@ abstract class PartHeader * "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" / <"> / "/" / "[" / "]" / "?" / "=" * * @param string $string String to quote + * * @return string */ private function quoteValueString($string) diff --git a/src/BeSimple/SoapCommon/SoapKernel.php b/src/BeSimple/SoapCommon/SoapKernel.php index 5a8f650..fc349c8 100644 --- a/src/BeSimple/SoapCommon/SoapKernel.php +++ b/src/BeSimple/SoapCommon/SoapKernel.php @@ -21,61 +21,68 @@ use BeSimple\SoapCommon\SoapResponseFilter; /** * SoapKernel provides methods to pre- and post-process SoapRequests and SoapResponses using - * chains of SoapRequestFilter and SoapResponseFilter objects (roughly following + * chains of SoapRequestFilter and SoapResponseFilter objects (roughly following * the chain-of-responsibility pattern). - * + * * @author Christian Kerl */ class SoapKernel { - private $requestFilters = array(); - private $responseFilters = array(); - /** - * Registers the given object either as filter for SoapRequests or as filter for SoapResponses + * Request filters. + * + * @var array(SoapRequestFilter) + */ + private $requestFilters = array(); + + /** + * Response filters. + * + * @var array(SoapResponseFilter) + */ + private $responseFilters = array(); + + /** + * Registers the given object either as filter for SoapRequests or as filter for SoapResponses * or as filter for both depending on the implemented interfaces. Inner filters have to be registered - * before outer filters. This means the order is as follows: RequestFilter2->RequestFilter1 and + * before outer filters. This means the order is as follows: RequestFilter2->RequestFilter1 and * ResponseFilter1->ResponseFilter2. - * + * * TODO: add priority mechanism to ensure correct order of filters - * - * @param SoapRequestFilter|SoapResponseFilter $filter + * + * @param SoapRequestFilter|SoapResponseFilter $filter Filter to register */ public function registerFilter($filter) - { - if($filter instanceof SoapRequestFilter) - { + { + if ($filter instanceof SoapRequestFilter) { array_unshift($this->requestFilters, $filter); } - - if($filter instanceof SoapResponseFilter) - { + + if ($filter instanceof SoapResponseFilter) { array_push($this->responseFilters, $filter); } } - + /** - * Applies all registered SoapRequestFilter to the given SoapRequest. - * - * @param SoapRequest $request + * Applies all registered SoapRequestFilter to the given SoapRequest. + * + * @param SoapRequest $request Soap request */ public function filterRequest(SoapRequest $request) { - foreach($this->requestFilters as $filter) - { + foreach ($this->requestFilters as $filter) { $filter->filterRequest($request); } } - + /** - * Applies all registered SoapResponseFilter to the given SoapResponse. - * - * @param SoapResponse $response + * Applies all registered SoapResponseFilter to the given SoapResponse. + * + * @param SoapResponse $response SOAP response */ public function filterResponse(SoapResponse $response) { - foreach($this->responseFilters as $filter) - { + foreach ($this->responseFilters as $filter) { $filter->filterResponse($response); } } diff --git a/src/BeSimple/SoapCommon/SoapMessage.php b/src/BeSimple/SoapCommon/SoapMessage.php index 4c256c0..e92baf5 100644 --- a/src/BeSimple/SoapCommon/SoapMessage.php +++ b/src/BeSimple/SoapCommon/SoapMessage.php @@ -91,6 +91,8 @@ abstract class SoapMessage * Get content type for given SOAP version. * * @param string $version SOAP version constant SOAP_1_1|SOAP_1_2 + * + * @return string * @throws \InvalidArgumentException */ public static function getContentTypeForVersion($version) @@ -115,7 +117,7 @@ abstract class SoapMessage /** * Set SOAP action. * - * @param string $action + * @param string $action SOAP action */ public function setAction($action) { @@ -138,7 +140,7 @@ abstract class SoapMessage /** * Set message content (MIME Message or SOAP Envelope). * - * @param string $content + * @param string $content SOAP message */ public function setContent($content) { @@ -176,7 +178,7 @@ abstract class SoapMessage /** * Set content type. * - * @param string $contentType + * @param string $contentType Content type header */ public function setContentType($contentType) { @@ -196,7 +198,7 @@ abstract class SoapMessage /** * Set location. * - * @param string $location + * @param string $location Location string */ public function setLocation($location) { @@ -216,7 +218,7 @@ abstract class SoapMessage /** * Set version. * - * @param string $version + * @param string $version SOAP version SOAP_1_1|SOAP_1_2 */ public function setVersion($version) { diff --git a/src/BeSimple/SoapCommon/SoapRequest.php b/src/BeSimple/SoapCommon/SoapRequest.php index 24120c4..314d157 100644 --- a/src/BeSimple/SoapCommon/SoapRequest.php +++ b/src/BeSimple/SoapCommon/SoapRequest.php @@ -16,9 +16,11 @@ namespace BeSimple\SoapCommon; use BeSimple\SoapCommon\SoapMessage; /** + * SOAP request message. + * * @author Christian Kerl */ class SoapRequest extends SoapMessage { - + } \ No newline at end of file diff --git a/src/BeSimple/SoapCommon/SoapRequestFilter.php b/src/BeSimple/SoapCommon/SoapRequestFilter.php index 8b200ee..dbc990c 100644 --- a/src/BeSimple/SoapCommon/SoapRequestFilter.php +++ b/src/BeSimple/SoapCommon/SoapRequestFilter.php @@ -16,9 +16,16 @@ namespace BeSimple\SoapCommon; use BeSimple\SoapCommon\SoapRequest; /** + * SOAP request filter interface. + * * @author Christian Kerl */ interface SoapRequestFilter { + /** + * Modify SOAP response. + * + * @param SoapRequest $request SOAP request + */ public function filterRequest(SoapRequest $request); } \ No newline at end of file diff --git a/src/BeSimple/SoapCommon/SoapResponse.php b/src/BeSimple/SoapCommon/SoapResponse.php index 7141917..b6815b2 100644 --- a/src/BeSimple/SoapCommon/SoapResponse.php +++ b/src/BeSimple/SoapCommon/SoapResponse.php @@ -16,9 +16,11 @@ namespace BeSimple\SoapCommon; use BeSimple\SoapCommon\SoapMessage; /** + * SOAP response message. + * * @author Christian Kerl */ class SoapResponse extends SoapMessage { - + } \ No newline at end of file diff --git a/src/BeSimple/SoapCommon/SoapResponseFilter.php b/src/BeSimple/SoapCommon/SoapResponseFilter.php index ebc4c50..c7d6bb6 100644 --- a/src/BeSimple/SoapCommon/SoapResponseFilter.php +++ b/src/BeSimple/SoapCommon/SoapResponseFilter.php @@ -16,9 +16,16 @@ namespace BeSimple\SoapCommon; use BeSimple\SoapCommon\SoapResponse; /** + * SOAP response filter interface. + * * @author Christian Kerl */ interface SoapResponseFilter { + /** + * Modify SOAP response. + * + * @param SoapResponse $response SOAP response + */ public function filterResponse(SoapResponse $response); } \ No newline at end of file diff --git a/src/BeSimple/SoapCommon/WsSecurityKey.php b/src/BeSimple/SoapCommon/WsSecurityKey.php index 327b521..432e654 100644 --- a/src/BeSimple/SoapCommon/WsSecurityKey.php +++ b/src/BeSimple/SoapCommon/WsSecurityKey.php @@ -42,6 +42,7 @@ class WsSecurityKey * @param string $key Private key * @param boolean $keyIsFile Given key parameter is path to key file * @param string $passphrase Passphrase for key + * * @return void */ public function addPrivateKey($encryptionType, $key = null, $keyIsFile = true, $passphrase = null) @@ -55,6 +56,7 @@ class WsSecurityKey * @param string $encryptionType Encryption type * @param string $key Public key * @param boolean $keyIsFile Given key parameter is path to key file + * * @return void */ public function addPublicKey($encryptionType, $key = null, $keyIsFile = true) diff --git a/src/BeSimple/SoapCommon/WsdlHandler.php b/src/BeSimple/SoapCommon/WsdlHandler.php index f0f533e..6fd044b 100644 --- a/src/BeSimple/SoapCommon/WsdlHandler.php +++ b/src/BeSimple/SoapCommon/WsdlHandler.php @@ -87,6 +87,7 @@ class WsdlHandler * Gets the mime type information from the WSDL file. * * @param string $soapAction Soap action to analyse + * * @return array(string=>array(string=>array(string))) */ private function getMimeTypesForSoapAction($soapAction) @@ -152,6 +153,7 @@ class WsdlHandler * @param string $operationType Operation type * @param string $part Part name * @param string $currentMimeType Current mime type + * * @return boolean */ public function isValidMimeTypeType($soapAction, $operationType, $part, $currentMimeType)