PhantomInstaller\Installer::__invoke PHP Method

__invoke() public method

public __invoke ( )
    public function __invoke()
    {
        $version = $this->getVersion();
        $config = $this->getComposer()->getConfig();
        $binDir = $config->get('bin-dir');
        // the installation folder depends on the vendor-dir (default prefix is './vendor')
        $targetDir = $config->get('vendor-dir') . static::PHANTOMJS_TARGETDIR;
        $io = $this->getIO();
        // do not install a lower or equal version
        $phantomJsBinary = $this->getPhantomJsBinary($binDir);
        if ($phantomJsBinary) {
            $installedVersion = $this->getPhantomJsVersionFromBinary($phantomJsBinary);
            if (version_compare($version, $installedVersion) !== 1) {
                $io->write('   - PhantomJS v' . $installedVersion . ' is already installed. Skipping the installation.');
                return;
            }
        }
        // Download the Archive
        if ($this->download($targetDir, $version)) {
            // Copy only the PhantomJS binary from the installation "target dir" to the "bin" folder
            $this->copyPhantomJsBinaryToBinFolder($targetDir, $binDir);
        }
    }