@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | * @return array |
| 148 | 148 | */ |
| 149 | 149 | public function post($ressourceName, $ressourcePath =null, $ressourceId = null, |
| 150 | - $bodyData = array(), $query = array(), $assoc = false, |
|
| 151 | - $contentType = 'json') |
|
| 150 | + $bodyData = array(), $query = array(), $assoc = false, |
|
| 151 | + $contentType = 'json') |
|
| 152 | 152 | { |
| 153 | 153 | if ($contentType !== 'json') { |
| 154 | 154 | throw new \Exception('Use only json to update or create'); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | * @return array |
| 180 | 180 | */ |
| 181 | 181 | public function put($ressourceName, $ressourcePath =null, $ressourceId = null, |
| 182 | - $bodyData = array(), $query = array(), $assoc = false, |
|
| 183 | - $contentType = 'json') |
|
| 182 | + $bodyData = array(), $query = array(), $assoc = false, |
|
| 183 | + $contentType = 'json') |
|
| 184 | 184 | { |
| 185 | 185 | if ($contentType !== 'json') { |
| 186 | 186 | throw new \Exception('Use only json to update or create'); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return array |
| 210 | 210 | */ |
| 211 | 211 | public function delete($ressourceName, $ressourcePath =null, $ressourceId = null, $assoc = false, |
| 212 | - $contentType = 'json') |
|
| 212 | + $contentType = 'json') |
|
| 213 | 213 | { |
| 214 | 214 | try { |
| 215 | 215 | $urlRessource = $this->builPathToCall($ressourceName, $ressourcePath, $ressourceId); |
@@ -108,20 +108,20 @@ discard block |
||
| 108 | 108 | * @param string $ressourceId |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - private function builPathToCall($ressourceName,$ressourcePath =null, $ressourceId = null) |
|
| 111 | + private function builPathToCall($ressourceName, $ressourcePath = null, $ressourceId = null) |
|
| 112 | 112 | { |
| 113 | 113 | $ressourceAdded = ''; |
| 114 | - if(!is_null($ressourcePath) && $ressourcePath != ''){ |
|
| 114 | + if (!is_null($ressourcePath) && $ressourcePath != '') { |
|
| 115 | 115 | $ressourceAdded = $ressourcePath; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if ($ressourceId !== null) { |
| 119 | 119 | $ressourceAdded = '/'.$ressourceId; |
| 120 | 120 | } |
| 121 | - if(!is_null($ressourcePath)){ |
|
| 121 | + if (!is_null($ressourcePath)) { |
|
| 122 | 122 | $this->builPath = 'accounts/'.$this->getAccountCode().$ressourceAdded; |
| 123 | 123 | return $this->builPath; |
| 124 | - }else{ |
|
| 124 | + }else { |
|
| 125 | 125 | $this->builPath = $ressourceName.'/'.$this->getAccountCode().$ressourceAdded; |
| 126 | 126 | return $this->builPath; |
| 127 | 127 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param string $contentType |
| 139 | 139 | * @return array |
| 140 | 140 | */ |
| 141 | - public function get($ressourceName, $ressourcePath =null, $ressourceId = null, $query = array(), |
|
| 141 | + public function get($ressourceName, $ressourcePath = null, $ressourceId = null, $query = array(), |
|
| 142 | 142 | $assoc = false, $contentType = 'json') |
| 143 | 143 | { |
| 144 | 144 | try { |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param string $contentType |
| 168 | 168 | * @return array |
| 169 | 169 | */ |
| 170 | - public function post($ressourceName, $ressourcePath =null, $ressourceId = null, |
|
| 170 | + public function post($ressourceName, $ressourcePath = null, $ressourceId = null, |
|
| 171 | 171 | $bodyData = array(), $query = array(), $assoc = false, |
| 172 | 172 | $contentType = 'json') |
| 173 | 173 | { |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @param string $contentType |
| 202 | 202 | * @return array |
| 203 | 203 | */ |
| 204 | - public function put($ressourceName, $ressourcePath =null, $ressourceId = null, |
|
| 204 | + public function put($ressourceName, $ressourcePath = null, $ressourceId = null, |
|
| 205 | 205 | $bodyData = array(), $query = array(), $assoc = false, |
| 206 | 206 | $contentType = 'json') |
| 207 | 207 | { |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @param string $contentType |
| 234 | 234 | * @return array |
| 235 | 235 | */ |
| 236 | - public function delete($ressourceName, $ressourcePath =null, $ressourceId = null, $assoc = false, |
|
| 236 | + public function delete($ressourceName, $ressourcePath = null, $ressourceId = null, $assoc = false, |
|
| 237 | 237 | $contentType = 'json') |
| 238 | 238 | { |
| 239 | 239 | try { |
@@ -45,59 +45,59 @@ |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * Send a "GET" request to get information about ressource; |
|
| 49 | - * @param string $ressourceName |
|
| 50 | - * @param string $ressourcePath |
|
| 51 | - * @param string $ressourceId |
|
| 52 | - * @param array $params |
|
| 53 | - * @param boolean $assoc |
|
| 54 | - * @param string $contentType |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 48 | + * Send a "GET" request to get information about ressource; |
|
| 49 | + * @param string $ressourceName |
|
| 50 | + * @param string $ressourcePath |
|
| 51 | + * @param string $ressourceId |
|
| 52 | + * @param array $params |
|
| 53 | + * @param boolean $assoc |
|
| 54 | + * @param string $contentType |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 57 | 57 | public function get($ressourceName, $ressourcePath =null, $ressourceId=null, $params = array(),$assoc = false,$contentType='json'){ |
| 58 | 58 | return $this->getCertainClient()->get($ressourceName, $ressourcePath, $ressourceId, $params, $assoc,$contentType); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * Send a "POST" request to put information to certain; |
|
| 63 | - * @param string $ressourceName |
|
| 64 | - * @param string $ressourcePath |
|
| 65 | - * @param string $ressourceId |
|
| 66 | - * @param array $bodyData |
|
| 67 | - * @param array $query |
|
| 68 | - * @param boolean $assoc |
|
| 69 | - * @param string $contentType |
|
| 70 | - * @return array |
|
| 71 | - */ |
|
| 62 | + * Send a "POST" request to put information to certain; |
|
| 63 | + * @param string $ressourceName |
|
| 64 | + * @param string $ressourcePath |
|
| 65 | + * @param string $ressourceId |
|
| 66 | + * @param array $bodyData |
|
| 67 | + * @param array $query |
|
| 68 | + * @param boolean $assoc |
|
| 69 | + * @param string $contentType |
|
| 70 | + * @return array |
|
| 71 | + */ |
|
| 72 | 72 | public function post($ressourceName, $ressourcePath =null, $ressourceId=null, $bodyData = array(),$query=array(), $assoc = false,$contentType='json'){ |
| 73 | 73 | return $this->getCertainClient()->post($ressourceName, $ressourcePath, $ressourceId, $bodyData, $query, $assoc,$contentType); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * Send a "PUT" request to put information to certain; |
|
| 79 | - * @param string $ressourceName |
|
| 80 | - * @param string $ressourcePath |
|
| 81 | - * @param string $ressourceId |
|
| 82 | - * @param array $bodyData |
|
| 83 | - * @param array $query |
|
| 84 | - * @param boolean $assoc |
|
| 85 | - * @param string $contentType |
|
| 86 | - * @return array |
|
| 87 | - */ |
|
| 78 | + * Send a "PUT" request to put information to certain; |
|
| 79 | + * @param string $ressourceName |
|
| 80 | + * @param string $ressourcePath |
|
| 81 | + * @param string $ressourceId |
|
| 82 | + * @param array $bodyData |
|
| 83 | + * @param array $query |
|
| 84 | + * @param boolean $assoc |
|
| 85 | + * @param string $contentType |
|
| 86 | + * @return array |
|
| 87 | + */ |
|
| 88 | 88 | public function put($ressourceName, $ressourcePath =null, $ressourceId=null, $bodyData = array(),$query=array(), $assoc = false,$contentType='json'){ |
| 89 | 89 | return $this->getCertainClient()->put($ressourceName, $ressourcePath, $ressourceId, $bodyData, $query, $assoc,$contentType); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * Send a "DELETE" request to delete information from certain; |
|
| 94 | - * @param string $ressourceName |
|
| 95 | - * @param string $ressourcePath |
|
| 96 | - * @param string $ressourceId |
|
| 97 | - * @param boolean $assoc |
|
| 98 | - * @param string $contentType |
|
| 99 | - * @return array |
|
| 100 | - */ |
|
| 93 | + * Send a "DELETE" request to delete information from certain; |
|
| 94 | + * @param string $ressourceName |
|
| 95 | + * @param string $ressourcePath |
|
| 96 | + * @param string $ressourceId |
|
| 97 | + * @param boolean $assoc |
|
| 98 | + * @param string $contentType |
|
| 99 | + * @return array |
|
| 100 | + */ |
|
| 101 | 101 | public function delete($ressourceName, $ressourcePath =null, $ressourceId=null, $assoc = false,$contentType='json'){ |
| 102 | 102 | return $this->getCertainClient()->delete($ressourceName, $ressourcePath, $ressourceId, $assoc,$contentType); |
| 103 | 103 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | /** |
| 6 | 6 | * CertainApiService |
| 7 | 7 | */ |
| 8 | -class CertainApiService{ |
|
| 8 | +class CertainApiService { |
|
| 9 | 9 | /** |
| 10 | 10 | * An instance of the CertainApiClient |
| 11 | 11 | * @var CertainApiClient |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * Get the certain api client |
| 41 | 41 | * @return CertainApiClient |
| 42 | 42 | */ |
| 43 | - public function getCertainClient(){ |
|
| 43 | + public function getCertainClient() { |
|
| 44 | 44 | return $this->certainClient; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | * @param string $contentType |
| 55 | 55 | * @return array |
| 56 | 56 | */ |
| 57 | - public function get($ressourceName, $ressourcePath =null, $ressourceId=null, $params = array(),$assoc = false,$contentType='json'){ |
|
| 58 | - return $this->getCertainClient()->get($ressourceName, $ressourcePath, $ressourceId, $params, $assoc,$contentType); |
|
| 57 | + public function get($ressourceName, $ressourcePath = null, $ressourceId = null, $params = array(), $assoc = false, $contentType = 'json') { |
|
| 58 | + return $this->getCertainClient()->get($ressourceName, $ressourcePath, $ressourceId, $params, $assoc, $contentType); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | * @param string $contentType |
| 70 | 70 | * @return array |
| 71 | 71 | */ |
| 72 | - public function post($ressourceName, $ressourcePath =null, $ressourceId=null, $bodyData = array(),$query=array(), $assoc = false,$contentType='json'){ |
|
| 73 | - return $this->getCertainClient()->post($ressourceName, $ressourcePath, $ressourceId, $bodyData, $query, $assoc,$contentType); |
|
| 72 | + public function post($ressourceName, $ressourcePath = null, $ressourceId = null, $bodyData = array(), $query = array(), $assoc = false, $contentType = 'json') { |
|
| 73 | + return $this->getCertainClient()->post($ressourceName, $ressourcePath, $ressourceId, $bodyData, $query, $assoc, $contentType); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * @param string $contentType |
| 86 | 86 | * @return array |
| 87 | 87 | */ |
| 88 | - public function put($ressourceName, $ressourcePath =null, $ressourceId=null, $bodyData = array(),$query=array(), $assoc = false,$contentType='json'){ |
|
| 89 | - return $this->getCertainClient()->put($ressourceName, $ressourcePath, $ressourceId, $bodyData, $query, $assoc,$contentType); |
|
| 88 | + public function put($ressourceName, $ressourcePath = null, $ressourceId = null, $bodyData = array(), $query = array(), $assoc = false, $contentType = 'json') { |
|
| 89 | + return $this->getCertainClient()->put($ressourceName, $ressourcePath, $ressourceId, $bodyData, $query, $assoc, $contentType); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | * @param string $contentType |
| 99 | 99 | * @return array |
| 100 | 100 | */ |
| 101 | - public function delete($ressourceName, $ressourcePath =null, $ressourceId=null, $assoc = false,$contentType='json'){ |
|
| 102 | - return $this->getCertainClient()->delete($ressourceName, $ressourcePath, $ressourceId, $assoc,$contentType); |
|
| 101 | + public function delete($ressourceName, $ressourcePath = null, $ressourceId = null, $assoc = false, $contentType = 'json') { |
|
| 102 | + return $this->getCertainClient()->delete($ressourceName, $ressourcePath, $ressourceId, $assoc, $contentType); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | class ProfileCertain extends CertainRessourceAbstract implements CertainRessourceInterface |
| 13 | 13 | { |
| 14 | - public function getRessourceName(){ |
|
| 14 | + public function getRessourceName() { |
|
| 15 | 15 | return 'Profile'; |
| 16 | 16 | } |
| 17 | 17 | public function getMandatoryFields() |
@@ -27,18 +27,18 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function getProfileByEmail($email) |
| 29 | 29 | { |
| 30 | - $resultCertain = $this->getProfileCertainReturnByEmail($email); |
|
| 31 | - if($resultCertain->isSuccessFul()){ |
|
| 30 | + $resultCertain = $this->getProfileCertainReturnByEmail($email); |
|
| 31 | + if ($resultCertain->isSuccessFul()) { |
|
| 32 | 32 | $resultCertainProfile = $resultCertain->getResults(); |
| 33 | - if($resultCertainProfile->size == 1){ |
|
| 33 | + if ($resultCertainProfile->size == 1) { |
|
| 34 | 34 | return $resultCertainProfile->profiles[0]; |
| 35 | 35 | |
| 36 | - } elseif($resultCertainProfile->size > 1){ |
|
| 36 | + } elseif ($resultCertainProfile->size>1) { |
|
| 37 | 37 | throw new RessourceException('Duplicate entries'); |
| 38 | - } else{ |
|
| 38 | + }else { |
|
| 39 | 39 | return $resultCertain; |
| 40 | 40 | } |
| 41 | - } else{ |
|
| 41 | + }else { |
|
| 42 | 42 | return null; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function getProfiles($params = []) |
| 64 | 64 | { |
| 65 | - $request= $this->get(null,$params); |
|
| 66 | - if($request->isSuccessFul()){ |
|
| 65 | + $request = $this->get(null, $params); |
|
| 66 | + if ($request->isSuccessFul()) { |
|
| 67 | 67 | $profileCertainResults = $request->getResults(); |
| 68 | 68 | return $profileCertainResults->profiles; |
| 69 | 69 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | class RegistrationCertain extends CertainRessourceAbstract implements CertainRessourceInterface |
| 13 | 13 | { |
| 14 | - public function getRessourceName(){ |
|
| 14 | + public function getRessourceName() { |
|
| 15 | 15 | return 'Registration'; |
| 16 | 16 | } |
| 17 | 17 | public function getMandatoryFields() |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function getRegistrations($params = []) |
| 27 | 27 | { |
| 28 | - $request= $this->get(null,$params); |
|
| 29 | - if($request->isSuccessFul()){ |
|
| 28 | + $request = $this->get(null, $params); |
|
| 29 | + if ($request->isSuccessFul()) { |
|
| 30 | 30 | $registrationCertainResults = $request->getResults(); |
| 31 | 31 | return $registrationCertainResults->registrations; |
| 32 | 32 | } |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | * Return with all the result from certain. |
| 38 | 38 | * @return RegistrationCertain[] |
| 39 | 39 | */ |
| 40 | - public function getRegistrationsByEventCode($eventCode,$params = []) |
|
| 40 | + public function getRegistrationsByEventCode($eventCode, $params = []) |
|
| 41 | 41 | { |
| 42 | - $request= $this->get($eventCode,$params); |
|
| 43 | - if($request->isSuccessFul()){ |
|
| 42 | + $request = $this->get($eventCode, $params); |
|
| 43 | + if ($request->isSuccessFul()) { |
|
| 44 | 44 | $registrationCertainResults = $request->getResults(); |
| 45 | 45 | return $registrationCertainResults->registrations; |
| 46 | 46 | } |
@@ -55,27 +55,27 @@ discard block |
||
| 55 | 55 | * @param string $orderBySecure in order to get the first registration when we have duplciates |
| 56 | 56 | * @return registrationCode|null|boolean|[registrationCode=> "",attendeeTypeCode=>""] |
| 57 | 57 | */ |
| 58 | - public function hasRegistrationsByEventCodeAndEmail($eventCode,$email,$returnRegCode= true,$withAttenteeType=true,$orderBySecure='dateModified_asc') |
|
| 58 | + public function hasRegistrationsByEventCodeAndEmail($eventCode, $email, $returnRegCode = true, $withAttenteeType = true, $orderBySecure = 'dateModified_asc') |
|
| 59 | 59 | { |
| 60 | - $request= $this->get($eventCode,[ |
|
| 60 | + $request = $this->get($eventCode, [ |
|
| 61 | 61 | 'email'=> $email, |
| 62 | 62 | 'orderBy'=> $orderBySecure |
| 63 | 63 | |
| 64 | 64 | ]); |
| 65 | - if($request->isSuccessFul()){ |
|
| 65 | + if ($request->isSuccessFul()) { |
|
| 66 | 66 | $registrationCertainResults = $request->getResults(); |
| 67 | - if($registrationCertainResults->size > 0 && $returnRegCode && $withAttenteeType){ |
|
| 67 | + if ($registrationCertainResults->size>0 && $returnRegCode && $withAttenteeType) { |
|
| 68 | 68 | return [ |
| 69 | 69 | 'registrationCode' => $registrationCertainResults->registrations[0]->registrationCode, |
| 70 | - 'attendeeTypeCode' => (isset($registrationCertainResults->registrations[0]->attendeeTypeCode))?$registrationCertainResults->registrations[0]->attendeeTypeCode:'', |
|
| 70 | + 'attendeeTypeCode' => (isset($registrationCertainResults->registrations[0]->attendeeTypeCode)) ? $registrationCertainResults->registrations[0]->attendeeTypeCode : '', |
|
| 71 | 71 | ]; |
| 72 | 72 | } |
| 73 | - elseif($registrationCertainResults->size > 0 && $returnRegCode){ |
|
| 73 | + elseif ($registrationCertainResults->size>0 && $returnRegCode) { |
|
| 74 | 74 | return $registrationCertainResults->registrations[0]->registrationCode; |
| 75 | - } elseif($registrationCertainResults->size > 0 && !$returnRegCode){ |
|
| 75 | + } elseif ($registrationCertainResults->size>0 && !$returnRegCode) { |
|
| 76 | 76 | return true; |
| 77 | 77 | } |
| 78 | - } elseif($request->isNotFound()){ |
|
| 78 | + } elseif ($request->isNotFound()) { |
|
| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | 81 | return null; |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | * @param string $regCode |
| 88 | 88 | * @return RegistrationObj |
| 89 | 89 | */ |
| 90 | - public function getRegistrationByEventCodeAnRegCode($eventCode,$regCode) |
|
| 90 | + public function getRegistrationByEventCodeAnRegCode($eventCode, $regCode) |
|
| 91 | 91 | { |
| 92 | - $request= $this->get($eventCode.'/'.$regCode); |
|
| 93 | - if($request->isSuccessFul()){ |
|
| 94 | - $registrationCertainResult= $request->getResults(); |
|
| 92 | + $request = $this->get($eventCode.'/'.$regCode); |
|
| 93 | + if ($request->isSuccessFul()) { |
|
| 94 | + $registrationCertainResult = $request->getResults(); |
|
| 95 | 95 | return $registrationCertainResult; |
| 96 | 96 | } |
| 97 | 97 | return null; |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | * @param string $regCode |
| 104 | 104 | * @return RegistrationObj |
| 105 | 105 | */ |
| 106 | - public function updateRegistrationByEventCodeAnRegCode($eventCode,$regCode,$data=[]) |
|
| 106 | + public function updateRegistrationByEventCodeAnRegCode($eventCode, $regCode, $data = []) |
|
| 107 | 107 | { |
| 108 | - $request= $this->post($data,[],$eventCode.'/'.$regCode); |
|
| 109 | - if($request->isSuccessFul()){ |
|
| 110 | - $registrationCertainResult= $request->getResults(); |
|
| 108 | + $request = $this->post($data, [], $eventCode.'/'.$regCode); |
|
| 109 | + if ($request->isSuccessFul()) { |
|
| 110 | + $registrationCertainResult = $request->getResults(); |
|
| 111 | 111 | return $registrationCertainResult; |
| 112 | 112 | } |
| 113 | 113 | return null; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @throws Exceptions\RessourceMandatoryFieldException |
| 76 | 76 | */ |
| 77 | 77 | public function post($bodyData, $query = array(), $ressourceId = null, |
| 78 | - $assoc = false, $contentType = 'json') |
|
| 78 | + $assoc = false, $contentType = 'json') |
|
| 79 | 79 | { |
| 80 | 80 | $ressourceName = $this->getRessourceName(); |
| 81 | 81 | ; |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @return \Wabel\CertainAPI\CertainRessourceAbstract |
| 225 | 225 | */ |
| 226 | 226 | public function getWithEventCode($eventCode, $ressourceId, $params = array(), |
| 227 | - $assoc = false, $contentType = 'json') |
|
| 227 | + $assoc = false, $contentType = 'json') |
|
| 228 | 228 | { |
| 229 | 229 | $ressourceId = $eventCode.'/'.$ressourceId; |
| 230 | 230 | return $this->get($ressourceId, $params, $assoc, $contentType); |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | * @return \Wabel\CertainAPI\CertainRessourceAbstract |
| 242 | 242 | */ |
| 243 | 243 | public function postWithEventCode($eventCode, $ressourceId, $bodyData, |
| 244 | - $query = array(), $assoc = false, |
|
| 245 | - $contentType = 'json') |
|
| 244 | + $query = array(), $assoc = false, |
|
| 245 | + $contentType = 'json') |
|
| 246 | 246 | { |
| 247 | 247 | $ressourceId = $eventCode.'/'.$ressourceId; |
| 248 | 248 | return $this->post($bodyData, $query, $ressourceId, $assoc, $contentType); |
@@ -259,8 +259,8 @@ discard block |
||
| 259 | 259 | * @return \Wabel\CertainAPI\CertainRessourceAbstract |
| 260 | 260 | */ |
| 261 | 261 | public function putWithEventCode($eventCode, $ressourceId, $bodyData, |
| 262 | - $query = array(), $assoc = false, |
|
| 263 | - $contentType = 'json') |
|
| 262 | + $query = array(), $assoc = false, |
|
| 263 | + $contentType = 'json') |
|
| 264 | 264 | { |
| 265 | 265 | $ressourceId = $eventCode.'/'.$ressourceId; |
| 266 | 266 | return $this->put($bodyData, $query, $ressourceId, $assoc, $contentType); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | if ($ressourceName == '' || is_null($ressourceName)) { |
| 83 | 83 | throw new Exceptions\RessourceException('No ressource name provided.'); |
| 84 | 84 | } |
| 85 | - if ($ressourceId === null && count($this->getMandatoryFields()) > 0) { |
|
| 85 | + if ($ressourceId === null && count($this->getMandatoryFields())>0) { |
|
| 86 | 86 | foreach ($this->getMandatoryFields() as $field) { |
| 87 | 87 | if (!in_array($field, array_keys($bodyData))) { |
| 88 | 88 | throw new Exceptions\RessourceMandatoryFieldException(sprintf('The field %s is required', |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | if ($ressourceName == '' || is_null($ressourceName)) { |
| 116 | 116 | throw new Exceptions\RessourceException('No ressource name provided.'); |
| 117 | 117 | } |
| 118 | - if (!is_null($ressourceId) && count($this->getMandatoryFields()) > 0) { |
|
| 118 | + if (!is_null($ressourceId) && count($this->getMandatoryFields())>0) { |
|
| 119 | 119 | foreach ($this->getMandatoryFields() as $field) { |
| 120 | 120 | if (!in_array($field, array_keys($bodyData))) { |
| 121 | 121 | throw new Exceptions\RessourceMandatoryFieldException(sprintf('The field %s is required', |
| 122 | 122 | $field)); |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | - } else { |
|
| 125 | + }else { |
|
| 126 | 126 | throw new Exceptions\RessourceMandatoryFieldException(sprintf('The id field is required')); |
| 127 | 127 | } |
| 128 | 128 | $this->results = $this->certainApiService->put($ressourceName, |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | foreach ($ressourceCalledParameters as $segmentKey => $segmentValue) { |
| 206 | 206 | if ($segmentValue != '') { |
| 207 | 207 | $this->ressourceCalled .= '/'.$segmentKey.'/'.$segmentValue; |
| 208 | - } else { |
|
| 208 | + }else { |
|
| 209 | 209 | $this->ressourceCalled .= '/'.$segmentKey; |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -61,9 +61,9 @@ |
||
| 61 | 61 | $bodyString = $streamBody->getContents(); |
| 62 | 62 | |
| 63 | 63 | if($contentType === 'json'){ |
| 64 | - $response['results'] = $this->jsonp_decode($bodyString, $assoc); |
|
| 64 | + $response['results'] = $this->jsonp_decode($bodyString, $assoc); |
|
| 65 | 65 | }else{ |
| 66 | - $response['results']=$bodyString; |
|
| 66 | + $response['results']=$bodyString; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $response['success'] = true; |
@@ -48,22 +48,22 @@ |
||
| 48 | 48 | * @param boolean $assoc |
| 49 | 49 | * @return array |
| 50 | 50 | */ |
| 51 | - public function getResponse($contentType='json',$assoc = false) |
|
| 51 | + public function getResponse($contentType = 'json', $assoc = false) |
|
| 52 | 52 | { |
| 53 | 53 | $response = array( |
| 54 | - 'statusCode' => $this->response?$this->response->getStatusCode():null, |
|
| 54 | + 'statusCode' => $this->response ? $this->response->getStatusCode() : null, |
|
| 55 | 55 | 'success' => false, |
| 56 | 56 | 'results' => null, |
| 57 | - 'message' => $this->response?$this->response->getReasonPhrase():null |
|
| 57 | + 'message' => $this->response ? $this->response->getReasonPhrase() : null |
|
| 58 | 58 | ); |
| 59 | 59 | if ($this->response && in_array($this->response->getStatusCode(), array(200, 201))) { |
| 60 | 60 | $streamBody = $this->response->getBody(); |
| 61 | 61 | $bodyString = $streamBody->getContents(); |
| 62 | 62 | |
| 63 | - if($contentType === 'json'){ |
|
| 63 | + if ($contentType === 'json') { |
|
| 64 | 64 | $response['results'] = $this->jsonp_decode($bodyString, $assoc); |
| 65 | - }else{ |
|
| 66 | - $response['results']=$bodyString; |
|
| 65 | + }else { |
|
| 66 | + $response['results'] = $bodyString; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $response['success'] = true; |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class AppointmentsCertain extends CertainRessourceAbstract implements CertainRessourceInterface |
| 13 | 13 | { |
| 14 | - public function getRessourceName(){ |
|
| 14 | + public function getRessourceName() { |
|
| 15 | 15 | return 'Appointments'; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -11,16 +11,16 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class AppointmentsPreferencesCertain extends CertainRessourceAbstract implements CertainRessourceInterface |
| 13 | 13 | { |
| 14 | - public function getRessourceName(){ |
|
| 14 | + public function getRessourceName() { |
|
| 15 | 15 | return 'AppointmentsPreferences'; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function getMandatoryFields() |
| 19 | 19 | { |
| 20 | - return array('attendeeTypeCode','regCode','rank','blacklist'); |
|
| 20 | + return array('attendeeTypeCode', 'regCode', 'rank', 'blacklist'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setRessourceCalled($eventCode,$regCode){ |
|
| 23 | + public function setRessourceCalled($eventCode, $regCode) { |
|
| 24 | 24 | return $this->createRessourceCalled([ |
| 25 | 25 | 'events' => $eventCode, |
| 26 | 26 | 'registration' => $regCode, |
@@ -29,22 +29,22 @@ discard block |
||
| 29 | 29 | * @param array $elements |
| 30 | 30 | * @return void |
| 31 | 31 | */ |
| 32 | - public function run($eventCode,array $elements) |
|
| 32 | + public function run($eventCode, array $elements) |
|
| 33 | 33 | { |
| 34 | - if(isset($elements['updated'])){ |
|
| 35 | - foreach ($elements['updated'] as $element){ |
|
| 36 | - if(!is_array($element)){ |
|
| 34 | + if (isset($elements['updated'])) { |
|
| 35 | + foreach ($elements['updated'] as $element) { |
|
| 36 | + if (!is_array($element)) { |
|
| 37 | 37 | $element = [$element]; |
| 38 | 38 | } |
| 39 | - $this->updateUpdateListFile($eventCode,$element); |
|
| 39 | + $this->updateUpdateListFile($eventCode, $element); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | - if(isset($elements['deleted'])){ |
|
| 43 | - foreach ($elements['deleted'] as $element){ |
|
| 44 | - if(!is_array($element)){ |
|
| 42 | + if (isset($elements['deleted'])) { |
|
| 43 | + foreach ($elements['deleted'] as $element) { |
|
| 44 | + if (!is_array($element)) { |
|
| 45 | 45 | $element = [$element]; |
| 46 | 46 | } |
| 47 | - $this->updateDeleteListFile($eventCode,$element); |
|
| 47 | + $this->updateDeleteListFile($eventCode, $element); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | * @param array $element |
| 56 | 56 | * @return void |
| 57 | 57 | */ |
| 58 | - private function updateFile($filePath,array $element){ |
|
| 58 | + private function updateFile($filePath, array $element) { |
|
| 59 | 59 | $content = FileChangesHelper::getJsonContentFromFile($filePath); |
| 60 | 60 | $content[] = $element; |
| 61 | - FileChangesHelper::writeFile($filePath,json_encode($content)); |
|
| 61 | + FileChangesHelper::writeFile($filePath, json_encode($content)); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | * @param array $element |
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | - private function updateUpdateListFile($eventCode,array $element){ |
|
| 69 | + private function updateUpdateListFile($eventCode, array $element) { |
|
| 70 | 70 | FileChangesHelper::createDirectory($this->dirPathChangings); |
| 71 | 71 | $fileName = 'update_'.$eventCode.'.json'; |
| 72 | - $this->updateFile($this->dirPathChangings.'/'.$fileName,$element); |
|
| 72 | + $this->updateFile($this->dirPathChangings.'/'.$fileName, $element); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | * @param array $element |
| 78 | 78 | * @return void |
| 79 | 79 | */ |
| 80 | - private function updateDeleteListFile($eventCode,array $element){ |
|
| 80 | + private function updateDeleteListFile($eventCode, array $element) { |
|
| 81 | 81 | FileChangesHelper::createDirectory($this->dirPathChangings); |
| 82 | 82 | $fileName = 'delete_'.$eventCode.'.json'; |
| 83 | - $this->updateFile($this->dirPathChangings.'/'.$fileName,$element); |
|
| 83 | + $this->updateFile($this->dirPathChangings.'/'.$fileName, $element); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |