-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace arachne/di-helpers with arachne/service-collections
- Loading branch information
Showing
5 changed files
with
73 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,15 @@ | |
|
||
namespace Arachne\Doctrine\EntityLoader; | ||
|
||
use Arachne\DIHelpers\ResolverInterface; | ||
use Doctrine\Common\Persistence\ManagerRegistry; | ||
|
||
/** | ||
* @author Jáchym Toušek <[email protected]> | ||
*/ | ||
class FilterInResolver implements ResolverInterface | ||
class FilterInResolver | ||
{ | ||
/** | ||
* @var ResolverInterface | ||
* @var callable | ||
*/ | ||
private $resolver; | ||
|
||
|
@@ -33,7 +32,7 @@ class FilterInResolver implements ResolverInterface | |
*/ | ||
private $filters; | ||
|
||
public function __construct(ResolverInterface $resolver, ManagerRegistry $managerRegistry) | ||
public function __construct(callable $resolver, ManagerRegistry $managerRegistry) | ||
{ | ||
$this->resolver = $resolver; | ||
$this->managerRegistry = $managerRegistry; | ||
|
@@ -44,9 +43,10 @@ public function __construct(ResolverInterface $resolver, ManagerRegistry $manage | |
* | ||
* @return FilterIn|null | ||
*/ | ||
public function resolve($name) | ||
public function __invoke($name) | ||
{ | ||
return $this->resolver->resolve($name) ?: (isset($this->filters[$name]) ? $this->filters[$name] : $this->filters[$name] = $this->create($name)); | ||
return call_user_func($this->resolver, $name) | ||
?: (isset($this->filters[$name]) ? $this->filters[$name] : $this->filters[$name] = $this->create($name)); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,15 @@ | |
|
||
namespace Arachne\Doctrine\EntityLoader; | ||
|
||
use Arachne\DIHelpers\ResolverInterface; | ||
use Doctrine\Common\Persistence\ManagerRegistry; | ||
|
||
/** | ||
* @author Jáchym Toušek <[email protected]> | ||
*/ | ||
class FilterOutResolver implements ResolverInterface | ||
class FilterOutResolver | ||
{ | ||
/** | ||
* @var ResolverInterface | ||
* @var callable | ||
*/ | ||
private $resolver; | ||
|
||
|
@@ -33,7 +32,7 @@ class FilterOutResolver implements ResolverInterface | |
*/ | ||
private $filters; | ||
|
||
public function __construct(ResolverInterface $resolver, ManagerRegistry $managerRegistry) | ||
public function __construct(callable $resolver, ManagerRegistry $managerRegistry) | ||
{ | ||
$this->resolver = $resolver; | ||
$this->managerRegistry = $managerRegistry; | ||
|
@@ -44,9 +43,10 @@ public function __construct(ResolverInterface $resolver, ManagerRegistry $manage | |
* | ||
* @return FilterOut|null | ||
*/ | ||
public function resolve($name) | ||
public function __invoke($name) | ||
{ | ||
return $this->resolver->resolve($name) ?: (isset($this->filters[$name]) ? $this->filters[$name] : $this->filters[$name] = $this->create($name)); | ||
return call_user_func($this->resolver, $name) | ||
?: (isset($this->filters[$name]) ? $this->filters[$name] : $this->filters[$name] = $this->create($name)); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters