Completed
Push — master ( c7d7d2...b9efc1 )
by Vadim
02:49
created
src/Adapter/Ivona/Authenticate.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 
20 20
     /**
21 21
      * Constructor
22
-     * @param $secretKey
23
-     * @param $accessKey
22
+     * @param string $secretKey
23
+     * @param string $accessKey
24 24
      */
25 25
     public function __construct($secretKey, $accessKey)
26 26
     {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     /**
83 83
      * Set post data
84
-     * @param array $postData
84
+     * @param string $postData
85 85
      * @return $this
86 86
      */
87 87
     public function setPostData($postData)
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     /**
94 94
      * Get authorization headers
95 95
      * @param string $serviceType
96
-     * @return array
96
+     * @return string[]
97 97
      */
98 98
     public function getHeader($serviceType)
99 99
     {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
     /**
137 137
      * Get string to sign
138
-     * @param $canonical
138
+     * @param string $canonical
139 139
      * @return string
140 140
      */
141 141
     protected function getStringToSign($canonical)
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
     /**
168 168
      * Create signature
169
-     * @param $requestType
169
+     * @param string $requestType
170 170
      * @return string
171 171
      */
172 172
     protected function createSignature($requestType)
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
build/coverage-checker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
tests/AudioManager/Adapter/Ivona/AuthenticateTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -86,19 +86,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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='
Please login to merge, or discard this patch.
src/Adapter/Ivona/Payload.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 
46 46
     /**
47 47
      * Get service headers
48
-     * @return array
48
+     * @return string[]
49 49
      */
50 50
     public function getHeaders()
51 51
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Adapter/Options/AbstractOptions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@
 block discarded – undo
18 18
      */
19 19
     public function setOption($name, $value)
20 20
     {
21
-        $methodName = 'set' . ucfirst($name);
21
+        $methodName = 'set'.ucfirst($name);
22 22
         if (!method_exists($this, $methodName)) {
23
-            throw new RuntimeException('Method not exists: ' . $methodName);
23
+            throw new RuntimeException('Method not exists: '.$methodName);
24 24
         }
25 25
         return $this->$methodName($value);
26 26
     }
Please login to merge, or discard this patch.
src/Adapter/Options/Polly.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function getOutputFormat()
49 49
     {
50
-        return (string)$this->outputFormat;
50
+        return (string) $this->outputFormat;
51 51
     }
52 52
 
53 53
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getLexiconNames()
67 67
     {
68
-        return (array)$this->lexiconNames;
68
+        return (array) $this->lexiconNames;
69 69
     }
70 70
 
71 71
     /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function getSampleRate()
85 85
     {
86
-        return (string)$this->sampleRate;
86
+        return (string) $this->sampleRate;
87 87
     }
88 88
 
89 89
     /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function getTextType()
103 103
     {
104
-        return (string)$this->textType;
104
+        return (string) $this->textType;
105 105
     }
106 106
 
107 107
     /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function getVoiceId()
121 121
     {
122
-        return (string)$this->voiceId;
122
+        return (string) $this->voiceId;
123 123
     }
124 124
 
125 125
     /**
Please login to merge, or discard this patch.
src/Adapter/Polly.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
         return array_merge(
64 64
             $headers,
65 65
             [
66
-                'http_code' => isset($headers['statusCode']) ? $headers['statusCode']: 500,
66
+                'http_code' => isset($headers['statusCode']) ? $headers['statusCode'] : 500,
67 67
             ]
68 68
         );
69 69
     }
Please login to merge, or discard this patch.