TenantRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A findDefaultTenant() 0 13 3
1
<?php
2
namespace Vivait\AuthBundle\Entity;
3
4
use Symfony\Component\Security\Core\User\UserInterface;
5
use Symfony\Component\Security\Core\User\UserProviderInterface;
6
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
7
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
8
use Doctrine\ORM\EntityRepository;
9
use Doctrine\ORM\NoResultException;
10
11
class TenantRepository extends EntityRepository {
12
	private $default_tenant;
13
14
	public function findDefaultTenant() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
15
		if (!$this->default_tenant) {
16
			$this->default_tenant = $this->findOneBy([
17
				'code' => 'DEF'
18
			]);
19
			if (!$this->default_tenant) {
20
				$this->default_tenant = new Tenant('DEF', 'Default tenant');
21
			}
22
		}
23
24
25
		return $this->default_tenant;
26
	}
27
}
28
29
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
30