Skip to content
Snippets Groups Projects
Select Git revision
  • e34dbe1fe5a9827e535edae1dc8319a3e4ab1a19
  • master default protected
  • php84
  • 6.x
  • ll-api-test
  • modif_maintenance_phtml
  • 6.0.x
  • detached2
  • detached
  • php82
  • feature_SearchAndSelectFilter
  • 5.x
  • 4.x
  • 7.3.1
  • 6.3.1
  • 7.3.0
  • 6.3.0
  • 6.2.1
  • 7.2.1
  • 7.2.0
  • 6.2.0
  • 7.1.0
  • 7.0.0
  • 1.1.1
  • 6.1.7
  • 6.1.6
  • 6.1.5
  • 6.0.16
  • 6.0.15
  • 6.1.4
  • 6.0.14
  • 6.1.3
  • 6.0.13
33 results

Controleurs.dokuwiki

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ArrayContainer.php 1.01 KiB
    <?php
    
    namespace UnicaenAlerte\Container\Array;
    
    use UnicaenAlerte\Container\ContainerInterface;
    use UnicaenAlerte\Entity\Db\Alerte;
    
    /**
     * Container basique de type tableau permettant d'ajouter manuellement des alertes.
     */
    class ArrayContainer implements ContainerInterface
    {
        /**
         * Alertes à afficher.
         * @var Alerte[]
         */
        protected array $alertes = [];
    
        public function addAlerte(Alerte $alerte): self
        {
            $this->alertes[] = $alerte;
    
            return $this;
        }
    
        public function addAlerteNew(string $text,
                                     string $title,
                                     string $severity = Alerte::SEVERITY_INFO,
                                     int    $duration = 0): self
        {
            $alerte = Alerte::create(uniqid('ALERTE_'), $text, $title, $severity, $duration);
    
            return $this->addAlerte($alerte);
        }
    
        /**
         * @return array|\UnicaenAlerte\Entity\Db\Alerte[]
         */
        public function fetchAlertes(): array
        {
            return $this->alertes;
        }
    }