Completed
Push — master ( 446046...611444 )
by Patrick
03:18
created

Provider::getMethodByName()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 6
c 1
b 0
f 1
nc 3
nop 1
dl 0
loc 12
rs 9.4285
1
<?php
2
3
class Provider extends Singleton
4
{
5
    /** The methods loaded by the provider */
6
    protected $methods;
7
8
    /**
9
     * Get the method object corresponding to the name
10
     *
11
     * @param string $methodName The class name of the method to get the instance for
12
     *
13
     * @return boolean|stdClass The specified method class instance or false if it is not loaded
14
     */
15
    public function getMethodByName($methodName)
16
    {
17
        $count = count($this->methods);
18
        for($i = 0; $i < $count; $i++)
19
        {
20
            if(strcasecmp(get_class($this->methods[$i]), $methodName) === 0)
21
            {
22
                return $this->methods[$i];
23
            }
24
        }
25
        return false;
26
    }
27
}
28
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
29