Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1.  public static function getInstance()
  2.     {
  3.        // o que seria isso?
  4.        // nΓ£o deveria estar no corpo da classe?
  5.         static $instance = null;
  6.         if (null === $instance) {
  7.            // nΓ£o estΓ‘ persistindo para static::$instance
  8.             $instance = new static();
  9.         }
  10.  
  11.       // deveria ser static::$instance
  12.         return $instance;
  13.     }
  14.  
  15.  
  16. // o correto seria:
  17. static $instance = null;
  18.  public static function getInstance()
  19.     {        
  20.         if (null === static::$instance) {
  21.             static::$instance = new static();
  22.         }
  23.         return static::$instance;
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement