original_string: public static function formatDate($format, $timestamp)
      {
          static $datesPatterns = null;
          static $timesPatterns = null;
  
          if ($datesPatterns === null || $timesPatterns === null) {
              $datesPatterns = "/\b(" . implode('|', array_keys(static::$_map['date'])) . ")\b(?![^']*'(?:(?:[^']*'){2})*[^']*$)/i";
              $timesPatterns = "/\b(" . implode('|', array_keys(static::$_map['time'])) . ")\b(?![^']*'(?:(?:[^']*'){2})*[^']*$)/i";
          }
  
          // normalize formats
          $result = preg_replace_callback($datesPatterns, function ($matches) use ($timestamp) {
              return date(static::$_map['date'][$matches[1]], $timestamp);
          }, trim($format));
  
          $result = preg_replace_callback($timesPatterns, function ($matches) use ($timestamp) {
              return date(static::$_map['time'][$matches[1]], $timestamp);
          }, $result);
  
          return str_replace('\'', '', $result);
      }
code: public static function formatDate($format, $timestamp)
      {
          static $datesPatterns = null;
          static $timesPatterns = null;
  
          if ($datesPatterns === null || $timesPatterns === null) {
              $datesPatterns = "/\b(" . implode('|', array_keys(static::$_map['date'])) . ")\b(?![^']*'(?:(?:[^']*'){2})*[^']*$)/i";
              $timesPatterns = "/\b(" . implode('|', array_keys(static::$_map['time'])) . ")\b(?![^']*'(?:(?:[^']*'){2})*[^']*$)/i";
          }
  
          // normalize formats
          $result = preg_replace_callback($datesPatterns, function ($matches) use ($timestamp) {
              return date(static::$_map['date'][$matches[1]], $timestamp);
          }, trim($format));
  
          $result = preg_replace_callback($timesPatterns, function ($matches) use ($timestamp) {
              return date(static::$_map['time'][$matches[1]], $timestamp);
          }, $result);
  
          return str_replace('\'', '', $result);
      }
code_tokens: public static function formatDate ( $ format , $ timestamp ) { static $ datesPatterns = null ; static $ timesPatterns = null ; if ( $ datesPatterns === null || $ timesPatterns === null ) { $ datesPatterns = "/\b(" . implode ( '|' , array_keys ( static :: $ _map [ 'date' ] ) ) . ")\b(?![^']*'(?:(?:[^']*'){2})*[^']*$)/i" ; $ timesPatterns = "/\b(" . implode ( '|' , array_keys ( static :: $ _map [ 'time' ] ) ) . ")\b(?![^']*'(?:(?:[^']*'){2})*[^']*$)/i" ; } // normalize formats $ result = preg_replace_callback ( $ datesPatterns , function ( $ matches ) use ( $ timestamp ) { return date ( static :: $ _map [ 'date' ] [ $ matches [ 1 ] ] , $ timestamp ) ; } , trim ( $ format ) ) ; $ result = preg_replace_callback ( $ timesPatterns , function ( $ matches ) use ( $ timestamp ) { return date ( static :: $ _map [ 'time' ] [ $ matches [ 1 ] ] , $ timestamp ) ; } , $ result ) ; return str_replace ( '\'' , '' , $ result ) ; }
docstring: Formats then given UNIX timestamp using the given jQuery format.
  
  @param string $format jQuery format. e.g. `'today is:' yy-mm-dd`
  @param int $timestamp Date as UNIX timestamp
  @return string Formated date. e.g. `today is: 2018-09-09`
docstring_tokens: Formats then given UNIX timestamp using the given jQuery format .