Test Failed
Branch master (2f190b)
by Mike
11:47
created
lib/phpfastcache/bin/dependencies/Psr/SimpleCache/src/CacheInterface.php 1 patch
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -4,111 +4,111 @@
 block discarded – undo
4 4
 
5 5
 interface CacheInterface
6 6
 {
7
-    /**
8
-     * Fetches a value from the cache.
9
-     *
10
-     * @param string $key     The unique key of this item in the cache.
11
-     * @param mixed  $default Default value to return if the key does not exist.
12
-     *
13
-     * @return mixed The value of the item from the cache, or $default in case of cache miss.
14
-     *
15
-     * @throws \Psr\SimpleCache\InvalidArgumentException
16
-     *   MUST be thrown if the $key string is not a legal value.
17
-     */
18
-    public function get($key, $default = null);
7
+	/**
8
+	 * Fetches a value from the cache.
9
+	 *
10
+	 * @param string $key     The unique key of this item in the cache.
11
+	 * @param mixed  $default Default value to return if the key does not exist.
12
+	 *
13
+	 * @return mixed The value of the item from the cache, or $default in case of cache miss.
14
+	 *
15
+	 * @throws \Psr\SimpleCache\InvalidArgumentException
16
+	 *   MUST be thrown if the $key string is not a legal value.
17
+	 */
18
+	public function get($key, $default = null);
19 19
 
20
-    /**
21
-     * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
22
-     *
23
-     * @param string                $key   The key of the item to store.
24
-     * @param mixed                 $value The value of the item to store, must be serializable.
25
-     * @param null|int|DateInterval $ttl   Optional. The TTL value of this item. If no value is sent and
26
-     *                                     the driver supports TTL then the library may set a default value
27
-     *                                     for it or let the driver take care of that.
28
-     *
29
-     * @return bool True on success and false on failure.
30
-     *
31
-     * @throws \Psr\SimpleCache\InvalidArgumentException
32
-     *   MUST be thrown if the $key string is not a legal value.
33
-     */
34
-    public function set($key, $value, $ttl = null);
20
+	/**
21
+	 * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
22
+	 *
23
+	 * @param string                $key   The key of the item to store.
24
+	 * @param mixed                 $value The value of the item to store, must be serializable.
25
+	 * @param null|int|DateInterval $ttl   Optional. The TTL value of this item. If no value is sent and
26
+	 *                                     the driver supports TTL then the library may set a default value
27
+	 *                                     for it or let the driver take care of that.
28
+	 *
29
+	 * @return bool True on success and false on failure.
30
+	 *
31
+	 * @throws \Psr\SimpleCache\InvalidArgumentException
32
+	 *   MUST be thrown if the $key string is not a legal value.
33
+	 */
34
+	public function set($key, $value, $ttl = null);
35 35
 
36
-    /**
37
-     * Delete an item from the cache by its unique key.
38
-     *
39
-     * @param string $key The unique cache key of the item to delete.
40
-     *
41
-     * @return bool True if the item was successfully removed. False if there was an error.
42
-     *
43
-     * @throws \Psr\SimpleCache\InvalidArgumentException
44
-     *   MUST be thrown if the $key string is not a legal value.
45
-     */
46
-    public function delete($key);
36
+	/**
37
+	 * Delete an item from the cache by its unique key.
38
+	 *
39
+	 * @param string $key The unique cache key of the item to delete.
40
+	 *
41
+	 * @return bool True if the item was successfully removed. False if there was an error.
42
+	 *
43
+	 * @throws \Psr\SimpleCache\InvalidArgumentException
44
+	 *   MUST be thrown if the $key string is not a legal value.
45
+	 */
46
+	public function delete($key);
47 47
 
48
-    /**
49
-     * Wipes clean the entire cache's keys.
50
-     *
51
-     * @return bool True on success and false on failure.
52
-     */
53
-    public function clear();
48
+	/**
49
+	 * Wipes clean the entire cache's keys.
50
+	 *
51
+	 * @return bool True on success and false on failure.
52
+	 */
53
+	public function clear();
54 54
 
55
-    /**
56
-     * Obtains multiple cache items by their unique keys.
57
-     *
58
-     * @param iterable $keys    A list of keys that can obtained in a single operation.
59
-     * @param mixed    $default Default value to return for keys that do not exist.
60
-     *
61
-     * @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
62
-     *
63
-     * @throws \Psr\SimpleCache\InvalidArgumentException
64
-     *   MUST be thrown if $keys is neither an array nor a Traversable,
65
-     *   or if any of the $keys are not a legal value.
66
-     */
67
-    public function getMultiple($keys, $default = null);
55
+	/**
56
+	 * Obtains multiple cache items by their unique keys.
57
+	 *
58
+	 * @param iterable $keys    A list of keys that can obtained in a single operation.
59
+	 * @param mixed    $default Default value to return for keys that do not exist.
60
+	 *
61
+	 * @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
62
+	 *
63
+	 * @throws \Psr\SimpleCache\InvalidArgumentException
64
+	 *   MUST be thrown if $keys is neither an array nor a Traversable,
65
+	 *   or if any of the $keys are not a legal value.
66
+	 */
67
+	public function getMultiple($keys, $default = null);
68 68
 
69
-    /**
70
-     * Persists a set of key => value pairs in the cache, with an optional TTL.
71
-     *
72
-     * @param iterable              $values A list of key => value pairs for a multiple-set operation.
73
-     * @param null|int|DateInterval $ttl    Optional. The TTL value of this item. If no value is sent and
74
-     *                                      the driver supports TTL then the library may set a default value
75
-     *                                      for it or let the driver take care of that.
76
-     *
77
-     * @return bool True on success and false on failure.
78
-     *
79
-     * @throws \Psr\SimpleCache\InvalidArgumentException
80
-     *   MUST be thrown if $values is neither an array nor a Traversable,
81
-     *   or if any of the $values are not a legal value.
82
-     */
83
-    public function setMultiple($values, $ttl = null);
69
+	/**
70
+	 * Persists a set of key => value pairs in the cache, with an optional TTL.
71
+	 *
72
+	 * @param iterable              $values A list of key => value pairs for a multiple-set operation.
73
+	 * @param null|int|DateInterval $ttl    Optional. The TTL value of this item. If no value is sent and
74
+	 *                                      the driver supports TTL then the library may set a default value
75
+	 *                                      for it or let the driver take care of that.
76
+	 *
77
+	 * @return bool True on success and false on failure.
78
+	 *
79
+	 * @throws \Psr\SimpleCache\InvalidArgumentException
80
+	 *   MUST be thrown if $values is neither an array nor a Traversable,
81
+	 *   or if any of the $values are not a legal value.
82
+	 */
83
+	public function setMultiple($values, $ttl = null);
84 84
 
85
-    /**
86
-     * Deletes multiple cache items in a single operation.
87
-     *
88
-     * @param iterable $keys A list of string-based keys to be deleted.
89
-     *
90
-     * @return bool True if the items were successfully removed. False if there was an error.
91
-     *
92
-     * @throws \Psr\SimpleCache\InvalidArgumentException
93
-     *   MUST be thrown if $keys is neither an array nor a Traversable,
94
-     *   or if any of the $keys are not a legal value.
95
-     */
96
-    public function deleteMultiple($keys);
85
+	/**
86
+	 * Deletes multiple cache items in a single operation.
87
+	 *
88
+	 * @param iterable $keys A list of string-based keys to be deleted.
89
+	 *
90
+	 * @return bool True if the items were successfully removed. False if there was an error.
91
+	 *
92
+	 * @throws \Psr\SimpleCache\InvalidArgumentException
93
+	 *   MUST be thrown if $keys is neither an array nor a Traversable,
94
+	 *   or if any of the $keys are not a legal value.
95
+	 */
96
+	public function deleteMultiple($keys);
97 97
 
98
-    /**
99
-     * Determines whether an item is present in the cache.
100
-     *
101
-     * NOTE: It is recommended that has() is only to be used for cache warming type purposes
102
-     * and not to be used within your live applications operations for get/set, as this method
103
-     * is subject to a race condition where your has() will return true and immediately after,
104
-     * another script can remove it making the state of your app out of date.
105
-     *
106
-     * @param string $key The cache item key.
107
-     *
108
-     * @return bool
109
-     *
110
-     * @throws \Psr\SimpleCache\InvalidArgumentException
111
-     *   MUST be thrown if the $key string is not a legal value.
112
-     */
113
-    public function has($key);
98
+	/**
99
+	 * Determines whether an item is present in the cache.
100
+	 *
101
+	 * NOTE: It is recommended that has() is only to be used for cache warming type purposes
102
+	 * and not to be used within your live applications operations for get/set, as this method
103
+	 * is subject to a race condition where your has() will return true and immediately after,
104
+	 * another script can remove it making the state of your app out of date.
105
+	 *
106
+	 * @param string $key The cache item key.
107
+	 *
108
+	 * @return bool
109
+	 *
110
+	 * @throws \Psr\SimpleCache\InvalidArgumentException
111
+	 *   MUST be thrown if the $key string is not a legal value.
112
+	 */
113
+	public function has($key);
114 114
 }
Please login to merge, or discard this patch.
lib/phpfastcache/bin/dependencies/Psr/Cache/src/CacheItemPoolInterface.php 1 patch
Indentation   +113 added lines, -114 removed lines patch added patch discarded remove patch
@@ -14,126 +14,125 @@
 block discarded – undo
14 14
  */
15 15
 interface CacheItemPoolInterface
