php-hotfix/src/Hotfix/Loader/GistLoader.php

24 lines
479 B
PHP

<?php
namespace NoccyLabs\Hotfix\Hotfix\Loader;
class GistLoader implements LoaderInterface
{
public function load($fix)
{
if (!preg_match('/^gist\:/i', $fix)) {
return false;
}
$url = "https://gist.githubusercontent.com/" . substr($fix, 5) . "/raw";
return file_get_contents($url);
}
public function getInfo()
{
return "gist:<info>user</info>/<info>gist-id</info> - Read hotfix from a Gist";
}
}