Completed
Push — stable13 ( b660dd...dc0fd5 )
by
unknown
33:01 queued 16:38
created
lib/private/Log/Errorlog.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,20 +28,20 @@
 block discarded – undo
28 28
 class Errorlog {
29 29
 
30 30
 
31
-	/**
32
-	 * Init class data
33
-	 */
34
-	public static function init() {
35
-	}
31
+    /**
32
+     * Init class data
33
+     */
34
+    public static function init() {
35
+    }
36 36
 
37
-	/**
38
-	 * write a message in the log
39
-	 * @param string $app
40
-	 * @param string $message
41
-	 * @param int $level
42
-	 */
43
-	public static function write($app, $message, $level) {
44
-		error_log('[owncloud]['.$app.']['.$level.'] '.$message);
45
-	}
37
+    /**
38
+     * write a message in the log
39
+     * @param string $app
40
+     * @param string $message
41
+     * @param int $level
42
+     */
43
+    public static function write($app, $message, $level) {
44
+        error_log('[owncloud]['.$app.']['.$level.'] '.$message);
45
+    }
46 46
 }
47 47
 
Please login to merge, or discard this patch.
lib/private/Log/Syslog.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -26,31 +26,31 @@
 block discarded – undo
26 26
 namespace OC\Log;
27 27
 
28 28
 class Syslog {
29
-	static protected $levels = array(
30
-		\OCP\Util::DEBUG => LOG_DEBUG,
31
-		\OCP\Util::INFO => LOG_INFO,
32
-		\OCP\Util::WARN => LOG_WARNING,
33
-		\OCP\Util::ERROR => LOG_ERR,
34
-		\OCP\Util::FATAL => LOG_CRIT,
35
-	);
29
+    static protected $levels = array(
30
+        \OCP\Util::DEBUG => LOG_DEBUG,
31
+        \OCP\Util::INFO => LOG_INFO,
32
+        \OCP\Util::WARN => LOG_WARNING,
33
+        \OCP\Util::ERROR => LOG_ERR,
34
+        \OCP\Util::FATAL => LOG_CRIT,
35
+    );
36 36
 
37
-	/**
38
-	 * Init class data
39
-	 */
40
-	public static function init() {
41
-		openlog(\OC::$server->getSystemConfig()->getValue("syslog_tag", "ownCloud"), LOG_PID | LOG_CONS, LOG_USER);
42
-		// Close at shutdown
43
-		register_shutdown_function('closelog');
44
-	}
37
+    /**
38
+     * Init class data
39
+     */
40
+    public static function init() {
41
+        openlog(\OC::$server->getSystemConfig()->getValue("syslog_tag", "ownCloud"), LOG_PID | LOG_CONS, LOG_USER);
42
+        // Close at shutdown
43
+        register_shutdown_function('closelog');
44
+    }
45 45
 
46
-	/**
47
-	 * write a message in the log
48
-	 * @param string $app
49
-	 * @param string $message
50
-	 * @param int $level
51
-	 */
52
-	public static function write($app, $message, $level) {
53
-		$syslog_level = self::$levels[$level];
54
-		syslog($syslog_level, '{'.$app.'} '.$message);
55
-	}
46
+    /**
47
+     * write a message in the log
48
+     * @param string $app
49
+     * @param string $message
50
+     * @param int $level
51
+     */
52
+    public static function write($app, $message, $level) {
53
+        $syslog_level = self::$levels[$level];
54
+        syslog($syslog_level, '{'.$app.'} '.$message);
55
+    }
56 56
 }
Please login to merge, or discard this patch.
lib/private/Log/ErrorHandler.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -28,74 +28,74 @@
 block discarded – undo
28 28
 use OCP\ILogger;
29 29
 
30 30
 class ErrorHandler {
31
-	/** @var ILogger */
32
-	private static $logger;
31
+    /** @var ILogger */
32
+    private static $logger;
33 33
 
34
-	/**
35
-	 * remove password in URLs
36
-	 * @param string $msg
37
-	 * @return string
38
-	 */
39
-	protected static function removePassword($msg) {
40
-		return preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $msg);
41
-	}
34
+    /**
35
+     * remove password in URLs
36
+     * @param string $msg
37
+     * @return string
38
+     */
39
+    protected static function removePassword($msg) {
40
+        return preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $msg);
41
+    }
42 42
 
43
-	public static function register($debug=false) {
44
-		$handler = new ErrorHandler();
43
+    public static function register($debug=false) {
44
+        $handler = new ErrorHandler();
45 45
 
46
-		if ($debug) {
47
-			set_error_handler(array($handler, 'onAll'), E_ALL);
48
-			if (\OC::$CLI) {
49
-				set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
50
-			}
51
-		} else {
52
-			set_error_handler(array($handler, 'onError'));
53
-		}
54
-		register_shutdown_function(array($handler, 'onShutdown'));
55
-		set_exception_handler(array($handler, 'onException'));
56
-	}
46
+        if ($debug) {
47
+            set_error_handler(array($handler, 'onAll'), E_ALL);
48
+            if (\OC::$CLI) {
49
+                set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
50
+            }
51
+        } else {
52
+            set_error_handler(array($handler, 'onError'));
53
+        }
54
+        register_shutdown_function(array($handler, 'onShutdown'));
55
+        set_exception_handler(array($handler, 'onException'));
56
+    }
57 57
 
58
-	public static function setLogger(ILogger $logger) {
59
-		self::$logger = $logger;
60
-	}
58
+    public static function setLogger(ILogger $logger) {
59
+        self::$logger = $logger;
60
+    }
61 61
 
