1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Class LanguageAbstract |
4
|
|
|
* |
5
|
|
|
* @filesource LanguageAbstract.php |
6
|
|
|
* @created 11.02.2016 |
7
|
|
|
* @package chillerlan\BBCode\Language |
8
|
|
|
* @author Smiley <[email protected]> |
9
|
|
|
* @copyright 2015 Smiley |
10
|
|
|
* @license MIT |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace chillerlan\bbcode\Language; |
14
|
|
|
|
15
|
|
|
use chillerlan\bbcode\Traits\ClassLoaderTrait; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @method string parserExceptionCallback($override_language = null) |
19
|
|
|
* @method string parserExceptionMatchall($override_language = null) |
20
|
|
|
* |
21
|
|
|
* @method string codeDisplayCSS($override_language = null) |
22
|
|
|
* @method string codeDisplayPHP($override_language = null) |
23
|
|
|
* @method string codeDisplaySQL($override_language = null) |
24
|
|
|
* @method string codeDisplayXML($override_language = null) |
25
|
|
|
* @method string codeDisplayHTML($override_language = null) |
26
|
|
|
* @method string codeDisplayJS($override_language = null) |
27
|
|
|
* @method string codeDisplayJSON($override_language = null) |
28
|
|
|
* @method string codeDisplayPRE($override_language = null) |
29
|
|
|
* @method string codeDisplayCODE($override_language = null) |
30
|
|
|
* @method string codeDisplayNSIS($override_language = null) |
31
|
|
|
* |
32
|
|
|
* @method string expanderDisplayExpander($override_language = null) |
33
|
|
|
* @method string expanderDisplayQuote($override_language = null) |
34
|
|
|
* @method string expanderDisplaySpoiler($override_language = null) |
35
|
|
|
* @method string expanderDisplayTrigger($override_language = null) |
36
|
|
|
*/ |
37
|
|
|
abstract class LanguageAbstract implements LanguageInterface{ |
38
|
|
|
use ClassLoaderTrait; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* It's magic. |
42
|
|
|
* |
43
|
|
|
* @param string $name |
44
|
|
|
* @param array $arguments |
45
|
|
|
* |
46
|
|
|
* @return mixed |
47
|
|
|
*/ |
48
|
|
|
public function __call(string $name, array $arguments){ |
49
|
|
|
return $this->string($name, ...$arguments); |
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Returns a language string for a given key and overrides the current language if desired. |
54
|
|
|
* |
55
|
|
|
* @param string $key |
56
|
|
|
* @param string $override_language (a LanguageInterface FQCN) |
|
|
|
|
57
|
|
|
* |
58
|
|
|
* @return mixed |
59
|
|
|
* @throws \chillerlan\bbcode\BBCodeException |
60
|
|
|
*/ |
61
|
|
|
public function string(string $key, string $override_language = null){ |
62
|
|
|
|
63
|
|
|
if($override_language){ |
|
|
|
|
64
|
|
|
return $this->__loadClass($override_language, LanguageInterface::class)->{$key}(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
return $this->{$key}; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
} |
71
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: