Completed
Pull Request — master (#50)
by
unknown
11:08
created

PositionCalculator::__invoke()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 4
nop 3
1
<?php
2
3
namespace Spatie\EloquentSortable;
4
5
class PositionCalculator
6
{
7
    public function __invoke($isMovedAfter, $isMovingForward, $postion)
8
    {
9
        if ($isMovedAfter) {
10
            ++$postion;
11
        }
12
13
        if ($isMovingForward) {
14
            --$postion;
15
        }
16
17
        return $postion;
18
    }
19
}
20