Test Failed
Push — master ( 84df56...b451e3 )
by Justin
06:34 queued 02:54
created

PluginLang   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
dl 0
loc 29
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A end() 0 1 1
A init() 0 1 1
A process() 0 5 1
1
<?php
2
/**
3
 * Copyright (c) 2018 Justin Kuenzel (jukusoft.com)
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace Dwoo\Plugins\Functions;
19
20
use Dwoo\Compiler;
21
use Dwoo\Block\Plugin as Plugin;
22
use Dwoo\ICompilable\Block as ICompilableBlock;
23
24
/**
25
 * Copyright (c) 2018 Justin Kuenzel (jukusoft.com)
26
 *
27
 * Licensed under the Apache License, Version 2.0 (the "License");
28
 * you may not use this file except in compliance with the License.
29
 * You may obtain a copy of the License at
30
 *
31
 *     http://www.apache.org/licenses/LICENSE-2.0
32
 *
33
 * Unless required by applicable law or agreed to in writing, software
34
 * distributed under the License is distributed on an "AS IS" BASIS,
35
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36
 * See the License for the specific language governing permissions and
37
 * limitations under the License.
38
 */
39
40
41
/**
42
 * Project: JuKuCMS
43
 * License: Apache 2.0 license
44
 * User: Justin
45
 * Date: 07.04.2018
46
 * Time: 12:56
47
 */
48
49
class PluginLang extends Plugin/* implements ICompilableBlock*/ {
50
51
	/**
52
	 * @param Compiler $compiler
53
	 * @param mixed    $value
54
	 * @param mixed    $var
55
	 *
56
	 * @return string
57
	 */
58
	/*public static function compile(Compiler $compiler, $value, $domain = "") {
59
		return 'Translator::translate(' . $value . ', ' . $domain . ')';
60
	}*/
61
62
	// parameters go here if you need any settings
63
	public function init() {
64
		//
65
	}
66
67
	// this can be ommitted, it's called once when the block ends, don't implement if you don't need it
68
	public function end() {
69
		//
70
	}
71
72
	// this is called when the block is required to output it's data, it should read $this->buffer, process it and return it
73
	public function process(){
74
		var_dump($this->buffer);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($this->buffer) looks like debug code. Are you sure you do not want to remove it?
Loading history...
75
76
		exit;
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
77
		return strtoupper($this->buffer);
0 ignored issues
show
Unused Code introduced by
return strtoupper($this->buffer) is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
78
	}
79
80
}
81
82
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
83