mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-02-12 11:31:07 +01:00
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Cachet.
|
|
*
|
|
* (c) Alt Three Services Limited
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace CachetHQ\Cachet\Presenters;
|
|
|
|
use CachetHQ\Cachet\Presenters\Traits\TimestampsTrait;
|
|
|
|
class ComponentPresenter extends AbstractPresenter
|
|
{
|
|
use TimestampsTrait;
|
|
|
|
/**
|
|
* Returns the override class name for theming.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function status_color()
|
|
{
|
|
switch ($this->wrappedObject->status) {
|
|
case 1: return 'greens';
|
|
case 2: return 'blues';
|
|
case 3: return 'yellows';
|
|
case 4: return 'reds';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Convert the presenter instance to an array.
|
|
*
|
|
* @return string[]
|
|
*/
|
|
public function toArray()
|
|
{
|
|
return array_merge($this->wrappedObject->toArray(), [
|
|
'created_at' => $this->created_at(),
|
|
'updated_at' => $this->updated_at(),
|
|
'status_name' => $this->wrappedObject->humanStatus,
|
|
]);
|
|
}
|
|
}
|