Completed
Push — master ( b87405...9bfa56 )
by Aleksandar
09:20
created

SimpleArrayLibrary::castColumns()   C

Complexity

Conditions 15
Paths 14

Size

Total Lines 45
Code Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 3
Metric Value
c 3
b 0
f 3
dl 0
loc 45
rs 5.0504
cc 15
eloc 34
nc 14
nop 3

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace SimpleArrayLibrary;
4
5
use SimpleArrayLibrary\Categories\Changers;
6
use SimpleArrayLibrary\Categories\Checkers;
7
use SimpleArrayLibrary\Categories\Counters;
8
use SimpleArrayLibrary\Categories\Getters;
9
use SimpleArrayLibrary\Categories\Inspectors;
10
11
class SimpleArrayLibrary
12
{
13
    use Changers, Checkers, Counters, Getters, Inspectors;
14
15
    const TYPE_INT = 'int';
16
    const TYPE_STRING = 'string';
17
    const TYPE_FLOAT = 'float';
18
    const TYPE_BOOL = 'bool';
19
    const TYPE_ARRAY = 'array';
20
    const TYPE_OBJECT = 'object';
21
22
    /**
23
     * Check whether casting a variable to int would conway useful information
24
     *
25
     * @param mixed $input
26
     *
27
     * @return bool
28
     */
29
    private static function isLogicallyCastableToInt($input)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
30
    {
31
        return !is_bool($input) && filter_var($input, FILTER_VALIDATE_INT) !== false;
32
    }
33
}