Skip to content

Commit

Permalink
Adding optional constructor param for DI
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmuse committed Jan 25, 2014
1 parent 006fbdb commit 2f16574
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Artdarek/OAuth/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ class OAuth

/**
* Constructor
*
* @param ServiceFactory $service_factory Optional dependency injection.
* If not provided, a ServiceFactory instance will be constructed.
*/
public function __construct() {
public function __construct(ServiceFactory $serviceFactory = null) {

// create a service factory
$this->serviceFactory = new ServiceFactory();
if (null === $serviceFactory) {
// Create the service factory
$serviceFactory = new ServiceFactory();
}

$this->serviceFactory = $serviceFactory;

}

Expand Down

0 comments on commit 2f16574

Please sign in to comment.