GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ClassName   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 3
A __toString() 0 4 1
A isClassOf() 0 4 1
1
<?php
2
3
namespace Isolate\UnitOfWork\Entity;
4
5
use Isolate\UnitOfWork\Exception\InvalidArgumentException;
6
7
/**
8
 * @api
9
 */
10
final class ClassName
11
{
12
    /**
13
     * @var string
14
     */
15
    private $className;
16
17
    /**
18
     * @param string $className
19
     * @throws InvalidArgumentException
20
     */
21
    public function __construct($className)
22
    {
23
        if (!is_string($className)) {
24
            throw new InvalidArgumentException("Class name must be a valid string.");
25
        }
26
27
        if (!class_exists($className)) {
28
            throw new InvalidArgumentException(sprintf("Class \"%s\" does not exists.", $className));
29
        }
30
31
        $this->className = $className;
32
    }
33
34
    public function __toString()
35
    {
36
        return $this->className;
37
    }
38
39
    /**
40
     * @param $entity
41
     * @return bool
42
     * 
43
     * @api
44
     */
45
    public function isClassOf($entity)
46
    {
47
        return $entity instanceof $this->className;
48
    }
49
}
50