ParagonIE\AntiCSRF\AntiCSRF::recycleTokens PHP Method

recycleTokens() protected method

Enforce an upper limit on the number of tokens stored in session state by removing the oldest tokens first.
protected recycleTokens ( ) : self
return self
    protected function recycleTokens()
    {
        if (!$this->expire_old) {
            // This is turned off.
            return $this;
        }
        // Sort by creation time
        \uasort($this->session[$this->sessionIndex], function ($a, $b) : int {
            return (int) ($a['created'] <=> $b['created']);
        });
        while (\count($this->session[$this->sessionIndex]) > $this->recycle_after) {
            // Let's knock off the oldest one
            \array_shift($this->session[$this->sessionIndex]);
        }
        return $this;
    }