Beispiel #1
0
 /**
  * @param string|UserBasic $user_id
  * @return User
  */
 public function get($user_id)
 {
     if ($user_id instanceof UserBasic) {
         $user_id = $user_id->getUserId();
     }
     if (empty($user_id)) {
         throw new Exception\InvalidArgumentException('No User Id was specified.');
     }
     $response = $this->service->get("/users/{$user_id}");
     return User::FromXml($this->service, $response);
 }
Beispiel #2
0
 /**
  * @param string|Basic $team_id
  *
  * @return Team
  * @throws Exception\InvalidArgumentException
  */
 public function get($team_id)
 {
     if ($team_id instanceof TeamBasic) {
         $team_id = $team_id->getId();
     }
     if (!is_string($team_id) || $team_id === '') {
         throw new Exception\InvalidArgumentException('No Team Id was specified.');
     }
     $response = $this->service->get("/teams/{$team_id}");
     return Team::FromXml($this->service, $response);
 }
Beispiel #3
0
 /**
  * @param PagingSearch $ps
  *
  * @return Course[]
  */
 public function getAll(PagingSearch $ps = null)
 {
     $response = $this->service->get("/users/{$this->user_id}/courses", $ps);
     $xml = new \SimpleXMLElement($response);
     $courses = array();
     $course_nodes = $xml->children();
     foreach ($course_nodes as $course_node) {
         $id = (string) $course_node->Id;
         $code = (string) $course_node->Code;
         $name = (string) $course_node->Name;
         $active = filter_var((string) $course_node->Active, FILTER_VALIDATE_BOOLEAN);
         $course = new Course($id, $code, $name, $active);
         $courses[] = $course;
     }
     return $courses;
 }
Beispiel #4
0
 /**
  * @param PagingSearch $ps
  *
  * @return UserBasic[]
  */
 public function getAll(PagingSearch $ps = null)
 {
     $response = $this->service->get("/teams/{$this->team_id}/users", $ps);
     $xml = new \SimpleXMLElement($response);
     $users = array();
     $user_nodes = $xml->children();
     foreach ($user_nodes as $user_node) {
         $id = (string) $user_node->Id;
         $user_name = (string) $user_node->UserName;
         $first_name = (string) $user_node->FirstName;
         $last_name = (string) $user_node->LastName;
         $user = new UserBasic($this->service, $id, $user_name, $first_name, $last_name);
         $users[] = $user;
     }
     return $users;
 }