Updated to ManiaLink v3
This commit is contained in:
		| @@ -6,70 +6,101 @@ namespace FML\Script; | ||||
|  * Class representing an Include of the ManiaLink Script | ||||
|  * | ||||
|  * @author    steeffeen | ||||
|  * @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 ScriptInclude { | ||||
| 	/* | ||||
| 	 * Constants | ||||
| 	 */ | ||||
| 	const MATHLIB = 'MathLib'; | ||||
| 	const TEXTLIB = 'TextLib'; | ||||
| class ScriptInclude | ||||
| { | ||||
|  | ||||
| 	/* | ||||
| 	 * Protected properties | ||||
| 	 */ | ||||
| 	protected $file = null; | ||||
| 	protected $namespace = null; | ||||
|     /* | ||||
|      * Constants | ||||
|      */ | ||||
|     const MATHLIB = 'MathLib'; | ||||
|     const TEXTLIB = 'TextLib'; | ||||
|  | ||||
| 	/** | ||||
| 	 * Construct a new Script Include | ||||
| 	 * | ||||
| 	 * @param string $file      (optional) Include file | ||||
| 	 * @param string $namespace (optional) Include namespace | ||||
| 	 */ | ||||
| 	public function __construct($file = null, $namespace = null) { | ||||
| 		$this->setFile($file); | ||||
| 		$this->setNamespace($namespace); | ||||
| 	} | ||||
|     /** | ||||
|      * @var string $file File name | ||||
|      */ | ||||
|     protected $file = null; | ||||
|  | ||||
| 	/** | ||||
| 	 * Set the file | ||||
| 	 * | ||||
| 	 * @param string $file Include file | ||||
| 	 * @return static | ||||
| 	 */ | ||||
| 	public function setFile($file) { | ||||
| 		$this->file = (string)$file; | ||||
| 		return $this; | ||||
| 	} | ||||
|     /** | ||||
|      * @var string $namespace Namespace | ||||
|      */ | ||||
|     protected $namespace = null; | ||||
|  | ||||
| 	/** | ||||
| 	 * Set the namespace | ||||
| 	 * | ||||
| 	 * @param string $namespace Include namespace | ||||
| 	 * @return static | ||||
| 	 */ | ||||
| 	public function setNamespace($namespace) { | ||||
| 		$this->namespace = (string)$namespace; | ||||
| 		return $this; | ||||
| 	} | ||||
|     /** | ||||
|      * Construct a new Script Include | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $file      (optional) File name | ||||
|      * @param string $namespace (optional) Namespace | ||||
|      */ | ||||
|     public function __construct($file = null, $namespace = null) | ||||
|     { | ||||
|         if ($file) { | ||||
|             $this->setFile($file); | ||||
|         } | ||||
|         if ($namespace) { | ||||
|             $this->setNamespace($namespace); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| 	/** | ||||
| 	 * Get the namespace | ||||
| 	 * | ||||
| 	 * @return string | ||||
| 	 */ | ||||
| 	public function getNamespace() { | ||||
| 		return $this->namespace; | ||||
| 	} | ||||
|     /** | ||||
|      * Get the file | ||||
|      * | ||||
|      * @api | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getFile() | ||||
|     { | ||||
|         return $this->file; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the file | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $file File name | ||||
|      * @return static | ||||
|      */ | ||||
|     public function setFile($file) | ||||
|     { | ||||
|         $this->file = (string)$file; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the namespace | ||||
|      * | ||||
|      * @api | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getNamespace() | ||||
|     { | ||||
|         return $this->namespace; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the namespace | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $namespace Namespace | ||||
|      * @return static | ||||
|      */ | ||||
|     public function setNamespace($namespace) | ||||
|     { | ||||
|         $this->namespace = (string)$namespace; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Build the Script Include text | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function __toString() | ||||
|     { | ||||
|         return Builder::getInclude($this->file, $this->namespace); | ||||
|     } | ||||
|  | ||||
| 	/** | ||||
| 	 * Build the Script Include text | ||||
| 	 * | ||||
| 	 * @return string | ||||
| 	 */ | ||||
| 	public function __toString() { | ||||
| 		return Builder::getInclude($this->file, $this->namespace); | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user