Passed
Pull Request — master (#16)
by Daryl
01:42
created

Controller_Base   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 32
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __call() 0 14 3
1
<?php
2
3
namespace Clubdeuce\WPGoogleMaps;
4
5
/**
6
 * Class Controller_Base
7
 * @package Clubdeuce\WPGoogleMaps
8
 */
9
class Controller_Base {
10
11
	/**
12
	 * @var Model_Base
13
	 */
14
	protected $_model;
15
16
	/**
17
	 * @var object
18
	 */
19
	protected $_view;
20
21
	/**
22
	 * @param  string $method
23
	 * @param  array  $args
24
	 *
25
	 * @return mixed|null
26
	 */
27 3
	function __call( $method, $args ) {
28
29 3
		$value = null;
30
31
		do {
32 3
			if ( method_exists( $this->_view, $method ) ) {
33
				$value = call_user_func_array( array( $this->_view, $method ), $args );
34
				break;
35
			}
36
37 3
			$value = call_user_func_array( array( $this->_model, $method ), $args );
38 3
		} while ( false );
39
40 3
		return $value;
41
42
	}
43
44
}
45