vendor/novosga/core/Entity/Perfil.php line 154

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Novo SGA project.
  4.  *
  5.  * (c) Rogerio Lino <rogeriolino@gmail.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Novosga\Entity;
  11. /**
  12.  * Classe Perfil
  13.  * O perfil define permissões de acesso a módulos do sistema.
  14.  *
  15.  * @author Rogerio Lino <rogeriolino@gmail.com>
  16.  */
  17. class Perfil implements \JsonSerializable
  18. {
  19.     /**
  20.      * @var mixed
  21.      */
  22.     protected $id;
  23.     
  24.     /**
  25.      * @var string
  26.      */
  27.     private $nome;
  28.     /**
  29.      * @var string
  30.      */
  31.     private $descricao;
  32.     /**
  33.      * @var Modulo[]
  34.      */
  35.     private $modulos;
  36.     /**
  37.      * @var \DateTime
  38.      */
  39.     private $createdAt;
  40.     /**
  41.      * @var \DateTime
  42.      */
  43.     private $updatedAt;
  44.     
  45.     public function __construct()
  46.     {
  47.         $this->modulos = [];
  48.     }
  49.     
  50.     public function getId()
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function setId($id): self
  55.     {
  56.         $this->id $id;
  57.         return $this;
  58.     }
  59.     
  60.     /**
  61.      * Define o nome do perfil.
  62.      *
  63.      * @param string $nome
  64.      */
  65.     public function setNome($nome): self
  66.     {
  67.         $this->nome $nome;
  68.         return $this;
  69.     }
  70.     /**
  71.      * Retorna a descrição do perfil.
  72.      *
  73.      * @return int
  74.      */
  75.     public function getDescricao()
  76.     {
  77.         return $this->descricao;
  78.     }
  79.     /**
  80.      * Define a descrição do perfil.
  81.      *
  82.      * @param string $descricao
  83.      */
  84.     public function setDescricao($descricao): self
  85.     {
  86.         $this->descricao $descricao;
  87.         return $this;
  88.     }
  89.     /**
  90.      * Retorna o nome do perfil.
  91.      *
  92.      * @return string
  93.      */
  94.     public function getNome()
  95.     {
  96.         return $this->nome;
  97.     }
  98.     public function getModulos()
  99.     {
  100.         return $this->modulos;
  101.     }
  102.     public function setModulos($modulos): self
  103.     {
  104.         $this->modulos $modulos;
  105.         return $this;
  106.     }
  107.     
  108.     public function getCreatedAt()
  109.     {
  110.         return $this->createdAt;
  111.     }
  112.     public function getUpdatedAt()
  113.     {
  114.         return $this->updatedAt;
  115.     }
  116.     public function setCreatedAt(\DateTime $createdAt): self
  117.     {
  118.         $this->createdAt $createdAt;
  119.         return $this;
  120.     }
  121.     public function setUpdatedAt(\DateTime $updatedAt): self
  122.     {
  123.         $this->updatedAt $updatedAt;
  124.         
  125.         return $this;
  126.     }
  127.     public function __toString()
  128.     {
  129.         return $this->nome;
  130.     }
  131.     public function jsonSerialize()
  132.     {
  133.         return [
  134.             'id'        => $this->getId(),
  135.             'nome'      => $this->getNome(),
  136.             'descricao' => $this->getDescricao(),
  137.             'modulos'   => $this->getModulos(),
  138.             'createdAt' => $this->getCreatedAt() ? $this->getCreatedAt()->format('Y-m-d\TH:i:s') : null,
  139.             'updatedAt' => $this->getUpdatedAt() ? $this->getUpdatedAt()->format('Y-m-d\TH:i:s') : null,
  140.         ];
  141.     }
  142. }