99namespace Joomla \Github \Package ;
1010
1111use Joomla \Github \AbstractPackage ;
12+ use Joomla \Uri \Uri ;
1213
1314/**
1415 * GitHub API Activity class for the Joomla Framework.
@@ -70,15 +71,13 @@ public function getListOwn($type = 'all', $sort = 'full_name', $direction = '')
7071 }
7172
7273 // Build the request path.
73- $ path = '/user/repos '
74- . ' ? type= ' . $ type
75- . ' & sort= ' . $ sort
76- . ' & direction= ' . $ direction ;
74+ $ uri = new Uri ( $ this -> fetchUrl ( '/user/repos ' ));
75+ $ uri -> setVar ( ' type ' , $ type);
76+ $ uri -> setVar ( ' sort ' , $ sort);
77+ $ uri -> setVar ( ' direction ' , $ direction) ;
7778
7879 // Send the request.
79- return $ this ->processResponse (
80- $ this ->client ->get ($ this ->fetchUrl ($ path ))
81- );
80+ return $ this ->processResponse ($ this ->client ->get ($ uri ));
8281 }
8382
8483 /**
@@ -117,15 +116,13 @@ public function getListUser($user, $type = 'all', $sort = 'full_name', $directio
117116 }
118117
119118 // Build the request path.
120- $ path = '/users/ ' . $ user . '/repos '
121- . ' ? type= ' . $ type
122- . ' & sort= ' . $ sort
123- . ' & direction= ' . $ direction ;
119+ $ uri = new Uri ( $ this -> fetchUrl ( '/users/ ' . $ user . '/repos ' ));
120+ $ uri -> setVar ( ' type ' , $ type);
121+ $ uri -> setVar ( ' sort ' , $ sort);
122+ $ uri -> setVar ( ' direction ' , $ direction) ;
124123
125124 // Send the request.
126- return $ this ->processResponse (
127- $ this ->client ->get ($ this ->fetchUrl ($ path ))
128- );
125+ return $ this ->processResponse ($ this ->client ->get ($ uri ));
129126 }
130127
131128 /**
@@ -149,13 +146,11 @@ public function getListOrg($org, $type = 'all')
149146 }
150147
151148 // Build the request path.
152- $ path = '/orgs/ ' . $ org . '/repos '
153- . ' ? type= ' . $ type ;
149+ $ uri = new Uri ( $ this -> fetchUrl ( '/orgs/ ' . $ org . '/repos ' ));
150+ $ uri -> setVar ( ' type ' , $ type) ;
154151
155152 // Send the request.
156- return $ this ->processResponse (
157- $ this ->client ->get ($ this ->fetchUrl ($ path ))
158- );
153+ return $ this ->processResponse ($ this ->client ->get ($ uri ));
159154 }
160155
161156 /**
@@ -173,13 +168,15 @@ public function getListOrg($org, $type = 'all')
173168 public function getList ($ id = 0 )
174169 {
175170 // Build the request path.
176- $ path = '/repositories ' ;
177- $ path .= ($ id ) ? '?since= ' . (int ) $ id : '' ;
171+ $ uri = new Uri ($ this ->fetchUrl ('/repositories ' ));
172+
173+ if ($ id )
174+ {
175+ $ uri ->setVar ('since ' , (int ) $ id );
176+ }
178177
179178 // Send the request.
180- return $ this ->processResponse (
181- $ this ->client ->get ($ this ->fetchUrl ($ path ))
182- );
179+ return $ this ->processResponse ($ this ->client ->get ($ uri ));
183180 }
184181
185182 /**
@@ -314,14 +311,15 @@ public function edit($owner, $repo, $name, $description = '', $homepage = '', $p
314311 public function getListContributors ($ owner , $ repo , $ anon = false )
315312 {
316313 // Build the request path.
317- $ path = '/repos/ ' . $ owner . '/ ' . $ repo . '/contributors ' ;
314+ $ uri = new Uri ( $ this -> fetchUrl ( '/repos/ ' . $ owner . '/ ' . $ repo . '/contributors ' )) ;
318315
319- $ path .= ($ anon ) ? '?anon=true ' : '' ;
316+ if ($ anon )
317+ {
318+ $ uri ->setVar ('anon ' , 'true ' );
319+ }
320320
321321 // Send the request.
322- return $ this ->processResponse (
323- $ this ->client ->get ($ this ->fetchUrl ($ path ))
324- );
322+ return $ this ->processResponse ($ this ->client ->get ($ uri ));
325323 }
326324
327325 /**
0 commit comments