1 | <?php |
||
14 | class Forge implements ArrayAccess, Iterator |
||
15 | { |
||
16 | use AbstractCollection, LazyIterator, LazyArrayAccess; |
||
17 | |||
18 | /** |
||
19 | * API provider. |
||
20 | * |
||
21 | * @var \Laravel\Forge\ApiProvider |
||
22 | */ |
||
23 | protected $api; |
||
24 | |||
25 | /** |
||
26 | * Servers [id => name] map. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $serversMap = []; |
||
31 | |||
32 | /** |
||
33 | * Single servers cache. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $serversCache = []; |
||
38 | |||
39 | /** |
||
40 | * Create new Servers manager instance. |
||
41 | * |
||
42 | * @param \Laravel\Forge\ApiProvider $api |
||
43 | */ |
||
44 | public function __construct(ApiProvider $api) |
||
48 | |||
49 | /** |
||
50 | * @{inheritdocs} |
||
51 | */ |
||
52 | public function lazyLoad() |
||
71 | |||
72 | /** |
||
73 | * Generate items keys. |
||
74 | */ |
||
75 | public function generateKeys() |
||
79 | |||
80 | /** |
||
81 | * Initialize servers factory. |
||
82 | * |
||
83 | * @return \Laravel\Forge\Servers\Factory |
||
84 | */ |
||
85 | public function create() |
||
89 | |||
90 | /** |
||
91 | * Returns single server. |
||
92 | * |
||
93 | * @param int $serverId |
||
94 | * |
||
95 | * @return \Laravel\Forge\Server |
||
96 | */ |
||
97 | public function get(int $serverId) |
||
107 | |||
108 | /** |
||
109 | * Get server provider credentials. |
||
110 | * |
||
111 | * @return array |
||
112 | */ |
||
113 | public function credentials(): array |
||
124 | |||
125 | /** |
||
126 | * Get first credential for given provider. |
||
127 | * |
||
128 | * @param string $provider |
||
129 | * |
||
130 | * @return int|null |
||
131 | */ |
||
132 | public function credentialFor(string $provider) |
||
146 | |||
147 | /** |
||
148 | * Load single server from API and save it to memory cache. |
||
149 | * |
||
150 | * @param int $serverId |
||
151 | * |
||
152 | * @throws \Laravel\Forge\Exceptions\Servers\ServerWasNotFoundException |
||
153 | * |
||
154 | * @return \Laravel\Forge\Server |
||
155 | */ |
||
156 | protected function loadSingleServer(int $serverId) |
||
170 | } |
||
171 |