This repository was archived by the owner on Jan 13, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-15
lines changed Expand file tree Collapse file tree 3 files changed +8
-15
lines changed Original file line number Diff line number Diff line change 2424namespace Facebook \GraphNodes ;
2525
2626use DateTime ;
27- use DateTimeZone ;
2827
2928/**
3029 * Birthday object to handle various Graph return formats
@@ -52,22 +51,16 @@ class Birthday extends DateTime
5251 *
5352 * @link https://developers.facebook.com/docs/graph-api/reference/user
5453 *
55- * @param string $date
56- * @param DateTimeZone $timezone
54+ * @param string $date
5755 */
58- public function __construct ($ date, DateTimeZone $ timezone = null )
56+ public function __construct ($ date )
5957 {
6058 $ parts = explode ('/ ' , $ date );
6159
62- if (count ($ parts ) === 3 || count ($ parts ) === 1 ) {
63- $ this ->hasYear = true ;
64- }
60+ $ this ->hasYear = count ($ parts ) === 3 || count ($ parts ) === 1 ;
61+ $ this ->hasDate = count ($ parts ) === 3 || count ($ parts ) === 2 ;
6562
66- if (count ($ parts ) === 3 || count ($ parts ) === 2 ) {
67- $ this ->hasDate = true ;
68- }
69-
70- parent ::__construct ($ date , $ timezone );
63+ parent ::__construct ($ date );
7164 }
7265
7366 /**
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public function castItems(array $data)
6565 || $ this ->isIso8601DateString ($ v ))
6666 ) {
6767 $ items [$ k ] = $ this ->castToDateTime ($ v );
68- } else if ($ k === 'birthday ' ) {
68+ } elseif ($ k === 'birthday ' ) {
6969 $ items [$ k ] = $ this ->castToBirthday ($ v );
7070 } else {
7171 $ items [$ k ] = $ v ;
@@ -178,7 +178,7 @@ public function castToDateTime($value)
178178 *
179179 * @param string $value
180180 *
181- * @return \Facebook\GraphNodes\ Birthday
181+ * @return Birthday
182182 */
183183 public function castToBirthday ($ value )
184184 {
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public function setUp()
4242 public function testDatesGetCastToDateTime ()
4343 {
4444 $ dataFromGraph = [
45- 'updated_time ' => '2016-04-26 13:22:05 '
45+ 'updated_time ' => '2016-04-26 13:22:05 ' ,
4646 ];
4747
4848 $ this ->responseMock
You can’t perform that action at this time.
0 commit comments