16 16
 {
17
-    /**
18
-     * Returns a Cache Item representing the specified key.
19
-     *
20
-     * This method must always return a CacheItemInterface object, even in case of
21
-     * a cache miss. It MUST NOT return null.
22
-     *
23
-     * @param string $key
24
-     *   The key for which to return the corresponding Cache Item.
25
-     *
26
-     * @throws InvalidArgumentException
27
-     *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
28
-     *   MUST be thrown.
29
-     *
30
-     * @return CacheItemInterface
31
-     *   The corresponding Cache Item.
32
-     */
33
-    public function getItem($key);
17
+	/**
18
+	 * Returns a Cache Item representing the specified key.
19
+	 *
20
+	 * This method must always return a CacheItemInterface object, even in case of
21
+	 * a cache miss. It MUST NOT return null.
22
+	 *
23
+	 * @param string $key
24
+	 *   The key for which to return the corresponding Cache Item.
25
+	 *
26
+	 * @throws InvalidArgumentException
27
+	 *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
28
+	 *   MUST be thrown.
29
+	 *
30
+	 * @return CacheItemInterface
31
+	 *   The corresponding Cache Item.
32
+	 */
33
+	public function getItem($key);
34 34
 
35
-    /**
36
-     * Returns a traversable set of cache items.
37
-     *
38
-     * @param array $keys
39
-     * An indexed array of keys of items to retrieve.
40
-     *
41
-     * @throws InvalidArgumentException
42
-     *   If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
43
-     *   MUST be thrown.
44
-     *
45
-     * @return array|\Traversable
46
-     *   A traversable collection of Cache Items keyed by the cache keys of
47
-     *   each item. A Cache item will be returned for each key, even if that
48
-     *   key is not found. However, if no keys are specified then an empty
49
-     *   traversable MUST be returned instead.
50
-     */
51
-    public function getItems(array $keys = array());
35
+	/**
36
+	 * Returns a traversable set of cache items.
37
+	 *
38
+	 * @param array $keys
39
+	 * An indexed array of keys of items to retrieve.
40
+	 *
41
+	 * @throws InvalidArgumentException
42
+	 *   If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
43
+	 *   MUST be thrown.
44
+	 *
45
+	 * @return array|\Traversable
46
+	 *   A traversable collection of Cache Items keyed by the cache keys of
47
+	 *   each item. A Cache item will be returned for each key, even if that
48
+	 *   key is not found. However, if no keys are specified then an empty
49
+	 *   traversable MUST be returned instead.
50
+	 */
51
+	public function getItems(array $keys = array());
52 52
 
53
-    /**
54
-     * Confirms if the cache contains specified cache item.
55
-     *
56
-     * Note: This method MAY avoid retrieving the cached value for performance reasons.
57
-     * This could result in a race condition with CacheItemInterface::get(). To avoid
58
-     * such situation use CacheItemInterface::isHit() instead.
59
-     *
60
-     * @param string $key
61
-     *    The key for which to check existence.
62
-     *
63
-     * @throws InvalidArgumentException
64
-     *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
65
-     *   MUST be thrown.
66
-     *
67
-     * @return bool
68
-     *  True if item exists in the cache, false otherwise.
69
-     */
70
-    public function hasItem($key);
53
+	/**
54
+	 * Confirms if the cache contains specified cache item.
55
+	 *
56
+	 * Note: This method MAY avoid retrieving the cached value for performance reasons.
57
+	 * This could result in a race condition with CacheItemInterface::get(). To avoid
58
+	 * such situation use CacheItemInterface::isHit() instead.
59
+	 *
60
+	 * @param string $key
61
+	 *    The key for which to check existence.
62
+	 *
63
+	 * @throws InvalidArgumentException
64
+	 *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
65
+	 *   MUST be thrown.
66
+	 *
67
+	 * @return bool
68
+	 *  True if item exists in the cache, false otherwise.
69
+	 */
70
+	public function hasItem($key);
71 71
 
72
-    /**
73
-     * Deletes all items in the pool.
74
-     *
75
-     * @return bool
76
-     *   True if the pool was successfully cleared. False if there was an error.
77
-     */
78
-    public function clear();
72
+	/**
73
+	 * Deletes all items in the pool.
74
+	 *
75
+	 * @return bool
76
+	 *   True if the pool was successfully cleared. False if there was an error.
77
+	 */
78
+	public function clear();
79 79
 
80
-    /**
81
-     * Removes the item from the pool.
82
-     *
83
-     * @param string $key
84
-     *   The key for which to delete
85
-     *
86
-     * @throws InvalidArgumentException
87
-     *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
88
-     *   MUST be thrown.
89
-     *
90
-     * @return bool
91
-     *   True if the item was successfully removed. False if there was an error.
92
-     */
93
-    public function deleteItem($key);
80
+	/**
81
+	 * Removes the item from the pool.
82
+	 *
83
+	 * @param string $key
84
+	 *   The key for which to delete
85
+	 *
86
+	 * @throws InvalidArgumentException
87
+	 *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
88
+	 *   MUST be thrown.
89
+	 *
90
+	 * @return bool
91
+	 *   True if the item was successfully removed. False if there was an error.
92
+	 */
93
+	public function deleteItem($key);
94 94
 
95
-    /**
96
-     * Removes multiple items from the pool.
97
-     *
98
-     * @param array $keys
99
-     *   An array of keys that should be removed from the pool.
95
+	/**
96
+	 * Removes multiple items from the pool.
97
+	 *
98
+	 * @param array $keys
99
+	 *   An array of keys that should be removed from the pool.
100
+	 * @throws InvalidArgumentException
101
+	 *   If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
102
+	 *   MUST be thrown.
103
+	 *
104
+	 * @return bool
105
+	 *   True if the items were successfully removed. False if there was an error.
106
+	 */
107
+	public function deleteItems(array $keys);
100 108
 
101
-     * @throws InvalidArgumentException
102
-     *   If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
103
-     *   MUST be thrown.
104
-     *
105
-     * @return bool
106
-     *   True if the items were successfully removed. False if there was an error.
107
-     */
108
-    public function deleteItems(array $keys);
109
+	/**
110
+	 * Persists a cache item immediately.
111
+	 *
112
+	 * @param CacheItemInterface $item
113
+	 *   The cache item to save.
114
+	 *
115
+	 * @return bool
116
+	 *   True if the item was successfully persisted. False if there was an error.
117
+	 */
118
+	public function save(CacheItemInterface $item);
109 119
 
110
-    /**
111
-     * Persists a cache item immediately.
112
-     *
113
-     * @param CacheItemInterface $item
114
-     *   The cache item to save.
115
-     *
116
-     * @return bool
117
-     *   True if the item was successfully persisted. False if there was an error.
118
-     */
119
-    public function save(CacheItemInterface $item);
120
+	/**
121
+	 * Sets a cache item to be persisted later.
122
+	 *
123
+	 * @param CacheItemInterface $item
124
+	 *   The cache item to save.
125
+	 *
126
+	 * @return bool
127
+	 *   False if the item could not be queued or if a commit was attempted and failed. True otherwise.
128
+	 */
129
+	public function saveDeferred(CacheItemInterface $item);
120 130
 
121
-    /**
122
-     * Sets a cache item to be persisted later.
123
-     *
124
-     * @param CacheItemInterface $item
125
-     *   The cache item to save.
126
-     *
127
-     * @return bool
128
-     *   False if the item could not be queued or if a commit was attempted and failed. True otherwise.
129
-     */
130
-    public function saveDeferred(CacheItemInterface $item);
131
-
132
-    /**
133
-     * Persists any deferred cache items.
134
-     *
135
-     * @return bool
136
-     *   True if all not-yet-saved items were successfully saved or there were none. False otherwise.
137
-     */
138
-    public function commit();
131
+	/**
132
+	 * Persists any deferred cache items.
133
+	 *
134
+	 * @return bool
135
+	 *   True if all not-yet-saved items were successfully saved or there were none. False otherwise.
136
+	 */
137
+	public function commit();
139 138
 }
Please login to merge, or discard this patch.
php/lib/phpfastcache/bin/dependencies/Psr/Cache/src/CacheItemInterface.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -24,83 +24,83 @@
 block discarded – undo
24 24
  */
25 25
 interface CacheItemInterface
