AppKernel.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Class AppKernel
  5. */
  6. class AppKernel
  7. {
  8. protected $rootDir;
  9. /**
  10. * @return string
  11. */
  12. public function getRootDir()
  13. {
  14. if (null === $this->rootDir) {
  15. $r = new \ReflectionObject($this);
  16. $this->rootDir = str_replace('\\', '/', dirname($r->getFileName()));
  17. }
  18. return $this->rootDir;
  19. }
  20. /**
  21. * Returns the real root path
  22. * @return string
  23. */
  24. public function getRealRootDir()
  25. {
  26. return realpath($this->getRootDir().'/../').'/';
  27. }
  28. /**
  29. * Returns the data path
  30. * @return string
  31. */
  32. public function getDataDir()
  33. {
  34. return $this->getRealRootDir().'data/';
  35. }
  36. /**
  37. * @return string
  38. */
  39. public function getAppDir()
  40. {
  41. return $this->getRealRootDir().'app/';
  42. }
  43. /**
  44. * @return string
  45. */
  46. public function getConfigDir()
  47. {
  48. return $this->getRealRootDir().'app/config/';
  49. }
  50. /**
  51. * @return string
  52. */
  53. public function getConfigurationFile()
  54. {
  55. return $this->getRealRootDir().'app/config/configuration.php';
  56. }
  57. }