if ($base != $name) {
throw new Exception('No directories supported for now');
}
+ if ($name == '') {
+ throw new Exception_Input('Empty file name given');
+ }
$path = $this->repoDir . '/' . $base;
if (!is_readable($path)) {
throw new Exception_Input('File does not exist');
return new File($path, $this);
}
+ public function hasFile($name)
+ {
+ try {
+ $this->getFileByName($name);
+ } catch (Exception $e) {
+ return false;
+ }
+ return true;
+ }
+
public function getDescription()
{
if (!is_readable($this->repoDir . '/.git/description')) {
return file_get_contents($this->repoDir . '/.git/description');
}
+ public function setDescription($description)
+ {
+ file_put_contents($this->repoDir . '/.git/description', $description);
+ }
+
/**
* Get a link to the repository
*