/** * Run service. * * @param array $arguments Command line arguments. * * @return boolean success */ public function run($arguments) { $this->msg('Sending due date reminders'); if (count($arguments) < 2) { $this->msg($this->getUsage()); return false; } else { $this->collectScriptArguments($arguments); } $users = $this->userTable->getUsersWithDueDateReminders(); $this->msg('Processing ' . count($users) . ' users'); foreach ($users as $user) { $remindLoans = $this->getReminders($user); if ($remindCnt = count($remindLoans)) { $this->msg("{$remindCnt} new loans to remind for user {$user->username}" . " (id {$user->id})"); $this->sendReminder($user, $remindLoans); } else { $this->msg("No loans to remind for user {$user->username} (id {$user->id})"); } } return true; }