UsesCollectionFormat::collectionFormat()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.072

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 9
ccs 4
cts 5
cp 0.8
crap 3.072
rs 10
1
<?php
2
3
namespace MyriadDataStore\Actions;
4
5
trait UsesCollectionFormat
6
{
7 16
    protected function collectionFormat()
8
    {
9 16
        if (property_exists($this, 'collectionFormat')
10 16
            && is_array(static::$collectionFormat)
11
        ) {
12
            return static::$collectionFormat;
13
        }
14
15 16
        return $this->defaultCollectionFormat();
16
    }
17
18
    abstract protected function defaultCollectionFormat(): array;
19
}
20