19 declare(strict_types=1);
44 public function __construct(
string $a_res,
int $a_type = self::RESULT_TYPE_JSON)
46 $this->result_type = $a_type;
48 $this->
init($a_res, $a_type);
60 $this->http_code = $a_code;
94 $this->headers = $a_headers;
102 return $this->headers ?: [];
108 private function init(
string $result_string,
int $result_type): void
110 switch ($result_type) {
111 case self::RESULT_TYPE_JSON:
112 if ($result_string) {
113 $this->result = json_decode($result_string,
false, 512, JSON_THROW_ON_ERROR);
119 case self::RESULT_TYPE_URL_LIST:
133 $lines = explode(
"\n", $a_content);
134 foreach ($lines as $line) {
139 $uri_parts = explode(
"/", $line);
140 $list->add($line, (
int) array_pop($uri_parts));
const RESULT_TYPE_URL_LIST
init(string $result_string, int $result_type)
init result (json_decode)
Presentation of ecs uril (http://...campusconnect/courselinks)
setHeaders(array $a_headers)
Set header.
parseUriList(string $a_content)
__construct(string $a_res, int $a_type=self::RESULT_TYPE_JSON)
Constructor.
getHTTPCode()
get HTTP code
setHTTPCode(int $a_code)
set HTTP return code