Skip to content

Commit

Permalink
Merge pull request #3 from adamtester/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
adcuz authored Aug 15, 2016
2 parents 2fafcb2 + db802f6 commit 1cb4a51
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class Client {

static public $base = 'http://platform.fatsecret.com/rest/server.api?format=json&';
public $maxResults = 20;

/* Private Data */
private $_consumerKey;
Expand All @@ -28,6 +29,14 @@ function SetKey($consumerKey) {
$this->_consumerKey = $consumerKey;
}

function GetMaxResults() {
return $this->maxResults;
}

function SetMaxResults($maxResults) {
$this->maxResults = $maxResults;
}

function GetSecret() {
return $this->_consumerSecret;
}
Expand All @@ -36,7 +45,7 @@ function SetSecret($consumerSecret) {
$this->_consumerSecret = $consumerSecret;
}

function SearchFood($query, $region = false, $language = false) {
function SearchFood($query, $region = false, $language = false, $maxResults = false) {

$url = Client::$base . 'method=foods.search';

Expand All @@ -50,6 +59,12 @@ function SearchFood($query, $region = false, $language = false) {
$url = $url . '&language=' . urlencode($language);
}

if ($maxResults !== false) {
$this->SetMaxResults($maxResults);

$url = $url . '&max_results=' . $this->GetMaxResults();
}

$oauth = new OAuthBase();

$normalizedUrl;
Expand Down

0 comments on commit 1cb4a51

Please sign in to comment.