protected function innerClose() { (new \Yasca\Core\IteratorBuilder())->from($this->pipes)->select(Operators::paramLimit('\\fclose', 1))->where(Operators::curry([Operators::_class, 'equals'], false))->toFunctionPipe()->pipe([Iterators::_class, 'count'])->pipe([Operators::_class, 'match'], [Operators::curry([Operators::_class, 'equals'], 0), Operators::identity(null)], [Operators::identity(true), static function ($failureCount) { throw new \Exception("Unable to close {$failuteCount} process pipes"); }]); if (\is_resource($this->process) === true) { \proc_close($this->process); } }
, \shell_exec('java -version 2>&1'), $matches )){ return \intval($matches['version']); } else { return 0; } }); static::$isWindows = Operators::lazy(static function(){ return (new \Yasca\Core\FunctionPipe) ->wrap(PHP_OS) ->pipe('\substr', 0, \strlen('win')) ->pipe('\strcasecmp', 'win') ->pipe([Operators::_class, 'equals'], 0) ->unwrap(); }); //TODO: Update with more values where PHP_OS !== 'Linux', but are Linux systems static::$isLinux = Operators::identity(PHP_OS === 'Linux'); static::$isLinuxWithWine = Operators::lazy(static function(){ return static::isLinux() && !preg_match('/no wine in/', \shell_exec('which wine')); }); }, null, __NAMESPACE__ . '\\' . \basename(__FILE__, '.php') )->__invoke();