/** * 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()); }
/** * 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; }