@@ -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 | } |
@@ -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=' |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $headers = [ |
39 | 39 | 'Content-Type: application/json', |
40 | 40 | 'Host: tts.eu-west-1.ivonacloud.com', |
41 | - 'User-Agent: ' . $this->getOptions()->getUserAgent() |
|
41 | + 'User-Agent: '.$this->getOptions()->getUserAgent() |
|
42 | 42 | ]; |
43 | 43 | |
44 | 44 | return array_merge( |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function createPayload() |
55 | 55 | { |
56 | - $payloadArray = (object)array(); |
|
56 | + $payloadArray = (object) array(); |
|
57 | 57 | $payloadArray->Input['Data'] = $this->getQueryText(); |
58 | 58 | $payloadArray->Input['Type'] = 'text/plain'; |
59 | 59 | |
60 | 60 | $payloadArray->OutputFormat['Codec'] = $this->getOptions()->getOutputFormatCodec(); |
61 | - $payloadArray->OutputFormat['SampleRate'] = (int)$this->getOptions()->getOutputSampleRate(); |
|
61 | + $payloadArray->OutputFormat['SampleRate'] = (int) $this->getOptions()->getOutputSampleRate(); |
|
62 | 62 | $payloadArray->Voice['Language'] = $this->getOptions()->getLanguage(); |
63 | 63 | $payloadArray->Voice['Name'] = $this->getOptions()->getVoice(); |
64 | 64 | $payloadArray->Parameters['Rate'] = $this->getOptions()->getParametersRate(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getServiceUrl() |
95 | 95 | { |
96 | - return $this->serviceUrl . '/' . self::SERVICE_TYPE_SPEECH; |
|
96 | + return $this->serviceUrl.'/'.self::SERVICE_TYPE_SPEECH; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $reflection = new \ReflectionObject($this); |
108 | 108 | $constants = $reflection->getConstants(); |
109 | 109 | if (!in_array($serviceType, $constants)) { |
110 | - throw new RuntimeException('The type of service does not support: ' . $serviceType); |
|
110 | + throw new RuntimeException('The type of service does not support: '.$serviceType); |
|
111 | 111 | } |
112 | 112 | return $serviceType; |
113 | 113 | } |