• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mimmi20 / monolog-factory / 16691402042

02 Aug 2025 07:41AM UTC coverage: 88.181%. Remained the same
16691402042

push

github

web-flow
Merge pull request #882 from mimmi20/dependabot/composer/4.x/development-dependencies-408f3b8041

composer (4.x)(deps-dev): bump the development-dependencies group with 7 updates

2574 of 2919 relevant lines covered (88.18%)

32.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Handler/TeamsLogHandlerFactory.php
1
<?php
2

3
/**
4
 * This file is part of the mimmi20/monolog-factory package.
5
 *
6
 * Copyright (c) 2022-2025, Thomas Mueller <mimmi20@live.de>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types = 1);
13

14
namespace Mimmi20\MonologFactory\Handler;
15

16
use CMDISP\MonologMicrosoftTeams\TeamsLogHandler;
17
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
18
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
19
use Laminas\ServiceManager\Factory\FactoryInterface;
20
use Mimmi20\MonologFactory\AddFormatterTrait;
21
use Mimmi20\MonologFactory\AddProcessorTrait;
22
use Monolog\Level;
23
use Override;
24
use Psr\Container\ContainerInterface;
25
use Psr\Log\LogLevel;
26

27
use function array_key_exists;
28
use function is_array;
29

30
final class TeamsLogHandlerFactory implements FactoryInterface
31
{
32
    use AddFormatterTrait;
33
    use AddProcessorTrait;
34

35
    /**
36
     * @param string                                $requestedName
37
     * @param array<string, (bool|int|string)>|null $options
38
     * @phpstan-param array{url?: string, level?: (value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::*), bubble?: bool}|null $options
39
     *
40
     * @throws ServiceNotFoundException   if unable to resolve the service
41
     * @throws ServiceNotCreatedException if an exception is raised when creating a service
42
     *
43
     * @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
44
     */
45
    #[Override]
×
46
    public function __invoke(
47
        ContainerInterface $container,
48
        $requestedName,
49
        array | null $options = null,
50
    ): TeamsLogHandler {
51
        if (!is_array($options)) {
×
52
            throw new ServiceNotCreatedException('Options must be an Array');
×
53
        }
54

55
        if (!array_key_exists('url', $options)) {
×
56
            throw new ServiceNotCreatedException('No url provided');
×
57
        }
58

59
        $url    = $options['url'];
×
60
        $level  = LogLevel::DEBUG;
×
61
        $bubble = true;
×
62

63
        if (array_key_exists('level', $options)) {
×
64
            $level = $options['level'];
×
65
        }
66

67
        if (array_key_exists('bubble', $options)) {
×
68
            $bubble = $options['bubble'];
×
69
        }
70

71
        $handler = new TeamsLogHandler($url, $level, $bubble);
×
72

73
        $this->addFormatter($container, $handler, $options);
×
74
        $this->addProcessor($container, $handler, $options);
×
75

76
        return $handler;
×
77
    }
78
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc