public function findByDirectory(Dir $directoryInPackage) {
    foreach ($this->packages as $package) {
      if ($directoryInPackage->isSubdirectoryOf($package->getRootDirectory())
          || $directoryInPackage->equals($package->getRootDirectory())
         ) {
        return $package;
      }
    }
  }
public function findByDirectory(Dir $directoryInPackage) {
    foreach ($this->packages as $package) {
      if ($directoryInPackage->isSubdirectoryOf($package->getRootDirectory())
          || $directoryInPackage->equals($package->getRootDirectory())
         ) {
        return $package;
      }
    }
  }
public function findByDirectory ( Dir $ directoryInPackage ) { foreach ( $ this -> packages as $ package ) { if ( $ directoryInPackage -> isSubdirectoryOf ( $ package -> getRootDirectory ( ) ) || $ directoryInPackage -> equals ( $ package -> getRootDirectory ( ) ) ) { return $ package ; } } }
Returns a package by some of its sub directories

@return Package|NULL
Returns a package by some of its sub directories