Passed
Pull Request — main (#3)
by Paolo
01:09
created

Search::score()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace BEdita\ElasticSearch\Model\Document;
5
6
use Cake\ElasticSearch\Document;
7
8
/**
9
 * Base searchable document.
10
 *
11
 * @property int|string $id Document ID.
12
 */
13
class Search extends Document
14
{
15
    /**
16
     * Returns the score of this document as returned by ElasticSearch after search.
17
     *
18
     * @return float|null
19
     */
20
    public function score(): float|null
21
    {
22
        if ($this->_result) {
23
            return $this->_result->getScore();
24
        }
25
26
        return null;
27
    }
28
}
29