Lines 0.00% 0 / 13
Methods 0.00% 0 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 __construct 0.00% 0 / 1 0.00% 0 / 1 2
 createControlPlane 0.00% 0 / 12 0.00% 0 / 1 6
20final readonly class ControlPlaneFactory
21{
22    public function __construct(
23        private ControlConfig $control,
24        private ControlRequestDispatcher $requests,
25        private Deadlines $deadlines,
26        private FrameCodec $codec,
27        private LoggerInterface $logger,
28        private UnixSocketFile $socketFile,
29        private ProjectRoot $projectRoot,
30    ) {}
31
32    /** @throws ConfigurationException */
33    public function createControlPlane(): ControlPlane
34    {
35        if ($this->control->listen === null) {
36            return new DisabledControlPlane();
37        }
38
39        return new ControlServer(
40            address: $this->control->listen,
41            token: $this->control->token ?? throw ConfigurationException::createForReason(ConfigurationError::ControlTokenMissing),
42            requests: $this->requests,
43            deadlines: $this->deadlines,
44            codec: $this->codec,
45            logger: $this->logger,
46            socketFile: $this->socketFile,
47            projectRoot: $this->projectRoot,
48        );
49    }
50}