| | <?php |
| |
|
| | namespace Kanboard\Model; |
| |
|
| | use Pimple\Container; |
| | use Kanboard\Core\Base; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | abstract class NotificationTypeModel extends Base |
| | { |
| | |
| | |
| | |
| | |
| | |
| | |
| | private $classes; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | private $labels = array(); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | private $hiddens = array(); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function __construct(Container $container) |
| | { |
| | parent::__construct($container); |
| | $this->classes = new Container; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function setType($type, $label, $class, $hidden = false) |
| | { |
| | $container = $this->container; |
| |
|
| | if ($hidden) { |
| | $this->hiddens[] = $type; |
| | } else { |
| | $this->labels[$type] = $label; |
| | } |
| |
|
| | $this->classes[$type] = function () use ($class, $container) { |
| | return new $class($container); |
| | }; |
| |
|
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getType($type) |
| | { |
| | return $this->classes[$type]; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getTypes() |
| | { |
| | return $this->labels; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getHiddenTypes() |
| | { |
| | return $this->hiddens; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function filterTypes(array $types) |
| | { |
| | $classes = $this->classes; |
| |
|
| | return array_filter($types, function ($type) use ($classes) { |
| | return isset($classes[$type]); |
| | }); |
| | } |
| | } |
| |
|