26 26
 {
27
-    /**
28
-     * Returns the key for the current cache item.
29
-     *
30
-     * The key is loaded by the Implementing Library, but should be available to
31
-     * the higher level callers when needed.
32
-     *
33
-     * @return string
34
-     *   The key string for this cache item.
35
-     */
36
-    public function getKey();
27
+	/**
28
+	 * Returns the key for the current cache item.
29
+	 *
30
+	 * The key is loaded by the Implementing Library, but should be available to
31
+	 * the higher level callers when needed.
32
+	 *
33
+	 * @return string
34
+	 *   The key string for this cache item.
35
+	 */
36
+	public function getKey();
37 37
 
38
-    /**
39
-     * Retrieves the value of the item from the cache associated with this object's key.
40
-     *
41
-     * The value returned must be identical to the value originally stored by set().
42
-     *
43
-     * If isHit() returns false, this method MUST return null. Note that null
44
-     * is a legitimate cached value, so the isHit() method SHOULD be used to
45
-     * differentiate between "null value was found" and "no value was found."
46
-     *
47
-     * @return mixed
48
-     *   The value corresponding to this cache item's key, or null if not found.
49
-     */
50
-    public function get();
38
+	/**
39
+	 * Retrieves the value of the item from the cache associated with this object's key.
40
+	 *
41
+	 * The value returned must be identical to the value originally stored by set().
42
+	 *
43
+	 * If isHit() returns false, this method MUST return null. Note that null
44
+	 * is a legitimate cached value, so the isHit() method SHOULD be used to
45
+	 * differentiate between "null value was found" and "no value was found."
46
+	 *
47
+	 * @return mixed
48
+	 *   The value corresponding to this cache item's key, or null if not found.
49
+	 */
50
+	public function get();
51 51
 
52
-    /**
53
-     * Confirms if the cache item lookup resulted in a cache hit.
54
-     *
55
-     * Note: This method MUST NOT have a race condition between calling isHit()
56
-     * and calling get().
57
-     *
58
-     * @return bool
59
-     *   True if the request resulted in a cache hit. False otherwise.
60
-     */
61
-    public function isHit();
52
+	/**
53
+	 * Confirms if the cache item lookup resulted in a cache hit.
54
+	 *
55
+	 * Note: This method MUST NOT have a race condition between calling isHit()
56
+	 * and calling get().
57
+	 *
58
+	 * @return bool
59
+	 *   True if the request resulted in a cache hit. False otherwise.
60
+	 */
61
+	public function isHit();
62 62
 
63
-    /**
64
-     * Sets the value represented by this cache item.
65
-     *
66
-     * The $value argument may be any item that can be serialized by PHP,
67
-     * although the method of serialization is left up to the Implementing
68
-     * Library.
69
-     *
70
-     * @param mixed $value
71
-     *   The serializable value to be stored.
72
-     *
73
-     * @return static
74
-     *   The invoked object.
75
-     */
76
-    public function set($value);
63
+	/**
64
+	 * Sets the value represented by this cache item.
65
+	 *
66
+	 * The $value argument may be any item that can be serialized by PHP,
67
+	 * although the method of serialization is left up to the Implementing
68
+	 * Library.
69
+	 *
70
+	 * @param mixed $value
71
+	 *   The serializable value to be stored.
72
+	 *
73
+	 * @return static
74
+	 *   The invoked object.
75
+	 */
76
+	public function set($value);
77 77
 
78
-    /**
79
-     * Sets the expiration time for this cache item.
80
-     *
81
-     * @param \DateTimeInterface $expiration
82
-     *   The point in time after which the item MUST be considered expired.
83
-     *   If null is passed explicitly, a default value MAY be used. If none is set,
84
-     *   the value should be stored permanently or for as long as the
85
-     *   implementation allows.
86
-     *
87
-     * @return static
88
-     *   The called object.
89
-     */
90
-    public function expiresAt($expiration);
78
+	/**
79
+	 * Sets the expiration time for this cache item.
80
+	 *
81
+	 * @param \DateTimeInterface $expiration
82
+	 *   The point in time after which the item MUST be considered expired.
83
+	 *   If null is passed explicitly, a default value MAY be used. If none is set,
84
+	 *   the value should be stored permanently or for as long as the
85
+	 *   implementation allows.
86
+	 *
87
+	 * @return static
88
+	 *   The called object.
89
+	 */
90
+	public function expiresAt($expiration);
91 91
 
92
-    /**
93
-     * Sets the expiration time for this cache item.
94
-     *
95
-     * @param int|\DateInterval $time
96
-     *   The period of time from the present after which the item MUST be considered
97
-     *   expired. An integer parameter is understood to be the time in seconds until
98
-     *   expiration. If null is passed explicitly, a default value MAY be used.
99
-     *   If none is set, the value should be stored permanently or for as long as the
100
-     *   implementation allows.
101
-     *
102
-     * @return static
103
-     *   The called object.
104
-     */
105
-    public function expiresAfter($time);
92
+	/**
93
+	 * Sets the expiration time for this cache item.
94
+	 *
95
+	 * @param int|\DateInterval $time
96
+	 *   The period of time from the present after which the item MUST be considered
97
+	 *   expired. An integer parameter is understood to be the time in seconds until
98
+	 *   expiration. If null is passed explicitly, a default value MAY be used.
99
+	 *   If none is set, the value should be stored permanently or for as long as the
100
+	 *   implementation allows.
101
+	 *
102
+	 * @return static
103
+	 *   The called object.
104
+	 */
105
+	public function expiresAfter($time);
106 106
 }
Please login to merge, or discard this patch.
plugins/files/php/lib/phpfastcache/lib/Phpfastcache/Entities/DriverIO.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -22,99 +22,99 @@
 block discarded – undo
22 22
  */
23 23
 class DriverIO
24 24
 {
25
-    /**
26
-     * @var int
27
-     */
28
-    protected $writeHit = 0;
25
+	/**
26
+	 * @var int
27
+	 */
28
+	protected $writeHit = 0;
29 29
 
30
-    /**
31
-     * @var int
32
-     */
33
-    protected $readHit = 0;
30
+	/**
31
+	 * @var int
32
+	 */
33
+	protected $readHit = 0;
34 34
 
35
-    /**
36
-     * @var int
37
-     */
38
-    protected $readMiss = 0;
35
+	/**
36
+	 * @var int
37
+	 */
38
+	protected $readMiss = 0;
39 39
 
40
-    /**
41
-     * @return int
42
-     */
43
-    public function getWriteHit(): int
44
-    {
45
-        return $this->writeHit;
46
-    }
40
+	/**
41
+	 * @return int
42
+	 */
43
+	public function getWriteHit(): int
44
+	{
45
+		return $this->writeHit;
46
+	}
47 47
 
48
-    /**
49
-     * @param int $writeHit
50
-     * @return DriverIO
51
-     */
52
-    public function setWriteHit(int $writeHit): DriverIO
53
-    {
54
-        $this->writeHit = $writeHit;
55
-        return $this;
56
-    }
48
+	/**
49
+	 * @param int $writeHit
50
+	 * @return DriverIO
51
+	 */
52
+	public function setWriteHit(int $writeHit): DriverIO
53
+	{
54
+		$this->writeHit = $writeHit;
55
+		return $this;
56
+	}
57 57
 
58
-    /**
59
-     * @return DriverIO
60
-     */
61
-    public function incWriteHit(): DriverIO
62
-    {
63
-        $this->writeHit++;
64
-        return $this;
65
-    }
58
+	/**
59
+	 * @return DriverIO
60
+	 */
61
+	public function incWriteHit(): DriverIO
62
+	{
63
+		$this->writeHit++;
64
+		return $this;
65
+	}
66 66
 
67
-    /**
68
-     * @return int
69
-     */
70
-    public function getReadHit(): int
71
-    {
72
-        return $this->readHit;
73
-    }
67
+	/**
68
+	 * @return int
69
+	 */
70
+	public function getReadHit(): int
71
+	{
72
+		return $this->readHit;
73
+	}
74 74
 
75
-    /**
76
-     * @param int $readHit
77
-     * @return DriverIO
78
-     */
79
-    public function setReadHit(int $readHit): DriverIO
80
-    {
81
-        $this->readHit = $readHit;
82
-        return $this;
83
-    }
75
+	/**
76
+	 * @param int $readHit
77
+	 * @return DriverIO
78
+	 */
79
+	public function setReadHit(int $readHit): DriverIO
80
+	{
81
+		$this->readHit = $readHit;
82
+		return $this;
83
+	}
84 84
 
85
-    /**
86
-     * @return DriverIO
87
-     */
88
-    public function incReadHit(): DriverIO
89
-    {
90
-        $this->readHit++;
91
-        return $this;
92
-    }
85
+	/**
86
+	 * @return DriverIO
87
+	 */
88
+	public function incReadHit(): DriverIO
89
+	{
90
+		$this->readHit++;
91
+		return $this;
92
+	}
93 93
 
94
-    /**
95
-     * @return int
96
-     */
97
-    public function getReadMiss(): int
98
-    {
99
-        return $this->readMiss;
100
-    }
94
+	/**
95
+	 * @return int
96
+	 */
97
+	public function getReadMiss(): int
98
+	{
99
+		return $this->readMiss;
100
+	}
101 101
 
102
-    /**
103
-     * @param int $readMiss
104
-     * @return DriverIO
105
-     */
106
-    public function setReadMiss(int $readMiss): DriverIO
107
-    {
108
-        $this->readMiss = $readMiss;
109
-        return $this;
110
-    }
102
+	/**
103
+	 * @param int $readMiss
104
+	 * @return DriverIO
105
+	 */
106
+	public function setReadMiss(int $readMiss): DriverIO
107
+	{
108
+		$this->readMiss = $readMiss;
109
+		return $this;
110
+	}
111 111
 
112
-    /**
113
-     * @return DriverIO
114
-     */
115
-    public function incReadMiss(): DriverIO
116
-    {
117
-        $this->readMiss++;
118
-        return $this;
119
-    }
112
+	/**
113
+	 * @return DriverIO
114
+	 */
115
+	public function incReadMiss(): DriverIO
116
+	{
117
+		$this->readMiss++;
118
+		return $this;
119
+	}
120 120
 }
121 121
\ No newline at end of file
Please login to merge, or discard this patch.
files/php/lib/phpfastcache/lib/Phpfastcache/Entities/DriverStatistic.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -22,112 +22,112 @@
 block discarded – undo
22 22
  */
23 23
 class DriverStatistic
