These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use Datium\Datium as Datium; |
||
4 | use Datium\Tools\Convert as Covnert; |
||
5 | |||
6 | try{ |
||
7 | |||
8 | require_once( 'vendor/autoload.php' ); |
||
9 | var_dump( Datium::create( 1394, 9, 24 )->from( 'shamsi' )->get() ); |
||
10 | var_dump( Datium::create( 2020, 07, 11 )->to( 'shamsi' )->get() ); |
||
11 | var_dump( Datium::create( 2020, 07, 11 )->to( 'ghamari' )->get() ); |
||
12 | echo '<br>this year:<br>'; |
||
13 | var_dump( Datium::now()->to( 'shamsi' )->get( 'l jS F Y h:i:s A' ) ); |
||
14 | echo "<br>"; |
||
15 | var_dump( Datium::now()->to( 'shamsi' )->sub('3 year')->get() ); |
||
16 | echo "<br>"; |
||
17 | var_dump( Datium::now()->to( 'shamsi' )->add('3 year')->get() ); |
||
18 | echo "<br>"; |
||
19 | var_dump( Datium::now()->get( 'l jS F Y h:i:s A' ) ); |
||
20 | echo "<br>Leap year "; |
||
21 | var_dump( Datium::now()->leap()->get() ); |
||
22 | echo "<br>Create new DateTime: "; |
||
23 | var_dump( Datium::create(2000, 1, 1, 0, 0, 0)->get() ); |
||
24 | echo "<br>"; |
||
25 | echo 'Is next year leap? '; |
||
26 | var_dump( Datium::now()->add('1 year')->leap()->get() ); |
||
27 | echo "<br>"; |
||
28 | echo "Day of Year in gregorian:"; |
||
29 | echo "<br>"; |
||
30 | var_dump( Datium::now()->dayOf()->year() ); |
||
31 | echo "<br>"; |
||
32 | echo "Day of Year in shamsi:"; |
||
33 | echo "<br>"; |
||
34 | var_dump( Datium::now()->to('shamsi')->dayOf()->year() ); |
||
35 | echo "<br>"; |
||
36 | echo "Day of Year in ghamari:"; |
||
37 | echo "<br>"; |
||
38 | var_dump( Datium::now()->to( 'ghamari' )->dayOf()->year() ); |
||
39 | echo "<br>"; |
||
40 | echo "Day of Week"; |
||
41 | echo "<br>"; |
||
42 | var_dump( Datium::now()->dayOf()->week() ); |
||
43 | echo "<br>"; |
||
44 | echo "Change date form gregorian to shamsi with method: "; |
||
45 | var_dump( Datium::create( 1989, 10, 27 )->to( 'shamsi' )->get( 'l jS F Y h:i:s A' ) ); |
||
46 | echo "<br>"; |
||
47 | var_dump( Datium::now()->to( 'ghamari' )->get( 'l jS F Y h:i:s A' ) ); |
||
48 | echo "<br>"; |
||
49 | echo "<br>"; |
||
50 | echo "<br>is persian holiday? "; |
||
51 | // var_dump( Datium::between( Datium::now()->object() , Datium::now()->add( '3 month' )->object() )->events()->local( 'us' )->local( 'ir' )->get() ); |
||
0 ignored issues
–
show
|
|||
52 | echo 'return international days'; |
||
53 | // var_dump( Datium::between( Datium::now()->object() , Datium::now()->add('4 month')->object() )->events()->international()->get() ); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
62% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
54 | echo 'Convert gregorian to perisan'; |
||
55 | var_dump( Datium::now()->to('shamsi')->get() ); |
||
56 | echo 'Today\'s events:'; |
||
57 | // var_dump( Datium::now()->events()->local( 'ir' )->get() ); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
60% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
58 | echo 'Date diff'; |
||
59 | $diff = Datium::diff( Datium::now()->object(), Datium::now()->add('5 day')->object() ); |
||
60 | var_dump( $diff->days ); |
||
61 | var_dump( Datium::create( 2015, 11, 9 )->to( 'ghamari' )->get() ); |
||
62 | |||
63 | |||
64 | } catch (Exception $e ) { |
||
65 | |||
66 | var_dump( $e ); |
||
67 | |||
68 | } |
||
69 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.