@@ -44,22 +44,22 @@ public function version()
4444
4545 public function containerList ($ all = false , $ size = false )
4646 {
47- return $ this ->browser ->get ($ this ->url ('/containers/json?all= ' . $ all . ' &size= ' . $ size ))->then (array ($ this ->parser , 'expectJson ' ));
47+ return $ this ->browser ->get ($ this ->url ('/containers/json?all=%u &size=%u ' , $ all , $ size ))->then (array ($ this ->parser , 'expectJson ' ));
4848 }
4949
5050 public function containerInspect ($ container )
5151 {
52- return $ this ->browser ->get ($ this ->url ('/containers/ ' . $ container . ' /json ' ))->then (array ($ this ->parser , 'expectJson ' ));
52+ return $ this ->browser ->get ($ this ->url ('/containers/%s/json ' , $ container ))->then (array ($ this ->parser , 'expectJson ' ));
5353 }
5454
5555 public function containerTop ($ container )
5656 {
57- return $ this ->browser ->get ($ this ->url ('/containers/ ' . $ container . ' /top ' ))->then (array ($ this ->parser , 'expectJson ' ));
57+ return $ this ->browser ->get ($ this ->url ('/containers/%s/top ' , $ container ))->then (array ($ this ->parser , 'expectJson ' ));
5858 }
5959
6060 public function containerWait ($ container )
6161 {
62- return $ this ->browser ->post ($ this ->url ('/containers/ ' . $ container . ' /wait ' ))->then (array ($ this ->parser , 'expectJson ' ));
62+ return $ this ->browser ->post ($ this ->url ('/containers/%s/wait ' , $ container ))->then (array ($ this ->parser , 'expectJson ' ));
6363 }
6464
6565 /**
@@ -70,7 +70,7 @@ public function containerWait($container)
7070 */
7171 public function containerStop ($ container , $ t )
7272 {
73- return $ this ->browser ->post ($ this ->url ('/containers/ ' . $ container . ' /stop?t= ' . $ t ))->then (array ($ this ->parser , 'expectEmpty ' ));
73+ return $ this ->browser ->post ($ this ->url ('/containers/%s /stop?t=%u ' , $ container , $ t ))->then (array ($ this ->parser , 'expectEmpty ' ));
7474 }
7575
7676 /**
@@ -81,22 +81,22 @@ public function containerStop($container, $t)
8181 */
8282 public function containerRestart ($ container , $ t )
8383 {
84- return $ this ->browser ->post ($ this ->url ('/containers/ ' . $ container . ' /restart?t= ' . $ t ))->then (array ($ this ->parser , 'expectEmpty ' ));
84+ return $ this ->browser ->post ($ this ->url ('/containers/%s /restart?t=%u ' , $ container , $ t ))->then (array ($ this ->parser , 'expectEmpty ' ));
8585 }
8686
8787 public function containerKill ($ container , $ signal = null )
8888 {
89- return $ this ->browser ->post ($ this ->url ('/containers/ ' . $ container . ' /kill?signal= ' . $ signal ))->then (array ($ this ->parser , 'expectEmpty ' ));
89+ return $ this ->browser ->post ($ this ->url ('/containers/%s /kill?signal=%s ' , $ container , $ signal ))->then (array ($ this ->parser , 'expectEmpty ' ));
9090 }
9191
9292 public function containerPause ($ container )
9393 {
94- return $ this ->browser ->post ($ this ->url ('/containers/ ' . $ container . ' /pause ' ))->then (array ($ this ->parser , 'expectEmpty ' ));
94+ return $ this ->browser ->post ($ this ->url ('/containers/%s/pause ' , $ container ))->then (array ($ this ->parser , 'expectEmpty ' ));
9595 }
9696
9797 public function containerUnpause ($ container )
9898 {
99- return $ this ->browser ->post ($ this ->url ('/containers/ ' . $ container . ' /unpause ' ))->then (array ($ this ->parser , 'expectEmpty ' ));
99+ return $ this ->browser ->post ($ this ->url ('/containers/%s/unpause ' , $ container ))->then (array ($ this ->parser , 'expectEmpty ' ));
100100 }
101101
102102 /**
@@ -108,16 +108,19 @@ public function containerUnpause($container)
108108 */
109109 public function containerDelete ($ container , $ v = false , $ force = false )
110110 {
111- return $ this ->browser ->delete ($ this ->url ('/containers/ ' . $ container . ' ?v= ' . ( int ) $ v . ' &force= ' . ( int ) $ force ))->then (array ($ this ->parser , 'expectEmpty ' ));
111+ return $ this ->browser ->delete ($ this ->url ('/containers/%s ?v=%u &force=%u ' , $ container , $ v , $ force ))->then (array ($ this ->parser , 'expectEmpty ' ));
112112 }
113113
114114 public function containerResize ($ container , $ w , $ h )
115115 {
116- return $ this ->browser ->get ($ this ->url ('/containers/ ' . $ container . ' /resize?w= ' . $ w . ' &h= ' . $ h ))->then (array ($ this ->parser , 'expectEmpty ' ));
116+ return $ this ->browser ->get ($ this ->url ('/containers/%s /resize?w=%u &h=%u ' , $ container , $ w , $ h ))->then (array ($ this ->parser , 'expectEmpty ' ));
117117 }
118118
119119 private function url ($ url )
120120 {
121- return $ this ->url . $ url ;
121+ $ args = func_get_args ();
122+ array_shift ($ args );
123+
124+ return $ this ->url . vsprintf ($ url , $ args );
122125 }
123126}
0 commit comments