Completed
Push — master ( 1e3a6a...6ef268 )
by Vadim
02:24
created
src/Adapter/Ivona.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     }
64 64
 
65 65
     /**
66
-     * @param $text
66
+     * @param string $text
67 67
      * @return Payload
68 68
      */
69 69
     public function getPayload($text)
Please login to merge, or discard this patch.
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.
src/Adapter/Ivona/Payload.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     /**
35 35
      * Get service headers
36
-     * @return array
36
+     * @return string[]
37 37
      */
38 38
     public function getHeaders()
39 39
     {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     /**
75 75
      * Set payload
76
-     * @param $payload
76
+     * @param string $payload
77 77
      * @return $this
78 78
      */
79 79
     public function setPayload($payload)
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     /**
86 86
      * Get post data for service
87
-     * @return array
87
+     * @return string
88 88
      */
89 89
     public function getPayload()
90 90
     {
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('Service type does not supports: ' . $serviceType);
110
+            throw new RuntimeException('Service type does not supports: '.$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
@@ -17,9 +17,9 @@
 block discarded – undo
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
     }
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.