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

brick / structured-data / 17475567799

04 Sep 2025 08:14PM UTC coverage: 77.67%. Remained the same
17475567799

push

github

BenMorel
Apply coding standard

14 of 15 new or added lines in 5 files covered. (93.33%)

59 existing lines in 7 files now uncovered.

240 of 309 relevant lines covered (77.67%)

1.84 hits per line

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

60.0
/src/HTMLReader.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\StructuredData;
6

7
final class HTMLReader
8
{
9
    private readonly Reader $reader;
10

11
    /**
12
     * HTMLReader constructor.
13
     */
14
    public function __construct(Reader $reader)
15
    {
16
        $this->reader = $reader;
5✔
17
    }
18

19
    /**
20
     * Reads the items contained in the given HTML string.
21
     *
22
     * @param string $html The HTML string to read.
23
     * @param string $url  The URL the document was retrieved from. This will be used only to resolve relative URLs in
24
     *                     property values. No attempt will be performed to connect to this URL.
25
     *
26
     * @return Item[] The top-level items.
27
     */
28
    public function read(string $html, string $url): array
29
    {
30
        $document = DOMBuilder::fromHTML($html);
×
31

UNCOV
32
        return $this->reader->read($document, $url);
×
33
    }
34

35
    /**
36
     * Reads the items contained in the given HTML file.
37
     *
38
     * @param string $file The HTML file to read.
39
     * @param string $url  The URL the document was retrieved from. This will be used only to resolve relative URLs in
40
     *                     property values. No attempt will be performed to connect to this URL.
41
     *
42
     * @return Item[] The top-level items.
43
     */
44
    public function readFile(string $file, string $url): array
45
    {
46
        $document = DOMBuilder::fromHTMLFile($file);
5✔
47

48
        return $this->reader->read($document, $url);
5✔
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