FormatController::actionCurrency()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 4
crap 2
1
<?php
2
/**
3
 * HiPanel core package
4
 *
5
 * @link      https://hipanel.com/
6
 * @package   hipanel-core
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2014-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\controllers;
12
13
use Yii;
14
use yii\web\Controller;
15
16
/**
17
 * Class FormatController
18
 * Used to format values with Yii formatter.
19
 */
20
class FormatController extends Controller
21
{
22
    /**
23
     * Formats [[$value]] as currency.
24
     * See [[Formatter::asCurrency]] documentation.
25
     *
26
     * @param $value
27
     * @param null $currency
28
     * @param array $options
29
     * @param array $textOptions
30
     * @throws \yii\base\InvalidConfigException
31
     * @return string
32
     */
33
    public function actionCurrency($value, $currency = null, $options = [], $textOptions = [])
34
    {
35
        return Yii::$app->formatter->asCurrency($value, $currency, $options, $textOptions);
36
    }
37
}
38