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

heimrichhannot / contao-utils-bundle / 15017483614

14 May 2025 09:41AM UTC coverage: 25.302% (-54.2%) from 79.482%
15017483614

Pull #96

github

koertho
backport anonymize utils
Pull Request #96: Backport anonymize utils

6 of 7 new or added lines in 2 files covered. (85.71%)

248 existing lines in 22 files now uncovered.

1488 of 5881 relevant lines covered (25.3%)

1.56 hits per line

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

84.21
/src/EventListener/DcaField/AbstractDcaFieldListener.php
1
<?php
2

3
namespace HeimrichHannot\UtilsBundle\EventListener\DcaField;
4

5
use Contao\CoreBundle\Framework\ContaoFramework;
6
use Contao\Model;
7
use HeimrichHannot\UtilsBundle\Dca\DcaFieldConfiguration;
8
use Psr\Container\ContainerInterface;
9
use Symfony\Contracts\Service\ServiceSubscriberInterface;
10

11
abstract class AbstractDcaFieldListener implements ServiceSubscriberInterface
12
{
13
    protected ContainerInterface $container;
14

15
    public function __construct(ContainerInterface $container)
16
    {
17
        $this->container = $container;
10✔
18
    }
19

20
    protected function getModelInstance(string $table, int $id): ?Model
21
    {
22
        $framework = $this->container->get('contao.framework');
1✔
23
        $modelClass = $framework->getAdapter(Model::class)->getClassFromTable($table);
1✔
24
        return $framework->getAdapter($modelClass)->findByPk($id);
1✔
25
    }
26

27
    protected function applyDefaultFieldAdjustments(array &$field, DcaFieldConfiguration $configuration): void
28
    {
29
        if ($configuration->isFilter()) {
7✔
30
            $field['filter'] = true;
2✔
31
        }
32

33
        if ($configuration->isSearch()) {
7✔
34
            $field['search'] = true;
2✔
35
        }
36

37
        if ($configuration->isExclude()) {
7✔
38
            $field['exclude'] = true;
2✔
39
        }
40

41
        if ($configuration->isSorting()) {
7✔
42
            $field['sorting'] = true;
2✔
43
        }
44

45
        if ($configuration->getFlag() !== null) {
7✔
46
            $field['flag'] = $configuration->getFlag();
2✔
47
        }
48

49
        if (!empty($configuration->getEval())) {
7✔
50
            $field['eval'] = \array_merge($field['eval'] ?? [], $configuration->getEval());
3✔
51
        }
52
    }
53

54
    public static function getSubscribedServices(): array
55
    {
UNCOV
56
        return [
×
UNCOV
57
            'contao.framework' => ContaoFramework::class,
×
UNCOV
58
        ];
×
59
    }
60
}
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