Skip to content

Commit

Permalink
Merge pull request #1 from sobolevna/master
Browse files Browse the repository at this point in the history
Немного блоков документации для среды разработки
  • Loading branch information
dracony authored Dec 4, 2016
2 parents 64213cc + 106b81f commit 206bb70
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/PHPixie/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public function __construct($contextContainer = null)
$this->builder = $this->buildBuilder($contextContainer);
}

/**
*
* @return \PHPixie\CLI\Context\SAPI
*/
public function context()
{
return $this->builder->context();
Expand All @@ -24,6 +28,11 @@ public function buildSapiContext()
return $this->builder->buildSapiContext();
}

/**
*
* @param type $contextContainer
* @return \PHPixie\CLI\Builder
*/
protected function buildBuilder($contextContainer)
{
return new CLI\Builder($contextContainer);
Expand Down
31 changes: 31 additions & 0 deletions src/PHPixie/CLI/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,50 @@

class Builder
{
/**
*
* @var \PHPixie\CLI\Context\Container\Implementation
*/
protected $contextContainer;

public function __construct($contextContainer = null)
{
$this->contextContainer = $contextContainer;
}

/**
*
* @param string $resource
* @return \PHPixie\CLI\Stream\Input
*/
public function inputStream($resource)
{
return new Stream\Input($resource);
}

/**
*
* @param string $resource
* @return \PHPixie\CLI\Stream\Output
*/
public function outputStream($resource)
{
return new Stream\Output($resource);
}

/**
*
* @return \PHPixie\CLI\Context\SAPI
*/
public function context()
{
return $this->contextContainer()->cliContext();
}

/**
*
* @return \PHPixie\CLI\Context\Container\Implementation
*/
public function contextContainer()
{
if($this->contextContainer === null) {
Expand All @@ -36,11 +58,20 @@ public function contextContainer()
return $this->contextContainer;
}

/**
*
* @param \PHPixie\CLI\Context\SAPI $context
* @return \PHPixie\CLI\Context\Container\Implementation
*/
public function buildContextContainer($context)
{
return new \PHPixie\CLI\Context\Container\Implementation($context);
}

/**
*
* @return \PHPixie\CLI\Context\SAPI
*/
public function buildSapiContext()
{
return new Context\SAPI($this);
Expand Down
14 changes: 13 additions & 1 deletion src/PHPixie/CLI/Context/Container/Implementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@

class Implementation implements \PHPixie\CLI\Context\Container
{
/**
*
* @var \PHPixie\CLI\Context\SAPI
*/
protected $cliContext;


/**
*
* @param \PHPixie\CLI\Context\SAPI $cliContext
*/
public function __construct($cliContext)
{
$this->cliContext = $cliContext;
}

/**
*
* @return \PHPixie\CLI\Context\SAPI
*/
public function cliContext()
{
return $this->cliContext;
Expand Down
20 changes: 20 additions & 0 deletions src/PHPixie/CLI/Context/SAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

class SAPI implements \PHPixie\CLI\Context
{
/**
*
* @var \PHPixie\CLI\Builder
*/
protected $builder;

protected $inputStream;
Expand All @@ -17,11 +21,19 @@ class SAPI implements \PHPixie\CLI\Context

protected $exitCode;

/**
*
* @param \PHPixie\CLI\Builder $builder
*/
public function __construct($builder)
{
$this->builder = $builder;
}

/**
*
* @return \PHPixie\CLI\Stream\Input
*/
public function inputStream()
{
if($this->inputStream === null) {
Expand All @@ -31,6 +43,10 @@ public function inputStream()
return $this->inputStream;
}

/**
*
* @return \PHPixie\CLI\Stream\Output
*/
public function outputStream()
{
if($this->outputStream === null) {
Expand All @@ -40,6 +56,10 @@ public function outputStream()
return $this->outputStream;
}

/**
*
* @return \PHPixie\CLI\Stream\Output
*/
public function errorStream()
{
if($this->errorStream === null) {
Expand Down

0 comments on commit 206bb70

Please sign in to comment.