basic.php ➔ _print()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 3 and the first side effect is on line 2.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
include __DIR__.'/../vendor/autoload.php';
3
function _print($id, $retry){
4
    var_dump(sprintf('Pushed job with id %s and retry:%d', $id, $retry));
0 ignored issues
show
Security Debugging Code introduced by
var_dump(sprintf('Pushed...try:%d', $id, $retry)); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
5
}
6
7
// connect to database 0 on 127.0.0.1
8
$redis = new Predis\Client('tcp://127.0.0.1:6379/0');
9
10
// Instantiate a new client
11
$client = new \SidekiqJob\Client($redis);
12
13
// push a job with three arguments - args array needs to be sequential (not associative)
14
$args = [
15
    ['url' => 'http://i.imgur.com/hlAsa4k.jpg'],
16
    true,
17
    70
18
];
19
20
$id = $client->push('ProcessImage', $args, true);
21
_print($id, true);
22
23
$id = $client->push('ProcessImage', $args, false);
24
_print($id, false);
25