aboutsummaryrefslogtreecommitdiff
path: root/src/Phorkie/File.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Phorkie/File.php')
-rw-r--r--src/Phorkie/File.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Phorkie/File.php b/src/Phorkie/File.php
index f12d837..14a7bbf 100644
--- a/src/Phorkie/File.php
+++ b/src/Phorkie/File.php
@@ -17,6 +17,15 @@ class File
*/
public $repo;
+ public static $arMimeTypeMap = array(
+ 'css' => 'text/css',
+ 'htm' => 'text/html',
+ 'html' => 'text/html',
+ 'js' => 'application/javascript',
+ 'php' => 'text/x-php',
+ 'txt' => 'text/plain',
+ );
+
public function __construct($path, Repository $repo)
{
$this->path = $path;
@@ -48,6 +57,15 @@ class File
return file_get_contents($this->path);
}
+ public function getMimeType()
+ {
+ $type = $this->getType();
+ if (!isset(static::$arMimeTypeMap[$type])) {
+ return null;
+ }
+ return static::$arMimeTypeMap[$type];
+ }
+
/**
* Get a link to the file
*