'html' => 'xml',
);
- public function __construct($path, Repository $repo)
+ public function __construct($path, Repository $repo = null)
{
$this->path = $path;
$this->repo = $repo;
return basename($this->path);
}
+ /**
+ * Return the full path to the file
+ *
+ * @return string
+ */
+ public function getPath()
+ {
+ return $this->path;
+ }
+
+ /**
+ * Get file extension without dot
+ *
+ * @return string
+ */
+ public function getExt()
+ {
+ return substr($this->path, strrpos($this->path, '.') + 1);
+ }
+
/**
* Returns the type of the file, as used by Geshi
*
*/
public function getType()
{
- $ext = substr($this->path, strrpos($this->path, '.') + 1);
+ $ext = $this->getExt();
if (isset(static::$arTypeMap[$ext])) {
$ext = static::$arTypeMap[$ext];
}
public function getMimeType()
{
- $type = $this->getType();
- if (!isset(static::$arMimeTypeMap[$type])) {
+ $ext = $this->getExt();
+ if (!isset(static::$arMimeTypeMap[$ext])) {
return null;
}
- return static::$arMimeTypeMap[$type];
+ return static::$arMimeTypeMap[$ext];
}
/**