Updated to ManiaLink v3
This commit is contained in:
@ -6,55 +6,95 @@ namespace FML\Script;
|
||||
* Class representing a Constant of the ManiaLink Script
|
||||
*
|
||||
* @author steeffeen <mail@steeffeen.com>
|
||||
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
||||
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class ScriptConstant {
|
||||
/*
|
||||
* Protected properties
|
||||
*/
|
||||
protected $name = null;
|
||||
protected $value = null;
|
||||
class ScriptConstant
|
||||
{
|
||||
|
||||
/**
|
||||
* Construct a new Script Constant
|
||||
*
|
||||
* @param string $name (optional) Constant name
|
||||
* @param string $value (optional) Constant value
|
||||
*/
|
||||
public function __construct($name = null, $value = null) {
|
||||
$this->setName($name);
|
||||
$this->setValue($value);
|
||||
}
|
||||
/**
|
||||
* @var string $name Name
|
||||
*/
|
||||
protected $name = null;
|
||||
|
||||
/**
|
||||
* Set the name
|
||||
*
|
||||
* @param string $name Constant name
|
||||
* @return static
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->name = (string)$name;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @var mixed $value Value
|
||||
*/
|
||||
protected $value = null;
|
||||
|
||||
/**
|
||||
* Set the value
|
||||
*
|
||||
* @param string $value Constant value
|
||||
* @return static
|
||||
*/
|
||||
public function setValue($value) {
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Construct a new Script Constant
|
||||
*
|
||||
* @api
|
||||
* @param string $name (optional) Constant name
|
||||
* @param mixed $value (optional) Constant value
|
||||
*/
|
||||
public function __construct($name = null, $value = null)
|
||||
{
|
||||
if ($name) {
|
||||
$this->setName($name);
|
||||
}
|
||||
if ($value !== null) {
|
||||
$this->setValue($value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name
|
||||
*
|
||||
* @api
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name
|
||||
*
|
||||
* @api
|
||||
* @param string $name Constant name
|
||||
* @return static
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = (string)$name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value
|
||||
*
|
||||
* @api
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value
|
||||
*
|
||||
* @api
|
||||
* @param mixed $value Constant value
|
||||
* @return static
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Script Constant text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return Builder::getConstant($this->name, $this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Script Constant text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
return Builder::getConstant($this->name, $this->value);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user