24 24
 {
25
-    /**
26
-     * @var string
27
-     */
28
-    protected $info = '';
29
-
30
-    /**
31
-     * @var int
32
-     */
33
-    protected $size = 0;
34
-
35
-    /**
36
-     * @var string
37
-     */
38
-    protected $data = '';
39
-
40
-    /**
41
-     * @var mixed
42
-     */
43
-    protected $rawData;
44
-
45
-    /**
46
-     * @return string Return info or false if no information available
47
-     */
48
-    public function getInfo(): string
49
-    {
50
-        return $this->info;
51
-    }
52
-
53
-    /**
54
-     * @param string $info
55
-     * @return $this
56
-     */
57
-    public function setInfo(string $info): self
58
-    {
59
-        $this->info = $info;
60
-
61
-        return $this;
62
-    }
63
-
64
-    /**
65
-     * @return int Return size in octet or false if no information available
66
-     */
67
-    public function getSize(): int
68
-    {
69
-        return $this->size;
70
-    }
71
-
72
-    /**
73
-     * @param int $size
74
-     * @return $this
75
-     */
76
-    public function setSize(int $size)
77
-    {
78
-        $this->size = $size;
79
-
80
-        return $this;
81
-    }
82
-
83
-    /**
84
-     * @return mixed
85
-     */
86
-    public function getData()
87
-    {
88
-        return $this->data;
89
-    }
90
-
91
-    /**
92
-     * @param mixed $data
93
-     * @return $this
94
-     */
95
-    public function setData($data): self
96
-    {
97
-        $this->data = ($data ?: '');
98
-
99
-        return $this;
100
-    }
101
-
102
-    /**
103
-     * @return mixed
104
-     */
105
-    public function getRawData()
106
-    {
107
-        return $this->rawData;
108
-    }
109
-
110
-    /**
111
-     * @param mixed $raw
112
-     * @return $this
113
-     */
114
-    public function setRawData($raw): self
115
-    {
116
-        $this->rawData = $raw;
117
-
118
-        return $this;
119
-    }
120
-
121
-    /**
122
-     * @return array
123
-     */
124
-    public function getPublicDesc(): array
125
-    {
126
-        return [
127
-            'Info' => 'Cache Information',
128
-            'Size' => 'Cache Size',
129
-            'Data' => 'Cache items keys',
130
-            'RawData' => 'Cache raw data',
131
-        ];
132
-    }
25
+	/**
26
+	 * @var string
27
+	 */
28
+	protected $info = '';
29
+
30
+	/**
31
+	 * @var int
32
+	 */
33
+	protected $size = 0;
34
+
35
+	/**
36
+	 * @var string
37
+	 */
38
+	protected $data = '';
39
+
40
+	/**
41
+	 * @var mixed
42
+	 */
43
+	protected $rawData;
44
+
45
+	/**
46
+	 * @return string Return info or false if no information available
47
+	 */
48
+	public function getInfo(): string
49
+	{
50
+		return $this->info;
51
+	}
52
+
53
+	/**
54
+	 * @param string $info
55
+	 * @return $this
56
+	 */
57
+	public function setInfo(string $info): self
58
+	{
59
+		$this->info = $info;
60
+
61
+		return $this;
62
+	}
63
+
64
+	/**
65
+	 * @return int Return size in octet or false if no information available
66
+	 */
67
+	public function getSize(): int
68
+	{
69
+		return $this->size;
70
+	}
71
+
72
+	/**
73
+	 * @param int $size
74
+	 * @return $this
75
+	 */
76
+	public function setSize(int $size)
77
+	{
78
+		$this->size = $size;
79
+
80
+		return $this;
81
+	}
82
+
83
+	/**
84
+	 * @return mixed
85
+	 */
86
+	public function getData()
87
+	{
88
+		return $this->data;
89
+	}
90
+
91
+	/**
92
+	 * @param mixed $data
93
+	 * @return $this
94
+	 */
95
+	public function setData($data): self
96
+	{
97
+		$this->data = ($data ?: '');
98
+
99
+		return $this;
100
+	}
101
+
102
+	/**
103
+	 * @return mixed
104
+	 */
105
+	public function getRawData()
106
+	{
107
+		return $this->rawData;
108
+	}
109
+
110
+	/**
111
+	 * @param mixed $raw
112
+	 * @return $this
113
+	 */
114
+	public function setRawData($raw): self
115
+	{
116
+		$this->rawData = $raw;
117
+
118
+		return $this;
119
+	}
120
+
121
+	/**
122
+	 * @return array
123
+	 */
124
+	public function getPublicDesc(): array
125
+	{
126
+		return [
127
+			'Info' => 'Cache Information',
128
+			'Size' => 'Cache Size',
129
+			'Data' => 'Cache items keys',
130
+			'RawData' => 'Cache raw data',
131
+		];
132
+	}
133 133
 }
134 134
\ No newline at end of file
Please login to merge, or discard this patch.
plugins/files/php/lib/phpfastcache/lib/Phpfastcache/Entities/ItemBatch.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -24,40 +24,40 @@
 block discarded – undo
24 24
  */
25 25
 class ItemBatch
26 26
 {
27
-    /**
28
-     * @var string
29
-     */
30
-    protected $itemKey;
31
-
32
-    /**
33
-     * @var DateTimeInterface
34
-     */
35
-    protected $itemDate;
36
-
37
-    /**
38
-     * ItemBatch constructor.
39
-     * @param string $itemKey
40
-     * @param DateTimeInterface $itemDate
41
-     */
42
-    public function __construct(string $itemKey, DateTimeInterface $itemDate)
43
-    {
44
-        $this->itemKey = $itemKey;
45
-        $this->itemDate = $itemDate;
46
-    }
47
-
48
-    /**
49
-     * @return string
50
-     */
51
-    public function getItemKey(): string
52
-    {
53
-        return $this->itemKey;
54
-    }
55
-
56
-    /**
57
-     * @return DateTimeInterface
58
-     */
59
-    public function getItemDate(): DateTimeInterface
60
-    {
61
-        return $this->itemDate;
62
-    }
27
+	/**
28
+	 * @var string
29
+	 */
30
+	protected $itemKey;
31
+
32
+	/**
33
+	 * @var DateTimeInterface
34
+	 */
35
+	protected $itemDate;
36
+
37
+	/**
38
+	 * ItemBatch constructor.
39
+	 * @param string $itemKey
40
+	 * @param DateTimeInterface $itemDate
41
+	 */
42
+	public function __construct(string $itemKey, DateTimeInterface $itemDate)
43
+	{
44
+		$this->itemKey = $itemKey;
45
+		$this->itemDate = $itemDate;
46
+	}
47
+
48
+	/**
49
+	 * @return string
50
+	 */
51
+	public function getItemKey(): string
52
+	{
53
+		return $this->itemKey;
54
+	}
55
+
56
+	/**
57
+	 * @return DateTimeInterface
58
+	 */
59
+	public function getItemDate(): DateTimeInterface
60
+	{
61
+		return $this->itemDate;
62
+	}
63 63
 }
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
plugins/files/php/lib/phpfastcache/lib/Phpfastcache/EventManager.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -47,100 +47,100 @@
 block discarded – undo
47 47
  */
48 48
 class EventManager implements EventManagerInterface
49 49
 {
50
-    public const ON_EVERY_EVENT = '__every';
50
+	public const ON_EVERY_EVENT = '__every';
51 51
 
52
-    /**
53
-     * @var $this
54
-     */
55
-    protected static $instance;
52
+	/**
53
+	 * @var $this
54
+	 */
55
+	protected static $instance;
56 56
 
57
-    /**
58
-     * @var array
59
-     */
60
-    protected $events = [
61
-        self::ON_EVERY_EVENT => []
62
-    ];
57
+	/**
58
+	 * @var array
59
+	 */
60
+	protected $events = [
61
+		self::ON_EVERY_EVENT => []
62
+	];
63 63
 
64
-    /**
65
-     * EventManager constructor.
66
-     */
67
-    final protected function __construct()
68
-    {
69
-        // The constructor should not be instantiated externally
70
-    }
64
+	/**
65
+	 * EventManager constructor.
66
+	 */
67
+	final protected function __construct()
68
+	{
69
+		// The constructor should not be instantiated externally
70
+	}
71 71
 
72
-    /**
73
-     * @return EventManagerInterface
74
-     */
75
-    public static function getInstance(): EventManagerInterface
76
-    {
77
-        return (self::$instance ?: self::$instance = new self);
78
-    }
72
+	/**
73
+	 * @return EventManagerInterface
74
+	 */
75
+	public static function getInstance(): EventManagerInterface
76
+	{
77
+		return (self::$instance ?: self::$instance = new self);
78
+	}
79 79
 
80
-    /**
81
-     * @param string $eventName
82
-     * @param array ...$args
83
-     */
84
-    public function dispatch(string $eventName, ...$args): void
85
-    {
86
-        /**
87
-         * Replace array_key_exists by isset
88
-         * due to performance issue on huge
89
-         * loop dispatching operations
90
-         */
91
-        if (isset($this->events[$eventName]) && $eventName !== self::ON_EVERY_EVENT) {
92
-            foreach ($this->events[$eventName] as $event) {
93
-                $event(... $args);
94
-            }
95
-        }
96
-        foreach ($this->events[self::ON_EVERY_EVENT] as $event) {
97
-            $event($eventName, ...$args);
98
-        }
99
-    }
80
+	/**
81
+	 * @param string $eventName
82
+	 * @param array ...$args
83
+	 */
84
+	public function dispatch(string $eventName, ...$args): void
85
+	{
86
+		/**
87
+		 * Replace array_key_exists by isset
88
+		 * due to performance issue on huge
89
+		 * loop dispatching operations
90
+		 */
91
+		if (isset($this->events[$eventName]) && $eventName !== self::ON_EVERY_EVENT) {
92
+			foreach ($this->events[$eventName] as $event) {
93
+				$event(... $args);
94
+			}
95
+		}
96
+		foreach ($this->events[self::ON_EVERY_EVENT] as $event) {
97
+			$event($eventName, ...$args);
98
+		}
99
+	}
100 100
 
101
-    /**
102
-     * @param string $name
103
-     * @param array $arguments
104
-     * @throws PhpfastcacheInvalidArgumentException
105
-     * @throws BadMethodCallException
106
-     */
107
-    public function __call(string $name, array $arguments): void
108
-    {
109
-        if (\strpos($name, 'on') === 0) {
110
-            $name = \substr($name, 2);
111
-            if (\is_callable($arguments[0])) {
112
-                if (isset($arguments[1]) && \is_string($arguments[0])) {
113
-                    $this->events[$name][$arguments[1]] = $arguments[0];
114
-                } else {
115
-                    $this->events[$name][] = $arguments[0];
116
-                }
117
-            } else {
118
-                throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[0])));
119
-            }
120
-        } else {
121
-            throw new BadMethodCallException('An event must start with "on" such as "onCacheGetItem"');
122
-        }
123
-    }
101
+	/**
102
+	 * @param string $name
103
+	 * @param array $arguments
104
+	 * @throws PhpfastcacheInvalidArgumentException
105
+	 * @throws BadMethodCallException
106
+	 */
107
+	public function __call(string $name, array $arguments): void
108
+	{
109
+		if (\strpos($name, 'on') === 0) {
110
+			$name = \substr($name, 2);
111
+			if (\is_callable($arguments[0])) {
112
+				if (isset($arguments[1]) && \is_string($arguments[0])) {
113
+					$this->events[$name][$arguments[1]] = $arguments[0];
114
+				} else {
115
+					$this->events[$name][] = $arguments[0];
116
+				}
117
+			} else {
118
+				throw new PhpfastcacheInvalidArgumentException(\sprintf('Expected Callable, got "%s"', \gettype($arguments[0])));
119
+			}
120
+		} else {
121
+			throw new BadMethodCallException('An event must start with "on" such as "onCacheGetItem"');
122
+		}
123
+	}
124 124
 
