Completed
Pull Request — master (#359)
by Maxence
41s
created
lib/Vendor/Elastic/Transport/Exception/TransportException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 
17 17
 use Throwable;
18 18
 
19
-interface TransportException extends Throwable
20
-{
19
+interface TransportException extends Throwable {
21 20
 
22 21
 }
23 22
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Transport/Exception/NotFoundException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 
17 17
 use RuntimeException;
18 18
 
19
-class NotFoundException extends RuntimeException implements TransportException
20
-{
19
+class NotFoundException extends RuntimeException implements TransportException {
21 20
 
22 21
 }
23 22
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Transport/Exception/InvalidArrayException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 
17 17
 use RuntimeException;
18 18
 
19
-class InvalidArrayException extends RuntimeException implements TransportException
20
-{
19
+class InvalidArrayException extends RuntimeException implements TransportException {
21 20
 
22 21
 }
23 22
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Transport/Exception/InvalidArgumentException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 
17 17
 use RuntimeException;
18 18
 
19
-class InvalidArgumentException extends RuntimeException implements TransportException
20
-{
19
+class InvalidArgumentException extends RuntimeException implements TransportException {
21 20
 
22 21
 }
23 22
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Transport/Exception/InvalidIterableException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 
17 17
 use RuntimeException;
18 18
 
19
-class InvalidIterableException extends RuntimeException implements TransportException
20
-{
19
+class InvalidIterableException extends RuntimeException implements TransportException {
21 20
 
22 21
 }
23 22
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Transport/NodePool/SimpleNodePool.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -24,59 +24,59 @@
 block discarded – undo
24 24
 
25 25
 class SimpleNodePool implements NodePoolInterface
26 26
 {
27
-    /**
28
-     * @var array
29
-     */
30
-    protected $nodes = [];
27
+	/**
28
+	 * @var array
29
+	 */
30
+	protected $nodes = [];
31 31
     
32
-    /**
33
-     * @var SelectorInterface
34
-     */
35
-    protected $selector;
32
+	/**
33
+	 * @var SelectorInterface
34
+	 */
35
+	protected $selector;
36 36
 
37
-    /**
38
-     * @var ResurrectInterface
39
-     */
40
-    protected $resurrect;
37
+	/**
38
+	 * @var ResurrectInterface
39
+	 */
40
+	protected $resurrect;
41 41
 
42
-    public function __construct(SelectorInterface $selector, ResurrectInterface $resurrect)
43
-    {   
44
-        $this->selector = $selector;
45
-        $this->resurrect = $resurrect;
46
-    }
42
+	public function __construct(SelectorInterface $selector, ResurrectInterface $resurrect)
43
+	{   
44
+		$this->selector = $selector;
45
+		$this->resurrect = $resurrect;
46
+	}
47 47
 
48
-    public function setHosts(array $hosts): self
49
-    {
50
-        $this->nodes = [];
51
-        foreach ($hosts as $host) {
52
-            $this->nodes[] = new Node($host);
53
-        }
54
-        shuffle($this->nodes); // randomize for use different hosts on each execution
55
-        $this->selector->setNodes($this->nodes);
48
+	public function setHosts(array $hosts): self
49
+	{
50
+		$this->nodes = [];
51
+		foreach ($hosts as $host) {
52
+			$this->nodes[] = new Node($host);
53
+		}
54
+		shuffle($this->nodes); // randomize for use different hosts on each execution
55
+		$this->selector->setNodes($this->nodes);
56 56
         
57
-        return $this;
58
-    }
57
+		return $this;
58
+	}
59 59
 
60
-    public function nextNode(): Node
61
-    {
62
-        $totNodes = count($this->nodes);
63
-        $dead = 0;
60
+	public function nextNode(): Node
61
+	{
62
+		$totNodes = count($this->nodes);
63
+		$dead = 0;
64 64
 
65
-        while ($dead < $totNodes) {
66
-            $next = $this->selector->nextNode();
67
-            if ($next->isAlive()) {
68
-                return $next;
69
-            }
70
-            if ($this->resurrect->ping($next)) {
71
-                $next->markAlive(true);
72
-                return $next;
73
-            }
74
-            $dead++;
75
-        }
65
+		while ($dead < $totNodes) {
66
+			$next = $this->selector->nextNode();
67
+			if ($next->isAlive()) {
68
+				return $next;
69
+			}
70
+			if ($this->resurrect->ping($next)) {
71
+				$next->markAlive(true);
72
+				return $next;
73
+			}
74
+			$dead++;
75
+		}
76 76
 
77
-        throw new NoNodeAvailableException(sprintf(
78
-            'No alive nodes. All the %d nodes seem to be down.',
79
-            $totNodes
80
-        ));
81
-    }
77
+		throw new NoNodeAvailableException(sprintf(
78
+			'No alive nodes. All the %d nodes seem to be down.',
79
+			$totNodes
80
+		));
81
+	}
82 82
 }
83 83
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
 use function shuffle;
23 23
 use function sprintf;
24 24
 
25
-class SimpleNodePool implements NodePoolInterface
26
-{
25
+class SimpleNodePool implements NodePoolInterface {
27 26
     /**
28 27
      * @var array
29 28
      */
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Transport/NodePool/NodePoolInterface.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 block discarded – undo
16 16
 
17 17
 interface NodePoolInterface
18 18
 {
19
-    public function nextNode(): Node;
19
+	public function nextNode(): Node;
20 20
 
21
-    /**
22
-     * @param string[] $hosts
23
-     */
24
-    public function setHosts(array $hosts): self;
21
+	/**
22
+	 * @param string[] $hosts
23
+	 */
24
+	public function setHosts(array $hosts): self;
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@
 block discarded – undo
14 14
 
15 15
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\NodePool;
16 16
 
17
-interface NodePoolInterface
18
-{
17
+interface NodePoolInterface {
19 18
     public function nextNode(): Node;
20 19
 
21 20
     /**
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Transport/NodePool/Selector/SelectorTrait.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -19,23 +19,23 @@
 block discarded – undo
19 19
 
20 20
 trait SelectorTrait
21 21
 {
22
-    protected array $nodes = [];
22
+	protected array $nodes = [];
23 23
 
24
-    public function setNodes(array $nodes): void
25
-    {
26
-        foreach ($nodes as $node) {
27
-            if (!$node instanceof Node) {
28
-                throw new InvalidArrayException(sprintf(
29
-                    "The nodes array must contain only %s objects",
30
-                    Node::class
31
-                ));
32
-            }
33
-        }
34
-        $this->nodes = $nodes;
35
-    }
24
+	public function setNodes(array $nodes): void
25
+	{
26
+		foreach ($nodes as $node) {
27
+			if (!$node instanceof Node) {
28
+				throw new InvalidArrayException(sprintf(
29
+					"The nodes array must contain only %s objects",
30
+					Node::class
31
+				));
32
+			}
33
+		}
34
+		$this->nodes = $nodes;
35
+	}
36 36
 
37
-    public function getNodes(): array
38
-    {
39
-        return $this->nodes;
40
-    }
37
+	public function getNodes(): array
38
+	{
39
+		return $this->nodes;
40
+	}
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
 use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\NodePool\Node;
18 18
 use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception\InvalidArrayException;
19 19
 
20
-trait SelectorTrait
21
-{
20
+trait SelectorTrait {
22 21
     protected array $nodes = [];
23 22
 
24 23
     public function setNodes(array $nodes): void
Please login to merge, or discard this patch.
lib/Vendor/Elastic/Transport/NodePool/Selector/RoundRobin.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@
 block discarded – undo
19 19
 
20 20
 class RoundRobin implements SelectorInterface
21 21
 {
22
-    use SelectorTrait;
22
+	use SelectorTrait;
23 23
 
24
-    public function nextNode(): Node
25
-    {
26
-        if (empty($this->getNodes())) {
27
-            $className = substr(__CLASS__, strrpos(__CLASS__, '\\') + 1);
28
-            throw new NoNodeAvailableException(sprintf(
29
-                "No node available. Please use %s::setNodes() before calling %s::nextNode().",
30
-                $className,
31
-                $className
32
-            ));
33
-        }
34
-        $node = current($this->nodes);
35
-        if (false === next($this->nodes)) {
36
-            reset($this->nodes);
37
-        }
38
-        return $node;
39
-    }   
24
+	public function nextNode(): Node
25
+	{
26
+		if (empty($this->getNodes())) {
27
+			$className = substr(__CLASS__, strrpos(__CLASS__, '\\') + 1);
28
+			throw new NoNodeAvailableException(sprintf(
29
+				"No node available. Please use %s::setNodes() before calling %s::nextNode().",
30
+				$className,
31
+				$className
32
+			));
33
+		}
34
+		$node = current($this->nodes);
35
+		if (false === next($this->nodes)) {
36
+			reset($this->nodes);
37
+		}
38
+		return $node;
39
+	}   
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
 use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\NodePool\Node;
18 18
 use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception\NoNodeAvailableException;
19 19
 
20
-class RoundRobin implements SelectorInterface
21
-{
20
+class RoundRobin implements SelectorInterface {
22 21
     use SelectorTrait;
23 22
 
24 23
     public function nextNode(): Node
Please login to merge, or discard this patch.