예제 #1
0
 /**
  * ResourceLimitVoter constructor.
  */
 public function __construct(array $config = [])
 {
     $requiredConfig = ['supportedClass', 'limit', 'count'];
     $config = array_replace(['supportsResource' => Fn\always()], $config);
     foreach ($requiredConfig as $key) {
         if (!isset($config[$key])) {
             throw new \InvalidArgumentException("ResourceLimitVoter `{$key}` config missing.");
         }
     }
     $this->supportedClass = $config['supportedClass'];
     $this->_supportsResource = $config['supportsResource'];
     $this->_getLimit = $config['limit'];
     $this->_getCount = $config['count'];
 }
예제 #2
0
파일: FnTest.php 프로젝트: aerisweather/Fn
 /** @test */
 public function method_always()
 {
     $always = Fn\always();
     $this->assertTrue($always());
     $this->assertTrue($always(true));
     $this->assertTrue($always(false));
 }