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

PositionCalculator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 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