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

43 lines
1.0 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>
2014-04-27 14:44:40 +02:00
* @copyright FancyManiaLinks Copyright © 2014 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
*/
abstract class ScriptFeature {
2014-07-03 22:34:47 +02:00
2014-05-16 22:44:22 +02:00
/**
2014-06-21 03:18:21 +02:00
* Collect the Script Features of the given objects
2014-05-16 22:44:22 +02:00
*
2014-06-21 03:18:21 +02:00
* @return ScriptFeature[]
2014-05-16 22:44:22 +02:00
*/
2014-06-21 03:18:21 +02:00
public static function collect() {
2014-05-16 22:44:22 +02:00
$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;
}
2014-04-27 14:44:40 +02:00
/**
2014-06-21 03:18:21 +02:00
* Prepare the given Script for rendering by adding the needed Labels, etc.
2014-04-27 14:44:40 +02:00
*
* @param Script $script Script to prepare
2014-07-03 22:34:47 +02:00
* @return static
2014-04-27 14:44:40 +02:00
*/
public abstract function prepare(Script $script);
}