View difference between Paste ID: AvsCw8Ar and apHL98s1
SHOW: | | - or go back to the newest paste.
1
<?php
2
3
namespace libs;
4
5
class Base
6
{
7-
	const BASE_URL = 'https://api.eveonline.com/';
7+
	const BASE_URL = 'https://api.something.loc/';
8
9
	function __construct($keyId, $vCode)
10
	{
11
		$this->keyId = $keyId;
12
		$this->vCode = $vCode;
13
	}
14
15
	/**
16
	 * Return API URI
17
	 * @param  [string] $api api name
18
	 * @return [string] API URI
19
	 */
20
	public function get($api, array $params = [])
21
	{
22
23
		if (method_exists($this, $api)) {
24
			$data['url'] = $this->$api($params);
25
		} else {
26
			return false;
27
		}
28
29
		$uri = self::BASE_URL.$data['url'].'?';
30
31
		if ($params) {
32
			foreach ($params as $p_name => $p_value) {
33
				$uri .= '&'.$p_name.'='.$p_value;
34
			}
35
		}
36
37
		$uri .= '&keyID='.$this->keyId.'&vCode='.$this->vCode;
38
39
		return $uri;
40
	}
41
}