1 | <?php |
||
9 | abstract class SiteResourceCommand extends SiteCommand |
||
10 | { |
||
11 | /** |
||
12 | * Associated site. |
||
13 | * |
||
14 | * @var \Laravel\Forge\Sites\Site |
||
15 | */ |
||
16 | protected $site; |
||
17 | |||
18 | /** |
||
19 | * Resource ID. |
||
20 | * |
||
21 | * @var int |
||
22 | */ |
||
23 | protected $siteResourceId = 0; |
||
24 | |||
25 | /** |
||
26 | * Site resource path. |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | abstract public function siteResourcePath(); |
||
31 | |||
32 | /** |
||
33 | * Site resource class. |
||
34 | * |
||
35 | * @return string|null |
||
36 | */ |
||
37 | public function siteResourceClass() |
||
41 | |||
42 | /** |
||
43 | * Set associated site and execute command on site server. |
||
44 | * |
||
45 | * @param \Laravel\Forge\Sites\Site $site |
||
46 | * |
||
47 | * @return static |
||
48 | */ |
||
49 | public function for(Site $site) |
||
56 | |||
57 | /** |
||
58 | * Set site resource ID. |
||
59 | * |
||
60 | * @param int $resourceId |
||
61 | * |
||
62 | * @return static |
||
63 | */ |
||
64 | public function setSiteResourceId(int $resourceId) |
||
70 | |||
71 | /** |
||
72 | * Get site resource ID. |
||
73 | * |
||
74 | * @return int |
||
75 | */ |
||
76 | public function getSiteResourceId(): int |
||
80 | |||
81 | /** |
||
82 | * Get associated site. |
||
83 | * |
||
84 | * @return \Laravel\Forge\Sites\Site |
||
85 | */ |
||
86 | public function getSite(): Site |
||
90 | |||
91 | /** |
||
92 | * HTTP request URL. |
||
93 | * |
||
94 | * @param \Laravel\Forge\Server |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | public function requestUrl(Server $server) |
||
104 | |||
105 | /** |
||
106 | * Processes new response item. |
||
107 | * |
||
108 | * @param mixed $item |
||
109 | * |
||
110 | * @return mixed |
||
111 | */ |
||
112 | public function processResponseItem($item) |
||
116 | |||
117 | /** |
||
118 | * Handle command response. |
||
119 | * |
||
120 | * @param \Psr\Http\Message\ResponseInterface $response |
||
121 | * @param \Laravel\Forge\Server $server |
||
122 | * |
||
123 | * @return bool|string |
||
124 | */ |
||
125 | public function handleResponse(ResponseInterface $response, Server $server) |
||
135 | } |
||
136 |