intercept() public method

Registers current class as the PHP file stream wrapper.
public intercept ( ) : void
return void
Esempio n. 1
0
 /**
  * @inheritDoc
  */
 public function enable(\Closure $requestCallback)
 {
     Assertion::isCallable($requestCallback, 'No valid callback for handling requests defined.');
     if (static::$status == self::ENABLED) {
         return;
     }
     $this->codeTransformer->register();
     $this->processor->appendCodeTransformer($this->codeTransformer);
     $this->processor->intercept();
     self::$requestCallback = $requestCallback;
     static::$status = self::ENABLED;
 }
Esempio n. 2
0
 /**
  * @inheritDoc
  */
 public function enable(\Closure $requestCallback)
 {
     self::$codeTransformer->register();
     self::$processor->appendCodeTransformer(self::$codeTransformer);
     self::$processor->intercept();
     Assertion::isCallable($requestCallback, 'No valid callback for handling requests defined.');
     self::$requestCallback = $requestCallback;
     stream_wrapper_unregister('http');
     stream_wrapper_register('http', __CLASS__, STREAM_IS_URL);
     stream_wrapper_unregister('https');
     stream_wrapper_register('https', __CLASS__, STREAM_IS_URL);
     $this->status = self::ENABLED;
 }