-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aude
committed
Apr 8, 2016
1 parent
523ca6a
commit ebb47ce
Showing
2 changed files
with
72 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Wikibase\Import\Console; | ||
|
||
use Maintenance; | ||
|
||
class ImportOptions { | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $options; | ||
|
||
/** | ||
* @param array $options | ||
*/ | ||
public function __construct( array $options ) { | ||
$this->options = $options; | ||
} | ||
|
||
public function setOption( $key, $value ) { | ||
$this->options[$key] = $value; | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* | ||
* @return bool | ||
*/ | ||
public function hasOption( $name ) { | ||
return isset( $this->options[$name] ); | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* | ||
* @return mixed | ||
*/ | ||
public function getOption( $name ) { | ||
if ( !$this->hasOption( $name ) ) { | ||
throw new \OutOfBoundsException( "Unknown option: $name" ); | ||
} | ||
|
||
return $this->options[$name]; | ||
} | ||
|
||
} |