public static function parse($response) { if (!is_array($response)) { Tag::setof($response, $response, "hash"); } $obj = new self(); return $obj->cp($response); }
public static function parse($response) { if (!is_array($response)) { $response = Text::parse_json($response); } $obj = new self(); return $obj->cp($response); }
public static function parse_list($response) { $result = array(); $res = Text::parse_json($response); foreach ($res as $re) { $obj = new self(); $result[] = $obj->cp($re); } return $result; }
public static function parse_update($response) { $result = array(); $re = Text::parse_json($response); if (isset($re["error"])) { throw new Exception($res["error"]); } $obj = new self(); return $obj->cp($re); }
public static function parse($response) { if (Tag::setof($tag, $response, "err")) { throw new Exception($tag->inParam("msg")); } if (Tag::setof($tag, $response, "rsp")) { $obj = new self(); return $obj->cp($tag->hash()); } throw new InvalidArgumentException(); }
public static function parse($response) { if (!is_array($response)) { if (Tag::setof($tag, $response, "error")) { throw new Exception($tag->value()); } Tag::setof($tag, $response, "user"); $response = $tag->hash(); } $obj = new self(); return $obj->cp($response); }
public static function parse_list($response) { $result = array(); if (Tag::setof($tag, $response, "info")) { foreach ($tag->in("photo") as $photo) { $obj = new self(); $result[] = $obj->cp($photo->hash()); } } else { throw new Exception("Invalid data"); } return $result; }
public static function parse($response) { if (Tag::setof($tag, $response, "error")) { throw new Exception($tag->value()); } if (Tag::setof($tag, $response, "status")) { $hash = $tag->hash(); $obj = new self(); $obj->user(TwitterUser::parse($hash["user"])); unset($hash["user"]); return $obj->cp($hash); } throw new Exception("invalid data"); }
public static function parse_list($response) { $result = array(); if (Tag::setof($tag, $response, "error")) { throw new Exception($tag->f("message.value()")); } if (Tag::setof($tag, $response, "programs")) { foreach ($tag->in("program") as $program) { $obj = new self(); $result[] = $obj->cp($program->hash()); } } return $result; }
public static function parse_list($response) { $result = array(); if (Tag::setof($tag, $response, "photos")) { foreach ($tag->in("photo") as $photo) { $obj = new self(); $params = array(); foreach ($photo->arParam() as $param) { $params[$param[0]] = $param[1]; } $result[] = $obj->cp($params); } } return $result; }
public static function parse_list($response) { $result = array(); $res = Text::parse_json($response); if (!isset($res)) { throw new Exception($response); } if (isset($res["channels"])) { foreach ($res["channels"] as $re) { $obj = new self(); $result[] = $obj->cp($re); } } return $result; }
public static function parse_list($response) { $result = array(); $res = Text::parse_json($response); if (!isset($res)) { throw new Exception($response); } foreach ($res as $re) { $obj = new self(); $obj->user(WassrUser::parse($re["user"])); unset($re["user"]); $result[] = $obj->cp($re); } return $result; }
public static function parse($response) { if (Tag::setof($tag, $response, "error")) { throw new Exception($tag->value()); } $result = array(); if (Tag::setof($tag, $response, "direct_message")) { $re = $status->hash(); $obj = new self(); $obj->sender(TwitterUser::parse($re["sender"])); $obj->recipient(TwitterUser::parse($re["recipient"])); unset($re["recipient"], $re["sender"]); return $obj->cp($re); } throw new Exception("invalid data"); }
/** * RequestのPaginator * @param \ebi\Request $req * @param integer $default_paginate_by * @param integer $max_paginate_by * @return \ebi\Paginator */ public static function request(\ebi\Request $req, $default_paginate_by = 20, $max_paginate_by = 100) { $paginate_by = $req->in_vars('paginate_by', $default_paginate_by); if ($paginate_by > $max_paginate_by) { $paginate_by = $max_paginate_by; } $self = new self($paginate_by, $req->in_vars('page', 1)); if ($req->is_vars('order')) { $o = $req->in_vars('order'); $p = $req->in_vars('porder'); if ($o == $p) { if ($o[0] == '-') { $o = substr($o, 1); } else { $o = '-' . $o; } $req->vars('order', $o); } $self->order($o); } $self->cp($req->ar_vars()); return $self; }