SetLocaleAction   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 4
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 7 1
1
<?php
2
3
namespace Bmatovu\Ussd\Actions;
4
5
use Illuminate\Support\Facades\App;
6
7
/**
8
 * Usage:
9
 *
10
 * ```xml
11
 * <action name="set_locale" />
12
 * <response text="{{locale}}" /><!-- en -->
13
 * ```
14
 */
15
class SetLocaleAction extends BaseAction
16
{
17
    public function process(?string $answer): void
18
    {
19
        $locale = $this->readAttr('locale', $this->store->get('locale', 'en'));
20
21
        App::setLocale($locale);
22
23
        $this->store->put('locale', $locale);
24
    }
25
}
26