src/bbn/time.php
public function compare($date, $comparator)
  {
    //check if the argument $date is an instance of this class
    if ( $date instanceof $this){
      $tmp = $date;
    }
    else {
      $tmp = new \bbn\time($date);
    }
    switch ( $comparator ){
      case $comparator === '>':  
        return $this->get_time() > $tmp->get_time(); 
        break;
      case $comparator === '>=':  
        return $this->get_time() >= $tmp->get_time(); 
        break;
      case $comparator === '<':  
        return $this->get_time() < $tmp->get_time(); 
        break;
      case $comparator === '<=':  
        return $this->get_time() <= $tmp->get_time(); 
        break;
      case $comparator === '=':  
        return $this->get_time() == $tmp->get_time(); 
        break;
    }
  }
public function compare($date, $comparator)
  {
    //check if the argument $date is an instance of this class
    if ( $date instanceof $this){
      $tmp = $date;
    }
    else {
      $tmp = new \bbn\time($date);
    }
    switch ( $comparator ){
      case $comparator === '>':  
        return $this->get_time() > $tmp->get_time(); 
        break;
      case $comparator === '>=':  
        return $this->get_time() >= $tmp->get_time(); 
        break;
      case $comparator === '<':  
        return $this->get_time() < $tmp->get_time(); 
        break;
      case $comparator === '<=':  
        return $this->get_time() <= $tmp->get_time(); 
        break;
      case $comparator === '=':  
        return $this->get_time() == $tmp->get_time(); 
        break;
    }
  }
public function compare ( $ date , $ comparator ) { //check if the argument $date is an instance of this class if ( $ date instanceof $ this ) { $ tmp = $ date ; } else { $ tmp = new \ bbn \ time ( $ date ) ; } switch ( $ comparator ) { case $ comparator === '>' : return $ this -> get_time ( ) > $ tmp -> get_time ( ) ; break ; case $ comparator === '>=' : return $ this -> get_time ( ) >= $ tmp -> get_time ( ) ; break ; case $ comparator === '<' : return $ this -> get_time ( ) < $ tmp -> get_time ( ) ; break ; case $ comparator === '<=' : return $ this -> get_time ( ) <= $ tmp -> get_time ( ) ; break ; case $ comparator === '=' : return $ this -> get_time ( ) == $ tmp -> get_time ( ) ; break ; } }
Compares two dates

@param [String|Object] $date the string of the date to compare or an object of this class
@param [String] $comparator allowed comparators '>','>=', '<','<=', '='
@return Boolean
Compares two dates