Passed
Push — develop ( 34fe6d...5f352c )
by Портнов
05:49
created

SayConf   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
eloc 40
c 2
b 0
f 0
dl 0
loc 44
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A generateConfigProtected() 0 40 1
1
<?php
2
/*
3
 * MikoPBX - free phone system for small business
4
 * Copyright (C) 2017-2020 Alexey Portnov and Nikolay Beketov
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License along with this program.
17
 * If not, see <https://www.gnu.org/licenses/>.
18
 */
19
20
namespace MikoPBX\Core\Asterisk\Configs;
21
22
23
class SayConf extends CoreConfigClass
24
{
25
    protected string $description = 'say.conf';
26
27
    protected function generateConfigProtected(): void
28
    {
29
        $conf = '[general]'.PHP_EOL.
30
                'mode=old'.PHP_EOL.PHP_EOL.
31
                '[ru]'.PHP_EOL.
32
                '_mi[n]uta:0 => num:${SAY}, digits/minutes'.PHP_EOL.
33
                '_mi[n]uta:1 => digits/1f, digits/minute'.PHP_EOL.
34
                '_mi[n]uta:2 => digits/2f, digits/minutes-i'.PHP_EOL.
35
                '_mi[n]uta:[3-4] => num:${SAY}, digits/minutes-i'.PHP_EOL.
36
                '_mi[n]uta:[5-9] => num:${SAY}, digits/minutes'.PHP_EOL.
37
                '_mi[n]uta:0X => minuta:${SAY:1}'.PHP_EOL.
38
                '_mi[n]uta:1X => num:${SAY}, digits/minutes'.PHP_EOL.
39
                '_mi[n]uta:[2-5]0 => num:${SAY}, digits/minutes'.PHP_EOL.
40
                '_mi[n]uta:[2-5][1-9] => num:${SAY:0:1}0, minuta:${SAY:1}'.PHP_EOL.
41
                ''.PHP_EOL.
42
                '_secu[n]da:0 => num:${SAY}, seconds'.PHP_EOL.
43
                '_secu[n]da:[5-9] => num:${SAY}, seconds'.PHP_EOL.
44
                '_secu[n]da:0X => secunda:${SAY:1}'.PHP_EOL.
45
                '_secu[n]da:1X => num:${SAY}, seconds'.PHP_EOL.
46
                '_secu[n]da:[2-5]0 => num:${SAY}, seconds'.PHP_EOL.
47
                ''.PHP_EOL.
48
                '_[n]um:0X => num:${SAY:1}'.PHP_EOL.
49
                '_[n]um:X => digits/${SAY}'.PHP_EOL.
50
                ''.PHP_EOL.
51
                '_[n]um:[1-2]f => digits/${SAY:0:1}f'.PHP_EOL.
52
                '_[n]um:[3-9]f => digits/${SAY:0:1}'.PHP_EOL.
53
                ''.PHP_EOL.
54
                '_[n]um:1X => digits/${SAY:0:2}'.PHP_EOL.
55
                '_[n]um:1Xf => digits/${SAY:0:2}'.PHP_EOL.
56
                ''.PHP_EOL.
57
                '_[n]um:[2-9]0 => digits/${SAY:0:2}'.PHP_EOL.
58
                '_[n]um:[2-9]0f => digits/${SAY:0:2}'.PHP_EOL.
59
                ''.PHP_EOL.
60
                '_[n]um:[2-9][1-2] => digits/${SAY:0:1}0, num:${SAY:1}'.PHP_EOL.
61
                '_[n]um:[2-9][1-2]f => digits/${SAY:0:1}0, num:${SAY:1}'.PHP_EOL.
62
                ''.PHP_EOL.
63
                '_[n]um:[2-9][3-9] => digits/${SAY:0:1}0, num:${SAY:1}'.PHP_EOL.
64
                '_[n]um:[2-9][3-9]f => digits/${SAY:0:1}0, num:${SAY:1}'.PHP_EOL.
65
                '';
66
        file_put_contents($this->config->path('asterisk.astetcdir') . '/say.conf', $conf);
67
    }
68
}