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

InvalidRequestException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 18
ccs 0
cts 14
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A missingFields() 0 7 1
A invalidVersion() 0 7 1
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