125
-    /**
126
-     * @param callable $callback
127
-     * @param string $callbackName
128
-     */
129
-    public function onEveryEvents(callable $callback, string $callbackName): void
130
-    {
131
-        $this->events[self::ON_EVERY_EVENT][$callbackName] = $callback;
132
-    }
125
+	/**
126
+	 * @param callable $callback
127
+	 * @param string $callbackName
128
+	 */
129
+	public function onEveryEvents(callable $callback, string $callbackName): void
130
+	{
131
+		$this->events[self::ON_EVERY_EVENT][$callbackName] = $callback;
132
+	}
133 133
 
134
-    /**
135
-     * @param string $eventName
136
-     * @param string $callbackName
137
-     * @return bool
138
-     */
139
-    public function unbindEventCallback(string $eventName, string $callbackName): bool
140
-    {
141
-        $return = isset($this->events[$eventName][$callbackName]);
142
-        unset($this->events[$eventName][$callbackName]);
134
+	/**
135
+	 * @param string $eventName
136
+	 * @param string $callbackName
137
+	 * @return bool
138
+	 */
139
+	public function unbindEventCallback(string $eventName, string $callbackName): bool
140
+	{
141
+		$return = isset($this->events[$eventName][$callbackName]);
142
+		unset($this->events[$eventName][$callbackName]);
143 143
 
144
-        return $return;
145
-    }
144
+		return $return;
145
+	}
146 146
 }
Please login to merge, or discard this patch.
plugins/files/php/lib/phpfastcache/lib/Phpfastcache/CacheManager.php 1 patch
Indentation   +449 added lines, -449 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 use Phpfastcache\Config\ConfigurationOptionInterface;
22 22
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
23 23
 use Phpfastcache\Exceptions\{PhpfastcacheDriverCheckException,
24
-    PhpfastcacheDriverException,
25
-    PhpfastcacheDriverNotFoundException,
26
-    PhpfastcacheInstanceNotFoundException,
27
-    PhpfastcacheInvalidArgumentException,
28
-    PhpfastcacheInvalidConfigurationException,
29
-    PhpfastcacheLogicException,
30
-    PhpfastcacheUnsupportedOperationException
24
+	PhpfastcacheDriverException,
25
+	PhpfastcacheDriverNotFoundException,
26
+	PhpfastcacheInstanceNotFoundException,
27
+	PhpfastcacheInvalidArgumentException,
28
+	PhpfastcacheInvalidConfigurationException,
29
+	PhpfastcacheLogicException,
30
+	PhpfastcacheUnsupportedOperationException
31 31
 };
32 32
 use Phpfastcache\Util\ClassNamespaceResolverTrait;
33 33
 
@@ -59,447 +59,447 @@  discard block
 block discarded – undo
59 59
  */
60 60
 class CacheManager
