Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
Solved the Singleton problem
Browse files Browse the repository at this point in the history
  • Loading branch information
AliGhaleyan committed Mar 3, 2020
1 parent 868771a commit e2a704a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
18 changes: 2 additions & 16 deletions src/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,12 @@ abstract class BaseType
*
* private construct for singleton
*/
private function __construct()
public function __construct()
{
//
}


/**
* get new instance of this
*
* @return static
*/
public static function getInstance()
{
if (self::$instance == null)
self::$instance = new static();

return self::$instance;
}


/**
* fetch and set from config (array)
*
Expand Down Expand Up @@ -173,7 +159,7 @@ public function useFileNameToUpload($status = true)
* and if not set these when set
* then return handle method
*
* @param \Illuminate\Http\File $file
* @param $file
* @return mixed
*/
public function upload($file)
Expand Down
2 changes: 1 addition & 1 deletion src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function type($type = null)

/** @var BaseType $providerClass */
$providerClass = $config['provider'];
$providerClass = $providerClass::getInstance();
$providerClass = new $providerClass;
$providerClass->setType($type)
->setConfig($config)
->fetchProperties();
Expand Down

0 comments on commit e2a704a

Please sign in to comment.