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.

Account   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 5
Bugs 0 Features 0
Metric Value
wmc 8
c 5
b 0
f 0
lcom 2
cbo 2
dl 0
loc 71
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getEndpoint() 0 4 1
A getId() 0 4 1
A setCurrency() 0 7 1
A getCurrency() 0 4 1
A getName() 0 4 1
A getTimezone() 0 4 1
A save() 0 10 1
A postHydrate() 0 4 1
1
<?php
2
3
namespace prgTW\BaseCRM\Service;
4
5
use prgTW\BaseCRM\Resource\InstanceResource;
6
use prgTW\BaseCRM\Service\Enum\Currency;
7
8
/**
9
 * @property-read int      id
10
 * @property string        name
11
 * @property string        timezone
12
 * @property-read Currency currency
13
 */
14
class Account extends InstanceResource
15
{
16
	/** {@inheritdoc} */
17
	protected function getEndpoint()
18
	{
19
		return self::ENDPOINT_SALES;
20
	}
21
22
	/**
23
	 * @return int
24
	 */
25
	protected function getId()
26
	{
27
		return $this->data['id'];
28
	}
29
30
	/**
31
	 * @param Currency $currency
32
	 *
33
	 * @return $this
34
	 */
35
	public function setCurrency(Currency $currency)
36
	{
37
		$this->data['currency_id']   = $currency->getValue();
38
		$this->data['currency_name'] = $currency->getName();
39
40
		return $this;
41
	}
42
43
	/**
44
	 * @return Currency
45
	 */
46
	protected function getCurrency()
47
	{
48
		return new Currency($this->data['currency_id']);
49
	}
50
51
	/**
52
	 * @return string
53
	 */
54
	protected function getName()
55
	{
56
		return $this->data['name'];
57
	}
58
59
	/**
60
	 * @return string
61
	 */
62
	protected function getTimezone()
63
	{
64
		return $this->data['timezone'];
65
	}
66
67
	/** {@inheritdoc} */
68
	public function save(array $fieldNames = [])
69
	{
70
		$fieldNames = array_intersect($fieldNames, [
71
			'name',
72
			'timezone',
73
			'currency_id',
74
		]);
75
76
		return parent::save($fieldNames);
77
	}
78
79
	/** {@inheritdoc} */
80
	protected function postHydrate(array $data)
81
	{
82
		$this->currency = Currency::fromName($data['currency_name']);
83
	}
84
}
85