/**
* Constructor.
*
- * Calling the constructor will ensure that the database file and table
+ * Calling the constructor will ensure that the database file and table
* exist and will create both if they don't.
*
* @param SQLite3 $sqlite
*/
protected function doFetch($id)
{
- if ($item = $this->findById($id)) {
- return unserialize($item[self::DATA_FIELD]);
+ $item = $this->findById($id);
+
+ if (!$item) {
+ return false;
}
- return false;
+ return unserialize($item[self::DATA_FIELD]);
}
/**
*
* @return array|null
*/
- private function findById($id, $includeData = true)
+ private function findById($id, bool $includeData = true) : ?array
{
list($idField) = $fields = $this->getFields();
*
* @return array
*/
- private function getFields()
+ private function getFields() : array
{
- return array(static::ID_FIELD, static::DATA_FIELD, static::EXPIRATION_FIELD);
+ return [static::ID_FIELD, static::DATA_FIELD, static::EXPIRATION_FIELD];
}
/**
*
* @return bool
*/
- private function isExpired(array $item)
+ private function isExpired(array $item) : bool
{
return isset($item[static::EXPIRATION_FIELD]) &&
$item[self::EXPIRATION_FIELD] !== null &&