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

sulu / SuluContentBundle / 11978668947

22 Nov 2024 07:11PM UTC coverage: 97.052% (-2.9%) from 100.0%
11978668947

Pull #271

github

web-flow
Merge 85d51e611 into a23a5b050
Pull Request #271: Draft: Base implementation of website content resolving

268 of 353 new or added lines in 17 files covered. (75.92%)

2798 of 2883 relevant lines covered (97.05%)

10.44 hits per line

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

69.23
/Content/Application/ContentResolver/Value/ContentView.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of Sulu.
7
 *
8
 * (c) Sulu GmbH
9
 *
10
 * This source file is subject to the MIT license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13

14
namespace Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\Value;
15

16
/**
17
 * @internal This class is intended for internal use only within the package/library. Modifying or depending on this class may result in unexpected behavior and is not supported.
18
 */
19
class ContentView
20
{
21
    /**
22
     * @param mixed[] $view
23
     */
24
    private function __construct(
25
        private mixed $content,
26
        private array $view
27
    ) {
28
    }
36✔
29

30
    /**
31
     * @param mixed[] $view
32
     */
33
    public static function create(mixed $content, array $view): self
34
    {
35
        return new self($content, $view);
31✔
36
    }
37

38
    /**
39
     * @param mixed[] $view
40
     */
41
    public static function createResolvable(string|int $id, string $resourceLoaderKey, array $view, ?\Closure $closure = null): self
42
    {
43
        return new self(new ResolvableResource($id, $resourceLoaderKey, $closure), $view);
7✔
44
    }
45

46
    /**
47
     * @param array<string|int> $ids
48
     * @param mixed[] $view
49
     */
50
    public static function createResolvables(array $ids, string $resourceLoaderKey, array $view): self
51
    {
52
        $resolvableResources = [];
1✔
53

54
        foreach ($ids as $id) {
1✔
55
            $resolvableResources[] = new ResolvableResource($id, $resourceLoaderKey);
1✔
56
        }
57

58
        return new self($resolvableResources, $view);
1✔
59
    }
60

61
    public function getContent(): mixed
62
    {
63
        return $this->content;
35✔
64
    }
65

66
    /**
67
     * @return mixed[]
68
     */
69
    public function getView(): array
70
    {
71
        return $this->view;
30✔
72
    }
73

74
    public function setContent(mixed $content): self
75
    {
NEW
76
        $this->content = $content;
×
77

NEW
78
        return $this;
×
79
    }
80

81
    /**
82
     * @param mixed[] $view
83
     */
84
    public function setView(array $view): self
85
    {
NEW
86
        $this->view = $view;
×
87

NEW
88
        return $this;
×
89
    }
90
}
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

© 2025 Coveralls, Inc