mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-26 13:34:01 +01:00
48 lines
779 B
PHP
48 lines
779 B
PHP
<?php
|
|
|
|
namespace Infinito\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;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function hasClass(): bool
|
|
{
|
|
return isset($this->class);
|
|
}
|
|
}
|