Completed
Push — master ( 198a3e...84e362 )
by Rougin
10:23
created

MethodHelper::call()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
namespace Rougin\Credo\Helpers;
4
5
use Doctrine\Common\Util\Inflector;
6
7
/**
8
 * Method Helper
9
 *
10
 * @package Credo
11
 * @author  Rougin Royce Gutib <[email protected]>
12
 */
13
class MethodHelper
14
{
15
    /**
16
     * Calls methods from the specified object in underscore case.
17
     *
18
     * @param  object $object
19
     * @param  string $method
20
     * @param  mixed  $parameters
21
     * @return mixed
22
     */
23
    public static function call($object, $method, $parameters)
24
    {
25
        $method = Inflector::camelize((string) $method);
26
27
        $instance = (array) array($object, (string) $method);
28
29
        return call_user_func_array($instance, $parameters);
30
    }
31
}
32