Skip to content

Commit

Permalink
[#15] add ability to collect events in Feature write model
Browse files Browse the repository at this point in the history
  • Loading branch information
kpicaza committed Oct 2, 2021
1 parent 6eefd0c commit 55c9c39
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 0 additions & 2 deletions grumphp.yml
@@ -1,6 +1,4 @@
grumphp:
git_hook_variables:
EXEC_GRUMPHP_COMMAND: 'docker run -e "TERM=xterm-256color" --tty=true --rm -v $PWD:/code:cached pheature/pheature-php-dev:latest'
hooks_dir: .
hooks_preset: local
tasks:
Expand Down
17 changes: 14 additions & 3 deletions src/Write/Feature.php
Expand Up @@ -13,10 +13,10 @@ final class Feature implements JsonSerializable
{
private FeatureId $featureId;
private bool $enabled;
/**
* @var Strategy[]
*/
/** @var Strategy[] */
private array $strategies = [];
/** @var array<object> */
private array $events = [];

/**
* Feature constructor.
Expand All @@ -34,6 +34,17 @@ public function __construct(FeatureId $featureId, bool $enabled, array $strategi
}
}

/**
* @return object[]
*/
public function release(): array
{
$events = $this->events;
$this->events = [];

return $events;
}

public static function withId(FeatureId $featureId): self
{
return new self($featureId, false);
Expand Down

0 comments on commit 55c9c39

Please sign in to comment.