Passed
Pull Request — master (#45)
by X
02:29
created

xKerman_Restricted_IntegerHandler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 4 1
1
<?php
2
3
/**
4
 * Handler for PHP serialized integer
5
 */
6
class xKerman_Restricted_IntegerHandler implements xKerman_Restricted_HandlerInterface
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
    /**
9
     * parse given `$source` as PHP serialized integer
10
     *
11
     * @param Source $source parser input
0 ignored issues
show
Documentation introduced by
Should the type for parameter $source not be xKerman_Restricted_Source?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
12
     * @param string $args   integer value
13
     * @return array
14
     * @throws UnserializeFailedException
15
     */
16
    public function handle(xKerman_Restricted_Source $source, $args)
17
    {
18
        return array(intval($args, 10), $source);
19
    }
20
}