Completed
Push — master ( 14b6f7...0631c4 )
by Andrii
04:33
created

Project::primaryKey()   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
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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
            ['id', 'number'],
32 1
            ['name', 'string'],
33 1
            ['platform', 'string'],
34 1
            ['description', 'string'],
35 1
            ['homepage', 'url'],
36 1
            ['repository_url', 'url'],
37 1
            ['normalized_licenses', 'each', 'rule' => ['string']],
38 1
            ['rank', 'integer'],
39 1
            ['latest_release_published_at', 'datetime', 'timestampAttribute' => 'latest_release_published_at'],
40 1
            ['latest_release_number', 'string'],
41 1
            ['language', 'string'],
42 1
            ['status', 'string'],
43 1
            ['package_manager_url', 'url'],
44 1
            ['stars', 'integer'],
45 1
            ['forks', 'integer'],
46 1
            ['keywords', 'each', 'rule' => ['string']],
47 1
        ];
48
    }
49
}
50