Completed
Push — master ( eef885...465d0c )
by
unknown
30:08 queued 12:49
created

Model_Util   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A construct() 0 1 1
A set_namespace() 0 3 1
A get_namespace() 0 3 1
A exec_callback() 0 9 3
1
<?php
2
/**
3
 * Gestion des modèles
4
 *
5
 * @package Evarisk\Plugin
6
 */
7
8
namespace eoxia;
9
10
if ( ! defined( 'ABSPATH' ) ) {
11
	exit;
12
}
13
14
if ( ! class_exists( '\eoxia\Model_Util' ) ) {
15
	/**
16
	 * Gestion des modèles
17
	 *
18
	 * @author Jimmy Latour <[email protected]>
19
	 * @version 1.1.0.0
20
	 */
21
	class Model_Util extends \eoxia\Singleton_Util {
22
		public static $namespace = '';
23
		/**
24
		 * Le constructeur obligatoirement pour utiliser la classe \eoxia\Singleton_Util
25
		 *
26
		 * @return void nothing
27
		 */
28
		protected function construct() {}
29
30
		public function set_namespace( $namespace ) {
31
			self::$namespace = $namespace;
32
		}
33
34
		public function get_namespace() {
35
			return self::$namespace . '\\';
36
		}
37
38
		public static function exec_callback( $object, $functions ) {
39
			if ( ! empty( $functions ) ) {
40
				foreach ( $functions as $function ) {
41
					$object = call_user_func( $function, $object );
42
				}
43
			}
44
45
			return $object;
46
		}
47
	}
48
}
49