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
FormNotFound
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\FormId;
8
9/**
10 * @license GPL-2.0-or-later
11 */
12class FormNotFound implements ApiError {
13
14    /**
15     * @var FormId
16     */
17    private $formId;
18
19    public function __construct( FormId $formId ) {
20        $this->formId = $formId;
21    }
22
23    /**
24     * @return ApiMessage
25     */
26    public function asApiMessage( $parameterName, array $path ) {
27        $message = new Message(
28            'apierror-wikibaselexeme-form-not-found',
29            [ $parameterName, $this->formId->getSerialization() ]
30        );
31        return new ApiMessage( $message, 'not-found', [
32            'parameterName' => $parameterName,
33            'fieldPath' => [],
34        ] );
35    }
36
37}