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

heimrichhannot / contao-encore-bundle / 4628948419

pending completion
4628948419

push

github

Thomas Körner
another fix for layout loading on error pages

2 of 2 new or added lines in 1 file covered. (100.0%)

623 of 830 relevant lines covered (75.06%)

1.96 hits per line

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

76.92
/src/EventListener/Callback/EncoreEntryOptionListener.php
1
<?php
2

3
/*
4
 * Copyright (c) 2022 Heimrich & Hannot GmbH
5
 *
6
 * @license LGPL-3.0-or-later
7
 */
8

9
namespace HeimrichHannot\EncoreBundle\EventListener\Callback;
10

11
use Contao\Message;
12
use HeimrichHannot\EncoreBundle\Collection\EntryCollection;
13
use HeimrichHannot\EncoreBundle\Exception\NoEntrypointsException;
14
use Symfony\Contracts\Translation\TranslatorInterface;
15

16
class EncoreEntryOptionListener
17
{
18
    private EntryCollection     $entryCollection;
19
    private TranslatorInterface $translator;
20

21
    public function __construct(EntryCollection $entryCollection, TranslatorInterface $translator)
22
    {
23
        $this->entryCollection = $entryCollection;
1✔
24
        $this->translator = $translator;
1✔
25
    }
26

27
    public function getEntriesAsOptions(): array
28
    {
29
        $choices = [];
1✔
30

31
        try {
32
            $projectEntries = $this->entryCollection->getEntries();
1✔
33
        } catch (NoEntrypointsException $e) {
×
34
            $projectEntries = [];
×
35
            Message::addError('[Encore Bundle] '.$this->translator->trans('huh.encore.errors.noEntrypoints').' '.$e->getMessage(), 'huh.encore.error.noEntryPoints');
×
36
        }
37

38
        if (empty($projectEntries)) {
1✔
39
            return $choices;
1✔
40
        }
41

42
        foreach ($projectEntries as $entry) {
1✔
43
            $choices[$entry['name']] = $entry['name'].(isset($entry['file']) ? ' ['.$entry['file'].']' : '');
1✔
44
        }
45

46
        asort($choices);
1✔
47

48
        return $choices;
1✔
49
    }
50
}
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