@@ -18,16 +18,16 @@ public function __construct(array $config)
1818 $ installation_url = @$ config ['installation_url ' ];
1919 $ api_key = @$ config ['api_key ' ];
2020
21- if (! isset ($ list_id )) {
22- throw new \Exception ("Required config parameter [list_id] is not set " , 1 );
21+ if (empty ($ list_id )) {
22+ throw new \Exception ("Required config parameter [list_id] is not set or empty " , 1 );
2323 }
2424
25- if (! isset ($ installation_url )) {
26- throw new \Exception ("Required config parameter [installation_url] is not set " , 1 );
25+ if (empty ($ installation_url )) {
26+ throw new \Exception ("Required config parameter [installation_url] is not set or empty " , 1 );
2727 }
2828
29- if (! isset ($ api_key )) {
30- throw new \Exception ("Required config parameter [api_key] is not set " , 1 );
29+ if (empty ($ api_key )) {
30+ throw new \Exception ("Required config parameter [api_key] is not set or empty " , 1 );
3131 }
3232
3333 $ this ->list_id = $ list_id ;
@@ -37,7 +37,7 @@ public function __construct(array $config)
3737
3838 public function setListId ($ list_id )
3939 {
40- if (! isset ($ list_id )) {
40+ if (empty ($ list_id )) {
4141 throw new \Exception ("Required config parameter [list_id] is not set " , 1 );
4242 }
4343
@@ -144,15 +144,16 @@ public function subcount($list = "")
144144 {
145145 $ type = 'api/subscribers/active-subscriber-count.php ' ;
146146
147+ //if a list is passed in use it, otherwise use $this->list_id
148+ if (empty ($ list )) {
149+ $ list = $ this ->list_id ;
150+ }
151+
147152 //handle exceptions
148- if ($ list== "" && $ this -> list_id == "" ) {
153+ if (empty ( $ list) ) {
149154 throw new \Exception ("method [subcount] requires parameter [list] or [ $ this ->list_id ] to be set. " , 1 );
150155 }
151156
152- //if a list is passed in use it, otherwise use $this->list_id
153- if ($ list == "" ) {
154- $ list = $ this ->list_id ;
155- }
156157
157158 //Send request for subcount
158159 $ result = $ this ->buildAndSend ($ type , array (
@@ -178,12 +179,12 @@ public function subcount($list = "")
178179 private function buildAndSend ($ type , array $ values )
179180 {
180181 //error checking
181- if (! isset ($ type )) {
182- throw new \Exception ("Required config parameter [type] is not set " , 1 );
182+ if (empty ($ type )) {
183+ throw new \Exception ("Required config parameter [type] is not set or empty " , 1 );
183184 }
184185
185- if (! isset ($ values )) {
186- throw new \Exception ("Required config parameter [values] is not set " , 1 );
186+ if (empty ($ values )) {
187+ throw new \Exception ("Required config parameter [values] is not set or empty " , 1 );
187188 }
188189
189190 //Global options for return
0 commit comments