Completed
Push — master ( 3cc9b0...d35865 )
by Timur
02:56
created

Recipe::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Laravel\Forge\Recipes;
4
5
use Laravel\Forge\ApiResource;
6
7 View Code Duplication
class Recipe extends ApiResource
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /**
10
     * Resource type.
11
     *
12
     * @return string
13
     */
14
    public static function resourceType()
15
    {
16
        return 'recipe';
17
    }
18
19
    /**
20
     * Resource path (relative to Server URL).
21
     *
22
     * @return string
23
     */
24
    public function resourcePath()
25
    {
26
        return 'recipes';
27
    }
28
29
    /**
30
     * Recipe user.
31
     *
32
     * @return string|null
33
     */
34
    public function user()
35
    {
36
        return $this->getData('user');
37
    }
38
39
    /**
40
     * Recipe script.
41
     *
42
     * @return string|null
43
     */
44
    public function script()
45
    {
46
        return $this->getData('script');
47
    }
48
49
    /**
50
     * Run the recipe.
51
     *
52
     * @return bool
53
     */
54
    public function run()
55
    {
56
        $this->getHttpClient()->request('POST', 'recipes/'.$this->id().'/run');
57
58
        return true;
59
    }
60
}
61