summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/src/ParameterProcessorFactory.php
blob: c9db2b54a90bf94b874d947149d42778408ca89d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

namespace SMW;

/**
 * @license GNU GPL v2+
 * @since   1.9
 *
 * @author mwjames
 */
class ParameterProcessorFactory {

	/**
	 * @since 1.9
	 *
	 * @param array $parameters
	 *
	 * @return ParserParameterProcessor
	 */
	public static function newFromArray( array $parameters ) {
		$instance = new self();
		return $instance->newParserParameterProcessor( $parameters );
	}

	/**
	 * @since 2.3
	 *
	 * @param array $parameters
	 *
	 * @return ParserParameterProcessor
	 */
	public function newParserParameterProcessor( array $parameters ) {

		if ( isset( $parameters[0] ) && is_object( $parameters[0] ) ) {
			array_shift( $parameters );
		}

		return new ParserParameterProcessor( $parameters );
	}

}