Passed
Push — master ( 3c6756...8b3b37 )
by Michael
20:43 queued 12:59
created

Demo_getChannels   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
c 2
b 0
f 0
dl 0
loc 22
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 3
A init() 0 6 1
1
<?php
2
	/**
3
	 * @package Demos
4
	 */
5
	class Demo_getChannels extends Demo
6
	{
7
		public $order = 500;
8
		
9
		protected $channels = array('red', 'green', 'blue', 'alpha');
10
		
11
		function init()
12
		{
13
			$this->addField(new CheckboxField('red', true));
14
			$this->addField(new CheckboxField('green', false));
15
			$this->addField(new CheckboxField('blue', true));
16
			$this->addField(new CheckboxField('alpha', false));
17
		}
18
		
19
		function execute($img, $request)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
		function execute($img, /** @scrutinizer ignore-unused */ $request)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
		{
21
			$on = array();
22
			foreach ($this->channels as $name)
23
				if ($this->fields[$name]->value)
24
					$on[] = $name;
25
			
26
			return $img->getChannels($on);
27
		}
28
	}
29