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

The-oGlow / ya-corapi / 19973072714

05 Dec 2025 07:00PM UTC coverage: 37.825%. First build
19973072714

push

github

web-flow
Push2master (#4)

11 of 51 new or added lines in 13 files covered. (21.57%)

713 of 1885 relevant lines covered (37.82%)

1.88 hits per line

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

23.68
/src/Yacorapi/Data/AddonMacroData.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of ezlogging
7
 *
8
 * (c) 2024 Oliver Glowa, coding.glowa.com
9
 *
10
 * This source file is subject to the Apache-2.0 license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13

14
namespace oglowa\tools\Yacorapi\Data;
15

16
use oglowa\tools\common\AbstractContainer;
17
use oglowa\tools\Yacorapi\Macro\AllMacro;
18
use oglowa\tools\Yacorapi\Macro\BlockerMacro;
19
use oglowa\tools\Yacorapi\Macro\SingleMacro;
20

21
class AddonMacroData extends AbstractContainer
22
{
23
    /**
24
     * @param int|string $mode
25
     *
26
     * @return mixed[]
27
     */
28
    public function getMacros($mode = SingleMacro::MACRO_SINGLE): array
×
29
    {
30
        $this->logger->debug('START', [$mode]);
×
31
        $macros = [];
×
32
        if ($this->keyExists($mode)) {
×
33
            $addons = $this->getDataByMode($mode);
×
34
            $macros = array_keys($addons);
×
35
        }
36
        $this->logger->debug('macros', [$macros]);
×
37
        $this->logger->debug('END', [$mode]);
×
38

39
        return $macros;
×
40
    }
41

42
    /**
43
     * @param int|string $mode
44
     * @param string     $addon
45
     *
46
     * @return mixed[]
47
     */
48
    public function getMacroNamesByAddon($mode, string $addon): array
×
49
    {
50
        $this->logger->debug('START', [$mode, $addon]);
×
51

52
        $macroNames = [];
×
53
        if ($this->keyExists($mode)) {
×
54
            $addons = $this->getDataByMode($mode);
×
NEW
55
            if (array_key_exists($addon, $addons)) {
×
56
                $macroNames = $addons[$addon];
×
57
            }
58
        }
59
        $this->logger->debug('macroNames', [$macroNames]);
×
60
        $this->logger->debug('END', [$mode, $addon]);
×
61

62
        return $macroNames;
×
63
    }
64

65
    /**
66
     * @param int|string $mode
67
     *
68
     * @return mixed[]
69
     */
70
    public function getMacroNamesByMode($mode): array
×
71
    {
72
        $this->logger->debug('START', [$mode]);
×
73

74
        $macroNames = [];
×
75
        if ($this->keyExists($mode)) {
×
76
            $addons = $this->getDataByMode($mode);
×
77
            foreach ($addons as $addon) {
×
78
                $macroNames = array_merge($macroNames, array_values($addon));
×
79
            }
80
        }
81
        $this->logger->debug('macroNames', [$macroNames]);
×
82
        $this->logger->debug('END', [$mode]);
×
83

84
        return $macroNames;
×
85
    }
86

87
    protected function prepareModes(): void
2✔
88
    {
89
        $allModes = [SingleMacro::MACRO_SINGLE, BlockerMacro::MACRO_BLOCKER, AllMacro::MACRO_ALL];
2✔
90
        $this->setModes($allModes);
2✔
91
    }
92

93
    protected function prepareData(): void
2✔
94
    {
95
        $allData                              = [];
2✔
96
        $allData[SingleMacro::MACRO_SINGLE]   = SingleMacro::getMacros();
2✔
97
        $allData[BlockerMacro::MACRO_BLOCKER] = BlockerMacro::getMacros();
2✔
98
        $allData[AllMacro::MACRO_ALL]         = AllMacro::getMacros();
2✔
99
        $this->setAllData($allData);
2✔
100
    }
101
}
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