TestCase   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A invokeMethod() 0 8 1
1
<?php
2
/**
3
 * This file is part of graze/data-flow
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/data-flow/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/data-flow
12
 */
13
14
namespace Graze\DataFlow\Test;
15
16
abstract class TestCase extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * Call protected/private method of a class.
20
     *
21
     * @param object &$object    Instantiated object that we will run method on.
22
     * @param string $methodName Method name to call
23
     * @param array  $parameters Array of parameters to pass into method.
24
     *
25
     * @return mixed Method return.
26
     */
27
    public static function invokeMethod(&$object, $methodName, array $parameters = array())
28
    {
29
        $reflection = new \ReflectionClass(get_class($object));
30
        $method = $reflection->getMethod($methodName);
31
        $method->setAccessible(true);
32
33
        return $method->invokeArgs($object, $parameters);
34
    }
35
}
36