mmi-correction-tp03/classes/class.Format.php
2015-04-07 19:11:26 +02:00

89 lines
1.4 KiB
PHP

<?php
class Format
{
/**
* @var integer $id Identifiant du format
*/
protected $id;
/**
* @var string $lib Lib du format
*/
protected $lib;
/**
* @var boolean $normalise
*/
protected $normalise;
/**
* @param string $lib Lib du format
*/
public function __construct($lib)
{
$this->setLib($lib);
}
/**
* @param integer $id
* @return Format
*/
public function setId($id)
{
$this->id = (int) $id;
return $this;
}
/**
* @return integer|null
*/
public function getId()
{
return $this->id;
}
/**
* @param string $lib
* @return Format
*/
public function setLib($lib)
{
if ('' === trim((string) $lib)) {
throw new InvalidArgumentException('La lib ne peut pas être vide.');
}
$this->lib = $lib;
return $this;
}
/**
* @return string|null
*/
public function getLib()
{
return $this->lib;
}
/**
* @param string $lib
* @return Format
*/
public function setNormalise($normalise)
{
$this->normalise = (bool) $normalise;
return $this;
}
/**
* @return boolean
*/
public function getNormalise()
{
return (bool) $this->normalise;
}
}