| 1 | <?php |
| 2 | |
| 3 | namespace Wikimedia\WRStats; |
| 4 | |
| 5 | /** |
| 6 | * Base class for entity keys. An entity key is an array of storage key |
| 7 | * components which can be used to distinguish stats with the same metric name. |
| 8 | * The entity key object also carries a global flag which is passed through to |
| 9 | * the store. |
| 10 | * |
| 11 | * @since 1.39 |
| 12 | */ |
| 13 | abstract class EntityKey { |
| 14 | /** @var array */ |
| 15 | private $components; |
| 16 | |
| 17 | /** |
| 18 | * @param array $components Array of elements, each convertible to string. |
| 19 | */ |
| 20 | public function __construct( array $components = [] ) { |
| 21 | $this->components = $components; |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * @return array |
| 26 | */ |
| 27 | public function getComponents() { |
| 28 | return $this->components; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * @return bool |
| 33 | */ |
| 34 | abstract public function isGlobal(); |
| 35 | } |