• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

craue / CraueConfigBundle / 32665405359

23 Aug 2026 08:45PM UTC coverage: 98.02% (-0.05%) from 98.068%
32665405359

Pull #68

github

web-flow
Merge 4e351edb9 into 433490339
Pull Request #68: types

23 of 24 new or added lines in 5 files covered. (95.83%)

2 existing lines in 2 files now uncovered.

198 of 202 relevant lines covered (98.02%)

163.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.35
/CacheAdapter/SymfonyCacheComponentAdapter.php
1
<?php declare(strict_types=1);
2

3
namespace Craue\ConfigBundle\CacheAdapter;
4

5
use Psr\Cache\CacheItemPoolInterface;
6
use Psr\SimpleCache\CacheInterface;
7
use Symfony\Component\Cache\Adapter\Psr16Adapter;
8

9
/**
10
 * @author Christian Raue <christian.raue@gmail.com>
11
 * @copyright 2011-2026 Christian Raue
12
 * @license http://opensource.org/licenses/mit-license.php MIT License
13
 */
14
class SymfonyCacheComponentAdapter implements CacheAdapterInterface {
15

16
        /**
17
         * @var CacheItemPoolInterface
18
         */
19
        private $cache;
20

21
        public function __construct(CacheInterface|CacheItemPoolInterface $cache) {
22
                if ($cache instanceof CacheInterface) {
135✔
23
                        @trigger_error(sprintf('Configuring a cache of type %s is deprecated since CraueConfigBundle 2.2.1. Use %s instead.', CacheInterface::class, CacheItemPoolInterface::class), E_USER_DEPRECATED);
×
24

UNCOV
25
                        $this->cache = new Psr16Adapter($cache);
×
NEW
26
                        return;
×
27
                }
28

29
                $this->cache = $cache;
135✔
30
        }
31

32
        public function clear() : bool {
33
                return $this->cache->clear();
90✔
34
        }
35

36
        public function has(string $key) : bool {
37
                return $this->cache->hasItem($key);
126✔
38
        }
39

40
        public function get(string $key) : mixed {
41
                return $this->cache->getItem($key)->get();
90✔
42
        }
43

44
        public function set(string $key, mixed $value) : bool {
45
                $cacheItem = $this->cache->getItem($key);
90✔
46
                $cacheItem->set($value);
90✔
47

48
                return $this->cache->save($cacheItem);
90✔
49
        }
50

51
        public function setMultiple(array $keysAndValues) : bool {
52
                foreach ($keysAndValues as $key => $value) {
63✔
53
                        $cacheItem = $this->cache->getItem($key);
63✔
54
                        $cacheItem->set($value);
63✔
55
                        if (!$this->cache->saveDeferred($cacheItem)) {
63✔
56
                                return false;
9✔
57
                        }
58
                }
59

60
                return $this->cache->commit();
54✔
61
        }
62

63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc