drawCircle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 7
rs 10
1
<?php
2
3
use Cairo\Context;
0 ignored issues
show
Bug introduced by
The type Cairo\Context was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
use Cairo\Operator;
0 ignored issues
show
Bug introduced by
The type Cairo\Operator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Cairo\Surface\Image;
0 ignored issues
show
Bug introduced by
The type Cairo\Surface\Image was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Cairo\Surface\ImageFormat;
0 ignored issues
show
Bug introduced by
The type Cairo\Surface\ImageFormat was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
$cisize = 10;
9
$pad = 2;
10
$width = $cisize * 6.5 + $pad;
11
$height = $cisize * 3.5 + $pad;
12
13
function drawCircle($context, $cisize, $x, $y)
14
{
15
	$context->save();
16
	$context->translate($x, $y);
17
	$context->arc(0, 0, $cisize / 2, 0, 2 * M_PI);
18
	$context->fill();
19
	$context->restore();
20
}
21
22
function drawCircles($context, $cisize)
23
{
24
	drawCircle($context, $cisize, 0, $cisize * -0.1);
25
	drawCircle($context, $cisize, $cisize * 0.4, $cisize * 0.25);
26
	drawCircle($context, $cisize, $cisize * 2, 0);
27
	drawCircle($context, $cisize, $cisize * 4, 0);
28
	drawCircle($context, $cisize, $cisize * 6, 0);
29
}
30
31
$surface = new Image(ImageFormat::ARGB32, $width, $height);
32
$context = new Context($surface);
33
34
$context->translate($pad, $pad);
35
$context->setSourceRgb(0, 1, 0);
36
$context->setOperator(Operator::OVER);
37
drawCircle($context, $cisize, $cisize * 0.5, $cisize * 1.5);
38
$context->setSourceRgb(1, 0, 0);
39
$context->setOperator(Operator::ADD);
40
drawCircle($context, $cisize, $cisize * 0.75, $cisize * 1.75);
41
$context->setSourceRgb(0, 1, 0);
42
$context->setOperator(Operator::OVER);
43
$context->translate($cisize * 2.5, $cisize * 0.6);
44
drawCircles($context, $cisize);
45
$context->setSourceRgb(1, 0, 0);
46
$context->setOperator(Operator::ADD);
47
$context->translate(0, $cisize * 2);
48
drawCircles($context, $cisize);
49
50
$surface->writeToPng(dirname(__FILE__).'/finer-grained-fallbacks-php.png');
51