| 1 | <?php | ||
| 16 | class ResetCommand extends BaseCommand | ||
| 17 | { | ||
| 18 | const GIT_RESET_COMMAND = 'reset'; | ||
| 19 | |||
| 20 | const OPTION_HARD = '--hard'; | ||
| 21 | const OPTION_MERGE = '--merge'; | ||
| 22 | const OPTION_SOFT = '--soft'; | ||
| 23 | |||
| 24 | /** | ||
| 25 | * constructor | ||
| 26 | * | ||
| 27 | * @param \GitElephant\Repository $repo The repository object this command | ||
| 28 | * will interact with | ||
| 29 | */ | ||
| 30 | 3 | public function __construct(Repository $repo = null) | |
| 34 | |||
| 35 | /** | ||
| 36 | * @param TreeishInterface|Commit|string $arg | ||
| 37 | * @param array $options | ||
| 38 | * | ||
| 39 | * @throws \RuntimeException | ||
| 40 | * @return string | ||
| 41 | */ | ||
| 42 | 3 | public function reset($arg = null, array $options = array()) | |
| 43 |     { | ||
| 44 | 3 | $this->clearAll(); | |
| 45 | 3 | $this->addCommandName(self::GIT_RESET_COMMAND); | |
| 46 | // if there are options add them. | ||
| 47 | 3 |         if (! is_null($options)) { | |
| 48 | 3 |             foreach ($options as $option) { | |
| 49 | 3 | $this->addCommandArgument($option); | |
| 50 | } | ||
| 51 | } | ||
| 52 | 3 |         if($arg!=null){ | |
| 53 | 3 | $this->addCommandSubject2($arg); | |
| 54 | } | ||
| 55 | |||
| 56 | 3 | return $this->getCommand(); | |
| 57 | } | ||
| 58 | |||
| 59 | /** | ||
| 60 | * @param Repository $repository | ||
| 61 | * @return ResetCommand | ||
| 62 | */ | ||
| 63 | 3 | public static function getInstance(Repository $repository=null) | |
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | } | ||
| 71 |