Completed
Push — master ( f02046...14b6f7 )
by Andrii
10s
created

Project::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 17
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Libraries.io API implementation for yii2-hiart.
4
 *
5
 * @link      https://github.com/hiqdev/yii2-hiart-librariesio
6
 * @package   yii2-hiart-librariesio
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\hiart\librariesio\models;
12
13
use hiqdev\hiart\librariesio\ActiveRecord;
14
15
/**
16
 * Project.
17
 * See [documentation](https://libraries.io/api#project).
18
 *
19
 * @author Andrii Vasyliev <[email protected]>
20
 */
21
class Project extends ActiveRecord
22
{
23
    public static function primaryKey()
24
    {
25
        return ['name', 'platform'];
26
    }
27
28 1
    public function rules()
29
    {
30
        return [
31 1
            ['name', 'string'],
32
            ['platform', 'string'],
33
            ['description', 'string'],
34
            ['homepage', 'url'],
35
            ['repository_url', 'url'],
36
            ['normalized_licenses', 'each', 'rule' => ['string']],
37
            ['rank', 'integer'],
38
            ['latest_release_published_at', 'datetime', 'timestampAttribute' => 'latest_release_published_at'],
39
            ['latest_release_number', 'string'],
40
            ['language', 'string'],
41
            ['status', 'string'],
42
            ['package_manager_url', 'url'],
43
            ['stars', 'integer'],
44
            ['forks', 'integer'],
45
            ['keywords', 'each', 'rule' => ['string']],
46
        ];
47
    }
48
}
49