Completed
Push — master ( d5f8b0...0fe70c )
by mehdi
02:20
created

DayOf::week()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 7
Ratio 100 %

Importance

Changes 8
Bugs 1 Features 6
Metric Value
c 8
b 1
f 6
dl 7
loc 7
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
1
<?php namespace Datium\Tools;
2
3
/**
4
 * Define Day of current date.
5
 */
6
class DayOf {
7
8
  protected $date_time;
9
10
  protected $month;
11
12
  protected $day;
13
14
  protected $config;
15
16
  protected $result;
17
18
  protected $calendar_type;
19
20
  protected $geregorian_DayofWeek;
21
22
  public function __construct( $date_time, $calendar_type = 'gregorian' ) {
23
24
    $this->config = include( 'Config.php' );
25
26
    $this->date_time = $date_time;
27
28
    $this->calendar_type = $calendar_type;
29
30
    return $this;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
31
32
  }
33
34
  /**
35
   * Which day of year is current day.
36
   * @since Aug, 03 2015
37
   * @return integer
38
   */
39 View Code Duplication
  public function year() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
40
41
    $this->config = include(  'CalendarSettings/' . ucfirst( $this->calendar_type ) . '.php' );
42
43
    return $this->config[ 'day_of_year' ]( $this->date_time );
44
45
  }
46
47
48
  /**
49
   * Which day of week is current day.
50
   * @since Aug, 09 2015
51
   * @return integer
52
   */
53 View Code Duplication
  public function week() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
55
    $this->config = include(  'CalendarSettings/' . ucfirst( $this->calendar_type ) . '.php' );
56
57
    return $this->config[ 'day_of_week' ]( $this->date_time );
58
59
  }
60
61
}
62