mmi-correction-tp03/classes/class.Video.php
2015-04-07 21:25:31 +02:00

545 lines
9.6 KiB
PHP

<?php
class Video
{
/**
* @var integer $id Identifiant de la vidéo
*/
protected $id;
/**
* @var string $titre Titre de la vidéo
*/
protected $titre;
/**
* @var string $duree Durée de la vidéo en minutes
*/
protected $duree;
/**
* @var string $nom Fichier vidéo
*/
protected $fichier;
/**
* @var string $nom Image de la vidéo
*/
protected $image;
/**
* @var string $synopsis Synopsis de la vidéo
*/
protected $synopsis;
/**
* @var string $annee Année de la vidéo
*/
protected $annee;
/**
* @var mixed[] $types Types
*/
protected $types = [];
/**
* @var mixed[] $formats Formats
*/
protected $formats = [];
/**
* @var mixed[] $categories Catégories
*/
protected $categories = [];
/**
* @var mixed[] $acteurs Acteurs
*/
protected $acteurs = [];
/**
* @var mixed[] $realisateurs Réalisateurs
*/
protected $realisateurs = [];
/**
* @var mixed[] $pays Pays
*/
protected $pays = [];
/**
* @param integer|null $id
* @return Pays
*/
public function setId($id)
{
$this->id = (int) $id;
return $this;
}
/**
* @return integer|null
*/
public function getId()
{
return $this->id;
}
/**
* @param string $titre
* @return Video
*/
public function setTitre($titre)
{
if ('' === trim((string) $titre)) {
throw new InvalidArgumentException('Le titre ne peut pas être vide.');
}
$this->titre = (string) $titre;
return $this;
}
/**
* @return string|null
*/
public function getTitre()
{
return $this->titre;
}
/**
* @param integer $duree
* @return Video
*/
public function setDuree($duree)
{
$this->duree = (int) $duree;
return $this;
}
/**
* @return integer|null
*/
public function getDuree()
{
return $this->duree;
}
/**
* @param string $fichier
* @return Video
*/
public function setFichier($fichier)
{
if ('' === trim((string) $fichier)) {
throw new InvalidArgumentException('Le fichier ne peut pas être vide.');
}
$this->fichier = (string) $fichier;
return $this;
}
/**
* @return string|null
*/
public function getFichier()
{
return $this->fichier;
}
/**
* @param string $image
* @return Video
*/
public function setImage($image)
{
if ('' === trim((string) $image)) {
throw new InvalidArgumentException('L\'image ne peut pas être vide.');
}
$this->image = (string) $image;
return $this;
}
/**
* @return string|null
*/
public function getImage()
{
return $this->image;
}
/**
* @param string $synopsis
* @return Video
*/
public function setSynopsis($synopsis)
{
$this->synopsis = (string) $synopsis;
return $this;
}
/**
* @return string|null
*/
public function getSynopsis()
{
return $this->synopsis;
}
/**
* @param integer $annee
* @return Video
*/
public function setAnnee($annee)
{
$this->annee = (int) $annee;
return $this;
}
/**
* @return integer|null
*/
public function getAnnee()
{
return $this->annee;
}
/**
* @param Type $type
* @return boolean La vidéo est associée au type
*/
public function hasType(Type $type)
{
foreach ($this->getTypes() as $p) {
if ($p === $type) {
return true;
}
}
return false;
}
/**
* @param Type $type
* @return Video
*/
public function addType(Type $type)
{
if ($this->hasType($type)) {
return $this;
}
$this->types[] = $type;
$type->addVideo($this);
return $this;
}
/**
* @param mixed[] $types
* @return Video
*/
public function setTypes(array $types)
{
$this->types = [];
foreach ($this->getTypes() as $v) {
$this->addType($v);
}
return $this;
}
/**
* @return mixed[] $types
*/
public function getTypes()
{
return $this->types;
}
/**
* @param Format $format
* @return boolean La vidéo est associée au format
*/
public function hasFormat(Format $format)
{
foreach ($this->getFormats() as $p) {
if ($p === $format) {
return true;
}
}
return false;
}
/**
* @param Format $format
* @return Video
*/
public function addFormat(Format $format)
{
if ($this->hasFormat($format)) {
return $this;
}
$this->formats[] = $format;
$format->addVideo($this);
return $this;
}
/**
* @param mixed[] $formats
* @return Video
*/
public function setFormats(array $formats)
{
$this->formats = [];
foreach ($formats as $v) {
$this->addFormat($v);
}
return $this;
}
/**
* @return mixed[] $formats
*/
public function getFormats()
{
return $this->formats;
}
/**
* @param Categorie $categorie
* @return boolean La vidéo est associée à la categorie
*/
public function hasCategorie(Categorie $categorie)
{
foreach ($this->getCategories() as $p) {
if ($p === $categorie) {
return true;
}
}
return false;
}
/**
* @param Categorie $categorie
* @return Video
*/
public function addCategorie(Categorie $categorie)
{
if ($this->hasCategorie($categorie)) {
return $this;
}
$this->categories[] = $categorie;
$categorie->addVideo($this);
return $this;
}
/**
* @param mixed[] $categories
* @return Video
*/
public function setCategories(array $categories)
{
$this->categories = [];
foreach ($categories as $v) {
$this->addCategorie($v);
}
return $this;
}
/**
* @return mixed[] $categories
*/
public function getCategories()
{
return $this->categories;
}
/**
* @param Pays $pays
* @return boolean La vidéo est associée au pays
*/
public function hasPays(Pays $pays)
{
foreach ($this->getPays() as $p) {
if ($p === $pays) {
return true;
}
}
return false;
}
/**
* @param Pays $pays
* @return Video
*/
public function addPays(Pays $pays)
{
if ($this->hasPays($pays)) {
return $this;
}
$this->pays[] = $pays;
$pays->addVideo($this);
return $this;
}
/**
* @param mixed[] $pays
* @return Video
*/
public function setPayss(array $pays)
{
$this->pays = [];
foreach ($this->getPays() as $v) {
$this->addPays($v);
}
return $this;
}
/**
* @return mixed[] $pays
*/
public function getPays()
{
return $this->pays;
}
/**
* @param Participant $acteur
* @return boolean La vidéo est associée au acteur
*/
public function hasActeur(Participant $acteur)
{
foreach ($this->getActeurs() as $p) {
if ($p === $acteur) {
return true;
}
}
return false;
}
/**
* @param Participant $acteur
* @return Video
*/
public function addActeur(Participant $acteur)
{
if ($this->hasActeur($acteur)) {
return $this;
}
$this->acteurs[] = $acteur;
$acteur->addVideoJouee($this);
return $this;
}
/**
* @param mixed[] $acteurs
* @return Video
*/
public function setActeurs(array $acteurs)
{
$this->acteurs = [];
foreach ($acteurs as $v) {
$this->addActeur($v);
}
return $this;
}
/**
* @return mixed[] $acteurs
*/
public function getActeurs()
{
return $this->acteurs;
}
/**
* @param Participant $realisateur
* @return boolean La vidéo est associée au realisateur
*/
public function hasRealisateur(Participant $realisateur)
{
foreach ($this->getRealisateurs() as $p) {
if ($p === $realisateur) {
return true;
}
}
return false;
}
/**
* @param Participant $realisateur
* @return Video
*/
public function addRealisateur(Participant $realisateur)
{
if ($this->hasRealisateur($realisateur)) {
return $this;
}
$this->realisateurs[] = $realisateur;
$realisateur->addVideoRealisee($this);
return $this;
}
/**
* @param mixed[] $realisateurs
* @return Video
*/
public function setRealisateurs(array $realisateurs)
{
$this->realisateurs = [];
foreach ($realisateurs as $v) {
$this->addRealisateur($v);
}
return $this;
}
/**
* @return mixed[] $realisateurs
*/
public function getRealisateurs()
{
return $this->realisateurs;
}
}