51d0ff59650a770a4d1f9c38283809549ff401ba
[shpub.git] / src / shpub / Config / Host.php
1 <?php
2 namespace shpub;
3
4 class Config_Host
5 {
6     /**
7      * (Base) server URL
8      *
9      * @var string
10      */
11     public $server;
12
13     /**
14      * User URL
15      *
16      * @var string
17      */
18     public $user;
19
20     /**
21      * Micropub access token
22      *
23      * @var string
24      */
25     public $token;
26
27     /**
28      * Host information
29      *
30      * @var Config_HostEndpoints
31      */
32     public $endpoints;
33
34     /**
35      * If this host is the default one
36      *
37      * @var boolean
38      */
39     public $default;
40
41     public function __construct()
42     {
43         $this->endpoints = new Config_Endpoints();
44     }
45
46     public function loadEndpoints()
47     {
48         $this->endpoints = new Config_Endpoints();
49         $this->endpoints->load($this->server);
50         if ($this->endpoints->incomplete()) {
51             $this->endpoints->discover($this->server);
52             $this->endpoints->save($this->server);
53         }
54     }
55 }
56 ?>