62
-	//Fatal errors handler
63
-	public static function onShutdown() {
64
-		$error = error_get_last();
65
-		if($error && self::$logger) {
66
-			//ob_end_clean();
67
-			$msg = $error['message'] . ' at ' . $error['file'] . '#' . $error['line'];
68
-			self::$logger->critical(self::removePassword($msg), array('app' => 'PHP'));
69
-		}
70
-	}
62
+    //Fatal errors handler
63
+    public static function onShutdown() {
64
+        $error = error_get_last();
65
+        if($error && self::$logger) {
66
+            //ob_end_clean();
67
+            $msg = $error['message'] . ' at ' . $error['file'] . '#' . $error['line'];
68
+            self::$logger->critical(self::removePassword($msg), array('app' => 'PHP'));
69
+        }
70
+    }
71 71
 
72
-	/**
73
-	 * 	Uncaught exception handler
74
-	 *
75
-	 * @param \Exception $exception
76
-	 */
77
-	public static function onException($exception) {
78
-		$class = get_class($exception);
79
-		$msg = $exception->getMessage();
80
-		$msg = "$class: $msg at " . $exception->getFile() . '#' . $exception->getLine();
81
-		self::$logger->critical(self::removePassword($msg), ['app' => 'PHP']);
82
-	}
72
+    /**
73
+     * 	Uncaught exception handler
74
+     *
75
+     * @param \Exception $exception
76
+     */
77
+    public static function onException($exception) {
78
+        $class = get_class($exception);
79
+        $msg = $exception->getMessage();
80
+        $msg = "$class: $msg at " . $exception->getFile() . '#' . $exception->getLine();
81
+        self::$logger->critical(self::removePassword($msg), ['app' => 'PHP']);
82
+    }
83 83
 
84
-	//Recoverable errors handler
85
-	public static function onError($number, $message, $file, $line) {
86
-		if (error_reporting() === 0) {
87
-			return;
88
-		}
89
-		$msg = $message . ' at ' . $file . '#' . $line;
90
-		self::$logger->error(self::removePassword($msg), array('app' => 'PHP'));
84
+    //Recoverable errors handler
85
+    public static function onError($number, $message, $file, $line) {
86
+        if (error_reporting() === 0) {
87
+            return;
88
+        }
89
+        $msg = $message . ' at ' . $file . '#' . $line;
90
+        self::$logger->error(self::removePassword($msg), array('app' => 'PHP'));
91 91
 
92
-	}
92
+    }
93 93
 
94
-	//Recoverable handler which catch all errors, warnings and notices
95
-	public static function onAll($number, $message, $file, $line) {
96
-		$msg = $message . ' at ' . $file . '#' . $line;
97
-		self::$logger->debug(self::removePassword($msg), array('app' => 'PHP'));
94
+    //Recoverable handler which catch all errors, warnings and notices
95
+    public static function onAll($number, $message, $file, $line) {
96
+        $msg = $message . ' at ' . $file . '#' . $line;
97
+        self::$logger->debug(self::removePassword($msg), array('app' => 'PHP'));
98 98
 
99
-	}
99
+    }
100 100
 
101 101
 }
Please login to merge, or discard this patch.
lib/private/Log/Rotate.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@
 block discarded – undo
31 31
  * location and manage that with your own tools.
32 32
  */
33 33
 class Rotate extends \OC\BackgroundJob\Job {
34
-	private $max_log_size;
35
-	public function run($dummy) {
36
-		$systemConfig = \OC::$server->getSystemConfig();
37
-		$logFile = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log');
38
-		$this->max_log_size = \OC::$server->getConfig()->getSystemValue('log_rotate_size', false);
39
-		if ($this->max_log_size) {
40
-			$filesize = @filesize($logFile);
41
-			if ($filesize >= $this->max_log_size) {
42
-				$this->rotate($logFile);
43
-			}
44
-		}
45
-	}
34
+    private $max_log_size;
35
+    public function run($dummy) {
36
+        $systemConfig = \OC::$server->getSystemConfig();
37
+        $logFile = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log');
38
+        $this->max_log_size = \OC::$server->getConfig()->getSystemValue('log_rotate_size', false);
39
+        if ($this->max_log_size) {
40
+            $filesize = @filesize($logFile);
41
+            if ($filesize >= $this->max_log_size) {
42
+                $this->rotate($logFile);
43
+            }
44
+        }
45
+    }
46 46
 
47
-	protected function rotate($logfile) {
48
-		$rotatedLogfile = $logfile.'.1';
49
-		rename($logfile, $rotatedLogfile);
50
-		$msg = 'Log file "'.$logfile.'" was over '.$this->max_log_size.' bytes, moved to "'.$rotatedLogfile.'"';
51
-		\OCP\Util::writeLog('OC\Log\Rotate', $msg, \OCP\Util::WARN);
52
-	}
47
+    protected function rotate($logfile) {
48
+        $rotatedLogfile = $logfile.'.1';
49
+        rename($logfile, $rotatedLogfile);
50
+        $msg = 'Log file "'.$logfile.'" was over '.$this->max_log_size.' bytes, moved to "'.$rotatedLogfile.'"';
51
+        \OCP\Util::writeLog('OC\Log\Rotate', $msg, \OCP\Util::WARN);
52
+    }
53 53
 }
Please login to merge, or discard this patch.
lib/private/Search.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -34,97 +34,97 @@
 block discarded – undo
34 34
  */
