22
33namespace Github \Api ;
44
5+ use Github \Exception \InvalidArgumentException ;
6+
57/**
68 * Searching organizations, getting organization information
79 * and managing authenticated organization account information.
@@ -30,35 +32,32 @@ public function show($name)
3032
3133 /**
3234 * List all repositories across all the organizations that you can access
33- * http://develop .github.202132.xyz/p/orgs.html
35+ * @link http://developer .github.202132.xyz/v3/repos/#list-organization-repositories
3436 *
3537 * @param string $name the user name
38+ * @param string $type the type of repositories
3639 * @return array the repositories
3740 */
38- public function getAllRepos ($ name )
41+ public function getAllRepos ($ name, $ type = ' all ' )
3942 {
40- $ response = $ this ->get ('organizations/repositories ' );
41-
42- return $ response ['repositories ' ];
43+ return $ this ->get ('orgs/ ' .urlencode ($ name ).'/repos?type= ' .urlencode ($ type ));
4344 }
4445
4546 /**
4647 * List all public repositories of any other organization
47- * http://develop .github.202132.xyz/p/orgs.html
48+ * @link http://developer .github.202132.xyz/v3/repos/#list-organization-repositories
4849 *
4950 * @param string $name the organization name
5051 * @return array the repositories
5152 */
5253 public function getPublicRepos ($ name )
5354 {
54- $ response = $ this ->get ('organizations/ ' .urlencode ($ name ).'/public_repositories ' );
55-
56- return $ response ['repositories ' ];
55+ return $ this ->getAllRepos ($ name , 'public ' );
5756 }
5857
5958 /**
6059 * List all public members of that organization
61- * @link http://developer.github.com/v3/orgs/members/
60+ * @link http://developer.github.com/v3/orgs/members/#list-members
6261 *
6362 * @param string $name the organization name
6463 * @return array the members
@@ -70,7 +69,7 @@ public function getPublicMembers($name)
7069
7170 /**
7271 * Check that user is in that organization
73- * @link http://developer.github.com/v3/orgs/members/
72+ * @link http://developer.github.com/v3/orgs/members/#get-member
7473 *
7574 * @param string $name the organization name
7675 * @param string $user the user
@@ -83,7 +82,7 @@ public function getPublicMember($name, $user)
8382
8483 /**
8584 * List all teams of that organization
86- * @link http://developer.github.com/v3/orgs/teams/
85+ * @link http://developer.github.com/v3/orgs/teams/#list-teams
8786 *
8887 * @param string $name the organization name
8988 * @return array the teams
@@ -95,7 +94,7 @@ public function getTeams($name)
9594
9695 /**
9796 * Get team with given id of that organization
98- * @link http://developer.github.com/v3/orgs/teams/
97+ * @link http://developer.github.com/v3/orgs/teams/#get-team
9998 *
10099 * @param string $name the organization name
101100 * @param string $id id of team
@@ -108,21 +107,21 @@ public function getTeam($name, $id)
108107
109108 /**
110109 * Add a team to that organization
111- * @link http://developer.github.com/v3/orgs/teams/
110+ * @link http://developer.github.com/v3/orgs/teams/#create-team
112111 *
113- * @param string $organization the organization name
114- * @param string $team name of the new team
115- * @param string $permission its permission [PULL|PUSH|ADMIN]
116- * @param array $repositories (optional) its repositories names
112+ * @param string $organization the organization name
113+ * @param string $team name of the new team
114+ * @param string $permission its permission [PULL|PUSH|ADMIN]
115+ * @param array $repositories (optional) its repositories names
117116 *
118- * @return array the teams
117+ * @return array the teams
119118 *
120- * @throws \ InvalidArgumentException
119+ * @throws InvalidArgumentException
121120 */
122121 public function addTeam ($ organization , $ team , $ permission = 'pull ' , array $ repositories = array ())
123122 {
124123 if (!in_array ($ permission , array (self ::ADMIN , self ::PUSH , self ::PULL ))) {
125- throw new \ InvalidArgumentException ("Invalid value for the permission variable " );
124+ throw new InvalidArgumentException ("Invalid value for the permission variable " );
126125 }
127126
128127 return $ this ->post ('orgs/ ' .urlencode ($ organization ).'/teams ' , array (
0 commit comments