public static function TryParse( $timeDefinition, Time &$refTime )
      : bool
   {

      if ( $timeDefinition instanceof Time )
      {
         // No converting needed! Return as it.
         $refTime = $timeDefinition;
         return true;
      }

      if ( $timeDefinition instanceof DateTime )
      {
         $refTime = $timeDefinition->getTime();
         return true;
      }

      if ( $timeDefinition instanceof \DateTime )
      {
         $refTime = ( new DateTime( $timeDefinition ) )->getTime();
         return true;
      }

      if ( false !== ( $dt = DateTime::Parse( $timeDefinition ) ) )
      {
         $refTime = $dt->getTime();
         return true;
      }

      return false;

   }
public static function TryParse( $timeDefinition, Time &$refTime )
      : bool
   {

      if ( $timeDefinition instanceof Time )
      {
         // No converting needed! Return as it.
         $refTime = $timeDefinition;
         return true;
      }

      if ( $timeDefinition instanceof DateTime )
      {
         $refTime = $timeDefinition->getTime();
         return true;
      }

      if ( $timeDefinition instanceof \DateTime )
      {
         $refTime = ( new DateTime( $timeDefinition ) )->getTime();
         return true;
      }

      if ( false !== ( $dt = DateTime::Parse( $timeDefinition ) ) )
      {
         $refTime = $dt->getTime();
         return true;
      }

      return false;

   }
public static function TryParse ( $ timeDefinition , Time & $ refTime ) : bool { if ( $ timeDefinition instanceof Time ) { // No converting needed! Return as it. $ refTime = $ timeDefinition ; return true ; } if ( $ timeDefinition instanceof DateTime ) { $ refTime = $ timeDefinition -> getTime ( ) ; return true ; } if ( $ timeDefinition instanceof \ DateTime ) { $ refTime = ( new DateTime ( $ timeDefinition ) ) -> getTime ( ) ; return true ; } if ( false !== ( $ dt = DateTime :: Parse ( $ timeDefinition ) ) ) { $ refTime = $ dt -> getTime ( ) ; return true ; } return false ; }
Tries to parse a time definition to a \Beluga\Time instance.

@param  mixed $timeDefinition The value to parse as Time. It can be a (date) time string, a unix timestamp, a
object of type \Beluga\DateTime or \DateTime or something that can be converted, by
a string cast, to a valid time string.
@param  Time  $refTime        Returns the new Time instance if the method returns TRUE
@return bool                  Returns if the parsing was successful.
Tries to parse a time definition to a \ Beluga \ Time instance .