Completed
Push — master ( fba866...b10a48 )
by Ori
03:03
created

Utils::isJsonString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
namespace frictionlessdata\tableschema;
3
4
// TODO: refactor to an independenct package (used by both tableschema and datapackage)
5
class Utils
6
{
7
    public static function isJsonString($json)
8
    {
9
        return (
10
            is_string($json)
11
            && (strpos(ltrim($json), "{") === 0)
12
        );
13
    }
14
}
15