Context.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Context file.
  4. *
  5. * Provides a handy class with usefull data to be accessible from anywhere in the app.
  6. *
  7. * @author Iñigo Valentin <i@inigovalentin.com>
  8. * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
  9. * @package IV
  10. */
  11. /**
  12. * Application context.
  13. *
  14. * Stores usefull data to be retrieved anywhere in the app.
  15. *
  16. * @category Context
  17. */
  18. class Context {
  19. /**
  20. * @var SQLITE3 Database connection.
  21. */
  22. private $db;
  23. /**
  24. * Retrieves the database connection.
  25. *
  26. * @return SQLITE3 The database connection.
  27. */
  28. public function get_db(){
  29. return $this->db;
  30. }
  31. /**
  32. * Sets the database connection
  33. *
  34. * @param SQLITE3 Database connection.
  35. */
  36. protected function set_db($db){
  37. $this->db = $db;
  38. Log::debug("Context database is set and accesible.");
  39. if ($this->db == null){
  40. Log::debug("It is null");
  41. }
  42. }
  43. /**
  44. * Retrieves the language.
  45. *
  46. * @todo Implement
  47. * @return string Two letter language code.
  48. */
  49. public function get_lang(){
  50. return "es";
  51. }
  52. /**
  53. * Retrieves the list of available languages.
  54. *
  55. * @todo Implement
  56. * @return string Two letter language code.
  57. */
  58. public function get_available_langs(){
  59. return [];
  60. }
  61. }