1<?php 2/** 3 * Matomo - free/libre analytics platform 4 * 5 * @link https://matomo.org 6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later 7 * 8 */ 9namespace Piwik\Plugins\CoreHome\SystemSummary; 10 11/** 12 * This class can be used to add a new entry / item to the system summary widget. 13 * 14 * @api 15 */ 16class Item 17{ 18 private $key; 19 private $label; 20 private $value; 21 private $urlParams; 22 private $icon; 23 private $order; 24 25 /** 26 * Item constructor. 27 * @param string $key The key or ID for this item. The entry in the widget will have this class so it is possible 28 * to style it individually and other plugins can use this key to for example remove this item 29 * from the list of system summary items. 30 * @param string $label The label that will be displayed for this item. The label may already include the value such as "5 segments" 31 * @param string|null $value Optional label. If given, the value will be displayed after the label separated by a colon, eg: "Segments: 5" 32 * @param array|null $urlParams Optional URL to make the item clickable. Accepts an array of URL parameters that need to be modfified. 33 * @param string $icon Optional icon css class, eg "icon-user". 34 * @param int $order Optional sort order. The lower the value, the higher up the entry will be shown 35 */ 36 public function __construct($key, $label, $value = null, $urlParams = null, $icon = '', $order = 99) 37 { 38 $this->key = $key; 39 $this->label = $label; 40 $this->value = $value; 41 $this->urlParams = $urlParams; 42 $this->icon = $icon; 43 $this->order = $order; 44 } 45 46 /** 47 * @return string 48 */ 49 public function getKey() 50 { 51 return $this->key; 52 } 53 54 /** 55 * @return string 56 */ 57 public function getLabel() 58 { 59 return $this->label; 60 } 61 62 /** 63 * @return mixed 64 */ 65 public function getValue() 66 { 67 return $this->value; 68 } 69 70 /** 71 * @return array|null 72 */ 73 public function getUrlParams() 74 { 75 return $this->urlParams; 76 } 77 78 /** 79 * @return string 80 */ 81 public function getIcon() 82 { 83 return $this->icon; 84 } 85 86 /** 87 * @return int 88 */ 89 public function getOrder() 90 { 91 return $this->order; 92 } 93 94} 95