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