Utils::isJsonString()   A
last analyzed

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
3
namespace frictionlessdata\tableschema;
4
5
// TODO: refactor to an independenct package (used by both tableschema and datapackage)
6
class Utils
7
{
8
    public static function isJsonString($json)
9
    {
10
        return
11
            is_string($json)
12
            && (strpos(ltrim($json), '{') === 0)
13
        ;
14
    }
15
}
16