TQ\Git\StreamWrapper\StreamWrapper::register PHP Method

register() public static method

Registers the stream wrapper with the given protocol
public static register ( string $protocol, Binary | string | null | TQ\Vcs\StreamWrapper\PathFactoryInterface $binary = null )
$protocol string The protocol (such as "git")
$binary TQ\Git\Cli\Binary | string | null | TQ\Vcs\StreamWrapper\PathFactoryInterface The Git binary or a path factory
    public static function register($protocol, $binary = null)
    {
        $bufferFactory = Factory::getDefault();
        if ($binary instanceof PathFactoryInterface) {
            $pathFactory = $binary;
        } else {
            $binary = Binary::ensure($binary);
            $pathFactory = new PathFactory($protocol, $binary, null);
        }
        parent::doRegister($protocol, $pathFactory, $bufferFactory);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Helper::removeDirectory(TESTS_TMP_PATH);
     mkdir(TESTS_TMP_PATH, 0777, true);
     mkdir(TESTS_REPO_PATH_1, 0777, true);
     exec(sprintf('cd %s && %s init', escapeshellarg(TESTS_REPO_PATH_1), GIT_BINARY));
     clearstatcache();
     StreamWrapper::register('git', new Binary(GIT_BINARY));
 }
All Usage Examples Of TQ\Git\StreamWrapper\StreamWrapper::register
StreamWrapper