Completed
Push — master ( ab4944...534e9c )
by Andrew
02:30
created

ClassyBasis   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 36
rs 10
wmc 7
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
C import() 0 26 7
1
<?php 
2
3
/**
4
 * Includes Basic Class methods that are common used in other classes
5
 */
6
7
class ClassyBasis {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
9
    /**
10
     * Imports data params into the class instance
11
     * 
12
     * @param  object/array $data
0 ignored issues
show
Documentation introduced by
The doc-type object/array could not be parsed: Unknown type name "object/array" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
13
     * @return void
14
     */
15
	protected function import($data) {
16
17
        if ( is_object( $data ) ) {
18
        
19
            $data = get_object_vars( $data );
20
        
21
        }
22
23
        if ( is_array( $data ) ) {
24
            
25
            foreach ( $data as $key => $value ) {
26
            
27
                if ( !empty( $key ) ) {
28
            
29
                    $this->$key = $value;
30
            
31
                } else if ( !empty( $key ) && !method_exists($this, $key) ){
32
            
33
                    $this->$key = $value;
34
            
35
                }
36
            }
37
38
        }
39
40
	}
41
42
}