Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2. class Banco
  3. {
  4.     private $dsn;
  5.     private $usuario;
  6.     private $senha;
  7.    
  8.     public function setDsn($d)
  9.     {
  10.         $this->dsn = $d;
  11.         return $this;
  12.     }
  13.    
  14.     public function getDsn()
  15.     {
  16.         return $this->dsn;
  17.     }
  18.    
  19.     public function setUsuario($u)
  20.     {
  21.         $this->user = $u;
  22.         return $this;
  23.     }
  24.    
  25.     public function getUsuario()
  26.     {
  27.         return $this->usuario;
  28.     }
  29.    
  30.     public function setSenha($s)
  31.     {
  32.         $this->senha = $s;
  33.         return $this;
  34.     }
  35.    
  36.     public function getSenha()
  37.     {
  38.         return $this->senha;
  39.     }
  40.    
  41.     public function novaConexao()
  42.     {
  43.         $user = $this->getUsuario();
  44.         $pass = $this->getSenha();
  45.         return new Pdo($this->getDsn(), $user, $pass);
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement