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

Demo_applyMask   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 7 1
A init() 0 8 2
A getFormat() 0 3 1
1
<?php
2
	/**
3
	 * @package Demos
4
	 */
5
	class Demo_applyMask extends Demo
6
	{
7
		public $order = 600;
8
		
9
		function init()
10
		{
11
			$this->addField(new FileSelectField('mask', 'masks'));
12
			$this->addField(new CoordinateField('left', 10));
13
			$this->addField(new CoordinateField('top', '30%'));
14
			
15
			if (!$this->request->get('mask'))
16
				$this->request->set('mask', 'mask-circle.gif');
17
		}
18
		
19
		function execute($image)
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...
20
		{
21
			$mask = \WideImage\WideImage::load(DEMO_PATH . 'masks/' . $this->fields['mask']->value);
22
			$left = $this->fields['left']->value;
23
			$top = $this->fields['top']->value;
24
			
25
			return $image->applyMask($mask, $left, $top);
26
		}
27
		
28
		function getFormat()
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...
29
		{
30
			return 'png';
31
		}
32
	}
33