Neos\Flow\Package\Package::setProtected PHP Method

setProtected() public method

Sets the protection flag of the package
public setProtected ( boolean $protected ) : void
$protected boolean TRUE if the package should be protected, otherwise FALSE
return void
    public function setProtected($protected)
    {
        $this->protected = (bool) $protected;
    }

Usage Example

 /**
  * @test
  */
 public function aPackageCanBeFlaggedAsProtected()
 {
     $packagePath = 'vfs://Packages/Application/Vendor/Dummy/';
     mkdir($packagePath, 0700, true);
     file_put_contents($packagePath . 'composer.json', '{"name": "vendor/dummy", "type": "flow-test"}');
     $package = new Package('Vendor.Dummy', 'vendor/dummy', $packagePath);
     $this->assertFalse($package->isProtected());
     $package->setProtected(true);
     $this->assertTrue($package->isProtected());
 }