original_string: protected function getDefaultTypeHandler($value) {
  		//get value type
  		$type = gettype($value);
  	
  		switch ($type) {
  			case 'null':
  				return null;
  			case 'array':
  				//check empty array
  				if (count($value) == 0)
  					return null;
  				elseif (count($value) == 1) //get first value type hanlder
  					return $this->getDefaultTypeHandler(current($value));
  				
  				$typeHandler = null;
  				
  				//obtain type by checking inner values
  				foreach ($value as $val) {
  					$typeHandler = $this->getDefaultTypeHandler($val);
  					//get type of the first not null value
  					if (!is_null($typeHandler))
  						break;
  				}
  				
  				return $typeHandler;
  
  			case 'object':
  				//get object class
  				$classname = get_class($value);	
  				//use class as type
  				$typeHandler = $this->typeManager->getTypeHandler($classname);
  				if ($typeHandler !== false)
  					return $typeHandler;
  				//no typehandler found, throw exception
  				throw new \RuntimeException("No default type handler found for class '$classname'");
  	
  			case 'resource':
  				//unsupported, throw exception
  				throw new \RuntimeException("Argument of type 'resource' is not supported");
  
  			default:
  				//generic type
  				return $this->typeManager->getTypeHandler($type);
  		}
  	}
code: protected function getDefaultTypeHandler($value) {
  		//get value type
  		$type = gettype($value);
  	
  		switch ($type) {
  			case 'null':
  				return null;
  			case 'array':
  				//check empty array
  				if (count($value) == 0)
  					return null;
  				elseif (count($value) == 1) //get first value type hanlder
  					return $this->getDefaultTypeHandler(current($value));
  				
  				$typeHandler = null;
  				
  				//obtain type by checking inner values
  				foreach ($value as $val) {
  					$typeHandler = $this->getDefaultTypeHandler($val);
  					//get type of the first not null value
  					if (!is_null($typeHandler))
  						break;
  				}
  				
  				return $typeHandler;
  
  			case 'object':
  				//get object class
  				$classname = get_class($value);	
  				//use class as type
  				$typeHandler = $this->typeManager->getTypeHandler($classname);
  				if ($typeHandler !== false)
  					return $typeHandler;
  				//no typehandler found, throw exception
  				throw new \RuntimeException("No default type handler found for class '$classname'");
  	
  			case 'resource':
  				//unsupported, throw exception
  				throw new \RuntimeException("Argument of type 'resource' is not supported");
  
  			default:
  				//generic type
  				return $this->typeManager->getTypeHandler($type);
  		}
  	}
code_tokens: protected function getDefaultTypeHandler ( $ value ) { //get value type $ type = gettype ( $ value ) ; switch ( $ type ) { case 'null' : return null ; case 'array' : //check empty array if ( count ( $ value ) == 0 ) return null ; elseif ( count ( $ value ) == 1 ) //get first value type hanlder return $ this -> getDefaultTypeHandler ( current ( $ value ) ) ; $ typeHandler = null ; //obtain type by checking inner values foreach ( $ value as $ val ) { $ typeHandler = $ this -> getDefaultTypeHandler ( $ val ) ; //get type of the first not null value if ( ! is_null ( $ typeHandler ) ) break ; } return $ typeHandler ; case 'object' : //get object class $ classname = get_class ( $ value ) ; //use class as type $ typeHandler = $ this -> typeManager -> getTypeHandler ( $ classname ) ; if ( $ typeHandler !== false ) return $ typeHandler ; //no typehandler found, throw exception throw new \ RuntimeException ( "No default type handler found for class '$classname'" ) ; case 'resource' : //unsupported, throw exception throw new \ RuntimeException ( "Argument of type 'resource' is not supported" ) ; default : //generic type return $ this -> typeManager -> getTypeHandler ( $ type ) ; } }
docstring: Obtains the default type handler for a given value
  @param mixed $value
  @throws \RuntimeException
  @return NULL | TypeHandler
docstring_tokens: Obtains the default type handler for a given value