for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?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 Alchemy\Zippy\Exception\InvalidArgumentException;
class ProcessBuilderFactory implements ProcessBuilderFactoryInterface
{
/**
* The binary path
* @var string
protected $binary;
* Constructor
* @param string $binary The path to the binary
* @throws InvalidArgumentException In case binary path is invalid
public function __construct($binary)
$this->useBinary($binary);
}
* @inheritdoc
public function getBinary()
return $this->binary;
public function useBinary($binary)
if ('\\' !== DIRECTORY_SEPARATOR && !is_executable($binary)) {
throw new InvalidArgumentException(sprintf('`%s` is not an executable binary', $binary));
$this->binary = $binary;
return $this;
public function create()
if (null === $this->binary) {
throw new InvalidArgumentException('No binary set');
return ProcessBuilder::create(array($this->binary));