Lines 0.00% 0 / 4
Functions and Methods 0.00% 0 / 4
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
RecordingExposedButton 0.00% 0 / 4 0.00% 0 / 4 20 0.00% 0 / 1
 getConfig 0.00% 0 / 1 0.00% 0 / 1 2
 updateConfig 0.00% 0 / 1 0.00% 0 / 1 2
 watchCommands 0.00% 0 / 1 0.00% 0 / 1 2
 pushCommand 0.00% 0 / 1 0.00% 0 / 1 2
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Testing\Exposure;
6
7use Stewart\Contracts\EventStream;
8use Stewart\Contracts\Exception\CommandException;
9use Stewart\Contracts\Exposure\ButtonConfig;
10use Stewart\Contracts\Exposure\Command\ButtonPress;
11use Stewart\Contracts\Exposure\ExposedButton;
12
13/** @extends RecordingExposedEntity<ButtonConfig> */
14final class RecordingExposedButton extends RecordingExposedEntity implements ExposedButton
15{
16    public function getConfig(): ButtonConfig
17    {
18        return $this->config;
19    }
20
21    public function updateConfig(ButtonConfig $config): void
22    {
23        $this->recordConfig($config);
24    }
25
26    public function watchCommands(): EventStream
27    {
28        /** @var EventStream<ButtonPress> */
29        return $this->watchPushedCommands();
30    }
31
32    /** @throws CommandException */
33    public function pushCommand(ButtonPress $command): void
34    {
35        $this->deliverCommand($command);
36    }
37}