public function compile($pharOutputPath, $binPath)
    {
        $pharBaseName = basename($pharOutputPath);

        // Delete the phar file if it already exists.
        if (file_exists($pharOutputPath)) {
            unlink($pharOutputPath);
        }

        $phar = $this->initialisePhar($pharOutputPath, 0, $pharBaseName);
        $phar->startBuffering();

        foreach ($this->files as $file) {
            $this->addFileToPhar($file, $phar);
        }

        $this->addFileToPhar($binPath, $phar);

        $phar->setStub($this->createStub($pharBaseName, $binPath));
        $phar->stopBuffering();
    }