35 35
 class Search implements ISearch {
36 36
 
37
-	private $providers = array();
38
-	private $registeredProviders = array();
37
+    private $providers = array();
38
+    private $registeredProviders = array();
39 39
 
40
-	/**
41
-	 * Search all providers for $query
42
-	 * @param string $query
43
-	 * @param string[] $inApps optionally limit results to the given apps
44
-	 * @return array An array of OC\Search\Result's
45
-	 */
46
-	public function search($query, array $inApps = array()) {
47
-		// old apps might assume they get all results, so we set size 0
48
-		return $this->searchPaged($query, $inApps, 1, 0);
49
-	}
40
+    /**
41
+     * Search all providers for $query
42
+     * @param string $query
43
+     * @param string[] $inApps optionally limit results to the given apps
44
+     * @return array An array of OC\Search\Result's
45
+     */
46
+    public function search($query, array $inApps = array()) {
47
+        // old apps might assume they get all results, so we set size 0
48
+        return $this->searchPaged($query, $inApps, 1, 0);
49
+    }
50 50
 
51
-	/**
52
-	 * Search all providers for $query
53
-	 * @param string $query
54
-	 * @param string[] $inApps optionally limit results to the given apps
55
-	 * @param int $page pages start at page 1
56
-	 * @param int $size, 0 = all
57
-	 * @return array An array of OC\Search\Result's
58
-	 */
59
-	public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30) {
60
-		$this->initProviders();
61
-		$results = array();
62
-		foreach($this->providers as $provider) {
63
-			/** @var $provider Provider */
64
-			if ( ! $provider->providesResultsFor($inApps) ) {
65
-				continue;
66
-			}
67
-			if ($provider instanceof PagedProvider) {
68
-				$results = array_merge($results, $provider->searchPaged($query, $page, $size));
69
-			} else if ($provider instanceof Provider) {
70
-				$providerResults = $provider->search($query);
71
-				if ($size > 0) {
72
-					$slicedResults = array_slice($providerResults, ($page - 1) * $size, $size);
73
-					$results = array_merge($results, $slicedResults);
74
-				} else {
75
-					$results = array_merge($results, $providerResults);
76
-				}
77
-			} else {
78
-				\OC::$server->getLogger()->warning('Ignoring Unknown search provider', array('provider' => $provider));
79
-			}
80
-		}
81
-		return $results;
82
-	}
51
+    /**
52
+     * Search all providers for $query
53
+     * @param string $query
54
+     * @param string[] $inApps optionally limit results to the given apps
55
+     * @param int $page pages start at page 1
56
+     * @param int $size, 0 = all
57
+     * @return array An array of OC\Search\Result's
58
+     */
59
+    public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30) {
60
+        $this->initProviders();
61
+        $results = array();
62
+        foreach($this->providers as $provider) {
63
+            /** @var $provider Provider */
64
+            if ( ! $provider->providesResultsFor($inApps) ) {
65
+                continue;
66
+            }
67
+            if ($provider instanceof PagedProvider) {
68
+                $results = array_merge($results, $provider->searchPaged($query, $page, $size));
69
+            } else if ($provider instanceof Provider) {
70
+                $providerResults = $provider->search($query);
71
+                if ($size > 0) {
72
+                    $slicedResults = array_slice($providerResults, ($page - 1) * $size, $size);
73
+                    $results = array_merge($results, $slicedResults);
74
+                } else {
75
+                    $results = array_merge($results, $providerResults);
76
+                }
77
+            } else {
78
+                \OC::$server->getLogger()->warning('Ignoring Unknown search provider', array('provider' => $provider));
79
+            }
80
+        }
81
+        return $results;
82
+    }
83 83
 
84
-	/**
85
-	 * Remove all registered search providers
86
-	 */
87
-	public function clearProviders() {
88
-		$this->providers = array();
89
-		$this->registeredProviders = array();
90
-	}
84
+    /**
85
+     * Remove all registered search providers
86
+     */
87
+    public function clearProviders() {
88
+        $this->providers = array();
89
+        $this->registeredProviders = array();
90
+    }
91 91
 
92
-	/**
93
-	 * Remove one existing search provider
94
-	 * @param string $provider class name of a OC\Search\Provider
95
-	 */
96
-	public function removeProvider($provider) {
97
-		$this->registeredProviders = array_filter(
98
-			$this->registeredProviders,
99
-			function ($element) use ($provider) {
100
-				return ($element['class'] != $provider);
101
-			}
102
-		);
103
-		// force regeneration of providers on next search
104
-		$this->providers = array();
105
-	}
92
+    /**
93
+     * Remove one existing search provider
94
+     * @param string $provider class name of a OC\Search\Provider
95
+     */
96
+    public function removeProvider($provider) {
97
+        $this->registeredProviders = array_filter(
98
+            $this->registeredProviders,
99
+            function ($element) use ($provider) {
100
+                return ($element['class'] != $provider);
101
+            }
102
+        );
103
+        // force regeneration of providers on next search
104
+        $this->providers = array();
105
+    }
106 106
 
107
-	/**
108
-	 * Register a new search provider to search with
109
-	 * @param string $class class name of a OC\Search\Provider
110
-	 * @param array $options optional
111
-	 */
112
-	public function registerProvider($class, array $options = array()) {
113
-		$this->registeredProviders[] = array('class' => $class, 'options' => $options);
114
-	}
107
+    /**
108
+     * Register a new search provider to search with
109
+     * @param string $class class name of a OC\Search\Provider
110
+     * @param array $options optional
111
+     */
112
+    public function registerProvider($class, array $options = array()) {
113
+        $this->registeredProviders[] = array('class' => $class, 'options' => $options);
114
+    }
115 115
 
