original_string: public function getInstance()
      {
          if (!$this->instance && $this->getType() && $this->getLocation()) {
              switch ($this->getType()) {
                  case static::TYPE_SQLITE:
                      $instance = $this->createPDOSQLite(
                          $this->getLocation(),
                          $this->getErrorMode()
                      );
                      $this->setInstance($instance);
                      break;
                  case static::TYPE_MYSQL:
                      if (!$this->getUsername() || !$this->getPassword() || !$this->getDatabase()) {
                          return null;
                      }
                      $instance = $this->createPDOMySQL(
                          $this->getLocation(),
                          $this->getDatabase(),
                          $this->getUsername(),
                          $this->getPassword(),
                          $this->getErrorMode(),
                          $this->getCharSet()
                      );
                      $this->setInstance($instance);
                      break;
                  default:
                      throw new \Parable\ORM\Exception("Database type was invalid: {$this->getType()}");
              }
          }
          return $this->instance;
      }
code: public function getInstance()
      {
          if (!$this->instance && $this->getType() && $this->getLocation()) {
              switch ($this->getType()) {
                  case static::TYPE_SQLITE:
                      $instance = $this->createPDOSQLite(
                          $this->getLocation(),
                          $this->getErrorMode()
                      );
                      $this->setInstance($instance);
                      break;
                  case static::TYPE_MYSQL:
                      if (!$this->getUsername() || !$this->getPassword() || !$this->getDatabase()) {
                          return null;
                      }
                      $instance = $this->createPDOMySQL(
                          $this->getLocation(),
                          $this->getDatabase(),
                          $this->getUsername(),
                          $this->getPassword(),
                          $this->getErrorMode(),
                          $this->getCharSet()
                      );
                      $this->setInstance($instance);
                      break;
                  default:
                      throw new \Parable\ORM\Exception("Database type was invalid: {$this->getType()}");
              }
          }
          return $this->instance;
      }
code_tokens: public function getInstance ( ) { if ( ! $ this -> instance && $ this -> getType ( ) && $ this -> getLocation ( ) ) { switch ( $ this -> getType ( ) ) { case static :: TYPE_SQLITE : $ instance = $ this -> createPDOSQLite ( $ this -> getLocation ( ) , $ this -> getErrorMode ( ) ) ; $ this -> setInstance ( $ instance ) ; break ; case static :: TYPE_MYSQL : if ( ! $ this -> getUsername ( ) || ! $ this -> getPassword ( ) || ! $ this -> getDatabase ( ) ) { return null ; } $ instance = $ this -> createPDOMySQL ( $ this -> getLocation ( ) , $ this -> getDatabase ( ) , $ this -> getUsername ( ) , $ this -> getPassword ( ) , $ this -> getErrorMode ( ) , $ this -> getCharSet ( ) ) ; $ this -> setInstance ( $ instance ) ; break ; default : throw new \ Parable \ ORM \ Exception ( "Database type was invalid: {$this->getType()}" ) ; } } return $ this -> instance ; }
docstring: Return the instance, and start one if needed.
  
  @return null|\PDO
  @throws \Parable\ORM\Exception
docstring_tokens: Return the instance and start one if needed .