Kahlan\Jit\Interceptor::instance PHP Method

instance() public static method

Returns the interceptor autoloader instance.
public static instance ( ) : object | null
return object | null
    public static function instance()
    {
        return static::$_interceptor;
    }

Usage Example

Example #1
0
 /**
  * The Constructor.
  *
  * @param array $config Possible options values are:
  *                    - `'driver'` _object_: the driver instance which will log the coverage data.
  *                    - `'path'`   _array_ : the path(s) which contain the code source files.
  *                    - `'base'`   _string_: the base path of the repo (default: `getcwd`).
  *                    - `'prefix'` _string_: some prefix to remove to get the real file path.
  */
 public function __construct($config = [])
 {
     $defaults = ['driver' => null, 'path' => [], 'include' => '*.php', 'exclude' => [], 'type' => 'file', 'skipDots' => true, 'leavesOnly' => false, 'followSymlinks' => true, 'recursive' => true, 'base' => getcwd()];
     $config += $defaults;
     if (Interceptor::instance()) {
         $config += ['prefix' => rtrim(Interceptor::instance()->cachePath(), DS)];
     } else {
         $config += ['prefix' => ''];
     }
     $this->_driver = $config['driver'];
     $this->_paths = (array) $config['path'];
     $this->_base = $config['base'];
     $this->_prefix = $config['prefix'];
     $files = Dir::scan($this->_paths, $config);
     foreach ($files as $file) {
         $this->_coverage[realpath($file)] = [];
     }
 }
All Usage Examples Of Kahlan\Jit\Interceptor::instance