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

24 lines
479 B
PHP
Raw Normal View History

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