abstract.LessEngine.inc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Class \LessEngine
  4. */
  5. abstract class LessEngine implements LessEngineInterface {
  6. /**
  7. * Path to the input .less file.
  8. *
  9. * @var string
  10. */
  11. protected $input_file_path;
  12. /**
  13. * This will get populated with a list of files that $input_file_path depended
  14. * on through @import statements.
  15. *
  16. * @var string[]
  17. */
  18. protected $dependencies = array();
  19. /**
  20. * This contains any variables that are to be modified into the output.
  21. *
  22. * Key => value pairs, where the key is the LESS variable name.
  23. *
  24. * @var string[]
  25. */
  26. protected $variables = array();
  27. /**
  28. * List of directories that are to be used for @import lookups.
  29. *
  30. * @var string[]
  31. */
  32. protected $import_directories = array();
  33. /**
  34. * Flag if source maps are enabled.
  35. *
  36. * @var bool
  37. */
  38. protected $source_maps_enabled = FALSE;
  39. /**
  40. * @var string|NULL
  41. */
  42. protected $source_maps_base_path = NULL;
  43. /**
  44. * @var string|NULL
  45. */
  46. protected $source_maps_root_path = NULL;
  47. /**
  48. * Basic constructor.
  49. *
  50. * Sets input_file_path property.
  51. *
  52. * @param string $input_file_path
  53. */
  54. public function __construct($input_file_path) {
  55. $this->input_file_path = $input_file_path;
  56. }
  57. /**
  58. * {@inheritdoc}
  59. */
  60. public function setImportDirectories(array $directories) {
  61. $this->import_directories = $directories;
  62. }
  63. /**
  64. * {@inheritdoc}
  65. */
  66. public function setSourceMaps($enabled = FALSE, $base_path = NULL, $root_path = NULL) {
  67. $this->source_maps_enabled = $enabled;
  68. $this->source_maps_base_path = $base_path;
  69. $this->source_maps_root_path = $root_path;
  70. }
  71. /**
  72. * {@inheritdoc}
  73. */
  74. public function modifyVariables(array $variables) {
  75. $this->variables = $variables;
  76. }
  77. /**
  78. * {@inheritdoc}
  79. */
  80. public function getDependencies() {
  81. return $this->dependencies;
  82. }
  83. }