original_string: public function addPrefix($table) {
          if (strpos($table, '`') !== false) {
              return $table;
          }
          preg_match('/([\w_\.]+)( (as )?[\w_]+)?/i', $table, $match);
          $table = count($match) == 2 ? $table : $match[1];
          $alias = '';
          if (count($match) > 2) {
              $alias = $match[2];
          }
          if (strpos($table, '.') !== false) {
              list($schema, $table) = explode('.', $table);
              return sprintf('`%s`.`%s`%s', $schema, $table, $alias);
          }
          if (strpos($table, '!') === 0) {
              return sprintf('`%s`%s', substr($table, 1), $alias);
          }
          $prefix = $this->getEngine()->getConfig('prefix');
          if (empty($prefix)) {
              return sprintf('`%s`%s', $table, $alias);
          }
          return sprintf('`%s`%s', $prefix.
              Str::firstReplace($table, $prefix), $alias);
      }
code: public function addPrefix($table) {
          if (strpos($table, '`') !== false) {
              return $table;
          }
          preg_match('/([\w_\.]+)( (as )?[\w_]+)?/i', $table, $match);
          $table = count($match) == 2 ? $table : $match[1];
          $alias = '';
          if (count($match) > 2) {
              $alias = $match[2];
          }
          if (strpos($table, '.') !== false) {
              list($schema, $table) = explode('.', $table);
              return sprintf('`%s`.`%s`%s', $schema, $table, $alias);
          }
          if (strpos($table, '!') === 0) {
              return sprintf('`%s`%s', substr($table, 1), $alias);
          }
          $prefix = $this->getEngine()->getConfig('prefix');
          if (empty($prefix)) {
              return sprintf('`%s`%s', $table, $alias);
          }
          return sprintf('`%s`%s', $prefix.
              Str::firstReplace($table, $prefix), $alias);
      }
code_tokens: public function addPrefix ( $ table ) { if ( strpos ( $ table , '`' ) !== false ) { return $ table ; } preg_match ( '/([\w_\.]+)( (as )?[\w_]+)?/i' , $ table , $ match ) ; $ table = count ( $ match ) == 2 ? $ table : $ match [ 1 ] ; $ alias = '' ; if ( count ( $ match ) > 2 ) { $ alias = $ match [ 2 ] ; } if ( strpos ( $ table , '.' ) !== false ) { list ( $ schema , $ table ) = explode ( '.' , $ table ) ; return sprintf ( '`%s`.`%s`%s' , $ schema , $ table , $ alias ) ; } if ( strpos ( $ table , '!' ) === 0 ) { return sprintf ( '`%s`%s' , substr ( $ table , 1 ) , $ alias ) ; } $ prefix = $ this -> getEngine ( ) -> getConfig ( 'prefix' ) ; if ( empty ( $ prefix ) ) { return sprintf ( '`%s`%s' , $ table , $ alias ) ; } return sprintf ( '`%s`%s' , $ prefix . Str :: firstReplace ( $ table , $ prefix ) , $ alias ) ; }
docstring: ADD TABLE PREFIX
  @param string $table
  @return string
  @throws \Exception
docstring_tokens: ADD TABLE PREFIX