Completed
Push — master ( c9c9bd...d36537 )
by Robert
02:25
created

WarmUpper::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zored\TelegramBundle\Telegram\Command;
6
7
use Zored\Telegram\TelegramApiInterface;
8
use Zored\TelegramBundle\Telegram\Command\Exception\WarmUpException;
9
10
final class WarmUpper
11
{
12
    /**
13
     * @var TelegramApiInterface[]
14
     */
15
    private $apis;
16
17
    public function __construct(TelegramApiInterface ...$apis)
18
    {
19
        $this->apis = $apis;
20
    }
21
22
    public function warmUp(): void
23
    {
24
        array_walk($this->apis, [$this, 'warmUpSingle']);
25
    }
26
27
    private function warmUpSingle(TelegramApiInterface $api): void
28
    {
29
        if (!$api->getCurrentUser()->getId()) {
30
            throw WarmUpException::becauseNoCurrentUserFound();
31
        }
32
    }
33
}
34