PhantomInstaller\Installer::getPhantomJsVersionFromBinary PHP Method

getPhantomJsVersionFromBinary() public method

Get PhantomJS application version. Equals running "phantomjs -v" on the CLI.
public getPhantomJsVersionFromBinary ( string $pathToBinary ) : string
$pathToBinary string
return string PhantomJS Version
    public function getPhantomJsVersionFromBinary($pathToBinary)
    {
        $io = $this->getIO();
        try {
            $cmd = escapeshellarg($pathToBinary) . ' -v';
            exec($cmd, $stdout);
            $version = $stdout[0];
            return $version;
        } catch (\Exception $e) {
            $io->warning("Caught exception while checking PhantomJS version:\n" . $e->getMessage());
            $io->notice('Re-downloading PhantomJS');
            return false;
        }
    }