-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hi!
What do you think about using switch (not if) in read function? More readable, more fast (if you need to use a lot of api/params). Less chance to make error when adding other "if". What do you think?
function read($model, $queryData = array()) {
switch ($queryData['fields']) {
case 'people' : if (!empty($queryData['conditions']['username'])) {
$url = 'flickr.people.findByUsername&' . $this->_buildParams(array(
'username',
), $queryData, true);}
break;
case 'photos' : if (!empty($queryData['conditions']['photoset_id'])) {
$url = 'flickr.photosets.getPhotos&' . $this->_buildParams(array(
'photoset_id',
), $queryData, true);}
break;
case 'sizes' : if (!empty($queryData['conditions']['photo_id'])) {
$url = 'flickr.photos.getSizes&' . $this->_buildParams(array(
'photo_id',
), $queryData, true);}
break;
case 'sets' : if (!empty($queryData['conditions']['user_id'])) {
$url = 'flickr.photosets.getList&' . $this->_buildParams(array(
'photo_id',
), $queryData, true);}
break;
default:
}
return $this->_request($url);
}
Metadata
Metadata
Assignees
Labels
No labels