Completed
Branch master (7d7b3f)
by Ori
01:38
created

Package::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace frictionlessdata\datapackage;
4
5
class Package
6
{
7
    public static function load($source, $basePath = null)
8
    {
9
        return Factory::datapackage($source, $basePath);
10
    }
11
12
    public static function validate($source, $basePath = null)
13
    {
14
        return Factory::validate($source, $basePath);
15
    }
16
17
    public static function create($descriptor = null, $basePath = null)
18
    {
19
        $descriptor = Utils::objectify($descriptor);
20
        if ($descriptor && !isset($descriptor->resources)) {
21
            $descriptor->resources = [];
22
        }
23
        $packageClass = Factory::getDatapackageClass($descriptor);
24
25
        return new $packageClass($descriptor, $basePath, true);
26
    }
27
}
28