Completed
Push — master ( b8d297...c6cce1 )
by Maxence
02:13
created

SharesController::new()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 25
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 25
rs 8.8571
c 1
b 0
f 0
cc 2
eloc 15
nc 2
nop 4
1
<?php
2
/**
3
 * Circles - Bring cloud-users closer together.
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Maxence Lange <[email protected]>
9
 * @copyright 2017
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 *
25
 */
26
27
namespace OCA\Circles\Controller;
28
29
use OCP\AppFramework\Http\DataResponse;
30
31
class SharesController extends BaseController {
32
33
34
	/**
35
	 * @NoAdminRequired
36
	 * @NoSubAdminRequired
37
	 *
38
	 * @param $id
39
	 * @param $source
40
	 * @param $type
41
	 * @param $item
42
	 *
43
	 * @return DataResponse
44
	 * @internal param string $name
45
	 *
46
	 */
47
	public function new($id, $source, $type, $item) {
48
49
		try {
50
			$this->sharesService->new($id, $source, $type, $item);
0 ignored issues
show
Bug introduced by
The method new() does not seem to exist on object<OCA\Circles\Service\MembersService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
51
		} catch (\Exception $e) {
52
			return $this->fail(
53
				[
54
					'circle_id' => $id,
55
					'source'    => $source,
56
					'type'      => $type,
57
					'item'      => $item,
58
					'error'     => $e->getMessage()
59
				]
60
			);
61
		}
62
63
		return $this->success(
64
			[
65
				'circle_id' => $id,
66
				'source'    => $source,
67
				'type'      => $type,
68
				'item'      => $item
69
			]
70
		);
71
	}
72
73
74
}
75
76