Completed
Push — master ( d19571...3a7c72 )
by Andrii
02:27
created

Project   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 29
ccs 2
cts 4
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A primaryKey() 0 4 1
A rules() 0 21 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
            ['id', 'number'],
32
            ['name', 'string'],
33
            ['platform', 'string'],
34
            ['description', 'string'],
35
            ['homepage', 'url'],
36
            ['repository_url', 'url'],
37
            ['normalized_licenses', 'each', 'rule' => ['string']],
38
            ['rank', 'integer'],
39
            ['latest_release_published_at', 'datetime', 'timestampAttribute' => 'latest_release_published_at'],
40
            ['latest_release_number', 'string'],
41
            ['language', 'string'],
42
            ['status', 'string'],
43
            ['package_manager_url', 'url'],
44
            ['stars', 'integer'],
45
            ['forks', 'integer'],
46
            ['keywords', 'each', 'rule' => ['string']],
47
        ];
48
    }
49
}
50