original_string: private function getDatesToInvalidateFromString($dates)
      {
          $toInvalidate = array();
          $invalidDates = array();
  
          $dates = explode(',', trim($dates));
          $dates = array_unique($dates);
  
          foreach ($dates as $theDate) {
              $theDate = trim($theDate);
              try {
                  $date = Date::factory($theDate);
              } catch (\Exception $e) {
                  $invalidDates[] = $theDate;
                  continue;
              }
  
              if ($date->toString() == $theDate) {
                  $toInvalidate[] = $date;
              } else {
                  $invalidDates[] = $theDate;
              }
          }
  
          return array($toInvalidate, $invalidDates);
      }
code: private function getDatesToInvalidateFromString($dates)
      {
          $toInvalidate = array();
          $invalidDates = array();
  
          $dates = explode(',', trim($dates));
          $dates = array_unique($dates);
  
          foreach ($dates as $theDate) {
              $theDate = trim($theDate);
              try {
                  $date = Date::factory($theDate);
              } catch (\Exception $e) {
                  $invalidDates[] = $theDate;
                  continue;
              }
  
              if ($date->toString() == $theDate) {
                  $toInvalidate[] = $date;
              } else {
                  $invalidDates[] = $theDate;
              }
          }
  
          return array($toInvalidate, $invalidDates);
      }
code_tokens: private function getDatesToInvalidateFromString ( $ dates ) { $ toInvalidate = array ( ) ; $ invalidDates = array ( ) ; $ dates = explode ( ',' , trim ( $ dates ) ) ; $ dates = array_unique ( $ dates ) ; foreach ( $ dates as $ theDate ) { $ theDate = trim ( $ theDate ) ; try { $ date = Date :: factory ( $ theDate ) ; } catch ( \ Exception $ e ) { $ invalidDates [ ] = $ theDate ; continue ; } if ( $ date -> toString ( ) == $ theDate ) { $ toInvalidate [ ] = $ date ; } else { $ invalidDates [ ] = $ theDate ; } } return array ( $ toInvalidate , $ invalidDates ) ; }
docstring: Ensure the specified dates are valid.
  Store invalid date so we can log them
  @param array $dates
  @return Date[]
docstring_tokens: Ensure the specified dates are valid . Store invalid date so we can log them