-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Showing
19 changed files
with
255 additions
and
173 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 |
---|---|---|
@@ -1,55 +1,24 @@ | ||
<?php | ||
namespace PharIo\Phive; | ||
|
||
use PharIo\Phive\Cli\Context; | ||
use PharIo\Phive\Cli\Options; | ||
use PharIo\Phive\Cli\GeneralContext; | ||
|
||
class PhiveContext implements Context { | ||
class PhiveContext extends GeneralContext { | ||
|
||
/** | ||
* @var Options | ||
*/ | ||
private $options; | ||
|
||
/** | ||
* PhiveContext constructor. | ||
*/ | ||
public function __construct() { | ||
$this->options = new Options(); | ||
} | ||
|
||
/** | ||
* @return Options | ||
*/ | ||
public function getOptions() { | ||
return $this->options; | ||
} | ||
|
||
public function knowsOption($option) { | ||
return false; | ||
protected function getKnownOptions() { | ||
return ['home']; | ||
} | ||
|
||
public function requiresValue($option) { | ||
return false; | ||
} | ||
|
||
public function getOptionForChar($char) { | ||
return $option === 'home'; | ||
} | ||
|
||
public function acceptsArguments() { | ||
return $this->options->getArgumentCount() === 0; | ||
return $this->getOptions()->getArgumentCount() === 0; | ||
} | ||
|
||
public function canContinue() { | ||
return $this->options->getArgumentCount() === 0; | ||
} | ||
|
||
public function addArgument($arg) { | ||
$this->options->addArgument($arg); | ||
} | ||
|
||
public function setOption($option, $value) { | ||
$this->options->setOption($option, $value); | ||
return $this->acceptsArguments(); | ||
} | ||
|
||
} |
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,8 @@ | ||
<?php | ||
namespace PharIo\Phive; | ||
|
||
use PharIo\Phive\Cli\GeneralContext; | ||
|
||
class ComposerContext extends GeneralContext { | ||
|
||
} |
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 |
---|---|---|
@@ -1,53 +1,21 @@ | ||
<?php | ||
namespace PharIo\Phive; | ||
|
||
use PharIo\Phive\Cli\Context; | ||
use PharIo\Phive\Cli\Options; | ||
use PharIo\Phive\Cli\GeneralContext; | ||
|
||
class InstallContext implements Context { | ||
class InstallContext extends GeneralContext { | ||
|
||
/** | ||
* @var Options | ||
*/ | ||
private $options; | ||
|
||
/** | ||
* InstallContext constructor. | ||
*/ | ||
public function __construct() { | ||
$this->options = new Options(); | ||
} | ||
|
||
public function canContinue() { | ||
return true; | ||
} | ||
|
||
public function knowsOption($option) { | ||
return false; | ||
protected function getKnownOptions() { | ||
return [ | ||
'target' => 't', | ||
'copy' => 'c', | ||
'global' => 'g', | ||
'temporary' => false | ||
]; | ||
} | ||
|
||
public function requiresValue($option) { | ||
// TODO: Implement requiresValue() method. | ||
return false; | ||
} | ||
|
||
public function getOptionForChar($char) { | ||
return null; | ||
} | ||
|
||
public function acceptsArguments() { | ||
return true; | ||
} | ||
|
||
public function addArgument($arg) { | ||
$this->options->addArgument($arg); | ||
} | ||
|
||
public function setOption($option, $value) { | ||
} | ||
|
||
public function getOptions() { | ||
return $this->options; | ||
return $option === 'target'; | ||
} | ||
|
||
} |
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,8 @@ | ||
<?php | ||
namespace PharIo\Phive; | ||
|
||
use PharIo\Phive\Cli\GeneralContext; | ||
|
||
class PurgeContext extends GeneralContext { | ||
|
||
} |
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,7 @@ | ||
<?php | ||
namespace PharIo\Phive; | ||
|
||
use PharIo\Phive\Cli\GeneralContext; | ||
|
||
class RemoveContext extends GeneralContext { | ||
} |
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,8 @@ | ||
<?php | ||
namespace PharIo\Phive; | ||
|
||
use PharIo\Phive\Cli\GeneralContext; | ||
|
||
class ResetContext extends GeneralContext { | ||
|
||
} |
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,8 @@ | ||
<?php | ||
namespace PharIo\Phive; | ||
|
||
use PharIo\Phive\Cli\GeneralContext; | ||
|
||
class SkelContext extends GeneralContext { | ||
|
||
} |
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,8 @@ | ||
<?php | ||
namespace PharIo\Phive; | ||
|
||
use PharIo\Phive\Cli\GeneralContext; | ||
|
||
class UpdateContext extends GeneralContext { | ||
|
||
} |
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,8 @@ | ||
<?php | ||
namespace PharIo\Phive\Cli; | ||
|
||
use PharIo\Phive\Exception; | ||
|
||
class ContextException extends \Exception implements Exception { | ||
|
||
} |
Oops, something went wrong.