/**
  * Log an action in the database.
  *
  * @param \PDO  $pdo    PDO instance.
  * @param int   $action Action ID in SimplePMSAction enum class.
  * @param array $param  Array of parameters for the log message.
  *
  * @return bool PDO execute response to the insert.
  */
 public static function log(\PDO $pdo, $action, $param)
 {
     $message = self::getMessage($action, $param);
     $sql = 'INSERT INTO ' . self::TABLE_LOG . ' (created, message) 
             VALUES (:created, :message)';
     $stmt = $pdo->prepare($sql);
     $stmt->bindValue(':created', SimplePMS::microtime());
     $stmt->bindValue(':message', $message);
     return $stmt->execute();
 }
 /**
  * Make sure the message content has been successfully saved.
  *
  * @param string $base64Content Base64 encoded content.
  *
  * @throws \Exception Checksum doesn't match the content.
  */
 public function validate($base64Content)
 {
     if ($this->checksum !== SimplePMS::generateChecksum($base64Content)) {
         throw new \Exception('Message #' . $this->id . ': could not validate checksum against content');
     }
 }
 /**
  * Call the manager without setting PDO instance first.
  *
  * @expectedException \Exception
  * @expectedExceptionMessage Database connection was not set
  */
 public function testUnsetManager()
 {
     $spms = new SimplePMS();
     $spms->receive();
 }