Applied fixes from StyleCI

This commit is contained in:
Dominik Liebler
2015-12-21 07:28:20 -05:00
committed by StyleCI Bot
parent 3663603b80
commit fe1f144ec3
167 changed files with 510 additions and 517 deletions

View File

@@ -2,10 +2,8 @@
namespace DesignPatterns\Creational\Singleton;
use DesignPatterns\Creational\Singleton\SingletonPatternViolationException;
/**
* class Singleton
* class Singleton.
*/
class Singleton
{
@@ -13,16 +11,16 @@ class Singleton
* @var Singleton reference to singleton instance
*/
private static $instance;
/**
* gets the instance via lazy initialization (created on first usage)
* gets the instance via lazy initialization (created on first usage).
*
* @return self
*/
public static function getInstance()
{
if (null === static::$instance) {
static::$instance = new static;
static::$instance = new static();
}
return static::$instance;
@@ -30,28 +28,31 @@ class Singleton
/**
* is not allowed to call from outside: private!
*
*/
private function __construct()
{
}
/**
* prevent the instance from being cloned
* prevent the instance from being cloned.
*
* @throws SingletonPatternViolationException
*
* @return void
*/
public final function __clone()
final public function __clone()
{
throw new SingletonPatternViolationException('This is a Singleton. Clone is forbidden');
}
/**
* prevent from being unserialized
* prevent from being unserialized.
*
* @throws SingletonPatternViolationException
*
* @return void
*/
public final function __wakeup()
final public function __wakeup()
{
throw new SingletonPatternViolationException('This is a Singleton. __wakeup usage is forbidden');
}