original_string: private static function loadInstaller($installer_file_folder, $is_install)
      {
          $installer = null;
  
          $installer_file_folder = rtrim($installer_file_folder, DS);
  
          $install_file = $installer_file_folder . DS . 'install.php';
  
          if (file_exists($install_file)) {
              require_once $install_file;
          } else {
              return null;
          }
  
          if ($is_install) {
              $slug = '';
              if (($pos = strpos($installer_file_folder, 'grav-plugin-')) !== false) {
                  $slug = substr($installer_file_folder, $pos + strlen('grav-plugin-'));
              } elseif (($pos = strpos($installer_file_folder, 'grav-theme-')) !== false) {
                  $slug = substr($installer_file_folder, $pos + strlen('grav-theme-'));
              }
          } else {
              $path_elements = explode('/', $installer_file_folder);
              $slug = end($path_elements);
          }
  
          if (!$slug) {
              return null;
          }
  
          $class_name = ucfirst($slug) . 'Install';
  
          if (class_exists($class_name)) {
              return $class_name;
          }
  
          $class_name_alphanumeric = preg_replace('/[^a-zA-Z0-9]+/', '', $class_name);
  
          if (class_exists($class_name_alphanumeric)) {
              return $class_name_alphanumeric;
          }
  
          return $installer;
      }
code: private static function loadInstaller($installer_file_folder, $is_install)
      {
          $installer = null;
  
          $installer_file_folder = rtrim($installer_file_folder, DS);
  
          $install_file = $installer_file_folder . DS . 'install.php';
  
          if (file_exists($install_file)) {
              require_once $install_file;
          } else {
              return null;
          }
  
          if ($is_install) {
              $slug = '';
              if (($pos = strpos($installer_file_folder, 'grav-plugin-')) !== false) {
                  $slug = substr($installer_file_folder, $pos + strlen('grav-plugin-'));
              } elseif (($pos = strpos($installer_file_folder, 'grav-theme-')) !== false) {
                  $slug = substr($installer_file_folder, $pos + strlen('grav-theme-'));
              }
          } else {
              $path_elements = explode('/', $installer_file_folder);
              $slug = end($path_elements);
          }
  
          if (!$slug) {
              return null;
          }
  
          $class_name = ucfirst($slug) . 'Install';
  
          if (class_exists($class_name)) {
              return $class_name;
          }
  
          $class_name_alphanumeric = preg_replace('/[^a-zA-Z0-9]+/', '', $class_name);
  
          if (class_exists($class_name_alphanumeric)) {
              return $class_name_alphanumeric;
          }
  
          return $installer;
      }
code_tokens: private static function loadInstaller ( $ installer_file_folder , $ is_install ) { $ installer = null ; $ installer_file_folder = rtrim ( $ installer_file_folder , DS ) ; $ install_file = $ installer_file_folder . DS . 'install.php' ; if ( file_exists ( $ install_file ) ) { require_once $ install_file ; } else { return null ; } if ( $ is_install ) { $ slug = '' ; if ( ( $ pos = strpos ( $ installer_file_folder , 'grav-plugin-' ) ) !== false ) { $ slug = substr ( $ installer_file_folder , $ pos + strlen ( 'grav-plugin-' ) ) ; } elseif ( ( $ pos = strpos ( $ installer_file_folder , 'grav-theme-' ) ) !== false ) { $ slug = substr ( $ installer_file_folder , $ pos + strlen ( 'grav-theme-' ) ) ; } } else { $ path_elements = explode ( '/' , $ installer_file_folder ) ; $ slug = end ( $ path_elements ) ; } if ( ! $ slug ) { return null ; } $ class_name = ucfirst ( $ slug ) . 'Install' ; if ( class_exists ( $ class_name ) ) { return $ class_name ; } $ class_name_alphanumeric = preg_replace ( '/[^a-zA-Z0-9]+/' , '' , $ class_name ) ; if ( class_exists ( $ class_name_alphanumeric ) ) { return $ class_name_alphanumeric ; } return $ installer ; }
docstring: Instantiates and returns the package installer class
  
  @param string $installer_file_folder The folder path that contains install.php
  @param bool $is_install True if install, false if removal
  
  @return null|string
docstring_tokens: Instantiates and returns the package installer class