| Conditions | 15 | 
| Paths | 9 | 
| Total Lines | 46 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 67 | public function set($data)  | 
            ||
| 68 |     { | 
            ||
| 69 |         if(is_array($data) || is_object($data)) { | 
            ||
| 70 | $mapper = \net\authorize\util\Mapper::Instance();  | 
            ||
| 71 | 			foreach($data AS $key => $value) { | 
            ||
| 72 | $classDetails = $mapper->getClass(get_class() , $key);  | 
            ||
| 73 | |||
| 74 | 				if($classDetails !== NULL ) { | 
            ||
| 75 | 					if ($classDetails->isArray) { | 
            ||
| 76 | 						if ($classDetails->isCustomDefined) { | 
            ||
| 77 | 							foreach($value AS $keyChild => $valueChild) { | 
            ||
| 78 | $type = new $classDetails->className;  | 
            ||
| 79 | $type->set($valueChild);  | 
            ||
| 80 | 								$this->{'addTo' . $key}($type); | 
            ||
| 81 | }  | 
            ||
| 82 | }  | 
            ||
| 83 | 						else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) { | 
            ||
| 84 | 							foreach($value AS $keyChild => $valueChild) { | 
            ||
| 85 | $type = new \DateTime($valueChild);  | 
            ||
| 86 | 								$this->{'addTo' . $key}($type); | 
            ||
| 87 | }  | 
            ||
| 88 | }  | 
            ||
| 89 | 						else { | 
            ||
| 90 | 							foreach($value AS $keyChild => $valueChild) { | 
            ||
| 91 | 								$this->{'addTo' . $key}($valueChild); | 
            ||
| 92 | }  | 
            ||
| 93 | }  | 
            ||
| 94 | }  | 
            ||
| 95 | 					else { | 
            ||
| 96 | 						if ($classDetails->isCustomDefined){ | 
            ||
| 97 | $type = new $classDetails->className;  | 
            ||
| 98 | $type->set($value);  | 
            ||
| 99 | 							$this->{'set' . $key}($type); | 
            ||
| 100 | }  | 
            ||
| 101 | 						else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) { | 
            ||
| 102 | $type = new \DateTime($value);  | 
            ||
| 103 | 							$this->{'set' . $key}($type); | 
            ||
| 104 | }  | 
            ||
| 105 | 						else { | 
            ||
| 106 | 							$this->{'set' . $key}($value); | 
            ||
| 107 | }  | 
            ||
| 108 | }  | 
            ||
| 109 | }  | 
            ||
| 110 | }  | 
            ||
| 111 | }  | 
            ||
| 112 | }  | 
            ||
| 113 | |||
| 116 |