Lines 0.00% 0 / 2
Functions and Methods 0.00% 0 / 2
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
AppPlacementFactory 0.00% 0 / 2 0.00% 0 / 2 6 0.00% 0 / 1
 __construct 0.00% 0 / 1 0.00% 0 / 1 2
 createPlacementForHost 0.00% 0 / 1 0.00% 0 / 1 2
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Runtime\Broker;
6
7final readonly class AppPlacementFactory
8{
9    private const int MAX_AUTO_WORKERS = 4;
10
11    public function __construct(private CpuCountDetector $cpus) {}
12
13    public function createPlacementForHost(): AppPlacement
14    {
15        return new AppPlacement(min(self::MAX_AUTO_WORKERS, $this->cpus->detectCpuCount()));
16    }
17}