diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-03-28 17:24:44 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-03-28 17:24:44 +0200 |
| commit | cec8f61ab84122a3f4b0702aaad6f7a141f99f7b (patch) | |
| tree | 829ccddf19eaf25ebf918632228eb96088b250d4 /src | |
| parent | 2f7659becb40e457872fc45f59ad81bff439722f (diff) | |
| download | phorkie-cec8f61ab84122a3f4b0702aaad6f7a141f99f7b.tar.gz phorkie-cec8f61ab84122a3f4b0702aaad6f7a141f99f7b.zip | |
editing works basically
Diffstat (limited to 'src')
| -rw-r--r-- | src/Phorkie/File.php | 10 | ||||
| -rw-r--r-- | src/Phorkie/Repository.php | 18 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/Phorkie/File.php b/src/Phorkie/File.php index 6cdc833..3c6ea4b 100644 --- a/src/Phorkie/File.php +++ b/src/Phorkie/File.php @@ -59,6 +59,16 @@ class File } /** + * Return the full path to the file + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** * Get file extension without dot * * @return string diff --git a/src/Phorkie/Repository.php b/src/Phorkie/Repository.php index aeccc72..5273b60 100644 --- a/src/Phorkie/Repository.php +++ b/src/Phorkie/Repository.php @@ -82,6 +82,9 @@ class Repository 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'); @@ -89,6 +92,16 @@ class Repository 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')) { @@ -97,6 +110,11 @@ class Repository 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 * |
