Puli\Repository\Api\EditableRepository::clear PHP Method

clear() public method

Removes all resources from the repository.
public clear ( ) : integer
return integer The number of resources removed from the repository.
    public function clear();

Usage Example

 public function testClear()
 {
     $this->repo->add('/webmozart/puli/file1', new TestFile());
     $this->repo->add('/webmozart/puli/file2', new TestFile());
     $this->assertTrue($this->repo->contains('/'));
     $this->assertTrue($this->repo->contains('/webmozart'));
     $this->assertTrue($this->repo->contains('/webmozart/puli'));
     $this->assertTrue($this->repo->contains('/webmozart/puli/file1'));
     $this->assertTrue($this->repo->contains('/webmozart/puli/file2'));
     $this->assertSame(4, $this->repo->clear());
     $this->assertTrue($this->repo->contains('/'));
     $this->assertFalse($this->repo->contains('/webmozart'));
     $this->assertFalse($this->repo->contains('/webmozart/puli'));
     $this->assertFalse($this->repo->contains('/webmozart/puli/file1'));
     $this->assertFalse($this->repo->contains('/webmozart/puli/file2'));
 }
All Usage Examples Of Puli\Repository\Api\EditableRepository::clear
EditableRepository