116
-	/**
117
-	 * Create instances of all the registered search providers
118
-	 */
119
-	private function initProviders() {
120
-		if( ! empty($this->providers) ) {
121
-			return;
122
-		}
123
-		foreach($this->registeredProviders as $provider) {
124
-			$class = $provider['class'];
125
-			$options = $provider['options'];
126
-			$this->providers[] = new $class($options);
127
-		}
128
-	}
116
+    /**
117
+     * Create instances of all the registered search providers
118
+     */
119
+    private function initProviders() {
120
+        if( ! empty($this->providers) ) {
121
+            return;
122
+        }
123
+        foreach($this->registeredProviders as $provider) {
124
+            $class = $provider['class'];
125
+            $options = $provider['options'];
126
+            $this->providers[] = new $class($options);
127
+        }
128
+    }
129 129
 
130 130
 }
Please login to merge, or discard this patch.
lib/private/Http/Client/Response.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -32,51 +32,51 @@
 block discarded – undo
32 32
  * @package OC\Http
33 33
  */
34 34
 class Response implements IResponse {
35
-	/** @var GuzzleResponse */
36
-	private $response;
35
+    /** @var GuzzleResponse */
36
+    private $response;
37 37
 
38
-	/**
39
-	 * @var bool
40
-	 */
41
-	private $stream;
38
+    /**
39
+     * @var bool
40
+     */
41
+    private $stream;
42 42
 
43
-	/**
44
-	 * @param GuzzleResponse $response
45
-	 * @param bool $stream
46
-	 */
47
-	public function __construct(GuzzleResponse $response, $stream = false) {
48
-		$this->response = $response;
49
-		$this->stream = $stream;
50
-	}
43
+    /**
44
+     * @param GuzzleResponse $response
45
+     * @param bool $stream
46
+     */
47
+    public function __construct(GuzzleResponse $response, $stream = false) {
48
+        $this->response = $response;
49
+        $this->stream = $stream;
50
+    }
51 51
 
52
-	/**
53
-	 * @return string|resource
54
-	 */
55
-	public function getBody() {
56
-		return $this->stream ?
57
-			$this->response->getBody()->detach():
58
-			$this->response->getBody()->getContents();
59
-	}
52
+    /**
53
+     * @return string|resource
54
+     */
55
+    public function getBody() {
56
+        return $this->stream ?
57
+            $this->response->getBody()->detach():
58
+            $this->response->getBody()->getContents();
59
+    }
60 60
 
61
-	/**
62
-	 * @return int
63
-	 */
64
-	public function getStatusCode() {
65
-		return $this->response->getStatusCode();
66
-	}
61
+    /**
62
+     * @return int
63
+     */
64
+    public function getStatusCode() {
65
+        return $this->response->getStatusCode();
66
+    }
67 67
 
68
-	/**
69
-	 * @param $key
70
-	 * @return string
71
-	 */
72
-	public function getHeader($key) {
73
-		return $this->response->getHeader($key);
74
-	}
68
+    /**
69
+     * @param $key
70
+     * @return string
71
+     */
72
+    public function getHeader($key) {
73
+        return $this->response->getHeader($key);
74
+    }
75 75
 
76
-	/**
77
-	 * @return array
78
-	 */
79
-	public function getHeaders() {
80
-		return $this->response->getHeaders();
81
-	}
76
+    /**
77
+     * @return array
78
+     */
79
+    public function getHeaders() {
80
+        return $this->response->getHeaders();
81
+    }
82 82
 }
Please login to merge, or discard this patch.
lib/private/Http/Client/Client.php 1 patch
Indentation   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -34,280 +34,280 @@
 block discarded – undo
34 34
  * @package OC\Http
35 35
  */
