Code Duplication    Length = 31-36 lines in 2 locations

lib/Doctrine/ORM/Cache/QueryCacheEntry.php 1 location

@@ 29-64 (lines=36) @@
26
 * @since   2.5
27
 * @author  Fabio B. Silva <[email protected]>
28
 */
29
class QueryCacheEntry implements CacheEntry
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
    public function __construct($result, $time = null)
50
    {
51
        $this->result = $result;
52
        $this->time   = $time ?: microtime(true);
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

lib/Doctrine/ORM/Cache/TimestampCacheEntry.php 1 location

@@ 29-59 (lines=31) @@
26
 * @since   2.5
27
 * @author  Fabio B. Silva <[email protected]>
28
 */
29
class TimestampCacheEntry implements CacheEntry
30
{
31
    /**
32
     * READ-ONLY: Public only for performance reasons, it should be considered immutable.
33
     *
34
     * @var float
35
     */
36
    public $time;
37
38
    /**
39
     * @param float $time
40
     */
41
    public function __construct($time = null)
42
    {
43
        $this->time = $time ? (float) $time : microtime(true);
44
    }
45
46
    /**
47
     * Creates a new TimestampCacheEntry
48
     *
49
     * This method allow Doctrine\Common\Cache\PhpFileCache compatibility
50
     *
51
     * @param array $values array containing property values
52
     *
53
     * @return TimestampCacheEntry
54
     */
55
    public static function __set_state(array $values)
56
    {
57
        return new self($values['time']);
58
    }
59
}
60