Completed
Push — master ( 358621...3c4e64 )
by Pavel
03:50
created

InvalidRequestException::invalidVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: batanov.pavel
5
 * Date: 17.05.2016
6
 * Time: 11:38
7
 */
8
9
namespace Bankiru\Api\JsonRpc\Exception;
10
11
use ScayTrase\Api\JsonRpc\JsonRpcError;
12
13
class InvalidRequestException extends JsonRpcException
14
{
15
    public static function missingFields(array $fields)
16
    {
17
        return self::create(
18
            JsonRpcError::INVALID_REQUEST,
19
            sprintf('Invalid JSONRPC 2.0 Request. Missing fields %s', implode(', ', $fields))
20
        );
21
    }
22
23
    public static function invalidVersion($expected, $actual)
24
    {
25
        return self::create(
26
            JsonRpcError::INVALID_REQUEST,
27
            sprintf('Invalid JSONRPC 2.0 Request. Version mismatch: %s expected, %s given', $expected, $actual)
28
        );
29
    }
30
}
31