示例#1
0
 /**
  * Adds an interceptor to apply to values coming from object accessors.
  *
  * @param InterceptorInterface $interceptor
  * @param \SplObjectStorage[] $interceptorArray
  * @return void
  */
 protected function addInterceptorToArray(InterceptorInterface $interceptor, array &$interceptorArray)
 {
     foreach ($interceptor->getInterceptionPoints() as $interceptionPoint) {
         if (!isset($interceptorArray[$interceptionPoint])) {
             $interceptorArray[$interceptionPoint] = new \SplObjectStorage();
         }
         $interceptors = $interceptorArray[$interceptionPoint];
         if (!$interceptors->contains($interceptor)) {
             $interceptors->attach($interceptor);
         }
     }
 }
 /**
  * Adds an interceptor to apply to values coming from object accessors.
  *
  * @param InterceptorInterface $interceptor
  * @return void
  */
 public function addInterceptor(InterceptorInterface $interceptor)
 {
     foreach ($interceptor->getInterceptionPoints() as $interceptionPoint) {
         if (!isset($this->interceptors[$interceptionPoint])) {
             $this->interceptors[$interceptionPoint] = new \SplObjectStorage();
         }
         /** @var $interceptors \SplObjectStorage */
         $interceptors = $this->interceptors[$interceptionPoint];
         if (!$interceptors->contains($interceptor)) {
             $interceptors->attach($interceptor);
         }
     }
 }