| Total Complexity | 8 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class Badge extends \KodiComponents\Navigation\Badge |
||
| 8 | { |
||
| 9 | // fix KodiComponents for bootstrap 4 |
||
| 10 | // http://bootstrap-4.ru/docs/4.0/migration/#labels-and-badges |
||
| 11 | use HtmlAttributes; |
||
| 12 | |||
| 13 | public function __construct($value = null, $priority = 0) |
||
| 14 | { |
||
| 15 | if (! is_null($value)) { |
||
| 16 | $this->setValue($value); |
||
| 17 | } |
||
| 18 | |||
| 19 | $this->setPriority($priority); |
||
| 20 | |||
| 21 | $this->setHtmlAttribute('class', 'badge'); |
||
| 22 | } |
||
| 23 | |||
| 24 | // end fix |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param null $view |
||
| 28 | */ |
||
| 29 | public $view; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return array |
||
| 33 | */ |
||
| 34 | public function toArray() |
||
| 35 | { |
||
| 36 | $value = $this->getValue(); |
||
| 37 | |||
| 38 | if (! $this->hasClassProperty('badge-', 'bg-')) { |
||
| 39 | $this->setHtmlAttribute('class', 'badge-primary'); |
||
| 40 | } |
||
| 41 | |||
| 42 | return [ |
||
| 43 | 'value' => $value, |
||
| 44 | 'attributes' => $this->htmlAttributesToString(), |
||
| 45 | ]; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return null|string |
||
| 50 | */ |
||
| 51 | public function getView() |
||
| 52 | { |
||
| 53 | if ($this->view) { |
||
| 54 | return $this->view; |
||
| 55 | } |
||
| 56 | |||
| 57 | return '_partials.navigation.badge'; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param $view |
||
| 62 | */ |
||
| 63 | public function setView($view = null) |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @param null $view |
||
|
|
|||
| 70 | * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory |
||
| 71 | */ |
||
| 72 | public function render($view = null) |
||
| 75 | } |
||
| 76 | } |
||
| 77 |