/**
  * @param       $config
  * @param array $options
  *
  * @return MWP_Backup_MysqlDump_MysqlDump
  * @throws InvalidArgumentException
  */
 public static function make($config, array $options = array(), MWP_Backup_Writer_WriterInterface $writer = null)
 {
     // Determine which dumping strategy is to be used
     // Check if user is trying to force a particular method
     $forcedMethod = MWP_Backup_ArrayHelper::getKey($options, 'force_method');
     if ($forcedMethod) {
         switch ($forcedMethod) {
             case 'mysqldump':
                 $strategy = new MWP_Backup_MysqlDump_ShellDump($config, $options, $writer);
                 break;
             case 'sequential':
                 $strategy = new MWP_Backup_MysqlDump_QuerySequenceDump($config, $options, $writer);
                 break;
             default:
                 throw new InvalidArgumentException('Trying to force a non existing backup method');
                 break;
         }
     } else {
         // Not forced, choose the best method
         $strategy = new MWP_Backup_MysqlDump_ShellDump($config, $options, $writer);
         if ($config instanceof PDO || !self::isShellExecAvailable() || !$strategy->isMysqldumpAvailable()) {
             $strategy = new MWP_Backup_MysqlDump_QuerySequenceDump($config, $options, $writer);
         }
     }
     return $strategy;
 }
 /**
  * Creates the database dump at a given path
  *
  * @param       $config
  * @param array $options
  *
  * @return MWP_Backup_MysqlDump_MysqlDump
  */
 public static function dump($config, array $options = array())
 {
     @set_time_limit(0);
     $writer = MWP_Backup_Writer_WriterFactory::make(MWP_Backup_ArrayHelper::getKey($options, 'save_path'), MWP_Backup_ArrayHelper::getKey($options, 'compression_method'));
     $dumper = MWP_Backup_MysqlDump_DumpFactory::make($config, $options, $writer);
     $dumper->dumpToFile();
 }