36 36
 class Client implements IClient {
37
-	/** @var GuzzleClient */
38
-	private $client;
39
-	/** @var IConfig */
40
-	private $config;
41
-	/** @var ICertificateManager */
42
-	private $certificateManager;
43
-	private $configured = false;
37
+    /** @var GuzzleClient */
38
+    private $client;
39
+    /** @var IConfig */
40
+    private $config;
41
+    /** @var ICertificateManager */
42
+    private $certificateManager;
43
+    private $configured = false;
44 44
 
45
-	/**
46
-	 * @param IConfig $config
47
-	 * @param ICertificateManager $certificateManager
48
-	 * @param GuzzleClient $client
49
-	 */
50
-	public function __construct(IConfig $config,
51
-								ICertificateManager $certificateManager,
52
-								GuzzleClient $client) {
53
-		$this->config = $config;
54
-		$this->client = $client;
55
-		$this->certificateManager = $certificateManager;
56
-	}
45
+    /**
46
+     * @param IConfig $config
47
+     * @param ICertificateManager $certificateManager
48
+     * @param GuzzleClient $client
49
+     */
50
+    public function __construct(IConfig $config,
51
+                                ICertificateManager $certificateManager,
52
+                                GuzzleClient $client) {
53
+        $this->config = $config;
54
+        $this->client = $client;
55
+        $this->certificateManager = $certificateManager;
56
+    }
57 57
 
58
-	/**
59
-	 * Sets the default options to the client
60
-	 */
61
-	private function setDefaultOptions() {
62
-		if ($this->configured) {
63
-			return;
64
-		}
65
-		$this->configured = true;
66
-		// Either use user bundle or the system bundle if nothing is specified
67
-		if ($this->certificateManager->listCertificates() !== []) {
68
-			$this->client->setDefaultOption('verify', $this->certificateManager->getAbsoluteBundlePath());
69
-		} else {
70
-			// If the instance is not yet setup we need to use the static path as
71
-			// $this->certificateManager->getAbsoluteBundlePath() tries to instantiiate
72
-			// a view
73
-			if ($this->config->getSystemValue('installed', false)) {
74
-				$this->client->setDefaultOption('verify', $this->certificateManager->getAbsoluteBundlePath(null));
75
-			} else {
76
-				$this->client->setDefaultOption('verify', \OC::$SERVERROOT . '/resources/config/ca-bundle.crt');
77
-			}
78
-		}
58
+    /**
59
+     * Sets the default options to the client
60
+     */
61
+    private function setDefaultOptions() {
62
+        if ($this->configured) {
63
+            return;
64
+        }
65
+        $this->configured = true;
66
+        // Either use user bundle or the system bundle if nothing is specified
67
+        if ($this->certificateManager->listCertificates() !== []) {
68
+            $this->client->setDefaultOption('verify', $this->certificateManager->getAbsoluteBundlePath());
69
+        } else {
70
+            // If the instance is not yet setup we need to use the static path as
71
+            // $this->certificateManager->getAbsoluteBundlePath() tries to instantiiate
72
+            // a view
73
+            if ($this->config->getSystemValue('installed', false)) {
74
+                $this->client->setDefaultOption('verify', $this->certificateManager->getAbsoluteBundlePath(null));
75
+            } else {
76
+                $this->client->setDefaultOption('verify', \OC::$SERVERROOT . '/resources/config/ca-bundle.crt');
77
+            }
78
+        }
79 79
 
80
-		$this->client->setDefaultOption('headers/User-Agent', 'Nextcloud Server Crawler');
81
-		$proxyUri = $this->getProxyUri();
82
-		if ($proxyUri !== '') {
83
-			$this->client->setDefaultOption('proxy', $proxyUri);
84
-		}
85
-	}
80
+        $this->client->setDefaultOption('headers/User-Agent', 'Nextcloud Server Crawler');
81
+        $proxyUri = $this->getProxyUri();
82
+        if ($proxyUri !== '') {
83
+            $this->client->setDefaultOption('proxy', $proxyUri);
84
+        }
85
+    }
86 86
 
87
-	/**
88
-	 * Get the proxy URI
89
-	 *
90
-	 * @return string
91
-	 */
92
-	private function getProxyUri() {
93
-		$proxyHost = $this->config->getSystemValue('proxy', null);
94
-		$proxyUserPwd = $this->config->getSystemValue('proxyuserpwd', null);
95
-		$proxyUri = '';
87
+    /**
88
+     * Get the proxy URI
89
+     *
90
+     * @return string
91
+     */
92
+    private function getProxyUri() {
93
+        $proxyHost = $this->config->getSystemValue('proxy', null);
94
+        $proxyUserPwd = $this->config->getSystemValue('proxyuserpwd', null);
95
+        $proxyUri = '';
96 96
 
97
-		if ($proxyUserPwd !== null) {
98
-			$proxyUri .= $proxyUserPwd . '@';
99
-		}
100
-		if ($proxyHost !== null) {
101
-			$proxyUri .= $proxyHost;
102
-		}
97
+        if ($proxyUserPwd !== null) {
98
+            $proxyUri .= $proxyUserPwd . '@';
99
+        }
100
+        if ($proxyHost !== null) {
101
+            $proxyUri .= $proxyHost;
102
+        }
103 103
 
104
-		return $proxyUri;
105
-	}
104
+        return $proxyUri;
105
+    }
106 106
 
107
-	/**
108
-	 * Sends a GET request
109
-	 *
110
-	 * @param string $uri
111
-	 * @param array $options Array such as
112
-	 *              'query' => [
113
-	 *                  'field' => 'abc',
114
-	 *                  'other_field' => '123',
115
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
116
-	 *              ],
117
-	 *              'headers' => [
118
-	 *                  'foo' => 'bar',
119
-	 *              ],
120
-	 *              'cookies' => ['
121
-	 *                  'foo' => 'bar',
122
-	 *              ],
123
-	 *              'allow_redirects' => [
124
-	 *                   'max'       => 10,  // allow at most 10 redirects.
125
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
126
-	 *                   'referer'   => true,     // add a Referer header
127
-	 *                   'protocols' => ['https'] // only allow https URLs
128
-	 *              ],
129
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
130
-	 *              'verify' => true, // bool or string to CA file
131
-	 *              'debug' => true,
132
-	 *              'timeout' => 5,
133
-	 * @return Response
134
-	 * @throws \Exception If the request could not get completed
135
-	 */
136
-	public function get($uri, array $options = []) {
137
-		$this->setDefaultOptions();
138
-		$response = $this->client->get($uri, $options);
139
-		$isStream = isset($options['stream']) && $options['stream'];
140
-		return new Response($response, $isStream);
141
-	}
107
+    /**
108
+     * Sends a GET request
109
+     *
110
+     * @param string $uri
111
+     * @param array $options Array such as
112
+     *              'query' => [
113
+     *                  'field' => 'abc',
114
+     *                  'other_field' => '123',
115
+     *                  'file_name' => fopen('/path/to/file', 'r'),
116
+     *              ],
117
+     *              'headers' => [
118
+     *                  'foo' => 'bar',
119
+     *              ],
120
+     *              'cookies' => ['
121
+     *                  'foo' => 'bar',
122
+     *              ],
123
+     *              'allow_redirects' => [
124
+     *                   'max'       => 10,  // allow at most 10 redirects.
125
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
126
+     *                   'referer'   => true,     // add a Referer header
127
+     *                   'protocols' => ['https'] // only allow https URLs
128
+     *              ],
129
+     *              'save_to' => '/path/to/file', // save to a file or a stream
130
+     *              'verify' => true, // bool or string to CA file
131
+     *              'debug' => true,
132
+     *              'timeout' => 5,
133
+     * @return Response
134
+     * @throws \Exception If the request could not get completed
135
+     */
136
+    public function get($uri, array $options = []) {
137
+        $this->setDefaultOptions();
138
+        $response = $this->client->get($uri, $options);
139
+        $isStream = isset($options['stream']) && $options['stream'];
140
+        return new Response($response, $isStream);
141
+    }
142 142
 
143
-	/**
144
-	 * Sends a HEAD request
145
-	 *
146
-	 * @param string $uri
147
-	 * @param array $options Array such as
148
-	 *              'headers' => [
149
-	 *                  'foo' => 'bar',
150
-	 *              ],
151
-	 *              'cookies' => ['
152
-	 *                  'foo' => 'bar',
153
-	 *              ],
154
-	 *              'allow_redirects' => [
155
-	 *                   'max'       => 10,  // allow at most 10 redirects.
156
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
157
-	 *                   'referer'   => true,     // add a Referer header
158
-	 *                   'protocols' => ['https'] // only allow https URLs
159
-	 *              ],
160
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
161
-	 *              'verify' => true, // bool or string to CA file
162
-	 *              'debug' => true,
163
-	 *              'timeout' => 5,
164
-	 * @return Response
165
-	 * @throws \Exception If the request could not get completed
166
-	 */
167
-	public function head($uri, $options = []) {
168
-		$this->setDefaultOptions();
169
-		$response = $this->client->head($uri, $options);
170
-		return new Response($response);
171
-	}
143
+    /**
144
+     * Sends a HEAD request
145
+     *
146
+     * @param string $uri
147
+     * @param array $options Array such as
148
+     *              'headers' => [
149
+     *                  'foo' => 'bar',
150
+     *              ],
151
+     *              'cookies' => ['
152
+     *                  'foo' => 'bar',
153
+     *              ],
154
+     *              'allow_redirects' => [
155
+     *                   'max'       => 10,  // allow at most 10 redirects.
156
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
157
+     *                   'referer'   => true,     // add a Referer header
158
+     *                   'protocols' => ['https'] // only allow https URLs
159
+     *              ],
160
+     *              'save_to' => '/path/to/file', // save to a file or a stream
161
+     *              'verify' => true, // bool or string to CA file
162
+     *              'debug' => true,
163
+     *              'timeout' => 5,
164
+     * @return Response
165
+     * @throws \Exception If the request could not get completed
166
+     */
167
+    public function head($uri, $options = []) {
168
+        $this->setDefaultOptions();
169
+        $response = $this->client->head($uri, $options);
170
+        return new Response($response);
171
+    }
172 172
 
173
-	/**
174
-	 * Sends a POST request
175
-	 *
176
-	 * @param string $uri
177
-	 * @param array $options Array such as
178
-	 *              'body' => [
179
-	 *                  'field' => 'abc',
180
-	 *                  'other_field' => '123',
181
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
182
-	 *              ],
183
-	 *              'headers' => [
184
-	 *                  'foo' => 'bar',
185
-	 *              ],
186
-	 *              'cookies' => ['
187
-	 *                  'foo' => 'bar',
188
-	 *              ],
189
-	 *              'allow_redirects' => [
190
-	 *                   'max'       => 10,  // allow at most 10 redirects.
191
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
192
-	 *                   'referer'   => true,     // add a Referer header
193
-	 *                   'protocols' => ['https'] // only allow https URLs
194
-	 *              ],
195
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
196
-	 *              'verify' => true, // bool or string to CA file
197
-	 *              'debug' => true,
198
-	 *              'timeout' => 5,
199
-	 * @return Response
200
-	 * @throws \Exception If the request could not get completed
201
-	 */
202
-	public function post($uri, array $options = []) {
203
-		$this->setDefaultOptions();
204
-		$response = $this->client->post($uri, $options);
205
-		return new Response($response);
206
-	}
173
+    /**
174
+     * Sends a POST request
175
+     *
176
+     * @param string $uri
177
+     * @param array $options Array such as
178
+     *              'body' => [
179
+     *                  'field' => 'abc',
180
+     *                  'other_field' => '123',
181
+     *                  'file_name' => fopen('/path/to/file', 'r'),
182
+     *              ],
183
+     *              'headers' => [
184
+     *                  'foo' => 'bar',
185
+     *              ],
186
+     *              'cookies' => ['
187
+     *                  'foo' => 'bar',
188
+     *              ],
189
+     *              'allow_redirects' => [
190
+     *                   'max'       => 10,  // allow at most 10 redirects.
191
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
192
+     *                   'referer'   => true,     // add a Referer header
193
+     *                   'protocols' => ['https'] // only allow https URLs
194
+     *              ],
195
+     *              'save_to' => '/path/to/file', // save to a file or a stream
196
+     *              'verify' => true, // bool or string to CA file
197
+     *              'debug' => true,
198
+     *              'timeout' => 5,
199
+     * @return Response
200
+     * @throws \Exception If the request could not get completed
201
+     */
202
+    public function post($uri, array $options = []) {
203
+        $this->setDefaultOptions();
204
+        $response = $this->client->post($uri, $options);
205
+        return new Response($response);
206
+    }
207 207
 
208
-	/**
209
-	 * Sends a PUT request
210
-	 *
211
-	 * @param string $uri
212
-	 * @param array $options Array such as
213
-	 *              'body' => [
214
-	 *                  'field' => 'abc',
215
-	 *                  'other_field' => '123',
216
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
217
-	 *              ],
218
-	 *              'headers' => [
219
-	 *                  'foo' => 'bar',
220
-	 *              ],
221
-	 *              'cookies' => ['
222
-	 *                  'foo' => 'bar',
223
-	 *              ],
224
-	 *              'allow_redirects' => [
225
-	 *                   'max'       => 10,  // allow at most 10 redirects.
226
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
227
-	 *                   'referer'   => true,     // add a Referer header
228
-	 *                   'protocols' => ['https'] // only allow https URLs
229
-	 *              ],
230
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
231
-	 *              'verify' => true, // bool or string to CA file
232
-	 *              'debug' => true,
233
-	 *              'timeout' => 5,
234
-	 * @return Response
235
-	 * @throws \Exception If the request could not get completed
236
-	 */
237
-	public function put($uri, array $options = []) {
238
-		$this->setDefaultOptions();
239
-		$response = $this->client->put($uri, $options);
240
-		return new Response($response);
241
-	}
208
+    /**
209
+     * Sends a PUT request
210
+     *
211
+     * @param string $uri
212
+     * @param array $options Array such as
213
+     *              'body' => [
214
+     *                  'field' => 'abc',
215
+     *                  'other_field' => '123',
216
+     *                  'file_name' => fopen('/path/to/file', 'r'),
217
+     *              ],
218
+     *              'headers' => [
219
+     *                  'foo' => 'bar',
220
+     *              ],
221
+     *              'cookies' => ['
222
+     *                  'foo' => 'bar',
223
+     *              ],
224
+     *              'allow_redirects' => [
225
+     *                   'max'       => 10,  // allow at most 10 redirects.
226
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
227
+     *                   'referer'   => true,     // add a Referer header
228
+     *                   'protocols' => ['https'] // only allow https URLs
229
+     *              ],
230
+     *              'save_to' => '/path/to/file', // save to a file or a stream
231
+     *              'verify' => true, // bool or string to CA file
232
+     *              'debug' => true,
233
+     *              'timeout' => 5,
234
+     * @return Response
235
+     * @throws \Exception If the request could not get completed
236
+     */
237
+    public function put($uri, array $options = []) {
238
+        $this->setDefaultOptions();
239
+        $response = $this->client->put($uri, $options);
240
+        return new Response($response);
241
+    }
242 242
 
243
-	/**
244
-	 * Sends a DELETE request
245
-	 *
246
-	 * @param string $uri
247
-	 * @param array $options Array such as
248
-	 *              'body' => [
249
-	 *                  'field' => 'abc',
250
-	 *                  'other_field' => '123',
251
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
252
-	 *              ],
253
-	 *              'headers' => [
254
-	 *                  'foo' => 'bar',
255
-	 *              ],
256
-	 *              'cookies' => ['
257
-	 *                  'foo' => 'bar',
258
-	 *              ],
259
-	 *              'allow_redirects' => [
260
-	 *                   'max'       => 10,  // allow at most 10 redirects.
261
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
262
-	 *                   'referer'   => true,     // add a Referer header
263
-	 *                   'protocols' => ['https'] // only allow https URLs
264
-	 *              ],
265
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
266
-	 *              'verify' => true, // bool or string to CA file
267
-	 *              'debug' => true,
268
-	 *              'timeout' => 5,
269
-	 * @return Response
270
-	 * @throws \Exception If the request could not get completed
271
-	 */
272
-	public function delete($uri, array $options = []) {
273
-		$this->setDefaultOptions();
274
-		$response = $this->client->delete($uri, $options);
275
-		return new Response($response);
276
-	}
243
+    /**
244
+     * Sends a DELETE request
245
+     *
246
+     * @param string $uri
247
+     * @param array $options Array such as
248
+     *              'body' => [
249
+     *                  'field' => 'abc',
250
+     *                  'other_field' => '123',
251
+     *                  'file_name' => fopen('/path/to/file', 'r'),
252
+     *              ],
253
+     *              'headers' => [
254
+     *                  'foo' => 'bar',
255
+     *              ],
256
+     *              'cookies' => ['
257
+     *                  'foo' => 'bar',
258
+     *              ],
259
+     *              'allow_redirects' => [
260
+     *                   'max'       => 10,  // allow at most 10 redirects.
261
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
262
+     *                   'referer'   => true,     // add a Referer header
263
+     *                   'protocols' => ['https'] // only allow https URLs
264
+     *              ],
265
+     *              'save_to' => '/path/to/file', // save to a file or a stream
266
+     *              'verify' => true, // bool or string to CA file
267
+     *              'debug' => true,
268
+     *              'timeout' => 5,
269
+     * @return Response
270
+     * @throws \Exception If the request could not get completed
271
+     */
272
+    public function delete($uri, array $options = []) {
273
+        $this->setDefaultOptions();
274
+        $response = $this->client->delete($uri, $options);
275
+        return new Response($response);
276
+    }
277 277
 
278 278
 
279
-	/**
280
-	 * Sends a options request
281
-	 *
282
-	 * @param string $uri
283
-	 * @param array $options Array such as
284
-	 *              'body' => [
285
-	 *                  'field' => 'abc',
286
-	 *                  'other_field' => '123',
287
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
288
-	 *              ],
289
-	 *              'headers' => [
290
-	 *                  'foo' => 'bar',
291
-	 *              ],
292
-	 *              'cookies' => ['
293
-	 *                  'foo' => 'bar',
294
-	 *              ],
295
-	 *              'allow_redirects' => [
296
-	 *                   'max'       => 10,  // allow at most 10 redirects.
297
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
298
-	 *                   'referer'   => true,     // add a Referer header
299
-	 *                   'protocols' => ['https'] // only allow https URLs
300
-	 *              ],
301
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
302
-	 *              'verify' => true, // bool or string to CA file
303
-	 *              'debug' => true,
304
-	 *              'timeout' => 5,
305
-	 * @return Response
306
-	 * @throws \Exception If the request could not get completed
307
-	 */
308
-	public function options($uri, array $options = []) {
309
-		$this->setDefaultOptions();
310
-		$response = $this->client->options($uri, $options);
311
-		return new Response($response);
312
-	}
279
+    /**
280
+     * Sends a options request
281
+     *
282
+     * @param string $uri
283
+     * @param array $options Array such as
284
+     *              'body' => [
285
+     *                  'field' => 'abc',
286
+     *                  'other_field' => '123',
287
+     *                  'file_name' => fopen('/path/to/file', 'r'),
288
+     *              ],
289
+     *              'headers' => [
290
+     *                  'foo' => 'bar',
291
+     *              ],
292
+     *              'cookies' => ['
293
+     *                  'foo' => 'bar',
294
+     *              ],
295
+     *              'allow_redirects' => [
296
+     *                   'max'       => 10,  // allow at most 10 redirects.
297
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
298
+     *                   'referer'   => true,     // add a Referer header
299
+     *                   'protocols' => ['https'] // only allow https URLs
300
+     *              ],
301
+     *              'save_to' => '/path/to/file', // save to a file or a stream
302
+     *              'verify' => true, // bool or string to CA file
303
+     *              'debug' => true,
304
+     *              'timeout' => 5,
305
+     * @return Response
306
+     * @throws \Exception If the request could not get completed
307
+     */
308
+    public function options($uri, array $options = []) {
309
+        $this->setDefaultOptions();
310
+        $response = $this->client->options($uri, $options);
311
+        return new Response($response);
312
+    }
313 313
 }
