DatabaseTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A clockSyncCheck() 0 6 2
1
<?php
2
/**
3
 * vipnytt/RobotsTxtParser
4
 *
5
 * @link https://github.com/VIPnytt/RobotsTxtParser
6
 * @license https://github.com/VIPnytt/RobotsTxtParser/blob/master/LICENSE The MIT License (MIT)
7
 */
8
9
namespace vipnytt\RobotsTxtParser\Handler;
10
11
use vipnytt\RobotsTxtParser\Exceptions\OutOfSyncException;
12
13
/**
14
 * Trait DatabaseTrait
15
 *
16
 * @package vipnytt\RobotsTxtParser\Handler
17
 */
18
trait DatabaseTrait
19
{
20
    /**
21
     * Clock sync check
22
     *
23
     * @param int $time
24
     * @param int $max
25
     * @throws OutOfSyncException
26
     */
27
    protected function clockSyncCheck($time, $max)
28
    {
29
        if (abs(time() - $time) >= $max) {
30
            throw new OutOfSyncException('PHP and database server clocks are out of sync. Please re-sync!');
31
        }
32
    }
33
}
34