public static function getCode(string $hook, string $repoPath, string $vendorPath, string $configPath) : string
    {
        $tplVendorPath = self::getTplTargetPath($repoPath, $vendorPath);
        $tplConfigPath = self::getTplTargetPath($repoPath, $configPath);

        return '#!/usr/bin/env php' . PHP_EOL .
               '<?php' . PHP_EOL .
               '$autoLoader = ' . $tplVendorPath . '/autoload.php\';' . PHP_EOL . PHP_EOL .
               'if (!file_exists($autoLoader)) {' . PHP_EOL .
               '    fwrite(STDERR,' . PHP_EOL .
               '        \'Composer autoload.php could not be found\' . PHP_EOL .' . PHP_EOL .
               '        \'Please re-install the hook with:\' . PHP_EOL .' . PHP_EOL .
               '        \'$ captainhook install --composer-vendor-path=...\' . PHP_EOL' . PHP_EOL .
               '    );' . PHP_EOL .
               '    exit(1);' . PHP_EOL .
               '}' . PHP_EOL .
               'require $autoLoader;' . PHP_EOL .
               '$config = realpath(' . $tplConfigPath . '\');' . PHP_EOL .
               '$app    = new CaptainHook\App\Console\Application\Hook();' . PHP_EOL .
               '$app->setHook(\'' . $hook . '\');' . PHP_EOL .
               '$app->setConfigFile($config);' . PHP_EOL .
               '$app->run();' . PHP_EOL . PHP_EOL;
    }