Skip to content
Snippets Groups Projects
Select Git revision
  • test
  • master default protected
  • release_3.0.0
  • feature_pre_sql
  • develop
  • 3.0.1
  • 3.0.0
  • 2.3.0
  • 2.2.0
  • 2.1.0
  • 2.0.0
  • 1.3.7
  • 1.3.6
  • 1.3.5
  • 1.3.4
  • 1.3.3
  • 1.3.2
  • 1.3.1
  • 1.3.0
  • 1.2.6
  • 1.2.5
  • 1.2.4
  • 1.2.3
  • 1.2.2
  • 1.2.1
25 results

auto.version.local.php.dist

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;
        }
    }