/** * Get the dashboard profil % completed * * @param User $user * * @return float */ function getPercentCompleted(User $user) { $totalToFill = 13; $completed = 0; if ($user->getPrenom()) { $completed++; } if ($user->getNom()) { $completed++; } if ($user->getTel()) { $completed++; } if ($user->getSexe()) { $completed++; } if ($user->getDob()) { $completed++; } if ($user->getArrival()) { $completed++; } if ($user->getDepart()) { $completed++; } if ($user->getEsncard()) { $completed++; } if ($user->getSexewanted()) { $completed++; } if ($user->getNationalite()) { $completed++; } if ($user->getLanguages()) { $completed++; } if ($user->getHobbies()) { $completed++; } if ($user->getUniversite()) { $completed++; } return round($completed / $totalToFill * 100); }