ILIAS  release_7 Revision v7.30-3-g800a261c036
ilECSResult Class Reference
+ Collaboration diagram for ilECSResult:

Public Member Functions

 __construct ($a_res, $a_type=self::RESULT_TYPE_JSON)
 Constructor. More...
 
 setHTTPCode ($a_code)
 set HTTP return code More...
 
 getHTTPCode ()
 get HTTP code More...
 
 getPlainResultString ()
 get unformated result string More...
 
 getResult ()
 get result More...
 
 setHeaders ($a_headers)
 Set header. More...
 
 getHeaders ()
 get headers More...
 

Data Fields

const RESULT_TYPE_JSON = 1
 
const RESULT_TYPE_URL_LIST = 2
 

Protected Attributes

 $log
 
 $result_string = ''
 
 $http_code = ''
 
 $result
 
 $result_type
 
 $headers = array()
 

Private Member Functions

 init ()
 init result (json_decode) @access private More...
 
 parseUriList ($a_content)
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 35 of file class.ilECSResult.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSResult::__construct (   $a_res,
  $a_type = self::RESULT_TYPE_JSON 
)

Constructor.

@access public

Parameters
stringresult_string
intresult type
Exceptions
ilECSConnectorException

Definition at line 58 of file class.ilECSResult.php.

59 {
60 global $DIC;
61
62 $ilLog = $DIC['ilLog'];
63
64 $this->log = $ilLog;
65
66 $this->result_string = $a_res;
67 $this->result_type = $a_type;
68
69 $this->init();
70 }
init()
init result (json_decode) @access private
global $DIC
Definition: goto.php:24

References $DIC, and init().

+ Here is the call graph for this function:

Member Function Documentation

◆ getHeaders()

ilECSResult::getHeaders ( )

get headers

@access public

Definition at line 131 of file class.ilECSResult.php.

132 {
133 return $this->headers ?: [];
134 }

◆ getHTTPCode()

ilECSResult::getHTTPCode ( )

get HTTP code

@access public

Definition at line 89 of file class.ilECSResult.php.

90 {
91 return $this->http_code;
92 }

References $http_code.

◆ getPlainResultString()

ilECSResult::getPlainResultString ( )

get unformated result string

@access public

Definition at line 100 of file class.ilECSResult.php.

101 {
103 }

References $result_string.

Referenced by parseUriList().

+ Here is the caller graph for this function:

◆ getResult()

ilECSResult::getResult ( )

get result

@access public

Returns
mixed JSON object, array of objects or false in case of errors.

Definition at line 112 of file class.ilECSResult.php.

113 {
114 return $this->result;
115 }

References $result.

◆ init()

ilECSResult::init ( )
private

init result (json_decode) @access private

Definition at line 141 of file class.ilECSResult.php.

142 {
143 switch ($this->result_type) {
145 if ($this->result_string) {
146 $this->result = json_decode($this->result_string);
147 } else {
148 $this->result = array();
149 }
150 break;
151
153 $this->result = $this->parseUriList($this->result_string);
154 break;
155 }
156 return true;
157 }
const RESULT_TYPE_URL_LIST
parseUriList($a_content)

References parseUriList(), RESULT_TYPE_JSON, and RESULT_TYPE_URL_LIST.

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseUriList()

ilECSResult::parseUriList (   $a_content)
private
Parameters
<type>$a_content
Returns
ilECSUriList

Definition at line 164 of file class.ilECSResult.php.

165 {
166 include_once 'Services/WebServices/ECS/classes/class.ilECSUriList.php';
167 $list = new ilECSUriList();
168 $lines = explode("\n", $this->getPlainResultString());
169 foreach ($lines as $line) {
170 $line = trim($line);
171 if (!strlen($line)) {
172 continue;
173 }
174 $uri_parts = explode("/", $line);
175 $list->add($line, array_pop($uri_parts));
176 }
177
178 return $list;
179 }
getPlainResultString()
get unformated result string
Presentation of ecs uril (http://...campusconnect/courselinks)

References getPlainResultString().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHeaders()

ilECSResult::setHeaders (   $a_headers)

Set header.

Parameters
array$a_headers

Definition at line 121 of file class.ilECSResult.php.

122 {
123 $this->headers = $a_headers;
124 }

◆ setHTTPCode()

ilECSResult::setHTTPCode (   $a_code)

set HTTP return code

@access public

Parameters
stringhttp code

Definition at line 79 of file class.ilECSResult.php.

80 {
81 $this->http_code = $a_code;
82 }

Field Documentation

◆ $headers

ilECSResult::$headers = array()
protected

Definition at line 47 of file class.ilECSResult.php.

◆ $http_code

ilECSResult::$http_code = ''
protected

Definition at line 43 of file class.ilECSResult.php.

Referenced by getHTTPCode().

◆ $log

ilECSResult::$log
protected

Definition at line 40 of file class.ilECSResult.php.

◆ $result

ilECSResult::$result
protected

Definition at line 44 of file class.ilECSResult.php.

Referenced by getResult().

◆ $result_string

ilECSResult::$result_string = ''
protected

Definition at line 42 of file class.ilECSResult.php.

Referenced by getPlainResultString().

◆ $result_type

ilECSResult::$result_type
protected

Definition at line 45 of file class.ilECSResult.php.

◆ RESULT_TYPE_JSON

const ilECSResult::RESULT_TYPE_JSON = 1

Definition at line 37 of file class.ilECSResult.php.

Referenced by init().

◆ RESULT_TYPE_URL_LIST

const ilECSResult::RESULT_TYPE_URL_LIST = 2

The documentation for this class was generated from the following file: