add() public method

All resources passed to this method must implement {@link PuliResource}.
public add ( string $path, Puli\Repository\Api\Resource\PuliResource | Puli\Repository\Api\ResourceCollection $resource )
$path string The path at which to add the resource.
$resource Puli\Repository\Api\Resource\PuliResource | Puli\Repository\Api\ResourceCollection The resource(s) to add at that path.
 private function addInOrder(array $filesystemPaths)
 {
     foreach ($filesystemPaths as $packageName => $filesystemPathsByRepoPath) {
         foreach ($filesystemPathsByRepoPath as $repoPath => $filesystemPaths) {
             foreach ($filesystemPaths as $filesystemPath) {
                 $this->repo->add($repoPath, $this->createResource($filesystemPath));
             }
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     // Quit if no mappings exist
     if (!($packageNames = $this->mappings->getPackageNames())) {
         return;
     }
     $sortedNames = $this->overrideGraph->getSortedPackageNames($packageNames);
     try {
         foreach ($sortedNames as $packageName) {
             foreach ($this->getEnabledMappingsByPackageName($packageName) as $repositoryPath => $mapping) {
                 foreach ($mapping->getFilesystemPaths() as $filesystemPath) {
                     $this->repo->add($repositoryPath, $this->createResource($filesystemPath));
                     $this->added = true;
                 }
             }
         }
     } catch (Exception $e) {
         $this->repo->clear();
         throw $e;
     }
 }
 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'));
 }