Puli\Manager\Api\Repository\PathMapping::isEnabled PHP Method

isEnabled() public method

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
See also: PathMappingState::ENABLED
public isEnabled ( ) : boolean
return boolean Returns `true` if the state is {@link PathMappingState::ENABLED}.
    public function isEnabled()
    {
        if (null === $this->state) {
            throw new NotLoadedException('The mapping is not loaded.');
        }
        return PathMappingState::ENABLED === $this->state;
    }

Usage Example

Beispiel #1
0
 public function testLoadStoresErrorIfPackageNotFound()
 {
     $mapping = new PathMapping('/path', array('@foo:resources', 'assets'));
     $mapping->load($this->package1, $this->packages);
     $this->assertSame(array('@foo:resources', 'assets'), $mapping->getPathReferences());
     $this->assertSame(array($this->packageDir1 . '/assets'), $mapping->getFilesystemPaths());
     // there's at least one found path, so the mapping is still enabled
     $this->assertTrue($mapping->isEnabled());
     $loadErrors = $mapping->getLoadErrors();
     $this->assertCount(1, $loadErrors);
     $this->assertInstanceOf('Puli\\Manager\\Api\\Package\\NoSuchPackageException', $loadErrors[0]);
 }
All Usage Examples Of Puli\Manager\Api\Repository\PathMapping::isEnabled