Passed
Branch master (9bcd56)
by Deric
02:49
created
src/Builder.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
 class Builder
12 12
 {
13 13
 
14
-	/**
14
+    /**
15 15
      * Command prefix.
16 16
      *
17 17
      * @var string
18 18
      */
19
-	public $prefix;
19
+    public $prefix;
20 20
 	
21
-	/**
21
+    /**
22 22
      * Command options.
23 23
      *
24 24
      * @var array
25 25
      */
26 26
     public $options;
27 27
 	
28
-	/**
28
+    /**
29 29
      * Command arguments.
30 30
      *
31 31
      * @var array
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $this->options = [];
69 69
         foreach ($opts as $key => $value)
70
-		{
71
-			if (preg_match('/^-.*$/', $key, $matches))
72
-			{
73
-				$this->options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
74
-			}
75
-			if (preg_match('/^-.*$/', $value, $matches))
76
-			{
77
-				$this->options[] = $value;
78
-			}
79
-		}
70
+        {
71
+            if (preg_match('/^-.*$/', $key, $matches))
72
+            {
73
+                $this->options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
74
+            }
75
+            if (preg_match('/^-.*$/', $value, $matches))
76
+            {
77
+                $this->options[] = $value;
78
+            }
79
+        }
80 80
         $this->options = implode(' ', array_filter($this->options, 'strlen'));
81 81
         return $this;
82 82
     }
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
      */
90 90
     final public function setArguments(array $args)
91 91
     {
92
-		$this->arguments = [];
92
+        $this->arguments = [];
93 93
         foreach ($args as $key => $value)
94
-		{
95
-			if (preg_match('/^-.*$/', $key, $matches))
96
-			{
97
-				$this->arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
98
-			}
99
-			else
100
-			{
101
-				$this->arguments[] = is_array($value) ? implode(' ', $value) : $value;
102
-			}
103
-		}
104
-		$this->arguments = implode(' ', array_filter($this->arguments, 'strlen'));
94
+        {
95
+            if (preg_match('/^-.*$/', $key, $matches))
96
+            {
97
+                $this->arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
98
+            }
99
+            else
100
+            {
101
+                $this->arguments[] = is_array($value) ? implode(' ', $value) : $value;
102
+            }
103
+        }
104
+        $this->arguments = implode(' ', array_filter($this->arguments, 'strlen'));
105 105
         return $this;
106 106
     }
107 107
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $this->options = [];
69 69
         foreach ($opts as $key => $value)
70
-		{
70
+        {
71 71
 			if (preg_match('/^-.*$/', $key, $matches))
72 72
 			{
73 73
 				$this->options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
@@ -91,12 +91,11 @@  discard block
 block discarded – undo
91 91
     {
92 92
 		$this->arguments = [];
93 93
         foreach ($args as $key => $value)
94
-		{
94
+        {
95 95
 			if (preg_match('/^-.*$/', $key, $matches))
96 96
 			{
97 97
 				$this->arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
98
-			}
99
-			else
98
+			} else
100 99
 			{
101 100
 				$this->arguments[] = is_array($value) ? implode(' ', $value) : $value;
102 101
 			}
Please login to merge, or discard this patch.
src/Connection.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      */
30 30
     public function __construct(Configuration $configuration, Authentication $authentication)
31 31
     {
32
-		if (extension_loaded('ssh2') == false)
32
+        if (extension_loaded('ssh2') == false)
33 33
         {
34 34
             throw new \RuntimeException('The libssh2 extension is not loaded.');
35 35
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function __construct(Configuration $configuration, Authentication $authentication)
31 31
     {
32
-		if (extension_loaded('ssh2') == false)
32
+		if (extension_loaded('ssh2') == FALSE)
33 33
         {
34 34
             throw new \RuntimeException('The libssh2 extension is not loaded.');
35 35
         }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     final public function connect(Configuration $configuration)
63 63
     {
64 64
         $this->connection = @ssh2_connect($configuration->get_host(), $configuration->get_port(), $configuration->get_methods());
65
-        if ($this->connection === false || !is_resource($this->connection))
65
+        if ($this->connection === FALSE || !is_resource($this->connection))
66 66
         {
67 67
             throw new \RuntimeException($this->get_error_message());
68 68
         }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     final public function tunnel(Configuration $configuration)
79 79
     {
80 80
         $tunnel = @ssh2_tunnel($this->connection, $configuration->get_tunnel_host(), $configuration->get_tunnel_port());
81
-        if ($tunnel === false)
81
+        if ($tunnel === FALSE)
82 82
         {
83 83
             throw new \RuntimeException($this->get_error_message());
84 84
         }
Please login to merge, or discard this patch.
src/Kerberos.php 3 patches
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class Kerberos
19 19
 {
20
-	private $configuration;
20
+    private $configuration;
21 21
 
22
-	private $authentication;
22
+    private $authentication;
23 23
 
24
-	/**
24
+    /**
25 25
      * Constructor.
26 26
      *
27 27
      * @param  instance $configuration  Configuration instance
@@ -31,121 +31,121 @@  discard block
 block discarded – undo
31 31
     public function __construct(Configuration $configuration, Authentication $authentication)
32 32
     {
33 33
         if (get_class($authentication) != 'LibSSH2\Authentication\Password')
34
-		{
35
-			throw new \RuntimeException("Kerberos authentication requires Password authentication to remote server.");
36
-		}
37
-		$this->configuration = $configuration;
38
-		$this->authentication = $authentication;
34
+        {
35
+            throw new \RuntimeException("Kerberos authentication requires Password authentication to remote server.");
36
+        }
37
+        $this->configuration = $configuration;
38
+        $this->authentication = $authentication;
39 39
     }
40 40
 
41
-	/**
42
-	 * kcreate creates a Kerberos credential (ticket) cache and sets the
43
-	 * KRB5CCNAME environmental variable.
44
-	 *
45
-	 * @return string Kerberos credential cache
46
-	 */
47
-	final public function kcreate($principle)
48
-	{
49
-		$username = $this->configuration->get_username();
50
-		$command = (new Builder())
51
-			->setPrefix('kinit')
52
-			->setArguments([$principle]);
41
+    /**
42
+     * kcreate creates a Kerberos credential (ticket) cache and sets the
43
+     * KRB5CCNAME environmental variable.
44
+     *
45
+     * @return string Kerberos credential cache
46
+     */
47
+    final public function kcreate($principle)
48
+    {
49
+        $username = $this->configuration->get_username();
50
+        $command = (new Builder())
51
+            ->setPrefix('kinit')
52
+            ->setArguments([$principle]);
53 53
 
54
-		$shell = new Shell($this->configuration, $this->authentication);
55
-		$shell
56
-			->shell()
57
-			->write("export KRB5CCNAME=`mktemp /tmp/krb5cc_{$username}_XXXXXXXXXXXXX`;")
58
-			->write($command)
59
-			->write($this->configuration->get_password())
60
-			->write('echo KRB5CCNAME:$KRB5CCNAME', true)
61
-			->output();
54
+        $shell = new Shell($this->configuration, $this->authentication);
55
+        $shell
56
+            ->shell()
57
+            ->write("export KRB5CCNAME=`mktemp /tmp/krb5cc_{$username}_XXXXXXXXXXXXX`;")
58
+            ->write($command)
59
+            ->write($this->configuration->get_password())
60
+            ->write('echo KRB5CCNAME:$KRB5CCNAME', true)
61
+            ->output();
62 62
 
63
-		if (!preg_match("/KRB5CCNAME:(\/tmp\/krb5cc_.*)/", $shell->get_output(), $matches))
64
-		{
65
-			throw new \RuntimeException('Failed to create the Kerberos credential cache and set the KRB5CCNAME environmental variable.');
66
-		}
67
-		return $matches[1];
68
-	}
63
+        if (!preg_match("/KRB5CCNAME:(\/tmp\/krb5cc_.*)/", $shell->get_output(), $matches))
64
+        {
65
+            throw new \RuntimeException('Failed to create the Kerberos credential cache and set the KRB5CCNAME environmental variable.');
66
+        }
67
+        return $matches[1];
68
+    }
69 69
 
70
-	/**
71
-	 * The kdestroy utility destroys the user’s active Kerberos 
72
-	 * authorization tickets by overwriting and deleting the 
73
-	 * credentials cache that contains them. If the credentials 
74
-	 * cache is not specified, the default credentials cache is 
75
-	 * destroyed.
76
-	 *
77
-	 * @param  array  $options   klist command line options
78
-	 * @param  array  $arguments klist command line arguments
79
-	 * @return int    return code (exit status code)
80
-	 */
81
-	final public function kdestroy(array $options = [], array $arguments = [], $strict = true)
82
-	{
83
-		$command = (new Builder())
84
-			->setPrefix('kdestroy')
85
-			->setOptions($options)
86
-			->setArguments($arguments);
87
-		list($retval, $output) = $this->_exec($command, $strict);
88
-		return $retval;
89
-	}
70
+    /**
71
+     * The kdestroy utility destroys the user’s active Kerberos 
72
+     * authorization tickets by overwriting and deleting the 
73
+     * credentials cache that contains them. If the credentials 
74
+     * cache is not specified, the default credentials cache is 
75
+     * destroyed.
76
+     *
77
+     * @param  array  $options   klist command line options
78
+     * @param  array  $arguments klist command line arguments
79
+     * @return int    return code (exit status code)
80
+     */
81
+    final public function kdestroy(array $options = [], array $arguments = [], $strict = true)
82
+    {
83
+        $command = (new Builder())
84
+            ->setPrefix('kdestroy')
85
+            ->setOptions($options)
86
+            ->setArguments($arguments);
87
+        list($retval, $output) = $this->_exec($command, $strict);
88
+        return $retval;
89
+    }
90 90
 
91
-	/**
92
-	 * klist lists the Kerberos principal and Kerberos tickets held 
93
-	 * in a credentials cache, or the keys held in a keytab file.
94
-	 *
95
-	 * @param  array  $options   klist command line options
96
-	 * @param  array  $arguments klist command line arguments
97
-	 * @return string klist results
98
-	 */
99
-	final public function klist(array $options = [], array $arguments = [], $strict = true)
100
-	{
101
-		$command = (new Builder())
102
-			->setPrefix('klist')
103
-			->setOptions($options)
104
-			->setArguments($arguments);
105
-		list($retval, $output) = $this->_exec($command, $strict);
106
-		return $output;
107
-	}
91
+    /**
92
+     * klist lists the Kerberos principal and Kerberos tickets held 
93
+     * in a credentials cache, or the keys held in a keytab file.
94
+     *
95
+     * @param  array  $options   klist command line options
96
+     * @param  array  $arguments klist command line arguments
97
+     * @return string klist results
98
+     */
99
+    final public function klist(array $options = [], array $arguments = [], $strict = true)
100
+    {
101
+        $command = (new Builder())
102
+            ->setPrefix('klist')
103
+            ->setOptions($options)
104
+            ->setArguments($arguments);
105
+        list($retval, $output) = $this->_exec($command, $strict);
106
+        return $output;
107
+    }
108 108
 
109
-	/**
110
-	 * kinit obtains and caches an initial ticket-granting ticket for 
111
-	 * principal. If principal is absent, kinit chooses an appropriate 
112
-	 * principal name based on existing credential cache contents or 
113
-	 * the local username of the user invoking kinit. Some options 
114
-	 * modify the choice of principal name.
115
-	 *
116
-	 * @param  array  $options   kinit command line options
117
-	 * @param  array  $arguments kinit command line arguments
118
-	 * @return int    exit status code
119
-	 */
120
-	final public function kinit(array $options = [], array $arguments = [], $strict = true)
121
-	{
122
-		$command = (new Builder())
123
-			->setPrefix('kinit')
124
-			->setOptions($options)
125
-			->setArguments($arguments);
126
-		list($retval, $output) = $this->_exec($command, $strict);
127
-		return $retval;
128
-	}
109
+    /**
110
+     * kinit obtains and caches an initial ticket-granting ticket for 
111
+     * principal. If principal is absent, kinit chooses an appropriate 
112
+     * principal name based on existing credential cache contents or 
113
+     * the local username of the user invoking kinit. Some options 
114
+     * modify the choice of principal name.
115
+     *
116
+     * @param  array  $options   kinit command line options
117
+     * @param  array  $arguments kinit command line arguments
118
+     * @return int    exit status code
119
+     */
120
+    final public function kinit(array $options = [], array $arguments = [], $strict = true)
121
+    {
122
+        $command = (new Builder())
123
+            ->setPrefix('kinit')
124
+            ->setOptions($options)
125
+            ->setArguments($arguments);
126
+        list($retval, $output) = $this->_exec($command, $strict);
127
+        return $retval;
128
+    }
129 129
 
130
-	/**
131
-	 * Execute Kerberos command.
132
-	 *
133
-	 * @param  string  $command   command to be executed
134
-	 * @return array   return code and STDOUT
135
-	 */
136
-	final private function _exec($command, $strict)
137
-	{
138
-		$ssh = new SSH($this->configuration, $this->authentication);
139
-		$ssh->exec($command);
130
+    /**
131
+     * Execute Kerberos command.
132
+     *
133
+     * @param  string  $command   command to be executed
134
+     * @return array   return code and STDOUT
135
+     */
136
+    final private function _exec($command, $strict)
137
+    {
138
+        $ssh = new SSH($this->configuration, $this->authentication);
139
+        $ssh->exec($command);
140 140
 
141
-		$output = $ssh->get_output();
142
-		$error = $ssh->get_error();
143
-		$retval = $ssh->get_exitstatus();
141
+        $output = $ssh->get_output();
142
+        $error = $ssh->get_error();
143
+        $retval = $ssh->get_exitstatus();
144 144
 
145
-		if ($strict && $retval != 0 )
146
-		{
147
-			throw new \RuntimeException($error);
148
-		}
149
-		return [$retval, $output];
150
-	}
145
+        if ($strict && $retval != 0 )
146
+        {
147
+            throw new \RuntimeException($error);
148
+        }
149
+        return [$retval, $output];
150
+    }
151 151
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
 		$error = $ssh->get_error();
143 143
 		$retval = $ssh->get_exitstatus();
144 144
 
145
-		if ($strict && $retval != 0 )
145
+		if ($strict && $retval != 0)
146 146
 		{
147 147
 			throw new \RuntimeException($error);
148 148
 		}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			->write("export KRB5CCNAME=`mktemp /tmp/krb5cc_{$username}_XXXXXXXXXXXXX`;")
58 58
 			->write($command)
59 59
 			->write($this->configuration->get_password())
60
-			->write('echo KRB5CCNAME:$KRB5CCNAME', true)
60
+			->write('echo KRB5CCNAME:$KRB5CCNAME', TRUE)
61 61
 			->output();
62 62
 
63 63
 		if (!preg_match("/KRB5CCNAME:(\/tmp\/krb5cc_.*)/", $shell->get_output(), $matches))
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @param  array  $arguments klist command line arguments
79 79
 	 * @return int    return code (exit status code)
80 80
 	 */
81
-	final public function kdestroy(array $options = [], array $arguments = [], $strict = true)
81
+	final public function kdestroy(array $options = [], array $arguments = [], $strict = TRUE)
82 82
 	{
83 83
 		$command = (new Builder())
84 84
 			->setPrefix('kdestroy')
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @param  array  $arguments klist command line arguments
97 97
 	 * @return string klist results
98 98
 	 */
99
-	final public function klist(array $options = [], array $arguments = [], $strict = true)
99
+	final public function klist(array $options = [], array $arguments = [], $strict = TRUE)
100 100
 	{
101 101
 		$command = (new Builder())
102 102
 			->setPrefix('klist')
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param  array  $arguments kinit command line arguments
118 118
 	 * @return int    exit status code
119 119
 	 */
120
-	final public function kinit(array $options = [], array $arguments = [], $strict = true)
120
+	final public function kinit(array $options = [], array $arguments = [], $strict = TRUE)
121 121
 	{
122 122
 		$command = (new Builder())
123 123
 			->setPrefix('kinit')
Please login to merge, or discard this patch.