Please login to merge, or discard this patch.
lib/private/Http/Client/ClientService.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -33,25 +33,25 @@
 block discarded – undo
33 33
  * @package OC\Http
34 34
  */
35 35
 class ClientService implements IClientService {
36
-	/** @var IConfig */
37
-	private $config;
38
-	/** @var ICertificateManager */
39
-	private $certificateManager;
36
+    /** @var IConfig */
37
+    private $config;
38
+    /** @var ICertificateManager */
39
+    private $certificateManager;
40 40
 
41
-	/**
42
-	 * @param IConfig $config
43
-	 * @param ICertificateManager $certificateManager
44
-	 */
45
-	public function __construct(IConfig $config,
46
-								ICertificateManager $certificateManager) {
47
-		$this->config = $config;
48
-		$this->certificateManager = $certificateManager;
49
-	}
41
+    /**
42
+     * @param IConfig $config
43
+     * @param ICertificateManager $certificateManager
44
+     */
45
+    public function __construct(IConfig $config,
46
+                                ICertificateManager $certificateManager) {
47
+        $this->config = $config;
48
+        $this->certificateManager = $certificateManager;
49
+    }
50 50
 
51
-	/**
52
-	 * @return Client
53
-	 */
54
-	public function newClient() {
55
-		return new Client($this->config, $this->certificateManager, new GuzzleClient());
56
-	}
51
+    /**
52
+     * @return Client
53
+     */
54
+    public function newClient() {
55
+        return new Client($this->config, $this->certificateManager, new GuzzleClient());
56
+    }
57 57
 }
