forked from ppetermann/pheal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PhealConfig.php
148 lines (130 loc) · 4.29 KB
/
PhealConfig.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
/*
MIT License
Copyright (c) 2010 - 2012 Peter Petermann, Daniel Hoffend
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* PhealConfig, implementing Singleton this is meant to
* store all Library configuration, like cache etc.
* to change the default config you can for example do:
* PhealConfig::getInstance()->cache = new CacheObject();
*/
class PhealConfig
{
/**
* Cache Object, defaults to an PhealNullCache Object
* @var PhealCacheInterface
*/
public $cache;
/**
* Archive Object, defaults to an PhealNullArchive Object
* @var PhealArchiveInterface
*/
public $archive;
/**
* Access Object to validate and check an API with a given keyType+accessMask
* defaults to PhealNullAccess Object
* @var PhealAccessInterface
*/
public $access;
/**
* usually this points to the EVE API directly, however if you use a API
* proxy you might want to modify this.
* use https://api.eveonline.com/ if you like to have ssl support
* @var String
*/
public $api_base = "https://api.eveonline.com/";
/**
* enable the new customize key system (use keyID instead of userID, etc)
* @var bool
*/
public $api_customkeys = true;
/**
* associative array with additional parameters that should be passed
* to the API on every request.
* @var array
*/
public $additional_request_parameters = array();
/**
* which http request method should be used 'curl' or 'file'
* @var String
*/
public $http_method = "curl";
/**
* which outgoing ip/inteface should be used for the http request
* (bool) false means use default ip address
* @var String
*/
public $http_interface_ip = false;
/**
* which useragent should be used for http calls.
* (bool) false means do not change php default
* @var String
*/
public $http_user_agent = false;
/**
* should parameters be transfered in the POST body request or via GET request
* @var bool
*/
public $http_post = false;
/**
* After what time should an api call considered to as timeout?
* @var int
*/
public $http_timeout = 10;
/**
* verify ssl peer (CURLOPT_SSL_VERIFYPEER
* @var bool
*/
public $http_ssl_verifypeer = true;
/**
* reuse a http connection (keep-alive for X seconds) to lower the connection handling overhead
* keep in mind after the script ended the connection will be closed anyway.
*
* @var bool|int number of seconds a connection should be kept open (bool true == 15)
*/
public $http_keepalive = false;
/**
* Singleton Instance
* @var PhealConfig
*/
private static $myInstance = null;
/**
* private constructor (use getInstance() to get an Instance)
*/
private function __construct()
{
$this->cache = new PhealNullCache();
$this->archive = new PhealNullArchive();
$this->log = new PhealNullLog();
$this->access = new PhealNullAccess();
}
/**
* Return Instance of PhealConfig Object
* @return PhealConfig
*/
public static function getInstance()
{
if(is_null(self::$myInstance))
self::$myInstance = new PhealConfig();
return self::$myInstance;
}
}