original_string: public static function makeCarbon($value, $throwException = true)
      {
          if ($value instanceof Carbon) {
              // Do nothing
          }
          elseif ($value instanceof PhpDateTime) {
              $value = Carbon::instance($value);
          }
          elseif (is_numeric($value)) {
              $value = Carbon::createFromTimestamp($value);
          }
          elseif (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $value)) {
              $value = Carbon::createFromFormat('Y-m-d', $value)->startOfDay();
          }
          else {
              try {
                  $value = Carbon::parse($value);
              } catch (Exception $ex) {}
          }
  
          if (!$value instanceof Carbon && $throwException) {
              throw new InvalidArgumentException('Invalid date value supplied to DateTime helper.');
          }
  
          return $value;
      }
code: public static function makeCarbon($value, $throwException = true)
      {
          if ($value instanceof Carbon) {
              // Do nothing
          }
          elseif ($value instanceof PhpDateTime) {
              $value = Carbon::instance($value);
          }
          elseif (is_numeric($value)) {
              $value = Carbon::createFromTimestamp($value);
          }
          elseif (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $value)) {
              $value = Carbon::createFromFormat('Y-m-d', $value)->startOfDay();
          }
          else {
              try {
                  $value = Carbon::parse($value);
              } catch (Exception $ex) {}
          }
  
          if (!$value instanceof Carbon && $throwException) {
              throw new InvalidArgumentException('Invalid date value supplied to DateTime helper.');
          }
  
          return $value;
      }
code_tokens: public static function makeCarbon ( $ value , $ throwException = true ) { if ( $ value instanceof Carbon ) { // Do nothing } elseif ( $ value instanceof PhpDateTime ) { $ value = Carbon :: instance ( $ value ) ; } elseif ( is_numeric ( $ value ) ) { $ value = Carbon :: createFromTimestamp ( $ value ) ; } elseif ( preg_match ( '/^(\d{4})-(\d{2})-(\d{2})$/' , $ value ) ) { $ value = Carbon :: createFromFormat ( 'Y-m-d' , $ value ) -> startOfDay ( ) ; } else { try { $ value = Carbon :: parse ( $ value ) ; } catch ( Exception $ ex ) { } } if ( ! $ value instanceof Carbon && $ throwException ) { throw new InvalidArgumentException ( 'Invalid date value supplied to DateTime helper.' ) ; } return $ value ; }
docstring: Converts mixed inputs to a Carbon object.
  
  @return Carbon\Carbon
docstring_tokens: Converts mixed inputs to a Carbon object .