예제 #1
0
 /**
  * Tests that the {@link PHP_Depend_Code_Function::getPackage()} returns as
  * default value <b>null</b> and that the package could be set and unset.
  *
  * @return void
  */
 public function testGetSetPackage()
 {
     $package = new PHP_Depend_Code_Package('package');
     $function = new PHP_Depend_Code_Function('func');
     $function->setPackage($package);
     $this->assertSame($package, $function->getPackage());
 }
예제 #2
0
파일: Package.php 프로젝트: noelg/pdepend
 /**
  * Adds the given function to this package and returns the input instance.
  *
  * @param PHP_Depend_Code_Function $function The new package function.
  *
  * @return PHP_Depend_Code_Function
  */
 public function addFunction(PHP_Depend_Code_Function $function)
 {
     if ($function->getPackage() !== null) {
         $function->getPackage()->removeFunction($function);
     }
     // Set this as function package
     $function->setPackage($this);
     // Append function to internal list
     $this->functions[] = $function;
     return $function;
 }