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

Package   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 4 1
A validate() 0 4 1
A create() 0 10 3
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