Test Failed
Branch master (2f190b)
by Mike
11:47
created
files/php/lib/phpfastcache/lib/Phpfastcache/Cluster/ItemAbstract.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,23 +26,23 @@
 block discarded – undo
26 26
  */
27 27
 abstract class ItemAbstract implements ExtendedCacheItemInterface
28 28
 {
29
-    use ItemBaseTrait {
30
-        ItemBaseTrait::__construct as __BaseConstruct;
31
-    }
29
+	use ItemBaseTrait {
30
+		ItemBaseTrait::__construct as __BaseConstruct;
31
+	}
32 32
 
33
-    /**
34
-     * @param ExtendedCacheItemPoolInterface $driver
35
-     * @return static
36
-     * @throws PhpfastcacheInvalidArgumentException
37
-     */
38
-    public function setDriver(ExtendedCacheItemPoolInterface $driver)
39
-    {
40
-        if ($driver instanceof ClusterPoolInterface) {
41
-            $this->driver = $driver;
33
+	/**
34
+	 * @param ExtendedCacheItemPoolInterface $driver
35
+	 * @return static
36
+	 * @throws PhpfastcacheInvalidArgumentException
37
+	 */
38
+	public function setDriver(ExtendedCacheItemPoolInterface $driver)
39
+	{
40
+		if ($driver instanceof ClusterPoolInterface) {
41
+			$this->driver = $driver;
42 42
 
43
-            return $this;
44
-        }
43
+			return $this;
44
+		}
45 45
 
46
-        throw new PhpfastcacheInvalidArgumentException('Invalid driver instance');
47
-    }
46
+		throw new PhpfastcacheInvalidArgumentException('Invalid driver instance');
47
+	}
48 48
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
      * @return static
36 36
      * @throws PhpfastcacheInvalidArgumentException
37 37
      */
38
-    public function setDriver(ExtendedCacheItemPoolInterface $driver)
39
-    {
38
+    public function setDriver(ExtendedCacheItemPoolInterface $driver) {
40 39
         if ($driver instanceof ClusterPoolInterface) {
41 40
             $this->driver = $driver;
42 41
 
Please login to merge, or discard this patch.
php/lib/phpfastcache/lib/Phpfastcache/Cluster/ClusterPoolInterface.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
  */
25 25
 interface ClusterPoolInterface extends ExtendedCacheItemPoolInterface
26 26
 {
27
-    /**
28
-     * @return ExtendedCacheItemPoolInterface[]
29
-     */
30
-    public function getClusterPools(): array;
27
+	/**
28
+	 * @return ExtendedCacheItemPoolInterface[]
29
+	 */
30
+	public function getClusterPools(): array;
31 31
 }
Please login to merge, or discard this patch.
files/php/lib/phpfastcache/lib/Phpfastcache/Cluster/ClusterAggregator.php 2 patches
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -35,140 +35,140 @@
 block discarded – undo
35 35
 class ClusterAggregator implements AggregatorInterface
36 36
 {
37 37
 
38
-    protected $driverPools;
39
-
40
-    /**
41
-     * @var ClusterPoolInterface
42
-     */
43
-    protected $cluster;
44
-
45
-    /**
46
-     * @var string
47
-     */
48
-    protected $clusterAggregatorName;
49
-
50
-    /**
51
-     * ClusterAggregator constructor.
52
-     * @param string $clusterAggregatorName
53
-     * @param AggregatablePoolInterface ...$driverPools
54
-     * @throws PhpfastcacheLogicException
55
-     */
56
-    public function __construct(string $clusterAggregatorName = '', AggregatablePoolInterface ...$driverPools)
57
-    {
58
-        $clusterAggregatorName = trim($clusterAggregatorName);
59
-        if (empty($clusterAggregatorName)) {
60
-            try {
61
-                $clusterAggregatorName = 'cluster_' . \bin2hex(\random_bytes(15));
62
-            } catch (Exception $e) {
63
-                $clusterAggregatorName = 'cluster_' . \str_shuffle(\spl_object_hash(new stdClass()));
64
-            }
65
-        }
66
-
67
-        $this->clusterAggregatorName = $clusterAggregatorName;
68
-
69
-        foreach ($driverPools as $driverPool) {
70
-            $this->aggregateDriver($driverPool);
71
-        }
72
-    }
73
-
74
-    /**
75
-     * @param AggregatablePoolInterface $driverPool
76
-     *
77
-     * @throws PhpfastcacheLogicException
78
-     */
79
-    public function aggregateDriver(AggregatablePoolInterface $driverPool): void
80
-    {
81
-        if ($this->cluster) {
82
-            throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.');
83
-        }
84
-
85
-        $splHash = \spl_object_hash($driverPool);
86
-        if (!isset($this->driverPools[$splHash])) {
87
-            if ($driverPool instanceof ClusterPoolInterface) {
88
-                throw new PhpfastcacheLogicException('Recursive cluster aggregation is not allowed !');
89
-            }
90
-
91
-            $this->driverPools[$splHash] = $driverPool;
92
-        } else {
93
-            throw new PhpfastcacheLogicException('This pool has been already aggregated !');
94
-        }
95
-    }
96
-
97
-    /**
98
-     * @param string $driverName
99
-     * @param ConfigurationOption|null $driverConfig
100
-     * @throws PhpfastcacheDriverCheckException
101
-     * @throws PhpfastcacheDriverException
102
-     * @throws PhpfastcacheDriverNotFoundException
103
-     * @throws PhpfastcacheInvalidArgumentException
104
-     * @throws PhpfastcacheInvalidConfigurationException
105
-     * @throws PhpfastcacheLogicException
106
-     * @throws ReflectionException
107
-     */
108
-    public function aggregateNewDriver(string $driverName, ConfigurationOption $driverConfig = null): void
109
-    {
110
-        if ($this->cluster) {
111
-            throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.');
112
-        }
113
-        $this->aggregateDriver(
114
-            CacheManager::getInstance($driverName, $driverConfig)
115
-        );
116
-    }
117
-
118
-    /**
119
-     * @param AggregatablePoolInterface $driverPool
120
-     *
121
-     * @throws PhpfastcacheLogicException
122
-     */
123
-    public function disaggregateDriver(AggregatablePoolInterface $driverPool): void
124
-    {
125
-        if ($this->cluster) {
126
-            throw new PhpfastcacheLogicException('The cluster has been already build, cannot disaggregate pools.');
127
-        }
128
-
129
-        $splHash = \spl_object_hash($driverPool);
130
-        if (isset($this->driverPools[$splHash])) {
131
-            unset($this->driverPools[$splHash]);
132
-        } else {
133
-            throw new PhpfastcacheLogicException('This pool was not aggregated !');
134
-        }
135
-    }
136
-
137
-    /**
138
-     * @param int $strategy
139
-     *
140
-     * @return ClusterPoolInterface
141
-     * @throws PhpfastcacheInvalidArgumentException
142
-     */
143
-    public function getCluster(int $strategy = AggregatorInterface::STRATEGY_FULL_REPLICATION): ClusterPoolInterface
144
-    {
145
-        if (isset(ClusterPoolAbstract::STRATEGY[$strategy])) {
146
-            if (!$this->cluster) {
147
-                $clusterClass = ClusterPoolAbstract::STRATEGY[$strategy];
148
-                $this->cluster = new $clusterClass(
149
-                    $this->getClusterAggregatorName(),
150
-                    ...\array_values($this->driverPools)
151
-                );
152
-
153
-                /**
154
-                 * @eventName CacheClusterBuilt
155
-                 * @param $clusterAggregator AggregatorInterface
156
-                 * @param $cluster ClusterPoolInterface
157
-                 */
158
-                $this->cluster->getEventManager()->dispatch('CacheClusterBuilt', $this, $this->cluster);
159
-            }
160
-        } else {
161
-            throw new PhpfastcacheInvalidArgumentException('Unknown cluster strategy');
162
-        }
163
-
164
-        return $this->cluster;
165
-    }
166
-
167
-    /**
168
-     * @return string
169
-     */
170
-    public function getClusterAggregatorName(): string
171
-    {
172
-        return $this->clusterAggregatorName;
173
-    }
38
+	protected $driverPools;
39
+
40
+	/**
41
+	 * @var ClusterPoolInterface
42
+	 */
43
+	protected $cluster;
44
+
45
+	/**
46
+	 * @var string
47
+	 */
48
+	protected $clusterAggregatorName;
49
+
50
+	/**
51
+	 * ClusterAggregator constructor.
52
+	 * @param string $clusterAggregatorName
53
+	 * @param AggregatablePoolInterface ...$driverPools
54
+	 * @throws PhpfastcacheLogicException
55
+	 */
56
+	public function __construct(string $clusterAggregatorName = '', AggregatablePoolInterface ...$driverPools)
57
+	{
58
+		$clusterAggregatorName = trim($clusterAggregatorName);
59
+		if (empty($clusterAggregatorName)) {
60
+			try {
61
+				$clusterAggregatorName = 'cluster_' . \bin2hex(\random_bytes(15));
62
+			} catch (Exception $e) {
63
+				$clusterAggregatorName = 'cluster_' . \str_shuffle(\spl_object_hash(new stdClass()));
64
+			}
65
+		}
66
+
67
+		$this->clusterAggregatorName = $clusterAggregatorName;
68
+
69
+		foreach ($driverPools as $driverPool) {
70
+			$this->aggregateDriver($driverPool);
71
+		}
72
+	}
73
+
74
+	/**
75
+	 * @param AggregatablePoolInterface $driverPool
76
+	 *
77
+	 * @throws PhpfastcacheLogicException
78
+	 */
79
+	public function aggregateDriver(AggregatablePoolInterface $driverPool): void
80
+	{
81
+		if ($this->cluster) {
82
+			throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.');
83
+		}
84
+
85
+		$splHash = \spl_object_hash($driverPool);
86
+		if (!isset($this->driverPools[$splHash])) {
87
+			if ($driverPool instanceof ClusterPoolInterface) {
88
+				throw new PhpfastcacheLogicException('Recursive cluster aggregation is not allowed !');
89
+			}
90
+
91
+			$this->driverPools[$splHash] = $driverPool;
92
+		} else {
93
+			throw new PhpfastcacheLogicException('This pool has been already aggregated !');
94
+		}
95
+	}
96
+
97
+	/**
98
+	 * @param string $driverName
99
+	 * @param ConfigurationOption|null $driverConfig
100
+	 * @throws PhpfastcacheDriverCheckException
101
+	 * @throws PhpfastcacheDriverException
102
+	 * @throws PhpfastcacheDriverNotFoundException
103
+	 * @throws PhpfastcacheInvalidArgumentException
104
+	 * @throws PhpfastcacheInvalidConfigurationException
105
+	 * @throws PhpfastcacheLogicException
106
+	 * @throws ReflectionException
107
+	 */
108
+	public function aggregateNewDriver(string $driverName, ConfigurationOption $driverConfig = null): void
109
+	{
110
+		if ($this->cluster) {
111
+			throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.');
112
+		}
113
+		$this->aggregateDriver(
114
+			CacheManager::getInstance($driverName, $driverConfig)
115
+		);
116
+	}
117
+
118
+	/**
119
+	 * @param AggregatablePoolInterface $driverPool
120
+	 *
121
+	 * @throws PhpfastcacheLogicException
122
+	 */
123
+	public function disaggregateDriver(AggregatablePoolInterface $driverPool): void
124
+	{
125
+		if ($this->cluster) {
126
+			throw new PhpfastcacheLogicException('The cluster has been already build, cannot disaggregate pools.');
127
+		}
128
+
129
+		$splHash = \spl_object_hash($driverPool);
130
+		if (isset($this->driverPools[$splHash])) {
131
+			unset($this->driverPools[$splHash]);
132
+		} else {
133
+			throw new PhpfastcacheLogicException('This pool was not aggregated !');
134
+		}
135
+	}
136
+
137
+	/**
138
+	 * @param int $strategy
139
+	 *
140
+	 * @return ClusterPoolInterface
141
+	 * @throws PhpfastcacheInvalidArgumentException
142
+	 */
143
+	public function getCluster(int $strategy = AggregatorInterface::STRATEGY_FULL_REPLICATION): ClusterPoolInterface
144
+	{
145
+		if (isset(ClusterPoolAbstract::STRATEGY[$strategy])) {
146
+			if (!$this->cluster) {
147
+				$clusterClass = ClusterPoolAbstract::STRATEGY[$strategy];
148
+				$this->cluster = new $clusterClass(
149
+					$this->getClusterAggregatorName(),
150
+					...\array_values($this->driverPools)
151
+				);
152
+
153
+				/**
154
+				 * @eventName CacheClusterBuilt
155
+				 * @param $clusterAggregator AggregatorInterface
156
+				 * @param $cluster ClusterPoolInterface
157
+				 */
158
+				$this->cluster->getEventManager()->dispatch('CacheClusterBuilt', $this, $this->cluster);
159
+			}
160
+		} else {
161
+			throw new PhpfastcacheInvalidArgumentException('Unknown cluster strategy');
162
+		}
163
+
164
+		return $this->cluster;
165
+	}
166
+
167
+	/**
168
+	 * @return string
169
+	 */
170
+	public function getClusterAggregatorName(): string
171
+	{
172
+		return $this->clusterAggregatorName;
173
+	}
174 174
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
      * @param AggregatablePoolInterface ...$driverPools
54 54
      * @throws PhpfastcacheLogicException
55 55
      */
56
-    public function __construct(string $clusterAggregatorName = '', AggregatablePoolInterface ...$driverPools)
57
-    {
56
+    public function __construct(string $clusterAggregatorName = '', AggregatablePoolInterface ...$driverPools) {
58 57
         $clusterAggregatorName = trim($clusterAggregatorName);
59 58
         if (empty($clusterAggregatorName)) {
60 59
             try {
61 60
                 $clusterAggregatorName = 'cluster_' . \bin2hex(\random_bytes(15));
62
-            } catch (Exception $e) {
61
+            }
62
+            catch (Exception $e) {
63 63
                 $clusterAggregatorName = 'cluster_' . \str_shuffle(\spl_object_hash(new stdClass()));
64 64
             }
65 65
         }
@@ -89,7 +89,8 @@  discard block
 block discarded – undo
89 89
             }
90 90
 
91 91
             $this->driverPools[$splHash] = $driverPool;
92
-        } else {
92
+        }
93
+        else {
93 94
             throw new PhpfastcacheLogicException('This pool has been already aggregated !');
94 95
         }
95 96
     }
@@ -129,7 +130,8 @@  discard block
 block discarded – undo
129 130
         $splHash = \spl_object_hash($driverPool);
130 131
         if (isset($this->driverPools[$splHash])) {
131 132
             unset($this->driverPools[$splHash]);
132
-        } else {
133
+        }
134
+        else {
133 135
             throw new PhpfastcacheLogicException('This pool was not aggregated !');
134 136
         }
135 137
     }
@@ -157,7 +159,8 @@  discard block
 block discarded – undo
157 159
                  */
158 160
                 $this->cluster->getEventManager()->dispatch('CacheClusterBuilt', $this, $this->cluster);
159 161
             }
160
-        } else {
162
+        }
163
+        else {
161 164
             throw new PhpfastcacheInvalidArgumentException('Unknown cluster strategy');
162 165
         }
163 166
 
Please login to merge, or discard this patch.
files/php/lib/phpfastcache/lib/Phpfastcache/Cluster/ClusterPoolTrait.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,54 +19,54 @@
 block discarded – undo
19 19
 
20 20
 trait ClusterPoolTrait
21 21
 {
22
-    /**
23
-     * @return bool
24
-     */
25
-    protected function driverCheck(): bool
26
-    {
27
-        return true;
28
-    }
22
+	/**
23
+	 * @return bool
24
+	 */
25
+	protected function driverCheck(): bool
26
+	{
27
+		return true;
28
+	}
29 29
 
30
-    /**
31
-     * @return bool
32
-     */
33
-    protected function driverConnect(): bool
34
-    {
35
-        return true;
36
-    }
30
+	/**
31
+	 * @return bool
32
+	 */
33
+	protected function driverConnect(): bool
34
+	{
35
+		return true;
36
+	}
37 37
 
38
-    /**
39
-     * @param CacheItemInterface $item
40
-     * @return null
41
-     */
42
-    protected function driverRead(CacheItemInterface $item)
43
-    {
44
-        return null;
45
-    }
38
+	/**
39
+	 * @param CacheItemInterface $item
40
+	 * @return null
41
+	 */
42
+	protected function driverRead(CacheItemInterface $item)
43
+	{
44
+		return null;
45
+	}
46 46
 
47
-    /**
48
-     * @param CacheItemInterface $item
49
-     * @return bool
50
-     */
51
-    protected function driverWrite(CacheItemInterface $item): bool
52
-    {
53
-        return true;
54
-    }
47
+	/**
48
+	 * @param CacheItemInterface $item
49
+	 * @return bool
50
+	 */
51
+	protected function driverWrite(CacheItemInterface $item): bool
52
+	{
53
+		return true;
54
+	}
55 55
 
56
-    /**
57
-     * @param CacheItemInterface $item
58
-     * @return bool
59
-     */
60
-    protected function driverDelete(CacheItemInterface $item): bool
61
-    {
62
-        return true;
63
-    }
56
+	/**
57
+	 * @param CacheItemInterface $item
58
+	 * @return bool
59
+	 */
60
+	protected function driverDelete(CacheItemInterface $item): bool
61
+	{
62
+		return true;
63
+	}
64 64
 
65
-    /**
66
-     * @return bool
67
-     */
68
-    protected function driverClear(): bool
69
-    {
70
-        return true;
71
-    }
65
+	/**
66
+	 * @return bool
67
+	 */
68
+	protected function driverClear(): bool
69
+	{
70
+		return true;
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@
 block discarded – undo
39 39
      * @param CacheItemInterface $item
40 40
      * @return null
41 41
      */
42
-    protected function driverRead(CacheItemInterface $item)
43
-    {
42
+    protected function driverRead(CacheItemInterface $item) {
44 43
         return null;
45 44
     }
46 45
 
Please login to merge, or discard this patch.
files/php/lib/phpfastcache/lib/Phpfastcache/Cluster/AggregatorInterface.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -25,81 +25,81 @@
 block discarded – undo
25 25
 interface AggregatorInterface
26 26
 {
27 27
 
28
-    /**
29
-     * Full replication mechanism
30
-     *
31
-     * Read on first working (and synchronize if needed, no failure allowed),
32
-     * Write on all (no failure allowed),
33
-     * Delete on all (no failure allowed)
34
-     *
35
-     * Conflict on multiple reads: Keep first found item (but sync the others)
36
-     * Cluster size: 2 minimum, unlimited
37
-     */
38
-    public const STRATEGY_FULL_REPLICATION = 1;
28
+	/**
29
+	 * Full replication mechanism
30
+	 *
31
+	 * Read on first working (and synchronize if needed, no failure allowed),
32
+	 * Write on all (no failure allowed),
33
+	 * Delete on all (no failure allowed)
34
+	 *
35
+	 * Conflict on multiple reads: Keep first found item (but sync the others)
36
+	 * Cluster size: 2 minimum, unlimited
37
+	 */
38
+	public const STRATEGY_FULL_REPLICATION = 1;
39 39
 
40
-    /**
41
-     * Semi replication mechanism
42
-     *
43
-     * Read first working (but do not synchronize, with partial failure allowed),
44
-     * Write on all (with partial failure allowed)
45
-     * Delete on all (with partial failure allowed)
46
-     *
47
-     * Conflict on multiple reads: Keep first found item
48
-     * Cluster size: 2 minimum, unlimited
49
-     */
50
-    public const STRATEGY_SEMI_REPLICATION = 2;
40
+	/**
41
+	 * Semi replication mechanism
42
+	 *
43
+	 * Read first working (but do not synchronize, with partial failure allowed),
44
+	 * Write on all (with partial failure allowed)
45
+	 * Delete on all (with partial failure allowed)
46
+	 *
47
+	 * Conflict on multiple reads: Keep first found item
48
+	 * Cluster size: 2 minimum, unlimited
49
+	 */
50
+	public const STRATEGY_SEMI_REPLICATION = 2;
51 51
 
52
-    /**
53
-     * First pool is master, second is slave
54
-     *
55
-     * Read from master (but do not synchronize, with master failure only allowed)
56
-     * Write on all (with master failure only allowed)
57
-     * Delete on all (with master failure only allowed)
58
-     *
59
-     * Conflict on multiple reads: No, master is exclusive source except if it fails
60
-     * Cluster size: 2 exactly: Master & Slave (Exception if more or less)
61
-     */
62
-    public const STRATEGY_MASTER_SLAVE = 4;
52
+	/**
53
+	 * First pool is master, second is slave
54
+	 *
55
+	 * Read from master (but do not synchronize, with master failure only allowed)
56
+	 * Write on all (with master failure only allowed)
57
+	 * Delete on all (with master failure only allowed)
58
+	 *
59
+	 * Conflict on multiple reads: No, master is exclusive source except if it fails
60
+	 * Cluster size: 2 exactly: Master & Slave (Exception if more or less)
61
+	 */
62
+	public const STRATEGY_MASTER_SLAVE = 4;
63 63
 
64
-    /**
65
-     * Mostly used for development testing
66
-     *
67
-     * CRUD operations are made on a random-chosen backend from a given cluster.
68
-     * This means you have 1 chance out of (n count of pools) to find an existing cache item
69
-     * but also to write/delete an non-existing item.
70
-     */
71
-    public const STRATEGY_RANDOM_REPLICATION = 8;
64
+	/**
65
+	 * Mostly used for development testing
66
+	 *
67
+	 * CRUD operations are made on a random-chosen backend from a given cluster.
68
+	 * This means you have 1 chance out of (n count of pools) to find an existing cache item
69
+	 * but also to write/delete an non-existing item.
70
+	 */
71
+	public const STRATEGY_RANDOM_REPLICATION = 8;
72 72
 
73
-    /**
74
-     * AggregatorInterface constructor.
75
-     *
76
-     * @param string $clusterAggregatorName
77
-     * @param AggregatablePoolInterface ...$driverPools
78
-     */
79
-    public function __construct(string $clusterAggregatorName, AggregatablePoolInterface ...$driverPools);
73
+	/**
74
+	 * AggregatorInterface constructor.
75
+	 *
76
+	 * @param string $clusterAggregatorName
77
+	 * @param AggregatablePoolInterface ...$driverPools
78
+	 */
79
+	public function __construct(string $clusterAggregatorName, AggregatablePoolInterface ...$driverPools);
80 80
 
81
-    /**
82
-     * @param int $strategy
83
-     *
84
-     * @return ClusterPoolInterface
85
-     */
86
-    public function getCluster(int $strategy): ClusterPoolInterface;
81
+	/**
82
+	 * @param int $strategy
83
+	 *
84
+	 * @return ClusterPoolInterface
85
+	 */
86
+	public function getCluster(int $strategy): ClusterPoolInterface;
87 87
 
88
-    /**
89
-     * @param string $driverName
90
-     * @param ConfigurationOption|NULL $driverConfig
91
-     *
92
-     * @return void
93
-     */
94
-    public function aggregateNewDriver(string $driverName, ConfigurationOption $driverConfig = null): void;
88
+	/**
89
+	 * @param string $driverName
90
+	 * @param ConfigurationOption|NULL $driverConfig
91
+	 *
92
+	 * @return void
93
+	 */
94
+	public function aggregateNewDriver(string $driverName, ConfigurationOption $driverConfig = null): void;
95 95
 
96
-    /**
97
-     * @param AggregatablePoolInterface $driverPool
98
-     */
99
-    public function aggregateDriver(AggregatablePoolInterface $driverPool): void;
96
+	/**
97
+	 * @param AggregatablePoolInterface $driverPool
98
+	 */
99
+	public function aggregateDriver(AggregatablePoolInterface $driverPool): void;
100 100
 
101
-    /**
102
-     * @param AggregatablePoolInterface $driverPool
103
-     */
104
-    public function disaggregateDriver(AggregatablePoolInterface $driverPool): void;
101
+	/**
102
+	 * @param AggregatablePoolInterface $driverPool
103
+	 */
104
+	public function disaggregateDriver(AggregatablePoolInterface $driverPool): void;
105 105
 }
Please login to merge, or discard this patch.
lib/Phpfastcache/Cluster/Drivers/FullReplication/FullReplicationCluster.php 2 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -26,151 +26,151 @@
 block discarded – undo
26 26
  */
27 27
 class FullReplicationCluster extends ClusterPoolAbstract
28 28
 {
29
-    /**
30
-     * @inheritDoc
31
-     */
32
-    public function getItem($key)
33
-    {
34
-        /** @var ExtendedCacheItemPoolInterface[] $poolsToResync */
35
-        $poolsToResync = [];
36
-        /** @var ExtendedCacheItemInterface $item */
37
-        $item = null;
38
-
39
-        foreach ($this->clusterPools as $driverPool) {
40
-            $poolItem = $driverPool->getItem($key);
41
-            if ($poolItem->isHit()) {
42
-                if (!$item) {
43
-                    $item = $poolItem;
44
-                    continue;
45
-                }
46
-
47
-                $itemData = $item->get();
48
-                $poolItemData = $poolItem->get();
49
-
50
-                if (\is_object($itemData)
51
-                ) {
52
-                    if ($item->get() != $poolItemData) {
53
-                        $poolsToResync[] = $driverPool;
54
-                    }
55
-                } else {
56
-                    if ($item->get() !== $poolItemData) {
57
-                        $poolsToResync[] = $driverPool;
58
-                    }
59
-                }
60
-            } else {
61
-                $poolsToResync[] = $driverPool;
62
-            }
63
-        }
64
-
65
-        if ($item && $item->isHit() && \count($poolsToResync) < \count($this->clusterPools)) {
66
-            foreach ($poolsToResync as $poolToResync) {
67
-                $poolItem = $poolToResync->getItem($key);
68
-                $poolItem->setEventManager($this->getEventManager())
69
-                    ->set($item->get())
70
-                    ->setHit($item->isHit())
71
-                    ->setTags($item->getTags())
72
-                    ->expiresAt($item->getExpirationDate())
73
-                    ->setDriver($poolToResync);
74
-                $poolToResync->save($poolItem);
75
-            }
76
-        }
77
-
78
-        return $this->getStandardizedItem($item ?? new Item($this, $key), $this);
79
-    }
80
-
81
-    /**
82
-     * @inheritDoc
83
-     */
84
-    public function hasItem($key)
85
-    {
86
-        foreach ($this->clusterPools as $driverPool) {
87
-            $poolItem = $driverPool->getItem($key);
88
-            if ($poolItem->isHit()) {
89
-                return true;
90
-            }
91
-        }
92
-
93
-        return false;
94
-    }
95
-
96
-    /**
97
-     * @inheritDoc
98
-     */
99
-    public function clear()
100
-    {
101
-        $hasClearedOnce = false;
102
-        foreach ($this->clusterPools as $driverPool) {
103
-            if ($result = $driverPool->clear()) {
104
-                $hasClearedOnce = $result;
105
-            }
106
-        }
107
-        // Return true only if at least one backend confirmed the "clear" operation
108
-        return $hasClearedOnce;
109
-    }
110
-
111
-    /**
112
-     * @inheritDoc
113
-     */
114
-    public function deleteItem($key)
115
-    {
116
-        $hasDeletedOnce = false;
117
-        foreach ($this->clusterPools as $driverPool) {
118
-            if ($result = $driverPool->deleteItem($key)) {
119
-                $hasDeletedOnce = $result;
120
-            }
121
-        }
122
-        // Return true only if at least one backend confirmed the "clear" operation
123
-        return $hasDeletedOnce;
124
-    }
125
-
126
-    /**
127
-     * @inheritDoc
128
-     */
129
-    public function save(CacheItemInterface $item)
130
-    {
131
-        /** @var ExtendedCacheItemInterface $item */
132
-        $hasSavedOnce = false;
133
-        foreach ($this->clusterPools as $driverPool) {
134
-            $poolItem = $this->getStandardizedItem($item, $driverPool);
135
-            if ($result = $driverPool->save($poolItem)) {
136
-                $hasSavedOnce = $result;
137
-            }
138
-        }
139
-        // Return true only if at least one backend confirmed the "commit" operation
140
-        return $hasSavedOnce;
141
-    }
142
-
143
-    /**
144
-     * @inheritDoc
145
-     */
146
-    public function saveDeferred(CacheItemInterface $item)
147
-    {
148
-        /** @var ExtendedCacheItemInterface $item */
149
-        $hasSavedOnce = false;
150
-        foreach ($this->clusterPools as $driverPool) {
151
-            $poolItem = $this->getStandardizedItem($item, $driverPool);
152
-            if ($result = $driverPool->saveDeferred($poolItem)) {
153
-                $hasSavedOnce = $result;
154
-            }
155
-        }
156
-        // Return true only if at least one backend confirmed the "commit" operation
157
-        return $hasSavedOnce;
158
-    }
159
-
160
-    /**
161
-     * @inheritDoc
162
-     */
163
-    public function commit()
164
-    {
165
-        $hasCommitOnce = false;
166
-        foreach ($this->clusterPools as $driverPool) {
167
-            if ($result = $driverPool->commit()) {
168
-                $hasCommitOnce = $result;
169
-            }
170
-        }
171
-        // Return true only if at least one backend confirmed the "commit" operation
172
-        return $hasCommitOnce;
173
-    }
29
+	/**
30
+	 * @inheritDoc
31
+	 */
32
+	public function getItem($key)
33
+	{
34
+		/** @var ExtendedCacheItemPoolInterface[] $poolsToResync */
35
+		$poolsToResync = [];
36
+		/** @var ExtendedCacheItemInterface $item */
37
+		$item = null;
38
+
39
+		foreach ($this->clusterPools as $driverPool) {
40
+			$poolItem = $driverPool->getItem($key);
41
+			if ($poolItem->isHit()) {
42
+				if (!$item) {
43
+					$item = $poolItem;
44
+					continue;
45
+				}
46
+
47
+				$itemData = $item->get();
48
+				$poolItemData = $poolItem->get();
49
+
50
+				if (\is_object($itemData)
51
+				) {
52
+					if ($item->get() != $poolItemData) {
53
+						$poolsToResync[] = $driverPool;
54
+					}
55
+				} else {
56
+					if ($item->get() !== $poolItemData) {
57
+						$poolsToResync[] = $driverPool;
58
+					}
59
+				}
60
+			} else {
61
+				$poolsToResync[] = $driverPool;
62
+			}
63
+		}
64
+
65
+		if ($item && $item->isHit() && \count($poolsToResync) < \count($this->clusterPools)) {
66
+			foreach ($poolsToResync as $poolToResync) {
67
+				$poolItem = $poolToResync->getItem($key);
68
+				$poolItem->setEventManager($this->getEventManager())
69
+					->set($item->get())
70
+					->setHit($item->isHit())
71
+					->setTags($item->getTags())
72
+					->expiresAt($item->getExpirationDate())
73
+					->setDriver($poolToResync);
74
+				$poolToResync->save($poolItem);
75
+			}
76
+		}
77
+
78
+		return $this->getStandardizedItem($item ?? new Item($this, $key), $this);
79
+	}
80
+
81
+	/**
82
+	 * @inheritDoc
83
+	 */
84
+	public function hasItem($key)
85
+	{
86
+		foreach ($this->clusterPools as $driverPool) {
87
+			$poolItem = $driverPool->getItem($key);
88
+			if ($poolItem->isHit()) {
89
+				return true;
90
+			}
91
+		}
92
+
93
+		return false;
94
+	}
95
+
96
+	/**
97
+	 * @inheritDoc
98
+	 */
99
+	public function clear()
100
+	{
101
+		$hasClearedOnce = false;
102
+		foreach ($this->clusterPools as $driverPool) {
103
+			if ($result = $driverPool->clear()) {
104
+				$hasClearedOnce = $result;
105
+			}
106
+		}
107
+		// Return true only if at least one backend confirmed the "clear" operation
108
+		return $hasClearedOnce;
109
+	}
110
+
111
+	/**
112
+	 * @inheritDoc
113
+	 */
114
+	public function deleteItem($key)
115
+	{
116
+		$hasDeletedOnce = false;
117
+		foreach ($this->clusterPools as $driverPool) {
118
+			if ($result = $driverPool->deleteItem($key)) {
119
+				$hasDeletedOnce = $result;
120
+			}
121
+		}
122
+		// Return true only if at least one backend confirmed the "clear" operation
123
+		return $hasDeletedOnce;
124
+	}
125
+
126
+	/**
127
+	 * @inheritDoc
128
+	 */
129
+	public function save(CacheItemInterface $item)
130
+	{
131
+		/** @var ExtendedCacheItemInterface $item */
132
+		$hasSavedOnce = false;
133
+		foreach ($this->clusterPools as $driverPool) {
134
+			$poolItem = $this->getStandardizedItem($item, $driverPool);
135
+			if ($result = $driverPool->save($poolItem)) {
136
+				$hasSavedOnce = $result;
137
+			}
138
+		}
139
+		// Return true only if at least one backend confirmed the "commit" operation
140
+		return $hasSavedOnce;
141
+	}
142
+
143
+	/**
144
+	 * @inheritDoc
145
+	 */
146
+	public function saveDeferred(CacheItemInterface $item)
147
+	{
148
+		/** @var ExtendedCacheItemInterface $item */
149
+		$hasSavedOnce = false;
150
+		foreach ($this->clusterPools as $driverPool) {
151
+			$poolItem = $this->getStandardizedItem($item, $driverPool);
152
+			if ($result = $driverPool->saveDeferred($poolItem)) {
153
+				$hasSavedOnce = $result;
154
+			}
155
+		}
156
+		// Return true only if at least one backend confirmed the "commit" operation
157
+		return $hasSavedOnce;
158
+	}
159
+
160
+	/**
161
+	 * @inheritDoc
162
+	 */
163
+	public function commit()
164
+	{
165
+		$hasCommitOnce = false;
166
+		foreach ($this->clusterPools as $driverPool) {
167
+			if ($result = $driverPool->commit()) {
168
+				$hasCommitOnce = $result;
169
+			}
170
+		}
171
+		// Return true only if at least one backend confirmed the "commit" operation
172
+		return $hasCommitOnce;
173
+	}
174 174
 
175 175
 
176 176
 }
Please login to merge, or discard this patch.
Braces   +11 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * @inheritDoc
31 31
      */
32
-    public function getItem($key)
33
-    {
32
+    public function getItem($key) {
34 33
         /** @var ExtendedCacheItemPoolInterface[] $poolsToResync */
35 34
         $poolsToResync = [];
36 35
         /** @var ExtendedCacheItemInterface $item */
@@ -52,12 +51,14 @@  discard block
 block discarded – undo
52 51
                     if ($item->get() != $poolItemData) {
53 52
                         $poolsToResync[] = $driverPool;
54 53
                     }
55
-                } else {
54
+                }
55
+                else {
56 56
                     if ($item->get() !== $poolItemData) {
57 57
                         $poolsToResync[] = $driverPool;
58 58
                     }
59 59
                 }
60
-            } else {
60
+            }
61
+            else {
61 62
                 $poolsToResync[] = $driverPool;
62 63
             }
63 64
         }
@@ -81,8 +82,7 @@  discard block
 block discarded – undo
81 82
     /**
82 83
      * @inheritDoc
83 84
      */
84
-    public function hasItem($key)
85
-    {
85
+    public function hasItem($key) {
86 86
         foreach ($this->clusterPools as $driverPool) {
87 87
             $poolItem = $driverPool->getItem($key);
88 88
             if ($poolItem->isHit()) {
@@ -96,8 +96,7 @@  discard block
 block discarded – undo
96 96
     /**
97 97
      * @inheritDoc
98 98
      */
99
-    public function clear()
100
-    {
99
+    public function clear() {
101 100
         $hasClearedOnce = false;
102 101
         foreach ($this->clusterPools as $driverPool) {
103 102
             if ($result = $driverPool->clear()) {
@@ -111,8 +110,7 @@  discard block
 block discarded – undo
111 110
     /**
112 111
      * @inheritDoc
113 112
      */
114
-    public function deleteItem($key)
115
-    {
113
+    public function deleteItem($key) {
116 114
         $hasDeletedOnce = false;
117 115
         foreach ($this->clusterPools as $driverPool) {
118 116
             if ($result = $driverPool->deleteItem($key)) {
@@ -126,8 +124,7 @@  discard block
 block discarded – undo
126 124
     /**
127 125
      * @inheritDoc
128 126
      */
129
-    public function save(CacheItemInterface $item)
130
-    {
127
+    public function save(CacheItemInterface $item) {
131 128
         /** @var ExtendedCacheItemInterface $item */
132 129
         $hasSavedOnce = false;
133 130
         foreach ($this->clusterPools as $driverPool) {
@@ -143,8 +140,7 @@  discard block
 block discarded – undo
143 140
     /**
144 141
      * @inheritDoc
145 142
      */
146
-    public function saveDeferred(CacheItemInterface $item)
147
-    {
143
+    public function saveDeferred(CacheItemInterface $item) {
148 144
         /** @var ExtendedCacheItemInterface $item */
149 145
         $hasSavedOnce = false;
150 146
         foreach ($this->clusterPools as $driverPool) {
@@ -160,8 +156,7 @@  discard block
 block discarded – undo
160 156
     /**
161 157
      * @inheritDoc
162 158
      */
163
-    public function commit()
164
-    {
159
+    public function commit() {
165 160
         $hasCommitOnce = false;
166 161
         foreach ($this->clusterPools as $driverPool) {
167 162
             if ($result = $driverPool->commit()) {
Please login to merge, or discard this patch.
lib/Phpfastcache/Cluster/Drivers/SemiReplication/SemiReplicationCluster.php 2 patches
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -27,177 +27,177 @@
 block discarded – undo
27 27
  */
28 28
 class SemiReplicationCluster extends ClusterPoolAbstract
29 29
 {
30
-    /**
31
-     * @inheritDoc
32
-     */
33
-    public function getItem($key)
34
-    {
35
-        /** @var ExtendedCacheItemInterface $item */
36
-        $item = null;
37
-        $eCount = 0;
38
-
39
-        foreach ($this->clusterPools as $driverPool) {
40
-            try {
41
-                $poolItem = $driverPool->getItem($key);
42
-                if ($poolItem->isHit()) {
43
-                    if (!$item) {
44
-                        $item = $poolItem;
45
-                        break;
46
-                    }
47
-                }
48
-            } catch (PhpfastcacheExceptionInterface $e) {
49
-                $eCount++;
50
-            }
51
-        }
52
-
53
-        if (\count($this->clusterPools) <= $eCount) {
54
-            throw new PhpfastcacheReplicationException('Every pools thrown an exception');
55
-        }
56
-
57
-        return $this->getStandardizedItem($item ?? new Item($this, $key), $this);
58
-    }
59
-
60
-    /**
61
-     * @inheritDoc
62
-     */
63
-    public function hasItem($key)
64
-    {
65
-        $eCount = 0;
66
-        foreach ($this->clusterPools as $driverPool) {
67
-            try {
68
-                $poolItem = $driverPool->getItem($key);
69
-                if ($poolItem->isHit()) {
70
-                    return true;
71
-                }
72
-            } catch (PhpfastcacheExceptionInterface $e) {
73
-                $eCount++;
74
-            }
75
-        }
76
-
77
-        if (\count($this->clusterPools) <= $eCount) {
78
-            throw new PhpfastcacheReplicationException('Every pools thrown an exception');
79
-        }
80
-
81
-        return false;
82
-    }
83
-
84
-    /**
85
-     * @inheritDoc
86
-     */
87
-    public function clear()
88
-    {
89
-        $hasClearedOnce = false;
90
-        $eCount = 0;
91
-
92
-        foreach ($this->clusterPools as $driverPool) {
93
-            try {
94
-                if ($result = $driverPool->clear()) {
95
-                    $hasClearedOnce = $result;
96
-                }
97
-            } catch (PhpfastcacheExceptionInterface $e) {
98
-                $eCount++;
99
-            }
100
-        }
101
-
102
-        if (\count($this->clusterPools) <= $eCount) {
103
-            throw new PhpfastcacheReplicationException('Every pools thrown an exception');
104
-        }
105
-
106
-        // Return true only if at least one backend confirmed the "clear" operation
107
-        return $hasClearedOnce;
108
-    }
109
-
110
-    /**
111
-     * @inheritDoc
112
-     */
113
-    public function deleteItem($key)
114
-    {
115
-        $hasDeletedOnce = false;
116
-        $eCount = 0;
117
-
118
-        foreach ($this->clusterPools as $driverPool) {
119
-            try {
120
-                if ($result = $driverPool->deleteItem($key)) {
121
-                    $hasDeletedOnce = $result;
122
-                }
123
-            } catch (PhpfastcacheExceptionInterface $e) {
124
-                $eCount++;
125
-            }
126
-        }
127
-
128
-        if (\count($this->clusterPools) <= $eCount) {
129
-            throw new PhpfastcacheReplicationException('Every pools thrown an exception');
130
-        }
131
-        // Return true only if at least one backend confirmed the "clear" operation
132
-        return $hasDeletedOnce;
133
-    }
134
-
135
-    /**
136
-     * @inheritDoc
137
-     */
138
-    public function save(CacheItemInterface $item)
139
-    {
140
-        /** @var ExtendedCacheItemInterface $item */
141
-        $hasSavedOnce = false;
142
-        $eCount = 0;
143
-
144
-        foreach ($this->clusterPools as $driverPool) {
145
-            try {
146
-                $poolItem = $this->getStandardizedItem($item, $driverPool);
147
-                if ($result = $driverPool->save($poolItem)) {
148
-                    $hasSavedOnce = $result;
149
-                }
150
-            } catch (PhpfastcacheExceptionInterface $e) {
151
-                $eCount++;
152
-            }
153
-        }
154
-
155
-        if (\count($this->clusterPools) <= $eCount) {
156
-            throw new PhpfastcacheReplicationException('Every pools thrown an exception');
157
-        }
158
-        // Return true only if at least one backend confirmed the "commit" operation
159
-        return $hasSavedOnce;
160
-    }
161
-
162
-    /**
163
-     * @inheritDoc
164
-     */
165
-    public function saveDeferred(CacheItemInterface $item)
166
-    {
167
-        /** @var ExtendedCacheItemInterface $item */
168
-        $hasSavedOnce = false;
169
-        foreach ($this->clusterPools as $driverPool) {
170
-            $poolItem = $this->getStandardizedItem($item, $driverPool);
171
-            if ($result = $driverPool->saveDeferred($poolItem)) {
172
-                $hasSavedOnce = $result;
173
-            }
174
-        }
175
-        // Return true only if at least one backend confirmed the "commit" operation
176
-        return $hasSavedOnce;
177
-    }
178
-
179
-    /**
180
-     * @inheritDoc
181
-     */
182
-    public function commit()
183
-    {
184
-        $hasCommitOnce = false;
185
-        $eCount = 0;
186
-
187
-        foreach ($this->clusterPools as $driverPool) {
188
-            try {
189
-                if ($result = $driverPool->commit()) {
190
-                    $hasCommitOnce = $result;
191
-                }
192
-            } catch (PhpfastcacheExceptionInterface $e) {
193
-                $eCount++;
194
-            }
195
-        }
196
-
197
-        if (\count($this->clusterPools) <= $eCount) {
198
-            throw new PhpfastcacheReplicationException('Every pools thrown an exception');
199
-        }
200
-        // Return true only if at least one backend confirmed the "commit" operation
201
-        return $hasCommitOnce;
202
-    }
30
+	/**
31
+	 * @inheritDoc
32
+	 */
33
+	public function getItem($key)
34
+	{
35
+		/** @var ExtendedCacheItemInterface $item */
36
+		$item = null;
37
+		$eCount = 0;
38
+
39
+		foreach ($this->clusterPools as $driverPool) {
40
+			try {
41
+				$poolItem = $driverPool->getItem($key);
42
+				if ($poolItem->isHit()) {
43
+					if (!$item) {
44
+						$item = $poolItem;
45
+						break;
46
+					}
47
+				}
48
+			} catch (PhpfastcacheExceptionInterface $e) {
49
+				$eCount++;
50
+			}
51
+		}
52
+
53
+		if (\count($this->clusterPools) <= $eCount) {
54
+			throw new PhpfastcacheReplicationException('Every pools thrown an exception');
55
+		}
56
+
57
+		return $this->getStandardizedItem($item ?? new Item($this, $key), $this);
58
+	}
59
+
60
+	/**
61
+	 * @inheritDoc
62
+	 */
63
+	public function hasItem($key)
64
+	{
65
+		$eCount = 0;
66
+		foreach ($this->clusterPools as $driverPool) {
67
+			try {
68
+				$poolItem = $driverPool->getItem($key);
69
+				if ($poolItem->isHit()) {
70
+					return true;
71
+				}
72
+			} catch (PhpfastcacheExceptionInterface $e) {
73
+				$eCount++;
74
+			}
75
+		}
76
+
77
+		if (\count($this->clusterPools) <= $eCount) {
78
+			throw new PhpfastcacheReplicationException('Every pools thrown an exception');
79
+		}
80
+
81
+		return false;
82
+	}
83
+
84
+	/**
85
+	 * @inheritDoc
86
+	 */
87
+	public function clear()
88
+	{
89
+		$hasClearedOnce = false;
90
+		$eCount = 0;
91
+
92
+		foreach ($this->clusterPools as $driverPool) {
93
+			try {
94
+				if ($result = $driverPool->clear()) {
95
+					$hasClearedOnce = $result;
96
+				}
97
+			} catch (PhpfastcacheExceptionInterface $e) {
98
+				$eCount++;
99
+			}
100
+		}
101
+
102
+		if (\count($this->clusterPools) <= $eCount) {
103
+			throw new PhpfastcacheReplicationException('Every pools thrown an exception');
104
+		}
105
+
106
+		// Return true only if at least one backend confirmed the "clear" operation
107
+		return $hasClearedOnce;
108
+	}
109
+
110
+	/**
111
+	 * @inheritDoc
112
+	 */
113
+	public function deleteItem($key)
114
+	{
115
+		$hasDeletedOnce = false;
116
+		$eCount = 0;
117
+
118
+		foreach ($this->clusterPools as $driverPool) {
119
+			try {
120
+				if ($result = $driverPool->deleteItem($key)) {
121
+					$hasDeletedOnce = $result;
122
+				}
123
+			} catch (PhpfastcacheExceptionInterface $e) {
124
+				$eCount++;
125
+			}
126
+		}
127
+
128
+		if (\count($this->clusterPools) <= $eCount) {
129
+			throw new PhpfastcacheReplicationException('Every pools thrown an exception');
130
+		}
131
+		// Return true only if at least one backend confirmed the "clear" operation
132
+		return $hasDeletedOnce;
133
+	}
134
+
135
+	/**
136
+	 * @inheritDoc
137
+	 */
138
+	public function save(CacheItemInterface $item)
139
+	{
140
+		/** @var ExtendedCacheItemInterface $item */
141
+		$hasSavedOnce = false;
142
+		$eCount = 0;
143
+
144
+		foreach ($this->clusterPools as $driverPool) {
145
+			try {
146
+				$poolItem = $this->getStandardizedItem($item, $driverPool);
147
+				if ($result = $driverPool->save($poolItem)) {
148
+					$hasSavedOnce = $result;
149
+				}
150
+			} catch (PhpfastcacheExceptionInterface $e) {
151
+				$eCount++;
152
+			}
153
+		}
154
+
155
+		if (\count($this->clusterPools) <= $eCount) {
156
+			throw new PhpfastcacheReplicationException('Every pools thrown an exception');
157
+		}
158
+		// Return true only if at least one backend confirmed the "commit" operation
159
+		return $hasSavedOnce;
160
+	}
161
+
162
+	/**
163
+	 * @inheritDoc
164
+	 */
165
+	public function saveDeferred(CacheItemInterface $item)
166
+	{
167
+		/** @var ExtendedCacheItemInterface $item */
168
+		$hasSavedOnce = false;
169
+		foreach ($this->clusterPools as $driverPool) {
170
+			$poolItem = $this->getStandardizedItem($item, $driverPool);
171
+			if ($result = $driverPool->saveDeferred($poolItem)) {
172
+				$hasSavedOnce = $result;
173
+			}
174
+		}
175
+		// Return true only if at least one backend confirmed the "commit" operation
176
+		return $hasSavedOnce;
177
+	}
178
+
179
+	/**
180
+	 * @inheritDoc
181
+	 */
182
+	public function commit()
183
+	{
184
+		$hasCommitOnce = false;
185
+		$eCount = 0;
186
+
187
+		foreach ($this->clusterPools as $driverPool) {
188
+			try {
189
+				if ($result = $driverPool->commit()) {
190
+					$hasCommitOnce = $result;
191
+				}
192
+			} catch (PhpfastcacheExceptionInterface $e) {
193
+				$eCount++;
194
+			}
195
+		}
196
+
197
+		if (\count($this->clusterPools) <= $eCount) {
198
+			throw new PhpfastcacheReplicationException('Every pools thrown an exception');
199
+		}
200
+		// Return true only if at least one backend confirmed the "commit" operation
201
+		return $hasCommitOnce;
202
+	}
203 203
 }
Please login to merge, or discard this patch.
Braces   +19 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * @inheritDoc
32 32
      */
33
-    public function getItem($key)
34
-    {
33
+    public function getItem($key) {
35 34
         /** @var ExtendedCacheItemInterface $item */
36 35
         $item = null;
37 36
         $eCount = 0;
@@ -45,7 +44,8 @@  discard block
 block discarded – undo
45 44
                         break;
46 45
                     }
47 46
                 }
48
-            } catch (PhpfastcacheExceptionInterface $e) {
47
+            }
48
+            catch (PhpfastcacheExceptionInterface $e) {
49 49
                 $eCount++;
50 50
             }
51 51
         }
@@ -60,8 +60,7 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * @inheritDoc
62 62
      */
63
-    public function hasItem($key)
64
-    {
63
+    public function hasItem($key) {
65 64
         $eCount = 0;
66 65
         foreach ($this->clusterPools as $driverPool) {
67 66
             try {
@@ -69,7 +68,8 @@  discard block
 block discarded – undo
69 68
                 if ($poolItem->isHit()) {
70 69
                     return true;
71 70
                 }
72
-            } catch (PhpfastcacheExceptionInterface $e) {
71
+            }
72
+            catch (PhpfastcacheExceptionInterface $e) {
73 73
                 $eCount++;
74 74
             }
75 75
         }
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
     /**
85 85
      * @inheritDoc
86 86
      */
87
-    public function clear()
88
-    {
87
+    public function clear() {
89 88
         $hasClearedOnce = false;
90 89
         $eCount = 0;
91 90
 
@@ -94,7 +93,8 @@  discard block
 block discarded – undo
94 93
                 if ($result = $driverPool->clear()) {
95 94
                     $hasClearedOnce = $result;
96 95
                 }
97
-            } catch (PhpfastcacheExceptionInterface $e) {
96
+            }
97
+            catch (PhpfastcacheExceptionInterface $e) {
98 98
                 $eCount++;
99 99
             }
100 100
         }
@@ -110,8 +110,7 @@  discard block
 block discarded – undo
110 110
     /**
111 111
      * @inheritDoc
112 112
      */
113
-    public function deleteItem($key)
114
-    {
113
+    public function deleteItem($key) {
115 114
         $hasDeletedOnce = false;
116 115
         $eCount = 0;
117 116
 
@@ -120,7 +119,8 @@  discard block
 block discarded – undo
120 119
                 if ($result = $driverPool->deleteItem($key)) {
121 120
                     $hasDeletedOnce = $result;
122 121
                 }
123
-            } catch (PhpfastcacheExceptionInterface $e) {
122
+            }
123
+            catch (PhpfastcacheExceptionInterface $e) {
124 124
                 $eCount++;
125 125
             }
126 126
         }
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
     /**
136 136
      * @inheritDoc
137 137
      */
138
-    public function save(CacheItemInterface $item)
139
-    {
138
+    public function save(CacheItemInterface $item) {
140 139
         /** @var ExtendedCacheItemInterface $item */
141 140
         $hasSavedOnce = false;
142 141
         $eCount = 0;
@@ -147,7 +146,8 @@  discard block
 block discarded – undo
147 146
                 if ($result = $driverPool->save($poolItem)) {
148 147
                     $hasSavedOnce = $result;
149 148
                 }
150
-            } catch (PhpfastcacheExceptionInterface $e) {
149
+            }
150
+            catch (PhpfastcacheExceptionInterface $e) {
151 151
                 $eCount++;
152 152
             }
153 153
         }
@@ -162,8 +162,7 @@  discard block
 block discarded – undo
162 162
     /**
163 163
      * @inheritDoc
164 164
      */
165
-    public function saveDeferred(CacheItemInterface $item)
166
-    {
165
+    public function saveDeferred(CacheItemInterface $item) {
167 166
         /** @var ExtendedCacheItemInterface $item */
168 167
         $hasSavedOnce = false;
169 168
         foreach ($this->clusterPools as $driverPool) {
@@ -179,8 +178,7 @@  discard block
 block discarded – undo
179 178
     /**
180 179
      * @inheritDoc
181 180
      */
182
-    public function commit()
183
-    {
181
+    public function commit() {
184 182
         $hasCommitOnce = false;
185 183
         $eCount = 0;
186 184
 
@@ -189,7 +187,8 @@  discard block
 block discarded – undo
189 187
                 if ($result = $driverPool->commit()) {
190 188
                     $hasCommitOnce = $result;
191 189
                 }
192
-            } catch (PhpfastcacheExceptionInterface $e) {
190
+            }
191
+            catch (PhpfastcacheExceptionInterface $e) {
193 192
                 $eCount++;
194 193
             }
195 194
         }
Please login to merge, or discard this patch.
Phpfastcache/Cluster/Drivers/RandomReplication/RandomReplicationCluster.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -27,33 +27,33 @@
 block discarded – undo
27 27
  */
28 28
 class RandomReplicationCluster extends MasterSlaveReplicationCluster
29 29
 {
30
-    /**
31
-     * RandomReplicationCluster constructor.
32
-     * @param string $clusterName
33
-     * @param ExtendedCacheItemPoolInterface ...$driverPools
34
-     * @throws ReflectionException
35
-     */
36
-    public function __construct(string $clusterName, ExtendedCacheItemPoolInterface ...$driverPools)
37
-    {
38
-        (new ReflectionMethod(\get_parent_class(\get_parent_class($this)), __FUNCTION__))
39
-            ->invoke($this, $clusterName, ...$driverPools);
40
-        $randomPool = $driverPools[\random_int(0, \count($driverPools) - 1)];
41
-
42
-        $this->eventManager->dispatch(
43
-            'CacheReplicationRandomPoolChosen',
44
-            $this,
45
-            $randomPool
46
-        );
47
-
48
-        $this->clusterPools = [$randomPool];
49
-    }
50
-
51
-    /**
52
-     * @param callable $operation
53
-     * @return mixed
54
-     */
55
-    protected function makeOperation(callable $operation)
56
-    {
57
-        return $operation($this->getMasterPool());
58
-    }
30
+	/**
31
+	 * RandomReplicationCluster constructor.
32
+	 * @param string $clusterName
33
+	 * @param ExtendedCacheItemPoolInterface ...$driverPools
34
+	 * @throws ReflectionException
35
+	 */
36
+	public function __construct(string $clusterName, ExtendedCacheItemPoolInterface ...$driverPools)
37
+	{
38
+		(new ReflectionMethod(\get_parent_class(\get_parent_class($this)), __FUNCTION__))
39
+			->invoke($this, $clusterName, ...$driverPools);
40
+		$randomPool = $driverPools[\random_int(0, \count($driverPools) - 1)];
41
+
42
+		$this->eventManager->dispatch(
43
+			'CacheReplicationRandomPoolChosen',
44
+			$this,
45
+			$randomPool
46
+		);
47
+
48
+		$this->clusterPools = [$randomPool];
49
+	}
50
+
51
+	/**
52
+	 * @param callable $operation
53
+	 * @return mixed
54
+	 */
55
+	protected function makeOperation(callable $operation)
56
+	{
57
+		return $operation($this->getMasterPool());
58
+	}
59 59
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param ExtendedCacheItemPoolInterface ...$driverPools
34 34
      * @throws ReflectionException
35 35
      */
36
-    public function __construct(string $clusterName, ExtendedCacheItemPoolInterface ...$driverPools)
37
-    {
36
+    public function __construct(string $clusterName, ExtendedCacheItemPoolInterface ...$driverPools) {
38 37
         (new ReflectionMethod(\get_parent_class(\get_parent_class($this)), __FUNCTION__))
39 38
             ->invoke($this, $clusterName, ...$driverPools);
40 39
         $randomPool = $driverPools[\random_int(0, \count($driverPools) - 1)];
@@ -52,8 +51,7 @@  discard block
 block discarded – undo
52 51
      * @param callable $operation
53 52
      * @return mixed
54 53
      */
55
-    protected function makeOperation(callable $operation)
56
-    {
54
+    protected function makeOperation(callable $operation) {
57 55
         return $operation($this->getMasterPool());
58 56
     }
59 57
 }
Please login to merge, or discard this patch.
php/lib/phpfastcache/lib/Phpfastcache/Config/IOConfigurationOptionTrait.php 1 patch
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -22,114 +22,114 @@
 block discarded – undo
22 22
 
23 23
 trait IOConfigurationOptionTrait
24 24
 {
25
-    /**
26
-     * @var boolean
27
-     */
28
-    protected $secureFileManipulation = false;
29
-
30
-    /**
31
-     * @var bool
32
-     */
33
-    protected $htaccess = true;
34
-
35
-    /**
36
-     * @var string
37
-     */
38
-    protected $securityKey = '';
39
-
40
-    /**
41
-     * @var string
42
-     */
43
-    protected $cacheFileExtension = 'txt';
44
-
45
-    /**
46
-     * @return string
47
-     */
48
-    public function getSecurityKey(): string
49
-    {
50
-        return $this->securityKey;
51
-    }
52
-
53
-    /**
54
-     * @param string $securityKey
55
-     * @return Config
56
-     */
57
-    public function setSecurityKey(string $securityKey): self
58
-    {
59
-        $this->securityKey = $securityKey;
60
-
61
-        return $this;
62
-    }
63
-
64
-    /**
65
-     * @return bool
66
-     */
67
-    public function getHtaccess(): bool
68
-    {
69
-        return $this->htaccess;
70
-    }
71
-
72
-    /**
73
-     * @param bool $htaccess
74
-     * @return Config
75
-     */
76
-    public function setHtaccess(bool $htaccess): ConfigurationOptionInterface
77
-    {
78
-        $this->htaccess = $htaccess;
79
-
80
-        return $this;
81
-    }
82
-
83
-    /**
84
-     * @return bool
85
-     */
86
-    public function isSecureFileManipulation(): bool
87
-    {
88
-        return $this->secureFileManipulation;
89
-    }
90
-
91
-    /**
92
-     * @param bool $secureFileManipulation
93
-     * @return self
94
-     */
95
-    public function setSecureFileManipulation(bool $secureFileManipulation): self
96
-    {
97
-        $this->secureFileManipulation = $secureFileManipulation;
98
-        return $this;
99
-    }
100
-
101
-
102
-    /**
103
-     * @return string
104
-     */
105
-    public function getCacheFileExtension(): string
106
-    {
107
-        return $this->cacheFileExtension;
108
-    }
109
-
110
-    /**
111
-     * @param string $cacheFileExtension
112
-     * @return self
113
-     * @throws PhpfastcacheInvalidConfigurationException
114
-     */
115
-    public function setCacheFileExtension(string $cacheFileExtension): self
116
-    {
117
-        /**
118
-         * Feel free to propose your own one
119
-         * by opening a pull request :)
120
-         */
121
-        $safeFileExtensions = \explode('|', SAFE_FILE_EXTENSIONS);
122
-
123
-        if (\strpos($cacheFileExtension, '.') !== false) {
124
-            throw new PhpfastcacheInvalidConfigurationException('cacheFileExtension cannot contain a dot "."');
125
-        }
126
-        if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) {
127
-            throw new PhpfastcacheInvalidConfigurationException(
128
-                "Extension \"{$cacheFileExtension}\" is not safe, currently allowed extension names: " . \implode(', ', $safeFileExtensions)
129
-            );
130
-        }
131
-
132
-        $this->cacheFileExtension = $cacheFileExtension;
133
-        return $this;
134
-    }
25
+	/**
26
+	 * @var boolean
27
+	 */
28
+	protected $secureFileManipulation = false;
29
+
30
+	/**
31
+	 * @var bool
32
+	 */
33
+	protected $htaccess = true;
34
+
35
+	/**
36
+	 * @var string
37
+	 */
38
+	protected $securityKey = '';
39
+
40
+	/**
41
+	 * @var string
42
+	 */
43
+	protected $cacheFileExtension = 'txt';
44
+
45
+	/**
46
+	 * @return string
47
+	 */
48
+	public function getSecurityKey(): string
49
+	{
50
+		return $this->securityKey;
51
+	}
52
+
53
+	/**
54
+	 * @param string $securityKey
55
+	 * @return Config
56
+	 */
57
+	public function setSecurityKey(string $securityKey): self
58
+	{
59
+		$this->securityKey = $securityKey;
60
+
61
+		return $this;
62
+	}
63
+
64
+	/**
65
+	 * @return bool
66
+	 */
67
+	public function getHtaccess(): bool
68
+	{
69
+		return $this->htaccess;
70
+	}
71
+
72
+	/**
73
+	 * @param bool $htaccess
74
+	 * @return Config
75
+	 */
76
+	public function setHtaccess(bool $htaccess): ConfigurationOptionInterface
77
+	{
78
+		$this->htaccess = $htaccess;
79
+
80
+		return $this;
81
+	}
82
+
83
+	/**
84
+	 * @return bool
85
+	 */
86
+	public function isSecureFileManipulation(): bool
87
+	{
88
+		return $this->secureFileManipulation;
89
+	}
90
+
91
+	/**
92
+	 * @param bool $secureFileManipulation
93
+	 * @return self
94
+	 */
95
+	public function setSecureFileManipulation(bool $secureFileManipulation): self
96
+	{
97
+		$this->secureFileManipulation = $secureFileManipulation;
98
+		return $this;
99
+	}
100
+
101
+
102
+	/**
103
+	 * @return string
104
+	 */
105
+	public function getCacheFileExtension(): string
106
+	{
107
+		return $this->cacheFileExtension;
108
+	}
109
+
110
+	/**
111
+	 * @param string $cacheFileExtension
112
+	 * @return self
113
+	 * @throws PhpfastcacheInvalidConfigurationException
114
+	 */
115
+	public function setCacheFileExtension(string $cacheFileExtension): self
116
+	{
117
+		/**
118
+		 * Feel free to propose your own one
119
+		 * by opening a pull request :)
120
+		 */
121
+		$safeFileExtensions = \explode('|', SAFE_FILE_EXTENSIONS);
122
+
123
+		if (\strpos($cacheFileExtension, '.') !== false) {
124
+			throw new PhpfastcacheInvalidConfigurationException('cacheFileExtension cannot contain a dot "."');
125
+		}
126
+		if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) {
127
+			throw new PhpfastcacheInvalidConfigurationException(
128
+				"Extension \"{$cacheFileExtension}\" is not safe, currently allowed extension names: " . \implode(', ', $safeFileExtensions)
129
+			);
130
+		}
131
+
132
+		$this->cacheFileExtension = $cacheFileExtension;
133
+		return $this;
134
+	}
135 135
 }
136 136
\ No newline at end of file
Please login to merge, or discard this patch.