TrackManiaControl/libs/FML/Script/Features/ScriptFeature.php

46 lines
1.2 KiB
PHP
Raw Normal View History

2014-04-27 14:44:40 +02:00
<?php
namespace FML\Script\Features;
use FML\Script\Script;
2014-05-16 22:44:22 +02:00
use FML\Types\ScriptFeatureable;
2014-04-27 14:44:40 +02:00
/**
* ManiaLink Script Feature Class
*
2014-05-20 15:44:45 +02:00
* @author steeffeen <mail@steeffeen.com>
2017-03-25 18:40:15 +01:00
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
2014-05-16 22:44:22 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
2014-04-27 14:44:40 +02:00
*/
2017-03-25 18:40:15 +01:00
abstract class ScriptFeature
{
2014-07-03 22:34:47 +02:00
2017-03-25 18:40:15 +01:00
/**
* Collect the Script Features of the given objects
*
* @return ScriptFeature[]
*/
public static function collect()
{
$params = func_get_args();
$scriptFeatures = array();
foreach ($params as $object) {
if ($object instanceof ScriptFeatureable) {
$scriptFeatures = array_merge($scriptFeatures, $object->getScriptFeatures());
} else if ($object instanceof ScriptFeature) {
array_push($scriptFeatures, $object);
}
}
return $scriptFeatures;
}
/**
* Prepare the given Script for rendering by adding the needed Labels, etc.
*
* @param Script $script Script to prepare
* @return static
*/
public abstract function prepare(Script $script);
2014-05-16 22:44:22 +02:00
2014-04-27 14:44:40 +02:00
}