Initial commit
This commit is contained in:
18
src/Hotfix/Loader/FileLoader.php
Normal file
18
src/Hotfix/Loader/FileLoader.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
|
||||
|
||||
class FileLoader implements LoaderInterface
|
||||
{
|
||||
public function load($fix)
|
||||
{
|
||||
if ($fix[0] !== '/') {
|
||||
$fix = getcwd()."/".$fix;
|
||||
}
|
||||
if (file_exists($fix)) {
|
||||
$hotfix = file_get_contents($fix);
|
||||
return $hotfix;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
13
src/Hotfix/Loader/GistLoader.php
Normal file
13
src/Hotfix/Loader/GistLoader.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
|
||||
|
||||
class GistLoader implements LoaderInterface
|
||||
{
|
||||
public function load($fix)
|
||||
{
|
||||
if (!preg_match('/^gist\:/i', $fix)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
11
src/Hotfix/Loader/HttpLoader.php
Normal file
11
src/Hotfix/Loader/HttpLoader.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
|
||||
|
||||
class HttpLoader implements LoaderInterface
|
||||
{
|
||||
public function load($fix)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
8
src/Hotfix/Loader/LoaderInterface.php
Normal file
8
src/Hotfix/Loader/LoaderInterface.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
|
||||
|
||||
interface LoaderInterface
|
||||
{
|
||||
public function load($fix);
|
||||
}
|
13
src/Hotfix/Loader/PastebinLoader.php
Normal file
13
src/Hotfix/Loader/PastebinLoader.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
|
||||
|
||||
class PastebinLoader implements LoaderInterface
|
||||
{
|
||||
public function load($fix)
|
||||
{
|
||||
if (!preg_match('/^pastebin\:/i', $fix)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user