Completed
Push — master ( 3c8880...e2c218 )
by Dmitry
06:42 queued 02:46
created

FormatController::actionCurrency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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