Passed
Push — master ( ff89ed...1371da )
by Cody
03:09
created

User::clearExpiredConfirmations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace RssApp\Components;
4
5
use DateTime;
6
7
class User
8
{
9
    public static function clearExpiredConfirmations(): void
10
    {
11
        $qb = Registry::get('em')->createQueryBuilder();
12
        $qb->delete('RssApp:User', 'u')
13
            ->where('u.lastLogin IS NULL')
14
            ->andWhere('u.created < :oneDayAgo')
15
            ->andWhere('u.accessLevel = 0')
16
            ->setParameter(':oneDayAgo', new DateTime('-1 month'))
17
            ->getQuery()
18
            ->getResult();
19
    }
20
}
21