Created
          February 19, 2015 03:30 
        
      - 
      
- 
        Save taion809/8c07fac007159ea8d7d3 to your computer and use it in GitHub Desktop. 
    Type resolver
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /** | |
| * Created by PhpStorm. | |
| * User: njohns | |
| * Date: 1/4/15 | |
| * Time: 9:49 AM | |
| */ | |
| namespace Rql\Types; | |
| class TypeResolver | |
| { | |
| /** | |
| * @param $type | |
| * @return \Rql\Datum | |
| */ | |
| public static function resolve($type = null) | |
| { | |
| if(is_null($type)) { | |
| return new Null(); | |
| } | |
| if(is_string($type)) { | |
| return new String($type); | |
| } | |
| if(is_bool($type)) { | |
| return new Boolean($type); | |
| } | |
| if(is_numeric($type)) { | |
| return new Number($type); | |
| } | |
| if(is_array($type)) { | |
| return new ArrayType($type); | |
| } | |
| if(is_object($type)) { | |
| return new ObjectType($type); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment