Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SenseNotFound
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 asApiMessage
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Wikibase\Lexeme\MediaWiki\Api\Error;
4
5use MediaWiki\Api\ApiMessage;
6use MediaWiki\Message\Message;
7use Wikibase\Lexeme\Domain\Model\SenseId;
8
9/**
10 * @license GPL-2.0-or-later
11 */
12class SenseNotFound implements ApiError {
13
14    /**
15     * @var SenseId
16     */
17    private $senseId;
18
19    public function __construct( SenseId $senseId ) {
20        $this->senseId = $senseId;
21    }
22
23    /**
24     * @return ApiMessage
25     */
26    public function asApiMessage( $parameterName, array $path ) {
27        $message = new Message(
28            'apierror-wikibaselexeme-sense-not-found',
29            [ $parameterName, $this->senseId->getSerialization() ]
30        );
31        return new ApiMessage( $message, 'not-found', [
32            'parameterName' => $parameterName,
33            'fieldPath' => [],
34        ] );
35    }
36
37}