original_string: protected function datesFromAjax($ajaxDates)
      {
          $dates = [];
          $dateRegex = '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/';
  
          if (null !== $ajaxDates) {
              if (!is_array($ajaxDates)) {
                  if(preg_match($dateRegex, $ajaxDates)) {
                      $dates = [$ajaxDates];
                  }
              } else {
                  foreach ($ajaxDates as $i => $date) {
                      if (preg_match($dateRegex, $date)) {
                          $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', $date);
                      } elseif (empty($date)) {
                          if($i == 0) {
                              $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', '0000-00-00 00:00:00');
                          } else {
                              $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', '2999-12-31 23:59:59');
                          }
                      } else {
                          $dates = [];
                          break;
                      }
                  }
              }
          }
          return $dates;
      }
code: protected function datesFromAjax($ajaxDates)
      {
          $dates = [];
          $dateRegex = '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/';
  
          if (null !== $ajaxDates) {
              if (!is_array($ajaxDates)) {
                  if(preg_match($dateRegex, $ajaxDates)) {
                      $dates = [$ajaxDates];
                  }
              } else {
                  foreach ($ajaxDates as $i => $date) {
                      if (preg_match($dateRegex, $date)) {
                          $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', $date);
                      } elseif (empty($date)) {
                          if($i == 0) {
                              $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', '0000-00-00 00:00:00');
                          } else {
                              $dates[] = Carbon::createFromFormat('Y-m-d H:i:s', '2999-12-31 23:59:59');
                          }
                      } else {
                          $dates = [];
                          break;
                      }
                  }
              }
          }
          return $dates;
      }
code_tokens: protected function datesFromAjax ( $ ajaxDates ) { $ dates = [ ] ; $ dateRegex = '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/' ; if ( null !== $ ajaxDates ) { if ( ! is_array ( $ ajaxDates ) ) { if ( preg_match ( $ dateRegex , $ ajaxDates ) ) { $ dates = [ $ ajaxDates ] ; } } else { foreach ( $ ajaxDates as $ i => $ date ) { if ( preg_match ( $ dateRegex , $ date ) ) { $ dates [ ] = Carbon :: createFromFormat ( 'Y-m-d H:i:s' , $ date ) ; } elseif ( empty ( $ date ) ) { if ( $ i == 0 ) { $ dates [ ] = Carbon :: createFromFormat ( 'Y-m-d H:i:s' , '0000-00-00 00:00:00' ) ; } else { $ dates [ ] = Carbon :: createFromFormat ( 'Y-m-d H:i:s' , '2999-12-31 23:59:59' ) ; } } else { $ dates = [ ] ; break ; } } } } return $ dates ; }
docstring: Convert an array from the posted dates
  
  @param  array $dates
  
  @return array
docstring_tokens: Convert an array from the posted dates