TrackManiaControl/application/core/Libs/FML/Script/Features/ScriptFeature.php

45 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-16 22:44:22 +02:00
* @author steeffeen
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-05-16 22:44:22 +02:00
/**
* Collect the Script Features of the given Objects
*
* @param object $scriptFeatureable ScriptFeatureable Object
* @param object $_ (optional) Various Amount of additional Objects
* @return array
*/
public static function collect($scriptFeatureable, $_ = null) {
$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
/**
* Prepare the given Script for Rendering by adding the needed Labels, etc.
*
* @param Script $script Script to prepare
* @return \FML\Script\Features\ScriptFeature
*/
public abstract function prepare(Script $script);
}