src/Elasticsearch/Contexte.php line 16

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * Copyright (C) Office National de Publication et de Communication - All Rights Reserved
  5.  *
  6.  * Unauthorized copying of this file, via any medium is strictly prohibited by law
  7.  * This file is proprietary and confidential
  8.  */
  9. namespace App\Elasticsearch;
  10. use App\Entity\Etablissement;
  11. final class Contexte
  12. {
  13.     /**
  14.      * @var string
  15.      */
  16.     public $quoi;
  17.     /**
  18.      * @var string
  19.      */
  20.     public $lieu;
  21.     /**
  22.      * @var array
  23.      */
  24.     public $ids = [];
  25.     public function __construct(string $quoistring $lieu)
  26.     {
  27.         $this->quoi $quoi;
  28.         $this->lieu $lieu;
  29.     }
  30.     public function getBounds(Etablissement $establishment): array
  31.     {
  32.         $previous null;
  33.         $next null;
  34.         $position array_search($establishment->getId(), $this->idstrue);
  35.         if (null !== $position && \count($this->ids) > 1) {
  36.             $previous $this->ids[$position 1] ?? null;
  37.             $next $this->ids[$position 1] ?? reset($this->ids);
  38.         }
  39.         return [$previous$next];
  40.     }
  41.     public function hasEstablishment(Etablissement $establishment): bool
  42.     {
  43.         return \in_array($establishment->getId(), $this->idstrue);
  44.     }
  45. }