TTSApiCom   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUri() 0 4 1
A make() 0 15 2
1
<?php
2
/**
3
 *
4
 * PHP version 5.5
5
 *
6
 * @package TTS\Driver
7
 * @author  Sergey V.Kuzin <[email protected]>
8
 * @license MIT
9
 */
10
11
namespace TTS\Driver;
12
13
14
class TTSApiCom extends AbstractAdapter
15
{
16
    protected $name = 'TTSApiCom';
17
    protected $voice = 'male';
18
19
    protected $speed = 0;
20
21
    protected $languageMap = [
22
        'en_GB' => 'en'
23
    ];
24
25
    public function getUri()
26
    {
27
        return 'http://tts-api.com/tts.mp3';
28
    }
29
30
    public function make($text, $fileName)
31
    {
32
        $sp = new SplitterText();
33
        $text = iconv('UTF-8', 'UTF-8', $text);
34
35
        $lines = $sp->split($text, 1000);
36
        $content = '';
37
        foreach ($lines as $line) {
38
            $query = [
39
                'q' => $line
40
            ];
41
            $content .= $this->reguestGet($query);
42
        }
43
        return $content;
44
    }
45
}
46
47