Completed
Push — master ( b2e200...1332b8 )
by Oscar
04:48
created

Resolver::resolve()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.2
cc 4
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace Psr7Middlewares\Transformers;
4
5
/**
6
 * Generic resolver to get transformers.
7
 */
8
abstract class Resolver implements ResolverInterface
9
{
10
    /**
11
     * Resolves the id and returns a transformer or null.
12
     * 
13
     * @param string $id
14
     * 
15
     * @return callable|null
16
     */
17
    public function resolve($id)
18
    {
19
        if (!empty($id) && $id !== __METHOD__ && method_exists($this, $id)) {
20
            return [$this, $id];
21
        }
22
    }
23
}
24