61 61
 {
62
-    public const CORE_DRIVER_NAMESPACE = 'Phpfastcache\Drivers\\';
63
-
64
-    use ClassNamespaceResolverTrait;
65
-
66
-    /**
67
-     * @var ConfigurationOption
68
-     */
69
-    protected static $config;
70
-    /**
71
-     * @var string
72
-     */
73
-    protected static $namespacePath;
74
-
75
-    /**
76
-     * @var ExtendedCacheItemPoolInterface[]
77
-     */
78
-    protected static $instances = [];
79
-
80
-    /**
81
-     * @var array
82
-     */
83
-    protected static $driverOverrides = [];
84
-
85
-    /**
86
-     * @var array
87
-     */
88
-    protected static $driverCustoms = [];
89
-
90
-    /**
91
-     * @var array
92
-     */
93
-    protected static $badPracticeOmeter = [];
94
-
95
-    /**
96
-     * CacheManager constructor.
97
-     */
98
-    final protected function __construct()
99
-    {
100
-        // The cache manager is not meant to be instantiated
101
-    }
102
-
103
-    /**
104
-     * @param string $instanceId
105
-     * @return ExtendedCacheItemPoolInterface
106
-     * @throws PhpfastcacheInstanceNotFoundException
107
-     */
108
-    public static function getInstanceById(string $instanceId): ExtendedCacheItemPoolInterface
109
-    {
110
-        if (isset(self::$instances[$instanceId])) {
111
-            return self::$instances[$instanceId];
112
-        }
113
-
114
-        throw new PhpfastcacheInstanceNotFoundException(sprintf('Instance ID %s not found', $instanceId));
115
-    }
116
-
117
-    /**
118
-     * Return the list of instances
119
-     *
120
-     * @return ExtendedCacheItemPoolInterface[]
121
-     */
122
-    public static function getInstances(): array
123
-    {
124
-        return self::$instances;
125
-    }
126
-
127
-    /**
128
-     * This method is intended for internal
129
-     * use only and should not be used for
130
-     * any external development use the
131
-     * getInstances() method instead
132
-     *
133
-     * @return ExtendedCacheItemPoolInterface[]
134
-     * @internal
135
-     * @todo Use a proper way to passe them as a reference ?
136
-     */
137
-    public static function &getInternalInstances(): array
138
-    {
139
-        return self::$instances;
140
-    }
141
-
142
-    /**
143
-     * @param string $name
144
-     * @param array $arguments
145
-     * @return ExtendedCacheItemPoolInterface
146
-     * @throws PhpfastcacheDriverCheckException
147
-     * @throws PhpfastcacheDriverException
148
-     * @throws PhpfastcacheDriverNotFoundException
149
-     * @throws PhpfastcacheInvalidArgumentException
150
-     * @throws PhpfastcacheInvalidConfigurationException
151
-     * @throws PhpfastcacheLogicException
152
-     * @throws \ReflectionException
153
-     */
154
-    public static function __callStatic(string $name, array $arguments): ExtendedCacheItemPoolInterface
155
-    {
156
-        $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []);
157
-
158
-        return self::getInstance($name, $options);
159
-    }
160
-
161
-    /**
162
-     * @param string $driver
163
-     * @param ConfigurationOptionInterface $config
164
-     * @param string|null $instanceId
165
-     * @return ExtendedCacheItemPoolInterface|AggregatablePoolInterface
166
-     * @throws PhpfastcacheDriverCheckException
167
-     * @throws PhpfastcacheDriverException
168
-     * @throws PhpfastcacheDriverNotFoundException
169
-     * @throws PhpfastcacheInvalidArgumentException
170
-     * @throws PhpfastcacheInvalidConfigurationException
171
-     * @throws PhpfastcacheLogicException
172
-     * @throws \ReflectionException
173
-     */
174
-    public static function getInstance(string $driver, ?ConfigurationOptionInterface $config = null, ?string $instanceId = null): ExtendedCacheItemPoolInterface
175
-    {
176
-        $config = self::validateConfig($config);
177
-        $driver = self::standardizeDriverName($driver);
178
-
179
-        $instanceId = $instanceId ?: md5($driver . \serialize(\array_filter($config->toArray(), static function ($val){
180
-            return !\is_callable($val);
181
-        })));
182
-
183
-        if (!isset(self::$instances[$instanceId])) {
184
-            self::$badPracticeOmeter[$driver] = 1;
185
-            $driverClass = self::validateDriverClass(self::getDriverClass($driver));
186
-
187
-            if (\class_exists($driverClass)) {
188
-                $configClass = $driverClass::getConfigClass();
189
-                self::$instances[$instanceId] = new $driverClass(new $configClass($config->toArray()), $instanceId);
190
-                self::$instances[$instanceId]->setEventManager(EventManager::getInstance());
191
-            } else {
192
-                throw new PhpfastcacheDriverNotFoundException(sprintf('The driver "%s" does not exists', $driver));
193
-            }
194
-        } else {
195
-            if (self::$badPracticeOmeter[$driver] >= 2) {
196
-                \trigger_error(
197
-                    '[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
62
+	public const CORE_DRIVER_NAMESPACE = 'Phpfastcache\Drivers\\';
63
+
64
+	use ClassNamespaceResolverTrait;
65
+
66
+	/**
67
+	 * @var ConfigurationOption
68
+	 */
69
+	protected static $config;
70
+	/**
71
+	 * @var string
72
+	 */
73
+	protected static $namespacePath;
74
+
75
+	/**
76
+	 * @var ExtendedCacheItemPoolInterface[]
77
+	 */
78
+	protected static $instances = [];
79
+
80
+	/**
81
+	 * @var array
82
+	 */
83
+	protected static $driverOverrides = [];
84
+
85
+	/**
86
+	 * @var array
87
+	 */
88
+	protected static $driverCustoms = [];
89
+
90
+	/**
91
+	 * @var array
92
+	 */
93
+	protected static $badPracticeOmeter = [];
94
+
95
+	/**
96
+	 * CacheManager constructor.
97
+	 */
98
+	final protected function __construct()
99
+	{
100
+		// The cache manager is not meant to be instantiated
101
+	}
102
+
103
+	/**
104
+	 * @param string $instanceId
105
+	 * @return ExtendedCacheItemPoolInterface
106
+	 * @throws PhpfastcacheInstanceNotFoundException
107
+	 */
108
+	public static function getInstanceById(string $instanceId): ExtendedCacheItemPoolInterface
109
+	{
110
+		if (isset(self::$instances[$instanceId])) {
111
+			return self::$instances[$instanceId];
112
+		}
113
+
114
+		throw new PhpfastcacheInstanceNotFoundException(sprintf('Instance ID %s not found', $instanceId));
115
+	}
116
+
117
+	/**
118
+	 * Return the list of instances
119
+	 *
120
+	 * @return ExtendedCacheItemPoolInterface[]
121
+	 */
122
+	public static function getInstances(): array
123
+	{
124
+		return self::$instances;
125
+	}
126
+
127
+	/**
128
+	 * This method is intended for internal
129
+	 * use only and should not be used for
130
+	 * any external development use the
131
+	 * getInstances() method instead
132
+	 *
133
+	 * @return ExtendedCacheItemPoolInterface[]
134
+	 * @internal
135
+	 * @todo Use a proper way to passe them as a reference ?
136
+	 */
137
+	public static function &getInternalInstances(): array
138
+	{
139
+		return self::$instances;
140
+	}
141
+
142
+	/**
143
+	 * @param string $name
144
+	 * @param array $arguments
145
+	 * @return ExtendedCacheItemPoolInterface
146
+	 * @throws PhpfastcacheDriverCheckException
147
+	 * @throws PhpfastcacheDriverException
148
+	 * @throws PhpfastcacheDriverNotFoundException
149
+	 * @throws PhpfastcacheInvalidArgumentException
150
+	 * @throws PhpfastcacheInvalidConfigurationException
151
+	 * @throws PhpfastcacheLogicException
152
+	 * @throws \ReflectionException
153
+	 */
154
+	public static function __callStatic(string $name, array $arguments): ExtendedCacheItemPoolInterface
155
+	{
156
+		$options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []);
157
+
158
+		return self::getInstance($name, $options);
159
+	}
160
+
161
+	/**
162
+	 * @param string $driver
163
+	 * @param ConfigurationOptionInterface $config
164
+	 * @param string|null $instanceId
165
+	 * @return ExtendedCacheItemPoolInterface|AggregatablePoolInterface
166
+	 * @throws PhpfastcacheDriverCheckException
167
+	 * @throws PhpfastcacheDriverException
168
+	 * @throws PhpfastcacheDriverNotFoundException
169
+	 * @throws PhpfastcacheInvalidArgumentException
170
+	 * @throws PhpfastcacheInvalidConfigurationException
171
+	 * @throws PhpfastcacheLogicException
172
+	 * @throws \ReflectionException
173
+	 */
174
+	public static function getInstance(string $driver, ?ConfigurationOptionInterface $config = null, ?string $instanceId = null): ExtendedCacheItemPoolInterface
175
+	{
176
+		$config = self::validateConfig($config);
177
+		$driver = self::standardizeDriverName($driver);
178
+
179
+		$instanceId = $instanceId ?: md5($driver . \serialize(\array_filter($config->toArray(), static function ($val){
180
+			return !\is_callable($val);
181
+		})));
182
+
183
+		if (!isset(self::$instances[$instanceId])) {
184
+			self::$badPracticeOmeter[$driver] = 1;
185
+			$driverClass = self::validateDriverClass(self::getDriverClass($driver));
186
+
187
+			if (\class_exists($driverClass)) {
188
+				$configClass = $driverClass::getConfigClass();
189
+				self::$instances[$instanceId] = new $driverClass(new $configClass($config->toArray()), $instanceId);
190
+				self::$instances[$instanceId]->setEventManager(EventManager::getInstance());
191
+			} else {
192
+				throw new PhpfastcacheDriverNotFoundException(sprintf('The driver "%s" does not exists', $driver));
193
+			}
194
+		} else {
195
+			if (self::$badPracticeOmeter[$driver] >= 2) {
196
+				\trigger_error(
197
+					'[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
198 198
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'
199
-                );
200
-            }
201
-        }
202
-
203
-        self::$badPracticeOmeter[$driver]++;
204
-
205
-        return self::$instances[$instanceId];
206
-    }
207
-
208
-    /**
209
-     * @param ConfigurationOptionInterface|null $config
210
-     * @return ConfigurationOption
211
-     * @throws PhpfastcacheInvalidArgumentException
212
-     * @throws PhpfastcacheInvalidConfigurationException
213
-     * @throws \ReflectionException
214
-     */
215
-    protected static function validateConfig(?ConfigurationOptionInterface $config): ConfigurationOption
216
-    {
217
-        if ($config === null) {
218
-            $config = self::getDefaultConfig();
219
-        } else {
220
-            if (!($config instanceof ConfigurationOption)) {
221
-                throw new PhpfastcacheInvalidArgumentException(\sprintf('Unsupported config type: %s', \gettype($config)));
222
-            }
223
-        }
224
-
225
-        return $config;
226
-    }
227
-
228
-    /**
229
-     * @return ConfigurationOptionInterface
230
-     * @throws PhpfastcacheInvalidConfigurationException
231
-     * @throws \ReflectionException
232
-     */
233
-    public static function getDefaultConfig(): ConfigurationOptionInterface
234
-    {
235
-        return self::$config ?: self::$config = new ConfigurationOption();
236
-    }
237
-
238
-    /**
239
-     * @param string $driverName
240
-     * @return string
241
-     */
242
-    public static function standardizeDriverName(string $driverName): string
243
-    {
244
-        return \ucfirst(\strtolower(\trim($driverName)));
245
-    }
246
-
247
-    /**
248
-     * @param string $driverClass
249
-     * @return string|ExtendedCacheItemPoolInterface
250
-     * @throws PhpfastcacheDriverException
251
-     */
252
-    protected static function validateDriverClass(string $driverClass): string
253
-    {
254
-        if (!\is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)) {
255
-            throw new PhpfastcacheDriverException(
256
-                \sprintf(
257
-                    'Class "%s" does not implement "%s"',
258
-                    $driverClass,
259
-                    ExtendedCacheItemPoolInterface::class
260
-                )
261
-            );
262
-        }
263
-        return $driverClass;
264
-    }
265
-
266
-    /**
267
-     * @param string $driverName
268
-     * @return string
269
-     */
270
-    public static function getDriverClass(string $driverName): string
271
-    {
272
-        if (!empty(self::$driverCustoms[$driverName])) {
273
-            $driverClass = self::$driverCustoms[$driverName];
274
-        } else {
275
-            if (!empty(self::$driverOverrides[$driverName])) {
276
-                $driverClass = self::$driverOverrides[$driverName];
277
-            } else {
278
-                $driverClass = self::getNamespacePath() . $driverName . '\Driver';
279
-            }
280
-        }
281
-
282
-        return $driverClass;
283
-    }
284
-
285
-    /**
286
-     * @return string
287
-     */
288
-    public static function getNamespacePath(): string
289
-    {
290
-        return self::$namespacePath ?: self::getDefaultNamespacePath();
291
-    }
292
-
293
-    /**
294
-     * @return string
295
-     */
296
-    public static function getDefaultNamespacePath(): string
297
-    {
298
-        return self::CORE_DRIVER_NAMESPACE;
299
-    }
300
-
301
-    /**
302
-     * @return bool
303
-     */
304
-    public static function clearInstances(): bool
305
-    {
306
-        self::$instances = [];
307
-
308
-        \gc_collect_cycles();
309
-        return !\count(self::$instances);
310
-    }
311
-
312
-    /**
313
-     * @param ExtendedCacheItemPoolInterface $cachePoolInstance
314
-     * @return bool
315
-     * @since 7.0.4
316
-     */
317
-    public static function clearInstance(ExtendedCacheItemPoolInterface $cachePoolInstance): bool
318
-    {
319
-        $found = false;
320
-        self::$instances = \array_filter(
321
-            \array_map(
322
-                static function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) {
323
-                    if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) {
324
-                        $found = true;
325
-                        return null;
326
-                    }
327
-                    return $cachePool;
328
-                },
329
-                self::$instances
330
-            )
331
-        );
332
-
333
-        return $found;
334
-    }
335
-
336
-    /**
337
-     * @param ConfigurationOption $config
338
-     */
339
-    public static function setDefaultConfig(ConfigurationOption $config): void
340
-    {
341
-        self::$config = $config;
342
-    }
343
-
344
-    /**
345
-     * @param string $driverName
346
-     * @param string $className
347
-     * @return void
348
-     * @throws PhpfastcacheLogicException
349
-     * @throws PhpfastcacheUnsupportedOperationException
350
-     * @throws PhpfastcacheInvalidArgumentException
351
-     */
352
-    public static function addCustomDriver(string $driverName, string $className): void
353
-    {
354
-        $driverName = self::standardizeDriverName($driverName);
355
-
356
-        if (empty($driverName)) {
357
-            throw new PhpfastcacheInvalidArgumentException("Can't add a custom driver because its name is empty");
358
-        }
359
-
360
-        if (!\class_exists($className)) {
361
-            throw new PhpfastcacheInvalidArgumentException(
362
-                \sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className)
363
-            );
364
-        }
365
-
366
-        if (!empty(self::$driverCustoms[$driverName])) {
367
-            throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already added", $driverName));
368
-        }
369
-
370
-        if (\in_array($driverName, self::getDriverList(), true)) {
371
-            throw new PhpfastcacheLogicException(\sprintf("Driver '%s' is already a part of the PhpFastCache core", $driverName));
372
-        }
373
-
374
-        self::$driverCustoms[$driverName] = $className;
375
-    }
376
-
377
-    /**
378
-     * Return the list of available drivers Capitalized
379
-     * with optional FQCN as key
380
-     *
381
-     * @param bool $FQCNAsKey Describe keys with Full Qualified Class Name
382
-     * @return string[]
383
-     * @throws PhpfastcacheUnsupportedOperationException
384
-     */
385
-    public static function getDriverList(bool $FQCNAsKey = false): array
386
-    {
387
-        static $driverList;
388
-
389
-        if (self::getDefaultNamespacePath() === self::getNamespacePath()) {
390
-            if ($driverList === null) {
391
-                $prefix = self::CORE_DRIVER_NAMESPACE;
392
-                $classMap = self::createClassMap(__DIR__ . '/Drivers');
393
-                $driverList = [];
394
-
395
-                foreach ($classMap as $class => $file) {
396
-                    $driverList[] = \str_replace($prefix, '', \substr($class, 0, \strrpos($class, '\\')));
397
-                }
398
-
399
-                $driverList = \array_values(\array_unique($driverList));
400
-            }
401
-
402
-            $driverList = \array_merge($driverList, \array_keys(self::$driverCustoms));
403
-
404
-            if ($FQCNAsKey) {
405
-                $realDriverList = [];
406
-                foreach ($driverList as $driverName) {
407
-                    $realDriverList[self::getDriverClass($driverName)] = $driverName;
408
-                }
409
-                $driverList = $realDriverList;
410
-            }
411
-
412
-            \asort($driverList);
413
-
414
-            return $driverList;
415
-        }
416
-
417
-        throw new PhpfastcacheUnsupportedOperationException('Cannot get the driver list if the default namespace path has changed.');
418
-    }
419
-
420
-    /**
421
-     * @param string $driverName
422
-     * @return void
423
-     * @throws PhpfastcacheLogicException
424
-     * @throws PhpfastcacheInvalidArgumentException
425
-     */
426
-    public static function removeCustomDriver(string $driverName): void
427
-    {
428
-        $driverName = self::standardizeDriverName($driverName);
429
-
430
-        if (empty($driverName)) {
431
-            throw new PhpfastcacheInvalidArgumentException("Can't remove a custom driver because its name is empty");
432
-        }
433
-
434
-        if (!isset(self::$driverCustoms[$driverName])) {
435
-            throw new PhpfastcacheLogicException(\sprintf("Driver '%s' does not exists", $driverName));
436
-        }
437
-
438
-        unset(self::$driverCustoms[$driverName]);
439
-    }
440
-
441
-    /**
442
-     * @param string $driverName
443
-     * @param string $className
444
-     * @return void
445
-     * @throws PhpfastcacheLogicException
446
-     * @throws PhpfastcacheUnsupportedOperationException
447
-     * @throws PhpfastcacheInvalidArgumentException
448
-     */
449
-    public static function addCoreDriverOverride(string $driverName, string $className): void
450
-    {
451
-        $driverName = self::standardizeDriverName($driverName);
452
-
453
-        if (empty($driverName)) {
454
-            throw new PhpfastcacheInvalidArgumentException("Can't add a core driver override because its name is empty");
455
-        }
456
-
457
-        if (!\class_exists($className)) {
458
-            throw new PhpfastcacheInvalidArgumentException(
459
-                \sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className)
460
-            );
461
-        }
462
-
463
-        if (!empty(self::$driverOverrides[$driverName])) {
464
-            throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already overridden", $driverName));
465
-        }
466
-
467
-        if (!\in_array($driverName, self::getDriverList(), true)) {
468
-            throw new PhpfastcacheLogicException(\sprintf("Driver '%s' can't be overridden since its not a part of the PhpFastCache core", $driverName));
469
-        }
470
-
471
-        if (!\is_subclass_of($className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver', true)) {
472
-            throw new PhpfastcacheLogicException(
473
-                \sprintf(
474
-                    "Can't override '%s' because the class '%s' MUST extend '%s'",
475
-                    $driverName,
476
-                    $className,
477
-                    self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver'
478
-                )
479
-            );
480
-        }
481
-
482
-        self::$driverOverrides[$driverName] = $className;
483
-    }
484
-
485
-    /**
486
-     * @param string $driverName
487
-     * @return void
488
-     * @throws PhpfastcacheLogicException
489
-     * @throws PhpfastcacheInvalidArgumentException
490
-     */
491
-    public static function removeCoreDriverOverride(string $driverName): void
492
-    {
493
-        $driverName = self::standardizeDriverName($driverName);
494
-
495
-        if (empty($driverName)) {
496
-            throw new PhpfastcacheInvalidArgumentException("Can't remove a core driver override because its name is empty");
497
-        }
498
-
499
-        if (!isset(self::$driverOverrides[$driverName])) {
500
-            throw new PhpfastcacheLogicException(\sprintf("Driver '%s' were not overridden", $driverName));
501
-        }
502
-
503
-        unset(self::$driverOverrides[$driverName]);
504
-    }
199
+				);
200
+			}
201
+		}
202
+
203
+		self::$badPracticeOmeter[$driver]++;
204
+
205
+		return self::$instances[$instanceId];
206
+	}
207
+
208
+	/**
209
+	 * @param ConfigurationOptionInterface|null $config
210
+	 * @return ConfigurationOption
211
+	 * @throws PhpfastcacheInvalidArgumentException
212
+	 * @throws PhpfastcacheInvalidConfigurationException
213
+	 * @throws \ReflectionException
214
+	 */
215
+	protected static function validateConfig(?ConfigurationOptionInterface $config): ConfigurationOption
216
+	{
217
+		if ($config === null) {
218
+			$config = self::getDefaultConfig();
219
+		} else {
220
+			if (!($config instanceof ConfigurationOption)) {
221
+				throw new PhpfastcacheInvalidArgumentException(\sprintf('Unsupported config type: %s', \gettype($config)));
222
+			}
223
+		}
224
+
225
+		return $config;
226
+	}
227
+
228
+	/**
229
+	 * @return ConfigurationOptionInterface
230
+	 * @throws PhpfastcacheInvalidConfigurationException
231
+	 * @throws \ReflectionException
232
+	 */
233
+	public static function getDefaultConfig(): ConfigurationOptionInterface
234
+	{
235
+		return self::$config ?: self::$config = new ConfigurationOption();
236
+	}
237
+
238
+	/**
239
+	 * @param string $driverName
240
+	 * @return string
241
+	 */
242
+	public static function standardizeDriverName(string $driverName): string
243
+	{
244
+		return \ucfirst(\strtolower(\trim($driverName)));
245
+	}
246
+
247
+	/**
248
+	 * @param string $driverClass
249
+	 * @return string|ExtendedCacheItemPoolInterface
250
+	 * @throws PhpfastcacheDriverException
251
+	 */
252
+	protected static function validateDriverClass(string $driverClass): string
253
+	{
254
+		if (!\is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)) {
255
+			throw new PhpfastcacheDriverException(
256
+				\sprintf(
257
+					'Class "%s" does not implement "%s"',
258
+					$driverClass,
259
+					ExtendedCacheItemPoolInterface::class
260
+				)
261
+			);
262
+		}
263
+		return $driverClass;
264
+	}
265
+
266
+	/**
267
+	 * @param string $driverName
268
+	 * @return string
269
+	 */
270
+	public static function getDriverClass(string $driverName): string
271
+	{
272
+		if (!empty(self::$driverCustoms[$driverName])) {
273
+			$driverClass = self::$driverCustoms[$driverName];
274
+		} else {
275
+			if (!empty(self::$driverOverrides[$driverName])) {
276
+				$driverClass = self::$driverOverrides[$driverName];
277
+			} else {
278
+				$driverClass = self::getNamespacePath() . $driverName . '\Driver';
279
+			}
280
+		}
281
+
282
+		return $driverClass;
283
+	}
284
+
285
+	/**
286
+	 * @return string
287
+	 */
288
+	public static function getNamespacePath(): string
289
+	{
290
+		return self::$namespacePath ?: self::getDefaultNamespacePath();
291
+	}
292
+
293
+	/**
294
+	 * @return string
295
+	 */
296
+	public static function getDefaultNamespacePath(): string
297
+	{
298
+		return self::CORE_DRIVER_NAMESPACE;
299
+	}
300
+
301
+	/**
302
+	 * @return bool
303
+	 */
304
+	public static function clearInstances(): bool
305
+	{
306
+		self::$instances = [];
307
+
308
+		\gc_collect_cycles();
309
+		return !\count(self::$instances);
310
+	}
311
+
312
+	/**
313
+	 * @param ExtendedCacheItemPoolInterface $cachePoolInstance
314
+	 * @return bool
315
+	 * @since 7.0.4
316
+	 */
317
+	public static function clearInstance(ExtendedCacheItemPoolInterface $cachePoolInstance): bool
318
+	{
319
+		$found = false;
320
+		self::$instances = \array_filter(
321
+			\array_map(
322
+				static function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) {
323
+					if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) {
324
+						$found = true;
325
+						return null;
326
+					}
327
+					return $cachePool;
328
+				},
329
+				self::$instances
330
+			)
331
+		);
332
+
333
+		return $found;
334
+	}
335
+
336
+	/**
337
+	 * @param ConfigurationOption $config
338
+	 */
339
+	public static function setDefaultConfig(ConfigurationOption $config): void
340
+	{
341
+		self::$config = $config;
342
+	}
343
+
344
+	/**
345
+	 * @param string $driverName
346
+	 * @param string $className
347
+	 * @return void
348
+	 * @throws PhpfastcacheLogicException
349
+	 * @throws PhpfastcacheUnsupportedOperationException
350
+	 * @throws PhpfastcacheInvalidArgumentException
351
+	 */
352
+	public static function addCustomDriver(string $driverName, string $className): void
353
+	{
354
+		$driverName = self::standardizeDriverName($driverName);
355
+
356
+		if (empty($driverName)) {
357
+			throw new PhpfastcacheInvalidArgumentException("Can't add a custom driver because its name is empty");
358
+		}
359
+
360
+		if (!\class_exists($className)) {
361
+			throw new PhpfastcacheInvalidArgumentException(
362
+				\sprintf("Can't add '%s' because the class '%s' does not exists", $driverName, $className)
363
+			);
364
+		}
365
+
366
+		if (!empty(self::$driverCustoms[$driverName])) {
367
+			throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already added", $driverName));
368
+		}
369
+
370
+		if (\in_array($driverName, self::getDriverList(), true)) {
371
+			throw new PhpfastcacheLogicException(\sprintf("Driver '%s' is already a part of the PhpFastCache core", $driverName));
372
+		}
373
+
374
+		self::$driverCustoms[$driverName] = $className;
375
+	}
376
+
377
+	/**
378
+	 * Return the list of available drivers Capitalized
379
+	 * with optional FQCN as key
380
+	 *
381
+	 * @param bool $FQCNAsKey Describe keys with Full Qualified Class Name
382
+	 * @return string[]
383
+	 * @throws PhpfastcacheUnsupportedOperationException
384
+	 */
385
+	public static function getDriverList(bool $FQCNAsKey = false): array
386
+	{
387
+		static $driverList;
388
+
389
+		if (self::getDefaultNamespacePath() === self::getNamespacePath()) {
390
+			if ($driverList === null) {
391
+				$prefix = self::CORE_DRIVER_NAMESPACE;
392
+				$classMap = self::createClassMap(__DIR__ . '/Drivers');
393
+				$driverList = [];
394
+
395
+				foreach ($classMap as $class => $file) {
396
+					$driverList[] = \str_replace($prefix, '', \substr($class, 0, \strrpos($class, '\\')));
397
+				}
398
+
399
+				$driverList = \array_values(\array_unique($driverList));
400
+			}
401
+
402
+			$driverList = \array_merge($driverList, \array_keys(self::$driverCustoms));
403
+
404
+			if ($FQCNAsKey) {
405
+				$realDriverList = [];
406
+				foreach ($driverList as $driverName) {
407
+					$realDriverList[self::getDriverClass($driverName)] = $driverName;
408
+				}
409
+				$driverList = $realDriverList;
410
+			}
411
+
412
+			\asort($driverList);
413
+
414
+			return $driverList;
415
+		}
416
+
417
+		throw new PhpfastcacheUnsupportedOperationException('Cannot get the driver list if the default namespace path has changed.');
418
+	}
419
+
420
+	/**
421
+	 * @param string $driverName
422
+	 * @return void
423
+	 * @throws PhpfastcacheLogicException
424
+	 * @throws PhpfastcacheInvalidArgumentException
425
+	 */
426
+	public static function removeCustomDriver(string $driverName): void
427
+	{
428
+		$driverName = self::standardizeDriverName($driverName);
429
+
430
+		if (empty($driverName)) {
431
+			throw new PhpfastcacheInvalidArgumentException("Can't remove a custom driver because its name is empty");
432
+		}
433
+
434
+		if (!isset(self::$driverCustoms[$driverName])) {
435
+			throw new PhpfastcacheLogicException(\sprintf("Driver '%s' does not exists", $driverName));
436
+		}
437
+
438
+		unset(self::$driverCustoms[$driverName]);
439
+	}
440
+
441
+	/**
442
+	 * @param string $driverName
443
+	 * @param string $className
444
+	 * @return void
445
+	 * @throws PhpfastcacheLogicException
446
+	 * @throws PhpfastcacheUnsupportedOperationException
447
+	 * @throws PhpfastcacheInvalidArgumentException
448
+	 */
449
+	public static function addCoreDriverOverride(string $driverName, string $className): void
450
+	{
451
+		$driverName = self::standardizeDriverName($driverName);
452
+
453
+		if (empty($driverName)) {
454
+			throw new PhpfastcacheInvalidArgumentException("Can't add a core driver override because its name is empty");
455
+		}
456
+
457
+		if (!\class_exists($className)) {
458
+			throw new PhpfastcacheInvalidArgumentException(
459
+				\sprintf("Can't override '%s' because the class '%s' does not exists", $driverName, $className)
460
+			);
461
+		}
462
+
463
+		if (!empty(self::$driverOverrides[$driverName])) {
464
+			throw new PhpfastcacheLogicException(\sprintf("Driver '%s' has been already overridden", $driverName));
465
+		}
466
+
467
+		if (!\in_array($driverName, self::getDriverList(), true)) {
468
+			throw new PhpfastcacheLogicException(\sprintf("Driver '%s' can't be overridden since its not a part of the PhpFastCache core", $driverName));
469
+		}
470
+
471
+		if (!\is_subclass_of($className, self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver', true)) {
472
+			throw new PhpfastcacheLogicException(
473
+				\sprintf(
474
+					"Can't override '%s' because the class '%s' MUST extend '%s'",
475
+					$driverName,
476
+					$className,
477
+					self::CORE_DRIVER_NAMESPACE . $driverName . '\\Driver'
478
+				)
479
+			);
480
+		}
481
+
482
+		self::$driverOverrides[$driverName] = $className;
483
+	}
484
+
485
+	/**
486
+	 * @param string $driverName
487
+	 * @return void
488
+	 * @throws PhpfastcacheLogicException
489
+	 * @throws PhpfastcacheInvalidArgumentException
490
+	 */
491
+	public static function removeCoreDriverOverride(string $driverName): void
492
+	{
493
+		$driverName = self::standardizeDriverName($driverName);
494
+
495
+		if (empty($driverName)) {
496
+			throw new PhpfastcacheInvalidArgumentException("Can't remove a core driver override because its name is empty");
497
+		}
498
+
499
+		if (!isset(self::$driverOverrides[$driverName])) {
500
+			throw new PhpfastcacheLogicException(\sprintf("Driver '%s' were not overridden", $driverName));
501
+		}
502
+
503
+		unset(self::$driverOverrides[$driverName]);
504
+	}
505 505
 }
