original_string: protected function getPlugin($plugin)
      {
          $path = $this->plugin->getPublicDirectory() . '/plugins/' . $plugin;
          
          if (file_exists($path) && is_dir($path)) {
              $files = scandir($path);
              
              foreach ($files as $file) {
                  $pattern = defined('HHVM_VERSION') ? '/\.(php|hh)$/' : '/\.php$/';
                  
                  if (preg_match($pattern, $file)) {
                      $content = file_get_contents($path . '/' . $file);
                      
                      if (preg_match('/\/\*(?!.*\*\/.*Plugin Name).*Plugin Name/si', $content)) {
                          return $plugin . '/' . $file;
                      }
                  }
              }
          }
          
          if (file_exists($path . '.php')) {
              return $plugin . '.php';
          }
          
          if (defined('HHVM_VERSION') && file_exists($path . '.hh')) {
              return $plugin . '.hh';
          }
          
          return false;
      }
code: protected function getPlugin($plugin)
      {
          $path = $this->plugin->getPublicDirectory() . '/plugins/' . $plugin;
          
          if (file_exists($path) && is_dir($path)) {
              $files = scandir($path);
              
              foreach ($files as $file) {
                  $pattern = defined('HHVM_VERSION') ? '/\.(php|hh)$/' : '/\.php$/';
                  
                  if (preg_match($pattern, $file)) {
                      $content = file_get_contents($path . '/' . $file);
                      
                      if (preg_match('/\/\*(?!.*\*\/.*Plugin Name).*Plugin Name/si', $content)) {
                          return $plugin . '/' . $file;
                      }
                  }
              }
          }
          
          if (file_exists($path . '.php')) {
              return $plugin . '.php';
          }
          
          if (defined('HHVM_VERSION') && file_exists($path . '.hh')) {
              return $plugin . '.hh';
          }
          
          return false;
      }
code_tokens: protected function getPlugin ( $ plugin ) { $ path = $ this -> plugin -> getPublicDirectory ( ) . '/plugins/' . $ plugin ; if ( file_exists ( $ path ) && is_dir ( $ path ) ) { $ files = scandir ( $ path ) ; foreach ( $ files as $ file ) { $ pattern = defined ( 'HHVM_VERSION' ) ? '/\.(php|hh)$/' : '/\.php$/' ; if ( preg_match ( $ pattern , $ file ) ) { $ content = file_get_contents ( $ path . '/' . $ file ) ; if ( preg_match ( '/\/\*(?!.*\*\/.*Plugin Name).*Plugin Name/si' , $ content ) ) { return $ plugin . '/' . $ file ; } } } } if ( file_exists ( $ path . '.php' ) ) { return $ plugin . '.php' ; } if ( defined ( 'HHVM_VERSION' ) && file_exists ( $ path . '.hh' ) ) { return $ plugin . '.hh' ; } return false ; }
docstring: Get the main plugin file for a plugin.
  
  @param  string  $plugin
  @return string|false
docstring_tokens: Get the main plugin file for a plugin .