Skip to content

Commit

Permalink
Prepare a feature to send the book by email (Send to Kindle). re #53
Browse files Browse the repository at this point in the history
  • Loading branch information
seblucas committed May 15, 2013
1 parent a561841 commit 4bbb2fa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions book.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,21 @@ public function getDatas ()
}
return $this->datas;
}

public function GetMostInterestingDataToSendToKindle ()
{
$bestFormatForKindle = array ("PDF", "MOBI");
$bestRank = -1;
$bestData = NULL;
foreach ($this->getDatas () as $data) {
$key = array_search ($data->format, $bestFormatForKindle);
if ($key !== false && $key > $bestRank) {
$bestRank = $key;
$bestData = $data;
}
}
return $bestData;
}

public function getDataById ($idData)
{
Expand Down

0 comments on commit 4bbb2fa

Please sign in to comment.