<?php
namespace App\Service;
use CIC\CSSC\CDES;
use CIC\CSSC\CSSC;
use CIC\CSSC\GradeBook;
use CIC\CSSC\PROGRAM;
use CIC\CSSC\REPORTCARD;
use CIC\CSSC\SINFO;
use CIC\CSSC\SREC;
use CIC\DB\envLoader\db;
class CsscHelperService
{
/**
* @var CacheService
*/
private $cache;
/**
* @var db
*/
private $db;
private $cdes;
private $cssc;
private $gradebook;
private $program;
private $reportcard;
private $sinfo;
private $srec;
public function __construct(db $db, CacheService $cache)
{
$this->cache = $cache->getCache();
$this->db = $db;
}
/**
* @return mixed
*/
public function getCdes(): ?CDES
{
if (empty($this->cdes)) {
$this->setCdes();
}
return $this->cdes;
}
/**
* @param mixed $cdes
*/
private function setCdes(): void
{
$this->cdes = new CDES($this->db, $this->cache);
}
/**
* @return mixed
*/
public function getCssc(): ?CSSC
{
if (empty($this->cssc)) {
$this->setCssc();
}
return $this->cssc;
}
/**
* @param mixed $cssc
*/
public function setCssc(): void
{
$this->cssc = new CSSC($this->db, $this->cache);
}
/**
* @return mixed
*/
public function getGradebook(): ?GradeBook
{
if (empty($this->gradebook)) {
$this->setGradebook();
}
return $this->gradebook;
}
/**
* @param mixed $gradebook
*/
private function setGradebook(): void
{
$this->gradebook = new GradeBook($this->db, $this->cache);
}
/**
* @return mixed
*/
public function getProgram(): ?PROGRAM
{
if (empty($this->program)) {
$this->setProgram();
}
return $this->program;
}
/**
* @param mixed $program
*/
private function setProgram(): void
{
$this->program = new PROGRAM($this->db, $this->cache);
}
/**
* @return mixed
*/
public function getReportcard(): ?REPORTCARD
{
if (empty($this->reportcard)) {
$this->setReportcard();
}
return $this->reportcard;
}
/**
* @param mixed $reportcard
*/
private function setReportcard(): void
{
$this->reportcard = new REPORTCARD($this->db, $this->cache);
}
/**
* @return mixed
*/
public function getSinfo(): ?SINFO
{
if (empty($this->sinfo)) {
$this->setSinfo();
}
return $this->sinfo;
}
/**
* @param mixed $sinfo
*/
private function setSinfo(): void
{
$this->sinfo = new SINFO($this->db, $this->cache);
}
/**
* @return mixed
*/
public function getSrec(): ?SREC
{
if (empty($this->srec)) {
$this->setSrec();
}
return $this->srec;
}
/**
* @param mixed $srec
*/
private function setSrec(): void
{
$this->srec = new SREC($this->db, $this->cache);
}
}