GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#68)
by Bidesh
03:32
created

MarathonEntityUtils::setPropertyIfExist()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 8
ccs 7
cts 7
cp 1
rs 9.4285
c 2
b 0
f 0
cc 3
eloc 4
nc 2
nop 3
crap 3
1
<?php
2
/**
3
 * @package: chapi
4
 *
5
 * @author: bthapaliya
6
 * @since: 2016-10-16
7
 *
8
 */
9
namespace Chapi\Entity\Marathon;
10
11
12
class MarathonEntityUtils
13
{
14 27
    public static function setPropertyIfExist($oSource, $oTarget, $sProperty)
15
    {
16 27
        if (isset($oSource[$sProperty]) &&
17 23
            property_exists($oTarget, $sProperty))
18 27
        {
19 23
            $oTarget->{$sProperty} = $oSource[$sProperty];
20 23
        }
21 27
    }
22
23
    /**
24
     * Sets all possible properties in the class from oData.
25
     * If the type is array or object, then it is ignored.
26
     * @param $oData
27
     */
28 36
    public static function setAllPossibleProperties($oData, $oTarget)
29
    {
30 36
        foreach($oData as $attrName => $attrValue)
31
        {
32
            // dont set array or objects.
33
            // Because this would need further type information to properly set.
34 27
            if (is_array($attrValue) || is_object($attrValue))
35 27
            {
36 21
                continue;
37
            }
38 17
            self::setPropertyIfExist($oData, $oTarget, $attrName);
39 36
        }
40
    }
41
}