123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace Client\Request {
- class Repos extends RequestBase {
- private $repo = array();
- protected function json_set_property($objs) {
- foreach ($objs as $key => $obj) {
- $this->repo[$key] = new Repos\Repo(
- sprintf("/repos/%s/%s",
- $obj->owner->username,
- $obj->name
- ),
- $this->token
- );
- $this->repo[$key]->json_set_property($obj);
- }
- }
- public function current() {
- return current($this->repo);
- }
- public function next() {
- return next($this->repo);
- }
- public function reset() {
- return reset($this->repo);
- }
- public function __destruct() {}
- }
- }
- namespace Client\Request\Repos {
- class Repo extends \Client\Request\RequestBase {
- public $rid;
- public $rowner;
- public $rname;
- public $rfull_name;
- public $rdescription;
- public $rprivate;
- public $rfork;
- public $rparent;
- public $rempty;
- public $rmirror;
- public $rsize;
- public $rhtml_url;
- public $rssh_url;
- public $rclone_url;
- public $rwebsite;
- public $rstars_count;
- public $rforks_count;
- public $rwathcers_count;
- public $ropen_issues_count;
- public $rpublic_branch;
- public $rcreated_at;
- public $rupdated_at;
- public $rpermissions;
- public function __construct($api_url, $token) {
- if (!strpos($api_url, API_URL))
- $api_url = sprintf("%s/%s", API_URL, $api_url);
- parent::__construct($api_url, $token);
- }
-
- protected function json_set_property($obj) {
- foreach($obj as $key => $value) {
- $key = 'r' . $key;
- if (property_exists($this, $key))
- $this->{$key} = $value;
- }
- }
- public function __destruct() {}
- }
- }
|