Code Duplication    Length = 10-14 lines in 3 locations

src/Client/Cache/MySQL/Manager.php 2 locations

@@ 116-129 (lines=14) @@
113
     * @param int|null $workerID
114
     * @return bool
115
     */
116
    private function markAsActive($base, $workerID = 0)
117
    {
118
        if ($workerID == 0) {
119
            $query = $this->pdo->prepare(<<<SQL
120
UPDATE robotstxt__cache1
121
SET worker = NULL
122
WHERE base = :base AND worker = 0;
123
SQL
124
            );
125
            $query->bindParam(':base', $base, PDO::PARAM_STR);
126
            return $query->execute();
127
        }
128
        return true;
129
    }
130
131
    /**
132
     * Update an robots.txt in the database
@@ 308-318 (lines=11) @@
305
     * @param int $delay - in seconds
306
     * @return bool
307
     */
308
    public function clean($delay)
309
    {
310
        $delay = self::CACHE_TIME + $delay;
311
        $query = $this->pdo->prepare(<<<SQL
312
DELETE FROM robotstxt__cache1
313
WHERE (worker = 0 OR worker IS NULL) AND nextUpdate < (UNIX_TIMESTAMP() - :delay);
314
SQL
315
        );
316
        $query->bindParam(':delay', $delay, PDO::PARAM_INT);
317
        return $query->execute();
318
    }
319
}
320

src/Client/Delay/MySQL/Manager.php 1 location

@@ 42-51 (lines=10) @@
39
     * @param int $delay - in seconds
40
     * @return bool
41
     */
42
    public function clean($delay = 60)
43
    {
44
        $query = $this->pdo->prepare(<<<SQL
45
DELETE FROM robotstxt__delay0
46
WHERE delayUntil < ((UNIX_TIMESTAMP() - :delay) * 1000000);
47
SQL
48
        );
49
        $query->bindParam(':delay', $delay, PDO::PARAM_INT);
50
        return $query->execute();
51
    }
52
53
    /**
54
     * Top X wait time