/** * Open a new string buffer. * * @param string $streamName Stream name. * @return void * @throws \Hoa\Stream\Exception */ public function __construct($streamName = null) { if (null === $streamName) { $streamName = 'hoa://Library/Stringbuffer#' . self::$_i++; } parent::__construct($streamName, null); return; }
/** * Connect. * * @return \Hoa\Socket\Connection */ public function connect() { parent::__construct($this->getSocket()->__toString(), $this->getContext()); $this->_disconnect = false; return $this; }
/** * Start a processus. * * @access public * @param string $command Command name. * @param array $options Command options. * @param array $descriptors Descriptors (descriptor => mode —r, w or * a—). * @param string $cwd Current working directory. * @param array $environment Environment. * @return void * @throw \Hoa\Console\Exception */ public function __construct($command, array $options = null, array $descriptors = null, $cwd = null, array $environment = null, $timeout = 30) { $this->setCommand($command); if (null !== $options) { $this->setOptions($options); } if (null !== $descriptors) { $this->_descriptors = array(); foreach ($descriptors as $descriptor => $nature) { if (isset($this->_descriptors[$descriptor])) { throw new Exception('Pipe descriptor %d already exists, cannot ' . 'redefine it.', 0, $descriptor); } $this->_descriptors[$descriptor] = $nature; } } $this->setCwd($cwd ?: getcwd()); if (null !== $environment) { $this->setEnvironment($environment); } $this->setTimeout($timeout); parent::__construct($this->getCommandLine(), null, true); $this->_on->addIds(array('input', 'output', 'timeout', 'start', 'stop')); return; }