Completed
Pull Request — master (#582)
by Mateusz
03:31 queued 31s
created

DNDeploymentHandlers::onQueue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 1
eloc 11
nc 1
nop 1
1
<?php
2
3
use \Finite\Event\TransitionEvent;
4
5
class DNDeploymentHandlers extends Object {
6
	public function onQueue(TransitionEvent $e) {
7
		$obj = $e->getStateMachine()->getObject();
8
9
		$log = $obj->log();
0 ignored issues
show
Unused Code introduced by
$log is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
10
		$token = $obj->enqueueDeployment();
11
		$obj->ResqueToken = $token;
12
		$obj->write();
13
14
		$message = sprintf(
15
			'Deploy queued as job %s (sigFile is %s)',
16
			$token,
17
			DeployJob::sig_file_for_data_object($obj)
18
		);
19
		$obj->write($message);
20
	}
21
22
	public function onAbort(TransitionEvent $e) {
23
		$obj = $e->getStateMachine()->getObject();
24
25
		// 2 is SIGINT - we can't use SIGINT constant in the mod_apache context.
26
		DeployJob::set_signal($obj, 2);
27
	}
28
}
29