Passed
Pull Request — develop ( #58 )
by
unknown
32:22 queued 14:42
created

Js   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 16
rs 10
c 0
b 0
f 0
ccs 0
cts 10
cp 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A run() 0 6 1
1
<?php
2
/**
3
 * @link http://www.newicon.net/neon
4
 * @copyright Copyright (c) 16/09/2016 Newicon Ltd
5
 * @license http://www.newicon.net/neon/license/
6
 */
7
8
namespace neon\core\widgets;
9
10
use yii\base\Widget;
11
use \neon\core\web\View;
12
13
class Js extends Widget
14
{
15
	public $position = View::POS_READY;
16
17
	public function init()
18
	{
19
		parent::init();
20
		ob_start();
21
	}
22
23
	public function run()
24
	{
25
		$jsScript = ob_get_clean();
26
		// remove script tags
27
		$jsScript = str_replace(['<script>', '</script>'], '', $jsScript);
28
		$this->view->registerJs($jsScript, $this->position);
29
	}
30
}