Passed
Pull Request — master (#2)
by Thomas
03:05
created

MigrationSchema::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Webfactor\Laravel\Generators\Schemas;
4
5
use Illuminate\Support\Collection;
6
7
class MigrationSchema
8
{
9
    protected $structure;
10
11
    public function __construct(string $schema)
12
    {
13
        $this->structure = collect();
14
15
        foreach (explode(',', $schema) as $field) {
16
            $this->structure->push(new MigrationField($field));
17
        }
18
    }
19
20
    /**
21
     * @return Collection
22
     */
23
    public function getStructure(): Collection
24
    {
25
        return $this->structure;
26
    }
27
}
28