xref: /dokuwiki/inc/Remote/Response/PageHit.php (revision 6cce3332fbc12c1e250ec7e6adbad6d4dc2c74e8)
1<?php
2
3namespace dokuwiki\Remote\Response;
4
5/**
6 * Represents a page found by a search
7 */
8class PageHit extends Page
9{
10    /** @var int The number of hits this result got */
11    public $score;
12
13    /** @var string The HTML formatted snippet in which the search term was found (if available) */
14    public $snippet;
15
16    /** @var string Not available for search results */
17    public $hash;
18
19    /** @var string Not available for search results */
20    public $author;
21
22    /** @inheritdoc */
23    public function __construct($data)
24    {
25        parent::__construct($data);
26
27        $this->snippet = $data['snippet'] ?? '';
28        $this->score = (int)($data['score'] ?? 0);
29    }
30}
31