@@ -17,9 +17,9 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function setOption($name, $value) |
| 19 | 19 | { |
| 20 | - $methodName = 'set' . ucfirst($name); |
|
| 20 | + $methodName = 'set'.ucfirst($name); |
|
| 21 | 21 | if (!method_exists($this, $methodName)) { |
| 22 | - throw new RuntimeException('Method not exists: ' . $methodName); |
|
| 22 | + throw new RuntimeException('Method not exists: '.$methodName); |
|
| 23 | 23 | } |
| 24 | 24 | $this->$methodName($value); |
| 25 | 25 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $headers = [ |
| 43 | 43 | 'Content-Type: application/json', |
| 44 | 44 | 'Host: tts.eu-west-1.ivonacloud.com', |
| 45 | - 'User-Agent: ' . $this->getOptions()->getUserAgent() |
|
| 45 | + 'User-Agent: '.$this->getOptions()->getUserAgent() |
|
| 46 | 46 | ]; |
| 47 | 47 | |
| 48 | 48 | return array_merge( |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function createPayload() |
| 59 | 59 | { |
| 60 | - $payloadArray = (object)array(); |
|
| 60 | + $payloadArray = (object) array(); |
|
| 61 | 61 | $payloadArray->Input['Data'] = $this->getQueryText(); |
| 62 | 62 | $payloadArray->Input['Type'] = 'text/plain'; |
| 63 | 63 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function getServiceUrl() |
| 99 | 99 | { |
| 100 | - return $this->serviceUrl . '/' . self::SERVICE_TYPE_SPEECH; |
|
| 100 | + return $this->serviceUrl.'/'.self::SERVICE_TYPE_SPEECH; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $reflection = new \ReflectionObject($this); |
| 112 | 112 | $constants = $reflection->getConstants(); |
| 113 | 113 | if (!in_array($serviceType, $constants)) { |
| 114 | - throw new RuntimeException('Service type does not supports: ' . $serviceType); |
|
| 114 | + throw new RuntimeException('Service type does not supports: '.$serviceType); |
|
| 115 | 115 | } |
| 116 | 116 | return $serviceType; |
| 117 | 117 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | public function getHeader($serviceType) |
| 99 | 99 | { |
| 100 | 100 | return [ |
| 101 | - 'X-Amz-Date: ' . $this->currentTime, |
|
| 101 | + 'X-Amz-Date: '.$this->currentTime, |
|
| 102 | 102 | 'Authorization: AWS4-HMAC-SHA256 Credential=' |
| 103 | 103 | . $this->getCredential() |
| 104 | 104 | . ',SignedHeaders=host,Signature=' |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function getCredential() |
| 113 | 113 | { |
| 114 | - return $this->getAccessKey() . "/" . $this->currentDate . "/eu-west-1/tts/aws4_request"; |
|
| 114 | + return $this->getAccessKey()."/".$this->currentDate."/eu-west-1/tts/aws4_request"; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | protected function getCanonicalRequest($service, $payload = null) |
| 124 | 124 | { |
| 125 | 125 | $canonical = |
| 126 | - "POST" . |
|
| 127 | - "\n/$service" . |
|
| 128 | - "\n" . |
|
| 129 | - "\nhost:tts.eu-west-1.ivonacloud.com" . |
|
| 130 | - "\n" . |
|
| 131 | - "\nhost" . |
|
| 132 | - "\n" . hash("sha256", $payload); |
|
| 126 | + "POST". |
|
| 127 | + "\n/$service". |
|
| 128 | + "\n". |
|
| 129 | + "\nhost:tts.eu-west-1.ivonacloud.com". |
|
| 130 | + "\n". |
|
| 131 | + "\nhost". |
|
| 132 | + "\n".hash("sha256", $payload); |
|
| 133 | 133 | return $canonical; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | protected function getStringToSign($canonical) |
| 142 | 142 | { |
| 143 | - $stringToSign = "AWS4-HMAC-SHA256" . |
|
| 144 | - "\n$this->currentTime" . |
|
| 145 | - "\n$this->currentDate/eu-west-1/tts/aws4_request" . |
|
| 146 | - "\n" . hash("sha256", $canonical); |
|
| 143 | + $stringToSign = "AWS4-HMAC-SHA256". |
|
| 144 | + "\n$this->currentTime". |
|
| 145 | + "\n$this->currentDate/eu-west-1/tts/aws4_request". |
|
| 146 | + "\n".hash("sha256", $canonical); |
|
| 147 | 147 | |
| 148 | 148 | return $stringToSign; |
| 149 | 149 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | protected function getSignature($stringToSign) |
| 157 | 157 | { |
| 158 | - $dateKey = hash_hmac('sha256', $this->currentDate, "AWS4" . $this->getSecretKey(), true); |
|
| 158 | + $dateKey = hash_hmac('sha256', $this->currentDate, "AWS4".$this->getSecretKey(), true); |
|
| 159 | 159 | $dateRegionKey = hash_hmac('sha256', "eu-west-1", $dateKey, true); |
| 160 | 160 | $dateRegionServiceKey = hash_hmac('sha256', "tts", $dateRegionKey, true); |
| 161 | 161 | $signingKey = hash_hmac('sha256', "aws4_request", $dateRegionServiceKey, true); |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | $coverage = ($totalElements === 0) ? 0 : ($checkedElements / $totalElements) * 100; |
| 25 | 25 | |
| 26 | 26 | if ($coverage < $percentage) { |
| 27 | - echo 'Code coverage is ' . $coverage . '%, which is below the accepted ' . $percentage . '%' . PHP_EOL; |
|
| 27 | + echo 'Code coverage is '.$coverage.'%, which is below the accepted '.$percentage.'%'.PHP_EOL; |
|
| 28 | 28 | exit(1); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -echo 'Code coverage is ' . $coverage . '% - OK!' . PHP_EOL; |
|
| 31 | +echo 'Code coverage is '.$coverage.'% - OK!'.PHP_EOL; |
|
@@ -86,19 +86,19 @@ discard block |
||
| 86 | 86 | $encodedData = $this->authenticate->getPostData(); |
| 87 | 87 | |
| 88 | 88 | $canonical = |
| 89 | - "POST\n/" . Payload::SERVICE_TYPE_SPEECH . |
|
| 90 | - "\n\nhost:tts.eu-west-1.ivonacloud.com\n" . |
|
| 91 | - "\nhost\n" . hash("sha256", $encodedData); |
|
| 89 | + "POST\n/".Payload::SERVICE_TYPE_SPEECH. |
|
| 90 | + "\n\nhost:tts.eu-west-1.ivonacloud.com\n". |
|
| 91 | + "\nhost\n".hash("sha256", $encodedData); |
|
| 92 | 92 | |
| 93 | - $stringToSign = "AWS4-HMAC-SHA256" . |
|
| 94 | - "\n" . $currentTime->getValue($this->authenticate) . |
|
| 95 | - "\n" . $currentData->getValue($this->authenticate) . "/eu-west-1/tts/aws4_request" . |
|
| 96 | - "\n" . hash("sha256", $canonical); |
|
| 93 | + $stringToSign = "AWS4-HMAC-SHA256". |
|
| 94 | + "\n".$currentTime->getValue($this->authenticate). |
|
| 95 | + "\n".$currentData->getValue($this->authenticate)."/eu-west-1/tts/aws4_request". |
|
| 96 | + "\n".hash("sha256", $canonical); |
|
| 97 | 97 | |
| 98 | 98 | $dateKey = hash_hmac( |
| 99 | 99 | 'sha256', |
| 100 | 100 | $currentData->getValue($this->authenticate), |
| 101 | - "AWS4" . $this->authenticate->getSecretKey(), |
|
| 101 | + "AWS4".$this->authenticate->getSecretKey(), |
|
| 102 | 102 | true |
| 103 | 103 | ); |
| 104 | 104 | $dateRegionKey = hash_hmac('sha256', "eu-west-1", $dateKey, true); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | $credentialMethod = self::getMethod('getCredential'); |
| 110 | 110 | $expectHeader = [ |
| 111 | - 'X-Amz-Date: ' . $currentTime->getValue($this->authenticate), |
|
| 111 | + 'X-Amz-Date: '.$currentTime->getValue($this->authenticate), |
|
| 112 | 112 | 'Authorization: AWS4-HMAC-SHA256 Credential=' |
| 113 | 113 | . $credentialMethod->invoke($this->authenticate) |
| 114 | 114 | . ',SignedHeaders=host,Signature=' |