Passed
Push — master ( 2ad95f...3e8087 )
by Morris
10:32 queued 11s
created
apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -44,90 +44,90 @@
 block discarded – undo
44 44
 use Sabre\DAV\Exception\ServiceUnavailable;
45 45
 
46 46
 class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
47
-	protected $nonFatalExceptions = [
48
-		NotAuthenticated::class => true,
49
-		// If tokenauth can throw this exception (which is basically as
50
-		// NotAuthenticated. So not fatal.
51
-		PasswordLoginForbidden::class => true,
52
-		// basically a NotAuthenticated
53
-		InvalidSyncToken::class => true,
54
-		// the sync client uses this to find out whether files exist,
55
-		// so it is not always an error, log it as debug
56
-		NotFound::class => true,
57
-		// this one mostly happens when the same file is uploaded at
58
-		// exactly the same time from two clients, only one client
59
-		// wins, the second one gets "Precondition failed"
60
-		PreconditionFailed::class => true,
61
-		// forbidden can be expected when trying to upload to
62
-		// read-only folders for example
63
-		Forbidden::class => true,
64
-		// Happens when an external storage or federated share is temporarily
65
-		// not available
66
-		StorageNotAvailableException::class => true,
67
-		// happens if some a client uses the wrong method for a given URL
68
-		// the error message itself is visible on the client side anyways
69
-		NotImplemented::class => true,
70
-		// happens when the parent directory is not present (for example when a
71
-		// move is done to a non-existent directory)
72
-		Conflict::class => true,
73
-		// happens when a certain method is not allowed to be called
74
-		// for example creating a folder that already exists
75
-		MethodNotAllowed::class => true,
76
-		// A locked file is perfectly valid and can happen in various cases
77
-		FileLocked::class => true,
78
-		// An invalid range is requested
79
-		RequestedRangeNotSatisfiable::class => true,
80
-	];
47
+    protected $nonFatalExceptions = [
48
+        NotAuthenticated::class => true,
49
+        // If tokenauth can throw this exception (which is basically as
50
+        // NotAuthenticated. So not fatal.
51
+        PasswordLoginForbidden::class => true,
52
+        // basically a NotAuthenticated
53
+        InvalidSyncToken::class => true,
54
+        // the sync client uses this to find out whether files exist,
55
+        // so it is not always an error, log it as debug
56
+        NotFound::class => true,
57
+        // this one mostly happens when the same file is uploaded at
58
+        // exactly the same time from two clients, only one client
59
+        // wins, the second one gets "Precondition failed"
60
+        PreconditionFailed::class => true,
61
+        // forbidden can be expected when trying to upload to
62
+        // read-only folders for example
63
+        Forbidden::class => true,
64
+        // Happens when an external storage or federated share is temporarily
65
+        // not available
66
+        StorageNotAvailableException::class => true,
67
+        // happens if some a client uses the wrong method for a given URL
68
+        // the error message itself is visible on the client side anyways
69
+        NotImplemented::class => true,
70
+        // happens when the parent directory is not present (for example when a
71
+        // move is done to a non-existent directory)
72
+        Conflict::class => true,
73
+        // happens when a certain method is not allowed to be called
74
+        // for example creating a folder that already exists
75
+        MethodNotAllowed::class => true,
76
+        // A locked file is perfectly valid and can happen in various cases
77
+        FileLocked::class => true,
78
+        // An invalid range is requested
79
+        RequestedRangeNotSatisfiable::class => true,
80
+    ];
81 81
 
82
-	/** @var string */
83
-	private $appName;
82
+    /** @var string */
83
+    private $appName;
84 84
 
85
-	/** @var ILogger */
86
-	private $logger;
85
+    /** @var ILogger */
86
+    private $logger;
87 87
 
88
-	/**
89
-	 * @param string $loggerAppName app name to use when logging
90
-	 * @param ILogger $logger
91
-	 */
92
-	public function __construct($loggerAppName, $logger) {
93
-		$this->appName = $loggerAppName;
94
-		$this->logger = $logger;
95
-	}
88
+    /**
89
+     * @param string $loggerAppName app name to use when logging
90
+     * @param ILogger $logger
91
+     */
92
+    public function __construct($loggerAppName, $logger) {
93
+        $this->appName = $loggerAppName;
94
+        $this->logger = $logger;
95
+    }
96 96
 
97
-	/**
98
-	 * This initializes the plugin.
99
-	 *
100
-	 * This function is called by \Sabre\DAV\Server, after
101
-	 * addPlugin is called.
102
-	 *
103
-	 * This method should set up the required event subscriptions.
104
-	 *
105
-	 * @param \Sabre\DAV\Server $server
106
-	 * @return void
107
-	 */
108
-	public function initialize(\Sabre\DAV\Server $server) {
109
-		$server->on('exception', [$this, 'logException'], 10);
110
-	}
97
+    /**
98
+     * This initializes the plugin.
99
+     *
100
+     * This function is called by \Sabre\DAV\Server, after
101
+     * addPlugin is called.
102
+     *
103
+     * This method should set up the required event subscriptions.
104
+     *
105
+     * @param \Sabre\DAV\Server $server
106
+     * @return void
107
+     */
108
+    public function initialize(\Sabre\DAV\Server $server) {
109
+        $server->on('exception', [$this, 'logException'], 10);
110
+    }
111 111
 
112
-	/**
113
-	 * Log exception
114
-	 *
115
-	 */
116
-	public function logException(\Throwable $ex) {
117
-		$exceptionClass = get_class($ex);
118
-		$level = ILogger::FATAL;
119
-		if (isset($this->nonFatalExceptions[$exceptionClass]) ||
120
-			(
121
-				$exceptionClass === ServiceUnavailable::class &&
122
-				$ex->getMessage() === 'System in maintenance mode.'
123
-			)
124
-		) {
125
-			$level = ILogger::DEBUG;
126
-		}
112
+    /**
113
+     * Log exception
114
+     *
115
+     */
116
+    public function logException(\Throwable $ex) {
117
+        $exceptionClass = get_class($ex);
118
+        $level = ILogger::FATAL;
119
+        if (isset($this->nonFatalExceptions[$exceptionClass]) ||
120
+            (
121
+                $exceptionClass === ServiceUnavailable::class &&
122
+                $ex->getMessage() === 'System in maintenance mode.'
123
+            )
124
+        ) {
125
+            $level = ILogger::DEBUG;
126
+        }
127 127
 
128
-		$this->logger->logException($ex, [
129
-			'app' => $this->appName,
130
-			'level' => $level,
131
-		]);
132
-	}
128
+        $this->logger->logException($ex, [
129
+            'app' => $this->appName,
130
+            'level' => $level,
131
+        ]);
132
+    }
133 133
 }
Please login to merge, or discard this patch.