src/Service/CsscHelperService.php line 152

Open in your IDE?
  1. <?php
  2. namespace App\Service;
  3. use CIC\CSSC\CDES;
  4. use CIC\CSSC\CSSC;
  5. use CIC\CSSC\GradeBook;
  6. use CIC\CSSC\PROGRAM;
  7. use CIC\CSSC\REPORTCARD;
  8. use CIC\CSSC\SINFO;
  9. use CIC\CSSC\SREC;
  10. use CIC\DB\envLoader\db;
  11. class CsscHelperService
  12. {
  13.     /**
  14.      * @var CacheService
  15.      */
  16.     private $cache;
  17.     /**
  18.      * @var db
  19.      */
  20.     private $db;
  21.     private $cdes;
  22.     private $cssc;
  23.     private $gradebook;
  24.     private $program;
  25.     private $reportcard;
  26.     private $sinfo;
  27.     private $srec;
  28.     public function __construct(db $dbCacheService $cache)
  29.     {
  30.         $this->cache $cache->getCache();
  31.         $this->db $db;
  32.     }
  33.     /**
  34.      * @return mixed
  35.      */
  36.     public function getCdes(): ?CDES
  37.     {
  38.         if (empty($this->cdes)) {
  39.             $this->setCdes();
  40.         }
  41.         return $this->cdes;
  42.     }
  43.     /**
  44.      * @param mixed $cdes
  45.      */
  46.     private function setCdes(): void
  47.     {
  48.         $this->cdes = new CDES($this->db$this->cache);
  49.     }
  50.     /**
  51.      * @return mixed
  52.      */
  53.     public function getCssc(): ?CSSC
  54.     {
  55.         if (empty($this->cssc)) {
  56.             $this->setCssc();
  57.         }
  58.         return $this->cssc;
  59.     }
  60.     /**
  61.      * @param mixed $cssc
  62.      */
  63.     public function setCssc(): void
  64.     {
  65.         $this->cssc = new CSSC($this->db$this->cache);
  66.     }
  67.     /**
  68.      * @return mixed
  69.      */
  70.     public function getGradebook(): ?GradeBook
  71.     {
  72.         if (empty($this->gradebook)) {
  73.             $this->setGradebook();
  74.         }
  75.         return $this->gradebook;
  76.     }
  77.     /**
  78.      * @param mixed $gradebook
  79.      */
  80.     private function setGradebook(): void
  81.     {
  82.         $this->gradebook = new GradeBook($this->db$this->cache);
  83.     }
  84.     /**
  85.      * @return mixed
  86.      */
  87.     public function getProgram(): ?PROGRAM
  88.     {
  89.         if (empty($this->program)) {
  90.             $this->setProgram();
  91.         }
  92.         return $this->program;
  93.     }
  94.     /**
  95.      * @param mixed $program
  96.      */
  97.     private function setProgram(): void
  98.     {
  99.         $this->program = new PROGRAM($this->db$this->cache);
  100.     }
  101.     /**
  102.      * @return mixed
  103.      */
  104.     public function getReportcard(): ?REPORTCARD
  105.     {
  106.         if (empty($this->reportcard)) {
  107.             $this->setReportcard();
  108.         }
  109.         return $this->reportcard;
  110.     }
  111.     /**
  112.      * @param mixed $reportcard
  113.      */
  114.     private function setReportcard(): void
  115.     {
  116.         $this->reportcard = new REPORTCARD($this->db$this->cache);
  117.     }
  118.     /**
  119.      * @return mixed
  120.      */
  121.     public function getSinfo(): ?SINFO
  122.     {
  123.         if (empty($this->sinfo)) {
  124.             $this->setSinfo();
  125.         }
  126.         return $this->sinfo;
  127.     }
  128.     /**
  129.      * @param mixed $sinfo
  130.      */
  131.     private function setSinfo(): void
  132.     {
  133.         $this->sinfo = new SINFO($this->db$this->cache);
  134.     }
  135.     /**
  136.      * @return mixed
  137.      */
  138.     public function getSrec(): ?SREC
  139.     {
  140.         if (empty($this->srec)) {
  141.             $this->setSrec();
  142.         }
  143.         return $this->srec;
  144.     }
  145.     /**
  146.      * @param mixed $srec
  147.      */
  148.     private function setSrec(): void
  149.     {
  150.         $this->srec = new SREC($this->db$this->cache);
  151.     }
  152. }