mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-28 22:44:00 +01:00
40 lines
652 B
PHP
40 lines
652 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Attribut;
|
||
|
|
||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||
|
|
||
|
/**
|
||
|
* @see ClassAttributInterface
|
||
|
*
|
||
|
* @author kevinfrantz
|
||
|
*/
|
||
|
trait ClassAttribut
|
||
|
{
|
||
|
/**
|
||
|
* @var string
|
||
|
*/
|
||
|
private $class;
|
||
|
|
||
|
/**
|
||
|
* @param string $class
|
||
|
*/
|
||
|
public function setClass(string $class): void
|
||
|
{
|
||
|
if (class_exists($class)) {
|
||
|
$this->class = $class;
|
||
|
|
||
|
return;
|
||
|
}
|
||
|
throw new NotFoundHttpException('Class '.$class.' couldn\'t be found!');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getClass(): string
|
||
|
{
|
||
|
return $this->class;
|
||
|
}
|
||
|
}
|