Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
phpbb_cache_memory
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 _read
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 _write
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 _delete
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 *
4 * This file is part of the phpBB Forum Software package.
5 *
6 * @copyright (c) phpBB Limited <https://www.phpbb.com>
7 * @license GNU General Public License, version 2 (GPL-2.0)
8 *
9 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14class phpbb_cache_memory extends \phpbb\cache\driver\memory
15{
16    protected $data = array();
17
18    /**
19    * Set cache path
20    */
21    function __construct()
22    {
23    }
24
25    /**
26     * {@inheritDoc}
27     */
28    protected function _read(string $var)
29    {
30        return $this->data[$var] ?? false;
31    }
32
33    /**
34    * {@inheritDoc}
35    */
36    protected function _write(string $var, $data, int $ttl = 2592000): bool
37    {
38        $this->data[$var] = $data;
39        return true;
40    }
41
42    /**
43     * {@inheritDoc}
44     */
45    protected function _delete(string $var): bool
46    {
47        unset($this->data[$var]);
48        return true;
49    }
50}