opencafe /
datium
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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; |
||
| 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
|
|||
| 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
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 |
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.