public function copyPhantomJsBinaryToBinFolder($targetDir, $binDir)
    {
        if (!is_dir($binDir)) {
            mkdir($binDir);
        }

        $os = $this->getOS();

        $sourceName = '/bin/phantomjs';
        $targetName = $binDir . '/phantomjs';

        if ($os === 'windows') {
            // the suffix for binaries on windows is ".exe"
            $sourceName .= '.exe';
            $targetName .= '.exe';

            /**
             * The release folder structure changed between versions.
             * For versions up to v1.9.8, the executables resides at the root.
             * From v2.0.0 on, the executable resides in the bin folder.
             */
            if (is_file($targetDir . '/phantomjs.exe')) {
                $sourceName = str_replace('/bin', '', $sourceName);
            }

            // slash fix (not needed, but looks better on the dropped php file)
            $targetName = str_replace('/', '\\', $targetName);
        }

        if ($os !== 'unknown') {
            $tempTargetName = tempnam($binDir, 'phantomjs_temp_');
            copy($targetDir . $sourceName, $tempTargetName);
            chmod($tempTargetName, 0777 & ~umask());
            rename($tempTargetName, $targetName);
        }

        $this->dropClassWithPathToInstalledBinary($targetName);
    }
public function copyPhantomJsBinaryToBinFolder($targetDir, $binDir)
    {
        if (!is_dir($binDir)) {
            mkdir($binDir);
        }

        $os = $this->getOS();

        $sourceName = '/bin/phantomjs';
        $targetName = $binDir . '/phantomjs';

        if ($os === 'windows') {
            // the suffix for binaries on windows is ".exe"
            $sourceName .= '.exe';
            $targetName .= '.exe';

            /**
             * The release folder structure changed between versions.
             * For versions up to v1.9.8, the executables resides at the root.
             * From v2.0.0 on, the executable resides in the bin folder.
             */
            if (is_file($targetDir . '/phantomjs.exe')) {
                $sourceName = str_replace('/bin', '', $sourceName);
            }

            // slash fix (not needed, but looks better on the dropped php file)
            $targetName = str_replace('/', '\\', $targetName);
        }

        if ($os !== 'unknown') {
            $tempTargetName = tempnam($binDir, 'phantomjs_temp_');
            copy($targetDir . $sourceName, $tempTargetName);
            chmod($tempTargetName, 0777 & ~umask());
            rename($tempTargetName, $targetName);
        }

        $this->dropClassWithPathToInstalledBinary($targetName);
    }
public function copyPhantomJsBinaryToBinFolder ( $ targetDir , $ binDir ) { if ( ! is_dir ( $ binDir ) ) { mkdir ( $ binDir ) ; } $ os = $ this -> getOS ( ) ; $ sourceName = '/bin/phantomjs' ; $ targetName = $ binDir . '/phantomjs' ; if ( $ os === 'windows' ) { // the suffix for binaries on windows is ".exe" $ sourceName .= '.exe' ; $ targetName .= '.exe' ; /**
             * The release folder structure changed between versions.
             * For versions up to v1.9.8, the executables resides at the root.
             * From v2.0.0 on, the executable resides in the bin folder.
             */ if ( is_file ( $ targetDir . '/phantomjs.exe' ) ) { $ sourceName = str_replace ( '/bin' , '' , $ sourceName ) ; } // slash fix (not needed, but looks better on the dropped php file) $ targetName = str_replace ( '/' , '\\' , $ targetName ) ; } if ( $ os !== 'unknown' ) { $ tempTargetName = tempnam ( $ binDir , 'phantomjs_temp_' ) ; copy ( $ targetDir . $ sourceName , $ tempTargetName ) ; chmod ( $ tempTargetName , 0777 & ~ umask ( ) ) ; rename ( $ tempTargetName , $ targetName ) ; } $ this -> dropClassWithPathToInstalledBinary ( $ targetName ) ; }
Copies the PhantomJs binary to the bin folder.
Takes different "folder structure" of the archives and different "binary file names" into account.

@param  string $targetDir path to /vendor/jakoch/phantomjs
@param  string $binDir path to binary folder

@return bool True, if file dropped. False, otherwise.
Copies the PhantomJs binary to the bin folder . Takes different folder structure of the archives and different binary file names into account .