Completed
Push — master ( f65d8f...4f3de5 )
by Pavel
04:14 queued 01:54
created

MaxPerPageScope   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
rs 10
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 4 1
1
<?php
2
3
namespace App\Scopes;
4
5
use Illuminate\Database\Eloquent\Scope;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Database\Eloquent\Builder;
8
9
class MaxPerPageScope implements Scope
10
{
11
    /**
12
     * Maximum count items in response
13
     */
14
    const MAX_PER_PAGE = 100;
15
16
    public function apply(Builder $builder, Model $model)
17
    {
18
        return $builder->take(self::MAX_PER_PAGE);
19
    }
20
}