GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 804d88...9de2aa )
by t
02:26
created

Html::getInputName()   A

Complexity

Conditions 6
Paths 8

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 11
c 1
b 0
f 0
nc 8
nop 3
dl 0
loc 16
rs 9.2222
1
<?php
2
/**
3
 * Class Html
4
 *
5
 * @link https://www.icy2003.com/
6
 * @author icy2003 <[email protected]>
7
 * @copyright Copyright (c) 2017, icy2003
8
 */
9
10
namespace icy2003\php\iexts\yii2\helpers;
11
12
use yii\base\InvalidArgumentException;
13
use yii\helpers\Html as H;
14
15
/**
16
 * Html 扩展
17
 */
18
class Html extends H
19
{
20
    /**
21
     * 获取 input 值
22
     *
23
     * @param yii\base\Model $model 模型对象
24
     * @param string $attribute
25
     * @param mixed $formName
26
     *
27
     * @return string
28
     */
29
    public static function getInputName($model, $attribute, $formName = null)
30
    {
31
        $formName = null === $formName ? $model->formName() : $formName;
32
        if (!preg_match(static::$attributeRegex, $attribute, $matches)) {
33
            throw new InvalidArgumentException('Attribute name must contain word characters only.');
34
        }
35
        $prefix = $matches[1];
36
        $attribute = $matches[2];
37
        $suffix = $matches[3];
38
        if ($formName === '' && $prefix === '') {
39
            return $attribute . $suffix;
40
        } elseif ($formName !== '') {
41
            return $formName . $prefix . '[' . $attribute . ']' . $suffix;
42
        }
43
44
        throw new InvalidArgumentException(get_class($model) . '::formName() cannot be empty for tabular inputs.');
45
    }
46
}
47