Please login to merge, or discard this patch.
lib/private/Session/Session.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -28,53 +28,53 @@
 block discarded – undo
28 28
 
29 29
 abstract class Session implements \ArrayAccess, ISession {
30 30
 
31
-	/**
32
-	 * @var bool
33
-	 */
34
-	protected $sessionClosed = false;
31
+    /**
32
+     * @var bool
33
+     */
34
+    protected $sessionClosed = false;
35 35
 
36
-	/**
37
-	 * $name serves as a namespace for the session keys
38
-	 *
39
-	 * @param string $name
40
-	 */
41
-	abstract public function __construct($name);
36
+    /**
37
+     * $name serves as a namespace for the session keys
38
+     *
39
+     * @param string $name
40
+     */
41
+    abstract public function __construct($name);
42 42
 
43
-	/**
44
-	 * @param mixed $offset
45
-	 * @return bool
46
-	 */
47
-	public function offsetExists($offset) {
48
-		return $this->exists($offset);
49
-	}
43
+    /**
44
+     * @param mixed $offset
45
+     * @return bool
46
+     */
47
+    public function offsetExists($offset) {
48
+        return $this->exists($offset);
49
+    }
50 50
 
51
-	/**
52
-	 * @param mixed $offset
53
-	 * @return mixed
54
-	 */
55
-	public function offsetGet($offset) {
56
-		return $this->get($offset);
57
-	}
51
+    /**
52
+     * @param mixed $offset
53
+     * @return mixed
54
+     */
55
+    public function offsetGet($offset) {
56
+        return $this->get($offset);
57
+    }
58 58
 
59
-	/**
60
-	 * @param mixed $offset
61
-	 * @param mixed $value
62
-	 */
63
-	public function offsetSet($offset, $value) {
64
-		$this->set($offset, $value);
65
-	}
59
+    /**
60
+     * @param mixed $offset
61
+     * @param mixed $value
62
+     */
63
+    public function offsetSet($offset, $value) {
64
+        $this->set($offset, $value);
65
+    }
66 66
 
67
-	/**
68
-	 * @param mixed $offset
69
-	 */
70
-	public function offsetUnset($offset) {
71
-		$this->remove($offset);
72
-	}
67
+    /**
68
+     * @param mixed $offset
69
+     */
70
+    public function offsetUnset($offset) {
71
+        $this->remove($offset);
72
+    }
73 73
 
74
-	/**
75
-	 * Close the session and release the lock
76
-	 */
77
-	public function close() {
78
-		$this->sessionClosed = true;
79
-	}
74
+    /**
75
+     * Close the session and release the lock
76
+     */
77
+    public function close() {
78
+        $this->sessionClosed = true;
79
+    }
80 80
 }
Please login to merge, or discard this patch.