Skip to content

Commit 2aa57b6

Browse files
committed
Support meta on messages
1 parent ede2156 commit 2aa57b6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Catalog/ArrayCatalog.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public function __construct($_data)
1818

1919
public static function fromFile($filePath)
2020
{
21-
$cat = new static(include($filePath));
22-
return $cat;
21+
return new static(include($filePath));
2322
}
2423

2524
public function getMessage($messageId): ?Message

src/Catalog/Message.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class Message
55
{
66
const DEFAULT_OPTION = '_';
7+
const META_OPTION = '__meta';
78

89
/**
910
* @var array
@@ -41,6 +42,11 @@ public static function fromDefault($default)
4142
return $msg;
4243
}
4344

45+
public function getMeta(): array
46+
{
47+
return $this->_options[self::META_OPTION] ?? [];
48+
}
49+
4450
public function addOption($key, $value)
4551
{
4652
$this->_options[$key] = $value;

0 commit comments

Comments
 (0)