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.

Date   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A from() 0 9 2
A __construct() 0 15 4
A __toString() 0 4 2
1
<?php
2
3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ICanBoogie\HTTP\Headers;
13
14
use ICanBoogie\DateTime;
15
16
/**
17
 * A date time object that renders into a string formatted for HTTP header fields.
18
 *
19
 * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
20
 */
21
class Date extends DateTime
22
{
23
    /**
24
     * @param mixed $source
25
     * @param string|\DateTimeZone|null $timezone
26
     *
27
     * @return Date|DateTime
28
     */
29
	static public function from($source, $timezone = null)
30
	{
31
		if ($source === null)
32
		{
33
			return static::none();
34
		}
35
36
		return parent::from($source, $timezone);
37
	}
38
39
	/**
40
	 * @param string|int|\DateTime $time If time is provided as a numeric value it is used as
41
	 * "@{$time}" and the time zone is set to UTC.
42
	 * @param \DateTimeZone|string $timezone A {@link \DateTimeZone} object representing the desired
43
	 * time zone. If the time zone is empty `utc` is used instead.
44
	 */
45
	public function __construct($time = 'now', $timezone = null)
46
	{
47
		if ($time instanceof \DateTime)
48
		{
49
			$time = $time->getTimestamp();
50
		}
51
52
		if (is_numeric($time))
53
		{
54
			$time = '@' . $time;
55
			$timezone = null;
56
		}
57
58
		parent::__construct($time, $timezone ?: 'utc');
59
	}
60
61
	/**
62
	 * Formats the instance according to the RFC 1123.
63
     *
64
     * @inheritdoc
65
	 */
66
	public function __toString()
67
	{
68
		return $this->is_empty ? '' : $this->utc->as_rfc1123;
69
	}
70
}
71