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

User   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 12
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A clearExpiredConfirmations() 0 10 1
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