PSMList 0.4.0 PSM-040-048
| Ordre affichage : | 46 | Création : | 29/06/2023 09h31 |
| Index BL : | 48 | Modification : | 29/06/2023 10h01 |
| BL : | PSM-040-048 | ||
| Source : | Aucune | Soeurs : | - |
| Fin dev : | D (Done) | Ticket : | - |
| Contrôle dev effectué : | Fiche : | - | |
| C.Qualif. : | #000000 | ||
| Activé : | Icône FA : | Par défaut | |
| Contact : | ARS - Arshellan | Qualification : | Nouveauté |
| Répartition : | - | Module : | Data |
| Dev : | ARS - Arshellan | Sous module : | - |
| Provenance : | 0.4.0 New | Constat : | - |
| Début : | S.26 | Charge j. : | - |
| Fin : | S.26 | Délai j. : | - |
| Priorité : | - | Pokercard : | - |
| Estimatif j. : | - | ||
| Description : | Global strategy for slugname length. | ||
| Texte Commit : | - | ||
| Description client : | The gst now holds a "global" variable for the strategy slugname length, and a function to access it. Also reworked tsafe_str so it works with it. | ||
| Fascicule : | Ne pas communiquer : | ||
| Alerte Mailing : |
| Statut PreP : | OK - Validé | Testeur : | ARS - Arshellan |
/**<br/> * Returns a random uppercase string of the desired length, only using read-safe letters and numbers.<br/> * If no length is specified, it uses the default strategy length.<br/> * @param int|null $length Number of characters in the returned string<br/> * @return string<br/> */<br/> public function random_safe_str(?int $length = null) :string {<br/> $entityClasses = [Ship::class, Crew::class, Treasure::class, Keyword::class];<br/> $characters = '123456789ABCDEFGHJKLMNPQRSTUVWXYZ';<br/><br/> // Use the default strategy if the parameter isn't specified<br/> $length = $length ?? $this->getStrategySlugnameLength();<br/><br/> // Generate new slugnames until we got one that's unique<br/> do {<br/> $randomString = '';<br/> for ($i = 0; $i < $length; $i++) {<br/> $index = rand(0, strlen($characters) - 1);<br/> $randomString .= $characters[$index];<br/> }<br/> } while ($this->doesSlugnameExists($entityClasses, $randomString));<br/><br/> return $randomString;<br/> }