Code Duplication    Length = 20-21 lines in 2 locations

src/Client/Delay/DelayHandlerClient.php 2 locations

@@ 72-91 (lines=20) @@
69
     *
70
     * @return float|int
71
     */
72
    public function getQueue()
73
    {
74
        if ($this->delay == 0) {
75
            return 0;
76
        }
77
        $query = $this->pdo->prepare(<<<SQL
78
SELECT (microTime / 1000000) - UNIX_TIMESTAMP(CURTIME(6)) AS sec
79
FROM robotstxt__delay0
80
WHERE base = :base AND userAgent = :userAgent;
81
SQL
82
        );
83
        $query->bindParam(':base', $this->base, PDO::PARAM_STR);
84
        $query->bindParam(':userAgent', $this->userAgent, PDO::PARAM_STR);
85
        $query->execute();
86
        if ($query->rowCount() > 0) {
87
            $row = $query->fetch(PDO::FETCH_ASSOC);
88
            return max($row['sec'], 0);
89
        }
90
        return 0;
91
    }
92
93
    /**
94
     * Sleep
@@ 118-138 (lines=21) @@
115
     *
116
     * @return float|int
117
     */
118
    public function getTimeSleepUntil()
119
    {
120
        if ($this->delay == 0) {
121
            return 0;
122
        }
123
        $query = $this->pdo->prepare(<<<SQL
124
SELECT microTime
125
FROM robotstxt__delay0
126
WHERE base = :base AND userAgent = :userAgent;
127
SQL
128
        );
129
        $query->bindParam(':base', $this->base, PDO::PARAM_STR);
130
        $query->bindParam(':userAgent', $this->userAgent, PDO::PARAM_STR);
131
        $query->execute();
132
        $this->increment();
133
        if ($query->rowCount() > 0) {
134
            $row = $query->fetch(PDO::FETCH_ASSOC);
135
            return $row['microTime'] / 1000000;
136
        }
137
        return 0;
138
    }
139
140
    /**
141
     * Set new delayUntil timestamp