AdminController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A index() 0 5 1
1
<?php
2
3
namespace OCA\Chat\Controller;
4
5
use OCA\Chat\IBackendManager;
6
use \OCP\AppFramework\Controller;
7
use \OCP\AppFramework\Http;
8
use \OCP\AppFramework\Http\TemplateResponse;
9
use \OCP\IRequest;
10
11
class AdminController extends Controller {
12
13
	/**
14
	 * @var \OCA\Chat\BackendManager
15
	 */
16
	private $backendManager;
17
18
	public function __construct($appName, IRequest $request,  IBackendManager $backendManager){
19
		parent::__construct($appName, $request);
20
		$this->backendManager = $backendManager;
0 ignored issues
show
Documentation Bug introduced by
$backendManager is of type object<OCA\Chat\IBackendManager>, but the property $backendManager was declared to be of type object<OCA\Chat\BackendManager>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
21
	}
22
23
	/**
24
	 * @NoAdminRequired
25
	 */
26
	public function index(){
27
		$params = array();
28
		$params['backends'] = $this->backendManager->getBackends();
29
		return new TemplateResponse($this->appName, 'admin', $params, 'blank');
30
	}
31
}