Completed
Push — master ( a79400...635bed )
by Phecho
03:27
created

ProjectPresenter::path()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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\Presenters;
13
14
use Gitamin\Presenters\Traits\TimestampsTrait;
15
16
class ProjectPresenter extends AbstractPresenter
17
{
18
    use TimestampsTrait;
19
20
    /**
21
     * Returns the override class name for theming.
22
     *
23
     * @return string
24
     */
25
    public function status_color()
26
    {
27
        switch ($this->wrappedObject->status) {
28
            case 1: return 'greens';
29
            case 2: return 'blues';
30
            case 3: return 'yellows';
31
            case 4: return 'reds';
32
        }
33
    }
34
35
    /**
36
     * Convert the presenter instance to an array.
37
     *
38
     * @return string[]
39
     */
40
    public function toArray()
41
    {
42
        return array_merge($this->wrappedObject->toArray(), [
43
            'created_at'  => $this->created_at(),
44
            'updated_at'  => $this->updated_at(),
45
            'namespace'   => $this->wrappedObject->group->path,
46
            'status_name' => $this->wrappedObject->humanStatus,
47
        ]);
48
    }
49
}
50