| @@ 14-93 (lines=80) @@ | ||
| 11 | ||
| 12 | namespace Gitamin\Commands\Project; |
|
| 13 | ||
| 14 | final class AddProjectCommand |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * The project name. |
|
| 18 | * |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | public $name; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * The project description. |
|
| 25 | * |
|
| 26 | * @var string |
|
| 27 | */ |
|
| 28 | public $description; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * The project visibility_level. |
|
| 32 | * |
|
| 33 | * @var int |
|
| 34 | */ |
|
| 35 | public $visibility_level; |
|
| 36 | ||
| 37 | /** |
|
| 38 | * The project slug. |
|
| 39 | * |
|
| 40 | * @var string |
|
| 41 | */ |
|
| 42 | public $path; |
|
| 43 | ||
| 44 | /** |
|
| 45 | * The project creator id. |
|
| 46 | * |
|
| 47 | * @var int |
|
| 48 | */ |
|
| 49 | public $creator_id; |
|
| 50 | ||
| 51 | /** |
|
| 52 | * The project ower. |
|
| 53 | * |
|
| 54 | * @var int |
|
| 55 | */ |
|
| 56 | public $owner_id; |
|
| 57 | ||
| 58 | /** |
|
| 59 | * The validation rules. |
|
| 60 | * |
|
| 61 | * @var string[] |
|
| 62 | */ |
|
| 63 | public $rules = [ |
|
| 64 | 'name' => 'required|string', |
|
| 65 | 'description' => 'string', |
|
| 66 | 'visibility_level' => 'int|min:1|max:4', |
|
| 67 | 'path' => 'required|string', |
|
| 68 | 'creator_id' => 'int', |
|
| 69 | 'owner_id' => 'int', |
|
| 70 | ]; |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Create a new add project command instance. |
|
| 74 | * |
|
| 75 | * @param string $name |
|
| 76 | * @param string $description |
|
| 77 | * @param int $visibility_level |
|
| 78 | * @param string $path |
|
| 79 | * @param int $creator_id |
|
| 80 | * @param int $owner_id |
|
| 81 | * @param bool $issues_enabled |
|
| 82 | */ |
|
| 83 | public function __construct($name, $description, $visibility_level, $path, $creator_id, $owner_id) |
|
| 84 | { |
|
| 85 | $this->name = $name; |
|
| 86 | $this->description = $description; |
|
| 87 | $this->visibility_level = (int) $visibility_level; |
|
| 88 | $this->path = $path; |
|
| 89 | $this->creator_id = $creator_id; |
|
| 90 | $this->owner_id = $owner_id; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||
| @@ 16-104 (lines=89) @@ | ||
| 13 | ||
| 14 | use Gitamin\Models\Project; |
|
| 15 | ||
| 16 | final class UpdateProjectCommand |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * The project to update. |
|
| 20 | * |
|
| 21 | * @var \Gitamin\Models\Project |
|
| 22 | */ |
|
| 23 | public $project; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * The project name. |
|
| 27 | * |
|
| 28 | * @var string |
|
| 29 | */ |
|
| 30 | public $name; |
|
| 31 | ||
| 32 | /** |
|
| 33 | * The project description. |
|
| 34 | * |
|
| 35 | * @var string |
|
| 36 | */ |
|
| 37 | public $description; |
|
| 38 | ||
| 39 | /** |
|
| 40 | * The project visibility_level. |
|
| 41 | * |
|
| 42 | * @var int |
|
| 43 | */ |
|
| 44 | public $visibility_level; |
|
| 45 | ||
| 46 | /** |
|
| 47 | * The project path. |
|
| 48 | * |
|
| 49 | * @var string |
|
| 50 | */ |
|
| 51 | public $path; |
|
| 52 | ||
| 53 | /** |
|
| 54 | * The project creator id. |
|
| 55 | * |
|
| 56 | * @var int |
|
| 57 | */ |
|
| 58 | public $creator_id; |
|
| 59 | ||
| 60 | /** |
|
| 61 | * The project owner. |
|
| 62 | * |
|
| 63 | * @var int |
|
| 64 | */ |
|
| 65 | public $owner_id; |
|
| 66 | ||
| 67 | /** |
|
| 68 | * The validation rules. |
|
| 69 | * |
|
| 70 | * @var string[] |
|
| 71 | */ |
|
| 72 | public $rules = [ |
|
| 73 | 'name' => 'string', |
|
| 74 | 'description' => 'string', |
|
| 75 | 'visibility_level' => 'int|min:1|max:4', |
|
| 76 | 'path' => 'string', |
|
| 77 | 'creator_id' => 'int', |
|
| 78 | 'owner_id' => 'int', |
|
| 79 | ]; |
|
| 80 | ||
| 81 | /** |
|
| 82 | * Create a new update project command instance. |
|
| 83 | * |
|
| 84 | * @param \Gitamin\Models\Project $project |
|
| 85 | * @param string $name |
|
| 86 | * @param string $description |
|
| 87 | * @param int $visibility_level |
|
| 88 | * @param string $path |
|
| 89 | * @param int $creator_id |
|
| 90 | * @param int $owner_id |
|
| 91 | */ |
|
| 92 | public function __construct(Project $project, $name, $description, $visibility_level, $path, $creator_id, $owner_id) |
|
| 93 | { |
|
| 94 | $this->project = $project; |
|
| 95 | $this->name = $name; |
|
| 96 | $this->description = $description; |
|
| 97 | $this->visibility_level = (int) $visibility_level; |
|
| 98 | $this->path = $path; |
|
| 99 | $this->creator_id = $creator_id; |
|
| 100 | $this->owner_id = $owner_id; |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||