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

Cecilapp / Cecil / 5171156489

pending completion
5171156489

push

github

web-flow
feat: add i18n support to taxonomy (#1711)

62 of 62 new or added lines in 4 files covered. (100.0%)

2803 of 3402 relevant lines covered (82.39%)

0.82 hits per line

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

88.89
/src/Generator/AbstractGenerator.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of Cecil.
7
 *
8
 * Copyright (c) Arnaud Ligny <arnaud@ligny.fr>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13

14
namespace Cecil\Generator;
15

16
use Cecil\Builder;
17
use Cecil\Collection\Page\Collection as PagesCollection;
18
use Cecil\Util;
19

20
/**
21
 * Abstract class AbstractGenerator.
22
 */
23
abstract class AbstractGenerator implements GeneratorInterface
24
{
25
    /** @var Builder */
26
    protected $builder;
27

28
    /** @var \Cecil\Config */
29
    protected $config;
30

31
    /** @var PagesCollection */
32
    protected $generatedPages;
33

34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function __construct(Builder $builder)
38
    {
39
        $this->builder = $builder;
1✔
40
        $this->config = $builder->getConfig();
1✔
41
        // Creates a new empty collection
42
        $this->generatedPages = new PagesCollection('generator-' . Util::formatClassName($this, ['lowercase' => true]));
1✔
43
    }
44

45
    /**
46
     * Run the `generate` method of the generator and returns pages.
47
     */
48
    public function runGenerate(): PagesCollection
49
    {
50
        $this->generate();
1✔
51

52
        // set default language (e.g.: "en") if necessary
53
        $this->generatedPages->map(function (\Cecil\Collection\Page\Page $page) {
1✔
54
            if ($page->getVariable('language') === null) {
1✔
55
                $page->setVariable('language', $this->config->getLanguageDefault());
×
56
            }
57
        });
1✔
58

59
        return $this->generatedPages;
1✔
60
    }
61
}
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