Completed
Push — 2.0-dev ( 574eeb...e9e84c )
by George
12s
created

None   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 2
dl 0
loc 97
ccs 12
cts 14
cp 0.8571
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A clear() 0 4 1
A getItem() 0 4 1
A deleteItem() 0 4 1
A save() 0 4 1
A hasItem() 0 4 1
A get() 0 4 1
A isSupported() 0 4 1
1
<?php
2
/**
3
 * Part of the Joomla Framework Cache Package
4
 *
5
 * @copyright  Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
6
 * @license    GNU General Public License version 2 or later; see LICENSE
7
 */
8
9
namespace Joomla\Cache\Adapter;
10
11
use Joomla\Cache\AbstractCacheItemPool;
12
use Joomla\Cache\Item\Item;
13
use Psr\Cache\CacheItemInterface;
14
15
/**
16
 * Runtime cache only driver for the Joomla Framework.
17
 *
18
 * @since  1.0
19
 */
20
class None extends AbstractCacheItemPool
21
{
22
	/**
23
	 * This will wipe out the entire cache's keys
24
	 *
25
	 * @return  boolean  True if the pool was successfully cleared. False if there was an error.
26
	 *
27
	 * @since   1.0
28
	 */
29 19
	public function clear()
30
	{
31 19
		return true;
32
	}
33
34
	/**
35
	 * Returns a Cache Item representing the specified key.
36
	 *
37
	 * @param   string  $key  The key for which to return the corresponding Cache Item.
38
	 *
39
	 * @return  CacheItemInterface  The corresponding Cache Item.
40
	 *
41
	 * @since   __DEPLOY_VERSION__
42
	 */
43 7
	public function getItem($key)
44
	{
45 7
		return new Item($key);
46
	}
47
48
	/**
49
	 * Removes the item from the pool.
50
	 *
51
	 * @param   string  $key  The key to delete.
52
	 *
53
	 * @return  boolean  True if the item was successfully removed. False if there was an error.
54
	 *
55
	 * @since   __DEPLOY_VERSION__
56
	 */
57 4
	public function deleteItem($key)
58
	{
59 4
		return true;
60
	}
61
62
	/**
63
	 * Persists a cache item immediately.
64
	 *
65
	 * @param   CacheItemInterface  $item  The cache item to save.
66
	 *
67
	 * @return  boolean  True if the item was successfully persisted. False if there was an error.
68
	 *
69
	 * @since   __DEPLOY_VERSION__
70
	 */
71 6
	public function save(CacheItemInterface $item)
72
	{
73 6
		return true;
74
	}
75
76
	/**
77
	 * Confirms if the cache contains specified cache item.
78
	 *
79
	 * @param   string  $key  The key for which to check existence.
80
	 *
81
	 * @return  boolean  True if item exists in the cache, false otherwise.
82
	 *
83
	 * @since   1.0
84
	 */
85 3
	public function hasItem($key)
86
	{
87 3
		return false;
88
	}
89
90
	/**
91
	 * Fetches a value from the cache.
92
	 *
93
	 * @param   string  $key      The unique key of this item in the cache.
94
	 * @param   mixed   $default  Default value to return if the key does not exist.
95
	 *
96
	 * @return  mixed  The value of the item from the cache, or $default in case of cache miss.
97
	 *
98
	 * @since   __DEPLOY_VERSION__
99
	 */
100 1
	public function get($key, $default = null)
101
	{
102 1
		return $default;
103
	}
104
105
	/**
106
	 * Test to see if the CacheItemPoolInterface is available
107
	 *
108
	 * @return  boolean  True on success, false otherwise
109
	 *
110
	 * @since   __DEPLOY_VERSION__
111
	 */
112
	public static function isSupported()
113
	{
114
		return true;
115
	}
116
}
117