private function setDate($data, $key, $defaultDate, callable $setCallback)
    {
        $date = $this->getProperty($data, $key, $defaultDate);

        if ($date !== null) {
            // set to null if empty
            if (empty($date)) {
                $date = null;
            }
            if (is_string($date)) {
                $date = new \DateTime($date);
            }
            // call the given set date function
            call_user_func($setCallback, $date);
        }
    }
private function setDate($data, $key, $defaultDate, callable $setCallback)
    {
        $date = $this->getProperty($data, $key, $defaultDate);

        if ($date !== null) {
            // set to null if empty
            if (empty($date)) {
                $date = null;
            }
            if (is_string($date)) {
                $date = new \DateTime($date);
            }
            // call the given set date function
            call_user_func($setCallback, $date);
        }
    }
private function setDate ( $ data , $ key , $ defaultDate , callable $ setCallback ) { $ date = $ this -> getProperty ( $ data , $ key , $ defaultDate ) ; if ( $ date !== null ) { // set to null if empty if ( empty ( $ date ) ) { $ date = null ; } if ( is_string ( $ date ) ) { $ date = new \ DateTime ( $ date ) ; } // call the given set date function call_user_func ( $ setCallback , $ date ) ; } }
Sets a date if it is set in given data.

@param array $data
@param string $key
@param string|\DateTime $defaultDate
@param callable $setCallback
Sets a date if it is set in given data .