File tree 1 file changed +32
-1
lines changed
1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,19 @@ class Api
41
41
*/
42
42
private $ userAgent ;
43
43
44
+ /**
45
+ * The url to communicate on
46
+ *
47
+ * @var string
48
+ */
49
+ private $ url ;
50
+
44
51
/**
45
52
* Default constructor
46
53
*/
47
- public function __construct ($ email = null , $ apiKey = null )
54
+ public function __construct ($ url , $ email = null , $ apiKey = null )
48
55
{
56
+ $ this ->setUrl ($ url );
49
57
if ($ email !== null ) {
50
58
$ this ->setEmail ($ email );
51
59
}
@@ -96,6 +104,16 @@ public function getUserAgent()
96
104
return 'PHP ForkAPI/ ' . self ::VERSION .' ' . $ this ->userAgent ;
97
105
}
98
106
107
+ /**
108
+ * Get the URL of the website we are working on
109
+ *
110
+ * @return string
111
+ */
112
+ public function getUrl ()
113
+ {
114
+ return $ this ->url ;
115
+ }
116
+
99
117
/**
100
118
* Set the API key
101
119
*
@@ -140,4 +158,17 @@ public function setUserAgent($userAgent)
140
158
{
141
159
$ this ->userAgent = (string ) $ userAgent ;
142
160
}
161
+
162
+ /**
163
+ * Set the URL to work on
164
+ *
165
+ * @param string $url
166
+ */
167
+ protected function setUrl ($ url )
168
+ {
169
+ // make sure there is a / on the end
170
+ $ url = trim ((string ) $ url , '/ ' ) . '/ ' ;
171
+
172
+ $ this ->url = (string ) $ url ;
173
+ }
143
174
}
You can’t perform that action at this time.
0 commit comments