Failed Conditions
Push — master ( 2ade86...13f838 )
by Jonathan
18s
created

lib/Doctrine/ORM/Cache/QueryCacheEntry.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the MIT license. For more information, see
18
 * <http://www.doctrine-project.org>.
19
 */
20
21
namespace Doctrine\ORM\Cache;
22
23
/**
24
 * Query cache entry
25
 *
26
 * @since   2.5
27
 * @author  Fabio B. Silva <[email protected]>
28
 */
29 View Code Duplication
class QueryCacheEntry implements CacheEntry
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
{
31
    /**
32
     * READ-ONLY: Public only for performance reasons, it should be considered immutable.
33
     *
34
     * @var array List of entity identifiers
35
     */
36
    public $result;
37
38
    /**
39
     * READ-ONLY: Public only for performance reasons, it should be considered immutable.
40
     *
41
     * @var float Time creation of this cache entry
42
     */
43
    public $time;
44
45
    /**
46
     * @param array $result
47
     * @param float $time
48
     */
49 53
    public function __construct($result, $time = null)
50
    {
51 53
        $this->result = $result;
52 53
        $this->time   = $time ?: microtime(true);
53 53
    }
54
55
    /**
56
     * @param array $values
57
     *
58
     * @return QueryCacheEntry
59
     */
60
    public static function __set_state(array $values)
61
    {
62
        return new self($values['result'], $values['time']);
63
    }
64
}
65