Completed
Pull Request — master (#58)
by Phecho
03:31
created

AddMomentCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 88
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of Gitamin.
5
 * 
6
 * Copyright (C) 2015-2016 The Gitamin Team
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Gitamin\Commands\Moment;
13
14
final class AddMomentCommand
15
{
16
    /**
17
     * The moment title.
18
     *
19
     * @var string
20
     */
21
    public $title;
22
23
    /**
24
     * The moment data.
25
     *
26
     * @var string
27
     */
28
    public $data;
29
30
    /**
31
     * The moment target_type.
32
     *
33
     * @var string
34
     */
35
    public $target_type;
36
37
    /**
38
     * The moment target_id.
39
     *
40
     * @var int
41
     */
42
    public $target_id;
43
44
     /**
45
     * The moment action.
46
     *
47
     * @var int
48
     */
49
    public $action;
50
51
    /**
52
     * The moment user.
53
     *
54
     * @var int
55
     */
56
    public $author_id;
57
58
    /**
59
     * The moment project.
60
     *
61
     * @var int
62
     */
63
    public $project_id;
64
65
    /**
66
     * The validation rules.
67
     *
68
     * @var string[]
69
     */
70
    public $rules = [
71
        'target_type' => 'string',
72
        'target_id'   => 'int',
73
        'action'      => 'required|int',
74
        'author_id'   => 'required|int',
75
        'project_id'  => 'int',
76
    ];
77
78
    /**
79
     * Create a new add moment command instance.
80
     *
81
     * @param string $title
82
     * @param string $data
83
     * @param string $target_type
84
     * @param int    $target_id
85
     * @param int    $action
86
     * @param int    $author_id
87
     * @param int    $project_id
88
     *
89
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
90
     */
91
    public function __construct($title, $data, $target_type, $target_id, $action, $author_id, $project_id)
92
    {
93
        $this->title = $title;
94
        $this->data = $data;
95
        $this->target_type = $target_type;
96
        $this->target_id = $target_id;
97
        $this->action = $action;
98
        $this->author_id = $author_id;
99
        $this->project_id = $project_id;
100
    }
101
}
102