예제 #1
0
파일: Default.php 프로젝트: noelg/pdepend
 /**
  * Returns an iterator with all generated {@link PHP_Depend_Code_Package}
  * objects.
  *
  * @return PHP_Depend_Code_NodeIterator
  */
 public function getPackages()
 {
     // Create a package array copy
     $packages = $this->_packages;
     // Remove default package if empty
     if ($this->defaultPackage->getTypes()->count() === 0 && $this->defaultPackage->getFunctions()->count() === 0) {
         unset($packages[self::DEFAULT_PACKAGE]);
     }
     return new PHP_Depend_Code_NodeIterator($packages);
 }
예제 #2
0
 /**
  * Returns an iterator with all generated {@link PHP_Depend_Code_Package}
  * objects.
  *
  * @return PHP_Depend_Code_NodeIterator
  * @since 0.9.12
  */
 private function _getPreparedPackages()
 {
     // Create a package array copy
     $packages = $this->_packages;
     // Remove default package if empty
     if ($this->defaultPackage->getTypes()->count() === 0 && $this->defaultPackage->getFunctions()->count() === 0) {
         unset($packages[self::DEFAULT_PACKAGE]);
     }
     return $packages;
 }
예제 #3
0
 /**
  * Tests that the {@link PHP_Depend_Code_Package::removeType()} method unsets
  * the package in the {@link PHP_Depend_Code_Class} object and it tests the
  * iterator to contain the new class.
  *
  * @return void
  * @covers PHP_Depend_Code_Package
  * @group pdepend
  * @group pdepend::code
  * @group unittest
  */
 public function testRemoveType()
 {
     $package = new PHP_Depend_Code_Package('package1');
     $class1 = new PHP_Depend_Code_Class('Class1', 0, 'class1.php');
     $class2 = new PHP_Depend_Code_Class('Class2', 0, 'class2.php');
     $package->addType($class1);
     $package->addType($class2);
     $package->removeType($class2);
     $this->assertNull($class2->getPackage());
     $this->assertEquals(1, $package->getTypes()->count());
 }
예제 #4
0
 /**
  * Tests that the {@link PHP_Depend_Code_Package::removeType()} method unsets
  * the package in the {@link PHP_Depend_Code_Class} object and it tests the
  * iterator to contain the new class.
  *
  * @return void
  */
 public function testRemoveType()
 {
     $package = new PHP_Depend_Code_Package('package1');
     $class2 = new PHP_Depend_Code_Class('Class2', 0, 'class2.php');
     $package->addType($class2);
     $package->removeType($class2);
     self::assertEquals(0, $package->getTypes()->count());
 }