issetOption() public method

public issetOption ( string $option ) : boolean
$option string
return boolean
Example #1
0
 public function testIssetOption()
 {
     $argv = array('./dbpatch.php', 'update', '--force');
     $console = new DbPatch_Core_Console($argv);
     $this->assertTrue($console->issetOption('force'));
     $this->assertFalse($console->issetOption('bogus'));
 }
Example #2
0
 /**
  * Create dump filename
  * @return string
  */
 protected function getDumpFilename()
 {
     $filename = null;
     $database = $this->config->db->params->dbname;
     if ($this->console->issetOption('file')) {
         $filename = $this->console->getOptionValue('file', null);
     }
     if (is_null($filename)) {
         $filename = $database . '_' . date('Ymd_His') . '.sql';
     }
     if (isset($this->config->dump_directory)) {
         $filename = $this->trimTrailingSlashes($this->config->dump_directory) . '/' . $filename;
     } else {
         $filename = './' . $filename;
     }
     return $filename;
 }
 /**
  * Create dump filename
  * @return string
  */
 protected function getDumpFilename()
 {
     $filename = null;
     $database = $this->config->db->params->dbname;
     if ($this->console->issetOption('file')) {
         $filename = $this->console->getOptionValue('file', null);
     }
     if (is_null($filename)) {
         $filename = $database . '_' . date('Ymd_Hi') . '.sql';
     }
     return $filename;
 }
Example #4
0
 /**
  * Create dump filename
  * @return string
  */
 protected function getDumpFilename()
 {
     $filename = null;
     $config = $this->getDb()->getAdapter()->getConfig();
     $database = $config['dbname'];
     if ($this->console->issetOption('file')) {
         $filename = $this->console->getOptionValue('file', null);
     }
     if (is_null($filename)) {
         // split by slash, database name can be a path (in case of SQLite)
         $parts = explode(DIRECTORY_SEPARATOR, $database);
         $filename = array_pop($parts) . '_' . date('Ymd_His') . '.sql';
     }
     if (isset($this->config->dump_directory)) {
         $filename = $this->trimTrailingSlashes($this->config->dump_directory) . '/' . $filename;
     } else {
         $filename = './' . $filename;
     }
     return $filename;
 }