Passed
Pull Request — master (#166)
by
unknown
21:05
created

EditingLockRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A findOutdatedLocks() 0 12 1
1
<?php
2
namespace EWW\Dpf\Domain\Repository;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
/**
18
 * The repository for editing lock objects
19
 */
20
class EditingLockRepository extends \EWW\Dpf\Domain\Repository\AbstractRepository
21
{
22
    /**
23
     * Finds all outdated locks,
24
     *
25
     * @param integer $timeout : Time interval (in seconds) in which locks are not outdated.
26
     * @return array The found Document Objects
27
     */
28
    public function findOutdatedLocks($timeout)
29
    {
30
        $query = $this->createQuery();
31
32
        $dateTimeObj= new \DateTime();
33
        $dateTimeObj->sub(new \DateInterval("PT".$timeout."S"));
34
35
        $query->matching(
36
            $query->lessThan('tstamp', $dateTimeObj->getTimestamp())
37
        );
38
39
        return $query->execute();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $query->execute() also could return the type TYPO3\CMS\Extbase\Persistence\QueryResultInterface which is incompatible with the documented return type array.
Loading history...
40
    }
41
42
}
43