ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSystemStyleLessVariable.php
Go to the documentation of this file.
1<?php
2require_once("./Services/Style/System/classes/Less/class.ilSystemStyleLessItem.php");
3
4/***
5 * Capsules data of a less variable in the variables to less file. A less variable has the following structure:
6 *
7 * //** Comment to describe the variable
8 * @variable: value;
9 *
10 *
11 * @author Timon Amstutz <timon.amstutz@ilub.unibe.ch>
12 * @version $Id$
13 *
14 */
16{
17
23 protected $name = "";
24
30 protected $value = "";
31
37 protected $comment = "";
38
43 protected $category_name = "";
44
50 protected $references = array();
51
61 {
62 $this->setName($name);
63 $this->setValue($value);
65 $this->setComment($comment);
67 }
68
72 public function getName()
73 {
74 return $this->name;
75 }
76
80 public function setName($name)
81 {
82 $this->name = $name;
83 }
84
88 public function getValue()
89 {
90 return $this->value;
91 }
92
96 public function setValue($value)
97 {
98 if ($this->getName() == "il-icon-font-path" ) {
99 if ($value[0] != "\"") {
100 $value = "\"" . $value;
101 ;
102 }
103 if (substr($value, -1, 1) != "\"") {
104 $value .= "\"";
105 }
106
107 if ($value == "\"../../node_modules/bootstrap/fonts/\"") {
108 $value = "\"../../../../node_modules/bootstrap/fonts/\"";
109 }
110 }
111
112 $value = str_replace(PHP_EOL, '', $value);
113 $this->value = str_replace("\n", '', $value);
114 }
115
119 public function getComment()
120 {
121 return $this->comment;
122 }
123
127 public function setComment($comment)
128 {
129 $comment = str_replace(PHP_EOL, '', $comment);
130 $this->comment = str_replace("\n", '', $comment);
131 }
132
136 public function getCategoryName()
137 {
139 }
140
145 {
146 $this->category_name = $category_name;
147 }
148
152 public function getReferences()
153 {
154 return $this->references;
155 }
156
160 public function setReferences($references)
161 {
162 $this->references = $references;
163 }
164
165
172 public function __toString()
173 {
174 $content = "";
175 if ($this->getComment()) {
176 $content .= "//** " . $this->getComment() . "\n";
177 }
178 $content .= "@" . $this->getName() . ":\t\t" . $this->getValue() . ";\n";
179 return $content;
180 }
181}
An exception for terminatinating execution or to throw for unit testing.
Abstracts content of a less file.
__construct($name, $value, $comment, $category_name, $references)
ilSystemStyleLessVariable constructor.
__toString()
This function will be needed to write the variable back to the less file and restore it's initial str...
comment()
Definition: comment.php:2