SensioLabs\Deptrac\DependencyResult::addInheritDependency PHP Method

addInheritDependency() public method

public addInheritDependency ( SensioLabs\Deptrac\DependencyResult\DependencyInterface $dependency )
$dependency SensioLabs\Deptrac\DependencyResult\DependencyInterface
    public function addInheritDependency(DependencyInterface $dependency)
    {
        if (!isset($this->inheritDependencies[$dependency->getClassA()])) {
            $this->inheritDependencies[$dependency->getClassA()] = [];
        }
        $this->inheritDependencies[$dependency->getClassA()][] = $dependency;
        return $this;
    }

Usage Example

 public function testGetDependenciesAndInheritDependencies()
 {
     $dependencyResult = new DependencyResult();
     $dependencyResult->addDependency($dep1 = new DependencyResult\Dependency('A', 12, 'B'));
     $dependencyResult->addInheritDependency($dep2 = new DependencyResult\Dependency('A', 12, 'B'));
     $this->assertEquals([$dep1, $dep2], $dependencyResult->getDependenciesAndInheritDependencies());
 }
All Usage Examples Of SensioLabs\Deptrac\DependencyResult::addInheritDependency