Created
June 17, 2014 23:01
-
-
Save mishak87/13ea6be081e217de06bb to your computer and use it in GitHub Desktop.
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
<?php | |
namespace App; | |
use Nette; | |
class ProviderCollector extends Nette\Object | |
{ | |
/** @var string[] */ | |
private $providers; | |
/** | |
* @param string[] $providers | |
*/ | |
public function __construct($providers) | |
{ | |
$this->providers = $providers; | |
} | |
} |
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
<?php | |
namespace App; | |
use Kdyby\Aop; | |
use Kdyby\Aop\JoinPoint\BeforeMethod; | |
use Nette; | |
class ProviderCollectorAspect extends Nette\Object | |
{ | |
public $blacklist = ['A', 'B']; | |
/** | |
* @Aop\Before("method(App\ProviderCollector->__construct)") | |
*/ | |
public function construct(BeforeMethod $joinPoint) | |
{ | |
$joinPoint->setArgument(0, array_filter($joinPoint->getArguments()[0], function ($provider) { | |
return !in_array($provider, $this->blacklist, TRUE); | |
})); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment