private function findById($id, bool $includeData = true) : ?array
    {
        [$idField] = $fields = $this->getFields();

        if (! $includeData) {
            $key = array_search(static::DATA_FIELD, $fields);
            unset($fields[$key]);
        }

        $statement = $this->sqlite->prepare(sprintf(
            'SELECT %s FROM %s WHERE %s = :id LIMIT 1',
            implode(',', $fields),
            $this->table,
            $idField
        ));

        $statement->bindValue(':id', $id, SQLITE3_TEXT);

        $item = $statement->execute()->fetchArray(SQLITE3_ASSOC);

        if ($item === false) {
            return null;
        }

        if ($this->isExpired($item)) {
            $this->doDelete($id);

            return null;
        }

        return $item;
    }
private function findById($id, bool $includeData = true) : ?array
    {
        [$idField] = $fields = $this->getFields();

        if (! $includeData) {
            $key = array_search(static::DATA_FIELD, $fields);
            unset($fields[$key]);
        }

        $statement = $this->sqlite->prepare(sprintf(
            'SELECT %s FROM %s WHERE %s = :id LIMIT 1',
            implode(',', $fields),
            $this->table,
            $idField
        ));

        $statement->bindValue(':id', $id, SQLITE3_TEXT);

        $item = $statement->execute()->fetchArray(SQLITE3_ASSOC);

        if ($item === false) {
            return null;
        }

        if ($this->isExpired($item)) {
            $this->doDelete($id);

            return null;
        }

        return $item;
    }
private function findById ( $ id , bool $ includeData = true ) : ? array { [ $ idField ] = $ fields = $ this -> getFields ( ) ; if ( ! $ includeData ) { $ key = array_search ( static :: DATA_FIELD , $ fields ) ; unset ( $ fields [ $ key ] ) ; } $ statement = $ this -> sqlite -> prepare ( sprintf ( 'SELECT %s FROM %s WHERE %s = :id LIMIT 1' , implode ( ',' , $ fields ) , $ this -> table , $ idField ) ) ; $ statement -> bindValue ( ':id' , $ id , SQLITE3_TEXT ) ; $ item = $ statement -> execute ( ) -> fetchArray ( SQLITE3_ASSOC ) ; if ( $ item === false ) { return null ; } if ( $ this -> isExpired ( $ item ) ) { $ this -> doDelete ( $ id ) ; return null ; } return $ item ; }
Find a single row by ID.

@param mixed $id

@return array|null
Find a single row by ID .