-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from aynsix/PHRAS-2331-zippy-php7-1
PHRAS-2331 Check Zippy, PHP 7.1 compliance
- Loading branch information
Showing
14 changed files
with
265 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ php: | |
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
|
||
env: | ||
PREFER_LOWEST="" | ||
|
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
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,87 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Zippy. | ||
* | ||
* (c) Alchemy <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Alchemy\Zippy\ProcessBuilder; | ||
|
||
use Symfony\Component\Process\Process; | ||
|
||
class ProcessBuilder implements ProcessBuilderInterface | ||
{ | ||
/** | ||
* The command to run and its arguments listed as separate entries | ||
* | ||
* @var array | ||
*/ | ||
private $command; | ||
|
||
/** | ||
* The working directory or null to use the working dir of the current PHP process | ||
* | ||
* @var string|null | ||
*/ | ||
private $cwd; | ||
|
||
/** | ||
* ProcessBuilder constructor. | ||
* @param array $command | ||
*/ | ||
public function __construct($command) | ||
{ | ||
$this->command = $command; | ||
$this->cwd = null; | ||
} | ||
|
||
/** | ||
* Creates a Process instance and returns it | ||
* | ||
* @return Process | ||
*/ | ||
public function getProcess() | ||
{ | ||
$process = new Process($this->command, $this->cwd); | ||
$process->setTimeout(null); | ||
|
||
return $process; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function add($argument) | ||
{ | ||
$this->command = array_merge($this->command, array($argument)); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function setWorkingDirectory($directory) | ||
{ | ||
$this->cwd = $directory; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* The command to run or a binary path and its arguments listed as separate entries | ||
* | ||
* @param array $command | ||
* | ||
* @return static | ||
*/ | ||
public static function create(array $command) | ||
{ | ||
return new static($command); | ||
} | ||
|
||
} |
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
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,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Zippy. | ||
* | ||
* (c) Alchemy <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Alchemy\Zippy\ProcessBuilder; | ||
|
||
use Symfony\Component\Process\Process; | ||
|
||
interface ProcessBuilderInterface | ||
{ | ||
/** | ||
* Creates a Process instance and returns it | ||
* | ||
* @return Process | ||
*/ | ||
public function getProcess(); | ||
|
||
/** | ||
* Adds an argument to the command string | ||
* | ||
* @param string $argument | ||
* | ||
* @return ProcessBuilder | ||
*/ | ||
public function add($argument); | ||
|
||
/** | ||
* Sets the working directory | ||
* | ||
* @param string $directory | ||
* | ||
* @return ProcessBuilder | ||
*/ | ||
public function setWorkingDirectory($directory); | ||
} |
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
Oops, something went wrong.