Skip to content

Commit f16c4a0

Browse files
Merge pull request #223 from feature/slim-json
Decrease action json footprint
2 parents 9f6bdf7 + f3f3759 commit f16c4a0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Config/Action.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,14 @@ public function getConditions(): array
173173
public function getJsonData(): array
174174
{
175175
$data = [
176-
'action' => $this->action,
177-
'options' => $this->options->getAll(),
176+
'action' => $this->action
178177
];
179178

179+
$options = $this->options->getAll();
180+
if (!empty($options)) {
181+
$data['options'] = $options;
182+
}
183+
180184
$conditions = $this->getConditionJsonData();
181185
if (!empty($conditions)) {
182186
$data['conditions'] = $conditions;

tests/unit/Config/ActionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testEmptyOptions(): void
100100
$action = new Action('\\Foo\\Bar');
101101
$config = $action->getJsonData();
102102

103-
$this->assertCount(0, $config['options']);
103+
$this->assertCount(1, $config);
104104
}
105105

106106
/**

0 commit comments

Comments
 (0)