summaryrefslogtreecommitdiffstats
path: root/source/Configuration/Path.php
diff options
context:
space:
mode:
authorPhilip Nicolcev <frugen@gmail.com>2014-08-24 13:12:44 -0400
committerPhilip Nicolcev <frugen@gmail.com>2014-08-24 13:12:44 -0400
commitf5fe739314de24e3a9cb94b9c8c64e11ed9cc14c (patch)
treebe46c6120d6dc0d08a7112a8dc80840281cbad33 /source/Configuration/Path.php
parent9ffeed7646620ae7de51b929a3b44f2cdffb677f (diff)
parent5d8755faf06fd2ff9d3977f103e641b0ba9f714e (diff)
downloadAJAX-Chat-origin/cli_testing.zip
AJAX-Chat-origin/cli_testing.tar.gz
AJAX-Chat-origin/cli_testing.tar.bz2
Merge pull request #178 from stevleibelt/masterorigin/cli_testing
Implemented Command Line Tools in cli_testing branch
Diffstat (limited to 'source/Configuration/Path.php')
-rw-r--r--source/Configuration/Path.php220
1 files changed, 220 insertions, 0 deletions
diff --git a/source/Configuration/Path.php b/source/Configuration/Path.php
new file mode 100644
index 0000000..06917f5
--- /dev/null
+++ b/source/Configuration/Path.php
@@ -0,0 +1,220 @@
+<?php
+/**
+ * @author stev leibelt <artodeto@bazzline.net>
+ * @since 2014-08-17
+ */
+
+/**
+ * Class Configuration_Path
+ */
+class Configuration_Path
+{
+ /**
+ * @var string
+ */
+ private $pathToRootDirectory;
+
+ /**
+ * @param string $relativePathToRootDirectory - relative path from Configuration_Path file
+ * @throws Exception
+ */
+ public function __construct($relativePathToRootDirectory)
+ {
+ $this->pathToRootDirectory = realpath(__DIR__ . DIRECTORY_SEPARATOR . $relativePathToRootDirectory);
+
+ if (!is_dir($relativePathToRootDirectory)) {
+ throw new Exception(
+ 'provided root path is not a directory: ' . PHP_EOL .
+ '"' . $this->pathToRootDirectory . '"'
+ );
+ }
+ }
+
+ //begin of path
+ /**
+ * @return string
+ */
+ public function getBackupPath()
+ {
+ return $this->pathToRootDirectory . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'backup';
+ }
+
+ /**
+ * @return string
+ */
+ public function getBackupChannelsFilePath()
+ {
+ return $this->getBackupPath() . DIRECTORY_SEPARATOR . $this->getChannelsFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getBackupConfigurationFilePath()
+ {
+ return $this->getBackupPath() . DIRECTORY_SEPARATOR . $this->getConfigurationFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getBackupUsersFilePath()
+ {
+ return $this->getBackupPath() . DIRECTORY_SEPARATOR . $this->getUsersFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getBackupVersionFilePath()
+ {
+ return $this->getBackupPath() . DIRECTORY_SEPARATOR . $this->getVersionFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getExamplePath()
+ {
+ return $this->pathToRootDirectory . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'example';
+ }
+
+ /**
+ * @return string
+ */
+ public function getExampleChannelsFilePath()
+ {
+ return $this->getExamplePath() . DIRECTORY_SEPARATOR . $this->getChannelsFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getExampleConfigurationFilePath()
+ {
+ return $this->getChatPath() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . $this->getConfigurationFileName() . '.example';
+ }
+
+ /**
+ * @return string
+ */
+ public function getExampleUsersFilePath()
+ {
+ return $this->getExamplePath() . DIRECTORY_SEPARATOR . $this->getUsersFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getExampleVersionFilePath()
+ {
+ return $this->getExamplePath() . DIRECTORY_SEPARATOR . $this->getVersionFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getChatPath()
+ {
+ return $this->pathToRootDirectory . DIRECTORY_SEPARATOR . 'chat';
+ }
+
+ /**
+ * @return string
+ */
+ public function getChatChannelsFilePath()
+ {
+ return $this->getChatPath() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . $this->getChannelsFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getChatClassesFilePath()
+ {
+ return $this->getChatPath() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . $this->getClassesFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getChatConfigurationFilePath()
+ {
+ return $this->getChatPath() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . $this->getConfigurationFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getChatUsersFilePath()
+ {
+ return $this->getChatPath() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . $this->getUsersFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getChatVersionFilePath()
+ {
+ return $this->getChatPath() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . $this->getVersionFileName();
+ }
+
+ /**
+ * @return string
+ */
+ public function getReleasePath()
+ {
+ return $this->pathToRootDirectory . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'release';
+ }
+
+ /**
+ * @return string
+ */
+ public function getChangeLogFilePath()
+ {
+ return $this->pathToRootDirectory . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'change.log';
+ }
+ //end of path
+
+ //begin of file name
+ /**
+ * @return string
+ */
+ public function getChannelsFileName()
+ {
+ return 'channels.php';
+ }
+
+ /**
+ * @return string
+ */
+ public function getClassesFileName()
+ {
+ return 'classes.php';
+ }
+
+ /**
+ * @return string
+ */
+ public function getConfigurationFileName()
+ {
+ return 'config.php';
+ }
+
+ /**
+ * @return string
+ */
+ public function getUsersFileName()
+ {
+ return 'users.php';
+ }
+
+ /**
+ * @return string
+ */
+ public function getVersionFileName()
+ {
+ return 'version.php';
+ }
+ //end of file name
+} \ No newline at end of file