Errors   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 13
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A respond() 0 7 2
1
<?php
2
/**
3
 * ownCloud - Notes
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Bernhard Posselt <[email protected]>
9
 * @copyright Bernhard Posselt 2012, 2014
10
 */
11
12
namespace OCA\Notes\Controller;
13
14
use OCP\AppFramework\Http;
15
use OCP\AppFramework\Http\DataResponse;
16
17
use OCA\Notes\Service\NoteDoesNotExistException;
18
19
/**
20
 * Class Errors
21
 *
22
 * @package OCA\Notes\Controller
23
 */
24
trait Errors {
25
	/**
26
	 * @param $callback
27
	 * @return DataResponse
28
	 */
29 14
	protected function respond($callback) {
30
		try {
31 14
			return new DataResponse($callback());
32 6
		} catch (NoteDoesNotExistException $ex) {
33 6
			return new DataResponse([], Http::STATUS_NOT_FOUND);
34
		}
35
	}
36
}
37