Please login to merge, or discard this patch.
php/lib/phpfastcache/lib/Phpfastcache/Helper/CacheConditionalHelper.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -25,39 +25,39 @@
 block discarded – undo
25 25
  */
26 26
 class CacheConditionalHelper
27 27
 {
28
-    /**
29
-     * @var CacheItemPoolInterface
30
-     */
31
-    protected $cacheInstance;
32
-
33
-    /**
34
-     * CachePromise constructor.
35
-     * @param CacheItemPoolInterface $cacheInstance
36
-     */
37
-    public function __construct(CacheItemPoolInterface $cacheInstance)
38
-    {
39
-        $this->cacheInstance = $cacheInstance;
40
-    }
41
-
42
-    /**
43
-     * @param string $cacheKey
44
-     * @param callable $callback
45
-     * @param int|DateInterval $expiresAfter
46
-     * @return mixed
47
-     */
48
-    public function get(string $cacheKey, callable $callback, $expiresAfter = null)
49
-    {
50
-        $cacheItem = $this->cacheInstance->getItem($cacheKey);
51
-
52
-        if (!$cacheItem->isHit()) {
53
-            /** Parameter $cacheItem will be available as of 8.0.6 */
54
-            $cacheItem->set($callback($cacheItem));
55
-            if ($expiresAfter) {
56
-                $cacheItem->expiresAfter($expiresAfter);
57
-            }
58
-            $this->cacheInstance->save($cacheItem);
59
-        }
60
-
61
-        return $cacheItem->get();
62
-    }
28
+	/**
29
+	 * @var CacheItemPoolInterface
30
+	 */
31
+	protected $cacheInstance;
32
+
33
+	/**
34
+	 * CachePromise constructor.
35
+	 * @param CacheItemPoolInterface $cacheInstance
36
+	 */
37
+	public function __construct(CacheItemPoolInterface $cacheInstance)
38
+	{
39
+		$this->cacheInstance = $cacheInstance;
40
+	}
41
+
42
+	/**
43
+	 * @param string $cacheKey
44
+	 * @param callable $callback
45
+	 * @param int|DateInterval $expiresAfter
46
+	 * @return mixed
47
+	 */
48
+	public function get(string $cacheKey, callable $callback, $expiresAfter = null)
49
+	{
50
+		$cacheItem = $this->cacheInstance->getItem($cacheKey);
51
+
52
+		if (!$cacheItem->isHit()) {
53
+			/** Parameter $cacheItem will be available as of 8.0.6 */
54
+			$cacheItem->set($callback($cacheItem));
55
+			if ($expiresAfter) {
56
+				$cacheItem->expiresAfter($expiresAfter);
57
+			}
58
+			$this->cacheInstance->save($cacheItem);
59
+		}
60
+
61
+		return $cacheItem->get();
62
+	}
63 63
 }
Please login to merge, or discard this patch.