@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @method buildBasePayload |
| 30 | 30 | * @author PA |
| 31 | 31 | * @date 2017-01-09 |
| 32 | - * @return SimpleXMLElement XML Envelope with necessary credential parameters |
|
| 32 | + * @return \SimpleXMLElement XML Envelope with necessary credential parameters |
|
| 33 | 33 | */ |
| 34 | 34 | public function buildBasePayload() : \SimpleXMLElement |
| 35 | 35 | { |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | * @method sxmlAppend |
| 108 | 108 | * @author PA |
| 109 | 109 | * @date 2017-01-09 |
| 110 | - * @param SimpleXMLElement $to |
|
| 111 | - * @param SimpleXMLElement $from |
|
| 110 | + * @param \SimpleXMLElement $to |
|
| 111 | + * @param \SimpleXMLElement $from |
|
| 112 | 112 | */ |
| 113 | 113 | private function sxmlAppend(\SimpleXMLElement $to, \SimpleXMLElement $from) { |
| 114 | 114 | $toDom = dom_import_simplexml($to); |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | |
| 69 | 69 | $call = new \SimpleXMLElement('<Call></Call>'); |
| 70 | - $call->addAttribute('method',$method); |
|
| 70 | + $call->addAttribute('method', $method); |
|
| 71 | 71 | |
| 72 | 72 | foreach ($arguments as $key => $value) { |
| 73 | - $call->addChild($key,$value); |
|
| 73 | + $call->addChild($key, $value); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | return $call; |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | public function buildXMLPayload(string $method, array $arguments) : \SimpleXMLElement |
| 80 | 80 | { |
| 81 | 81 | $xml = $this->buildBasePayload(); |
| 82 | - $callPayload = $this->createCallPayload($method,$arguments); |
|
| 82 | + $callPayload = $this->createCallPayload($method, $arguments); |
|
| 83 | 83 | |
| 84 | - $this->sxmlAppend($xml,$callPayload); |
|
| 84 | + $this->sxmlAppend($xml, $callPayload); |
|
| 85 | 85 | |
| 86 | 86 | return $xml; |
| 87 | 87 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param SimpleXMLElement $to |
| 111 | 111 | * @param SimpleXMLElement $from |
| 112 | 112 | */ |
| 113 | - private function sxmlAppend(\SimpleXMLElement $to, \SimpleXMLElement $from) { |
|
| 113 | + private function sxmlAppend(\SimpleXMLElement $to, \SimpleXMLElement $from) { |
|
| 114 | 114 | $toDom = dom_import_simplexml($to); |
| 115 | 115 | $fromDom = dom_import_simplexml($from); |
| 116 | 116 | $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
@@ -8,32 +8,32 @@ discard block |
||
| 8 | 8 | class Request |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - public static $API_VERSION = '2.25'; |
|
| 12 | - public static $BASE_URL = 'https://api.yourmembership.com'; |
|
| 13 | - |
|
| 14 | - public static $callID = 1; |
|
| 15 | - |
|
| 16 | - private $apiKey; |
|
| 17 | - private $saPasscode; |
|
| 18 | - private $version; |
|
| 19 | - |
|
| 20 | - |
|
| 21 | - function __construct(string $apiKey, string $saPasscode) |
|
| 22 | - { |
|
| 23 | - $this->apiKey = $apiKey; |
|
| 24 | - $this->saPasscode = $saPasscode; |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Create the Base Envelope for an API call to YourMembership |
|
| 29 | - * @method buildBasePayload |
|
| 30 | - * @author PA |
|
| 31 | - * @date 2017-01-09 |
|
| 32 | - * @return SimpleXMLElement XML Envelope with necessary credential parameters |
|
| 33 | - */ |
|
| 34 | - public function buildBasePayload() : \SimpleXMLElement |
|
| 35 | - { |
|
| 36 | - /* |
|
| 11 | + public static $API_VERSION = '2.25'; |
|
| 12 | + public static $BASE_URL = 'https://api.yourmembership.com'; |
|
| 13 | + |
|
| 14 | + public static $callID = 1; |
|
| 15 | + |
|
| 16 | + private $apiKey; |
|
| 17 | + private $saPasscode; |
|
| 18 | + private $version; |
|
| 19 | + |
|
| 20 | + |
|
| 21 | + function __construct(string $apiKey, string $saPasscode) |
|
| 22 | + { |
|
| 23 | + $this->apiKey = $apiKey; |
|
| 24 | + $this->saPasscode = $saPasscode; |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Create the Base Envelope for an API call to YourMembership |
|
| 29 | + * @method buildBasePayload |
|
| 30 | + * @author PA |
|
| 31 | + * @date 2017-01-09 |
|
| 32 | + * @return SimpleXMLElement XML Envelope with necessary credential parameters |
|
| 33 | + */ |
|
| 34 | + public function buildBasePayload() : \SimpleXMLElement |
|
| 35 | + { |
|
| 36 | + /* |
|
| 37 | 37 | <YourMembership> |
| 38 | 38 | <Version>2.25</Version> |
| 39 | 39 | <ApiKey>3D638C5F-CCE2-4638-A2C1-355FA7BBC917</ApiKey> |
@@ -45,75 +45,75 @@ discard block |
||
| 45 | 45 | </YourMembership> |
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | - $xml = new \SimpleXMLElement('<YourMembership></YourMembership>'); |
|
| 49 | - $xml->addChild('Version', self::$API_VERSION); |
|
| 50 | - $xml->addChild('ApiKey', $this->apiKey); |
|
| 51 | - $xml->addChild('CallID', self::$callID); |
|
| 52 | - $xml->addChild('SaPasscode', $this->saPasscode); |
|
| 53 | - |
|
| 54 | - return $xml; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Generates the XML for a API method call within |
|
| 59 | - * @method createCallPayload |
|
| 60 | - * @author PA |
|
| 61 | - * @date 2017-01-09 |
|
| 62 | - * @param string $method YourMembership API Function Name |
|
| 63 | - * @param array $arguments Array of Arguments to be passed as part of the YourMembership "Call" |
|
| 64 | - * @return \SimpleXMLElement |
|
| 65 | - */ |
|
| 66 | - public function createCallPayload(string $method, array $arguments) : \SimpleXMLElement |
|
| 67 | - { |
|
| 68 | - |
|
| 69 | - $call = new \SimpleXMLElement('<Call></Call>'); |
|
| 70 | - $call->addAttribute('method',$method); |
|
| 71 | - |
|
| 72 | - foreach ($arguments as $key => $value) { |
|
| 73 | - $call->addChild($key,$value); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - return $call; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - public function buildXMLPayload(string $method, array $arguments) : \SimpleXMLElement |
|
| 80 | - { |
|
| 81 | - $xml = $this->buildBasePayload(); |
|
| 82 | - $callPayload = $this->createCallPayload($method,$arguments); |
|
| 83 | - |
|
| 84 | - $this->sxmlAppend($xml,$callPayload); |
|
| 85 | - |
|
| 86 | - return $xml; |
|
| 87 | - } |
|
| 88 | - /** |
|
| 89 | - * Complete XML envelope |
|
| 90 | - * @method call |
|
| 91 | - * @author PA |
|
| 92 | - * @date 2017-01-09 |
|
| 93 | - * @param string $method [description] |
|
| 94 | - * @param array $arguments [description] |
|
| 95 | - * @return [type] [description] |
|
| 96 | - */ |
|
| 97 | - public function call(string $method, array $arguments) { |
|
| 98 | - |
|
| 99 | - $xml = $this->buildXMLPayload($method, $arguments); |
|
| 100 | - |
|
| 101 | - self::$callId++; //Update the Call ID as they need to be unique per call |
|
| 102 | - |
|
| 103 | - return $xml; |
|
| 104 | - } |
|
| 105 | - /** |
|
| 106 | - * Deep Copy for SimpleXML |
|
| 107 | - * @method sxmlAppend |
|
| 108 | - * @author PA |
|
| 109 | - * @date 2017-01-09 |
|
| 110 | - * @param SimpleXMLElement $to |
|
| 111 | - * @param SimpleXMLElement $from |
|
| 112 | - */ |
|
| 113 | - private function sxmlAppend(\SimpleXMLElement $to, \SimpleXMLElement $from) { |
|
| 114 | - $toDom = dom_import_simplexml($to); |
|
| 115 | - $fromDom = dom_import_simplexml($from); |
|
| 116 | - $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
|
| 117 | - } |
|
| 48 | + $xml = new \SimpleXMLElement('<YourMembership></YourMembership>'); |
|
| 49 | + $xml->addChild('Version', self::$API_VERSION); |
|
| 50 | + $xml->addChild('ApiKey', $this->apiKey); |
|
| 51 | + $xml->addChild('CallID', self::$callID); |
|
| 52 | + $xml->addChild('SaPasscode', $this->saPasscode); |
|
| 53 | + |
|
| 54 | + return $xml; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Generates the XML for a API method call within |
|
| 59 | + * @method createCallPayload |
|
| 60 | + * @author PA |
|
| 61 | + * @date 2017-01-09 |
|
| 62 | + * @param string $method YourMembership API Function Name |
|
| 63 | + * @param array $arguments Array of Arguments to be passed as part of the YourMembership "Call" |
|
| 64 | + * @return \SimpleXMLElement |
|
| 65 | + */ |
|
| 66 | + public function createCallPayload(string $method, array $arguments) : \SimpleXMLElement |
|
| 67 | + { |
|
| 68 | + |
|
| 69 | + $call = new \SimpleXMLElement('<Call></Call>'); |
|
| 70 | + $call->addAttribute('method',$method); |
|
| 71 | + |
|
| 72 | + foreach ($arguments as $key => $value) { |
|
| 73 | + $call->addChild($key,$value); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + return $call; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + public function buildXMLPayload(string $method, array $arguments) : \SimpleXMLElement |
|
| 80 | + { |
|
| 81 | + $xml = $this->buildBasePayload(); |
|
| 82 | + $callPayload = $this->createCallPayload($method,$arguments); |
|
| 83 | + |
|
| 84 | + $this->sxmlAppend($xml,$callPayload); |
|
| 85 | + |
|
| 86 | + return $xml; |
|
| 87 | + } |
|
| 88 | + /** |
|
| 89 | + * Complete XML envelope |
|
| 90 | + * @method call |
|
| 91 | + * @author PA |
|
| 92 | + * @date 2017-01-09 |
|
| 93 | + * @param string $method [description] |
|
| 94 | + * @param array $arguments [description] |
|
| 95 | + * @return [type] [description] |
|
| 96 | + */ |
|
| 97 | + public function call(string $method, array $arguments) { |
|
| 98 | + |
|
| 99 | + $xml = $this->buildXMLPayload($method, $arguments); |
|
| 100 | + |
|
| 101 | + self::$callId++; //Update the Call ID as they need to be unique per call |
|
| 102 | + |
|
| 103 | + return $xml; |
|
| 104 | + } |
|
| 105 | + /** |
|
| 106 | + * Deep Copy for SimpleXML |
|
| 107 | + * @method sxmlAppend |
|
| 108 | + * @author PA |
|
| 109 | + * @date 2017-01-09 |
|
| 110 | + * @param SimpleXMLElement $to |
|
| 111 | + * @param SimpleXMLElement $from |
|
| 112 | + */ |
|
| 113 | + private function sxmlAppend(\SimpleXMLElement $to, \SimpleXMLElement $from) { |
|
| 114 | + $toDom = dom_import_simplexml($to); |
|
| 115 | + $fromDom = dom_import_simplexml($from); |
|
| 116 | + $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | 119 | }; |
@@ -94,7 +94,8 @@ discard block |
||
| 94 | 94 | * @param array $arguments [description] |
| 95 | 95 | * @return [type] [description] |
| 96 | 96 | */ |
| 97 | - public function call(string $method, array $arguments) { |
|
| 97 | + public function call(string $method, array $arguments) |
|
| 98 | + { |
|
| 98 | 99 | |
| 99 | 100 | $xml = $this->buildXMLPayload($method, $arguments); |
| 100 | 101 | |
@@ -110,7 +111,8 @@ discard block |
||
| 110 | 111 | * @param SimpleXMLElement $to |
| 111 | 112 | * @param SimpleXMLElement $from |
| 112 | 113 | */ |
| 113 | - private function sxmlAppend(\SimpleXMLElement $to, \SimpleXMLElement $from) { |
|
| 114 | + private function sxmlAppend(\SimpleXMLElement $to, \SimpleXMLElement $from) |
|
| 115 | + { |
|
| 114 | 116 | $toDom = dom_import_simplexml($to); |
| 115 | 117 | $fromDom = dom_import_simplexml($from); |
| 116 | 118 | $toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true)); |
@@ -4,41 +4,41 @@ |
||
| 4 | 4 | |
| 5 | 5 | class YourMembershipClient { |
| 6 | 6 | |
| 7 | - public static $API_VERSION = '1.62'; |
|
| 8 | - public static $BASE_URL = 'https://api.yourmembership.com'; |
|
| 9 | - |
|
| 10 | - /** |
|
| 11 | - * [$callID description] |
|
| 12 | - * @var [type] |
|
| 13 | - */ |
|
| 14 | - private $callID; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * [$sessionID description] |
|
| 18 | - * @var [type] |
|
| 19 | - */ |
|
| 20 | - private $sessionID; |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * [$apiKey description] |
|
| 24 | - * @var [type] |
|
| 25 | - */ |
|
| 26 | - private $apiKey; |
|
| 27 | - |
|
| 28 | - |
|
| 29 | - public function __construct() { |
|
| 30 | - |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Builds Base Request For YourMembership API |
|
| 35 | - * @method buildBaseRequest |
|
| 36 | - * @author PA |
|
| 37 | - * @date 2017-01-09 |
|
| 38 | - * @return [type] [description] |
|
| 39 | - */ |
|
| 40 | - private function buildBaseRequest() { |
|
| 41 | - |
|
| 42 | - } |
|
| 7 | + public static $API_VERSION = '1.62'; |
|
| 8 | + public static $BASE_URL = 'https://api.yourmembership.com'; |
|
| 9 | + |
|
| 10 | + /** |
|
| 11 | + * [$callID description] |
|
| 12 | + * @var [type] |
|
| 13 | + */ |
|
| 14 | + private $callID; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * [$sessionID description] |
|
| 18 | + * @var [type] |
|
| 19 | + */ |
|
| 20 | + private $sessionID; |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * [$apiKey description] |
|
| 24 | + * @var [type] |
|
| 25 | + */ |
|
| 26 | + private $apiKey; |
|
| 27 | + |
|
| 28 | + |
|
| 29 | + public function __construct() { |
|
| 30 | + |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Builds Base Request For YourMembership API |
|
| 35 | + * @method buildBaseRequest |
|
| 36 | + * @author PA |
|
| 37 | + * @date 2017-01-09 |
|
| 38 | + * @return [type] [description] |
|
| 39 | + */ |
|
| 40 | + private function buildBaseRequest() { |
|
| 41 | + |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | } |
@@ -2,7 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace P2A\YourMembership; |
| 4 | 4 | |
| 5 | -class YourMembershipClient { |
|
| 5 | +class YourMembershipClient |
|
| 6 | +{ |
|
| 6 | 7 | |
| 7 | 8 | public static $API_VERSION = '1.62'; |
| 8 | 9 | public static $BASE_URL = 'https://api.yourmembership.com'; |
@@ -26,7 +27,8 @@ discard block |
||
| 26 | 27 | private $apiKey; |
| 27 | 28 | |
| 28 | 29 | |
| 29 | - public function __construct() { |
|
| 30 | + public function __construct() |
|
| 31 | + { |
|
| 30 | 32 | |
| 31 | 33 | } |
| 32 | 34 | |
@@ -37,7 +39,8 @@ discard block |
||
| 37 | 39 | * @date 2017-01-09 |
| 38 | 40 | * @return [type] [description] |
| 39 | 41 | */ |
| 40 | - private function buildBaseRequest() { |
|
| 42 | + private function buildBaseRequest() |
|
| 43 | + { |
|
| 41 | 44 | |
| 42 | 45 | } |
| 43 | 46 | |