Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
88.89% covered (warning)
88.89%
8 / 9
75.00% covered (warning)
75.00%
3 / 4
66.67% covered (warning)
66.67%
2 / 3
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SuggestionNotificationPropsBuilder
88.89% covered (warning)
88.89%
8 / 9
75.00% covered (warning)
75.00%
3 / 4
66.67% covered (warning)
66.67%
2 / 3
50.00% covered (danger)
50.00%
1 / 2
3.33
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 buildProps
87.50% covered (warning)
87.50%
7 / 8
66.67% covered (warning)
66.67%
2 / 3
50.00% covered (danger)
50.00%
1 / 2
0.00% covered (danger)
0.00%
0 / 1
2.50
1<?php
2
3namespace App\Service\Notification\Factory;
4
5use App\Entity\Suggestion;
6use App\Enum\NotificationType;
7use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;
8use Symfony\Component\DependencyInjection\Attribute\Autowire;
9
10/**
11 * @author Wilhelm Zwertvaegher
12 */
13#[AsTaggedItem(index: Suggestion::class)]
14readonly class SuggestionNotificationPropsBuilder implements NotificationPropsBuilder
15{
16    public function __construct(
17        #[Autowire('%recipient.admin%')]
18        private string $adminEmail,
19    ) {
20    }
21
22    public function buildProps(object $source): NotificationProps
23    {
24        if (!is_a($source, Suggestion::class)) {
25            throw new \InvalidArgumentException('$source must be a Word');
26        }
27
28        return new NotificationProps(
29            NotificationType::SUGGESTION,
30            $this->adminEmail,
31            'Words suggestion',
32            sprintf('A word has been suggested to you by %s : %s', $source->getCreatorEmail() ?? 'unspecified', $source->getLabel()),
33        );
34    }
35}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

SuggestionNotificationPropsBuilder->__construct
16    public function __construct(
17        #[Autowire('%recipient.admin%')]
18        private string $adminEmail,
19    ) {
20    }
SuggestionNotificationPropsBuilder->buildProps
22    public function buildProps(object $source): NotificationProps
23    {
24        if (!is_a($source, Suggestion::class)) {
 
25            throw new \InvalidArgumentException('$source must be a Word');
22    public function buildProps(object $source): NotificationProps
23    {
24        if (!is_a($source, Suggestion::class)) {
 
28        return new NotificationProps(
29            NotificationType::SUGGESTION,
30            $this->adminEmail,
31            'Words suggestion',
32            sprintf('A word has been suggested to you by %s : %s', $source->getCreatorEmail() ?? 'unspecified', $source->getLabel()),
33        );
34    }
{main}
3namespace App\Service\Notification\Factory;
4
5use App\Entity\Suggestion;
6use App\Enum\NotificationType;
7use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem;
8use Symfony\Component\DependencyInjection\Attribute\Autowire;
9
10/**
11 * @author Wilhelm Zwertvaegher
12 */
13#[AsTaggedItem(index: Suggestion::class)]
14readonly class SuggestionNotificationPropsBuilder implements NotificationPropsBuilder
15{
16    public function __construct(
17        #[Autowire('%recipient.admin%')]
18        private string $adminEmail,
19    ) {
20    }
21
22    public function buildProps(object $source): NotificationProps
23    {
24        if (!is_a($source, Suggestion::class)) {
25            throw new \InvalidArgumentException('$source must be a Word');
26        }
27
28        return new NotificationProps(
29            NotificationType::SUGGESTION,
30            $this->adminEmail,
31            'Words suggestion',
32            sprintf('A word has been suggested to you by %s : %s', $source->getCreatorEmail() ?? 'unspecified', $source->getLabel()),
33        );
34    }