original_string: protected function manipulateRootPackage(array $packages, int $type, array $requires): array
      {
          if ($type === self::ADD) {
              foreach ($packages as $packageName => $version) {
                  $requires[$packageName] = new Link(
                      '__root__',
                      $packageName,
                      (new VersionParser())->parseConstraints($version),
                      'relates to',
                      $version
                  );
              }
          } elseif ($type === self::REMOVE) {
              foreach ($packages as $packageName => $version) {
                  unset($requires[$packageName]);
              }
          }
  
          return $requires;
      }
code: protected function manipulateRootPackage(array $packages, int $type, array $requires): array
      {
          if ($type === self::ADD) {
              foreach ($packages as $packageName => $version) {
                  $requires[$packageName] = new Link(
                      '__root__',
                      $packageName,
                      (new VersionParser())->parseConstraints($version),
                      'relates to',
                      $version
                  );
              }
          } elseif ($type === self::REMOVE) {
              foreach ($packages as $packageName => $version) {
                  unset($requires[$packageName]);
              }
          }
  
          return $requires;
      }
code_tokens: protected function manipulateRootPackage ( array $ packages , int $ type , array $ requires ) : array { if ( $ type === self :: ADD ) { foreach ( $ packages as $ packageName => $ version ) { $ requires [ $ packageName ] = new Link ( '__root__' , $ packageName , ( new VersionParser ( ) ) -> parseConstraints ( $ version ) , 'relates to' , $ version ) ; } } elseif ( $ type === self :: REMOVE ) { foreach ( $ packages as $ packageName => $ version ) { unset ( $ requires [ $ packageName ] ) ; } } return $ requires ; }
docstring: Manipulates the given requires with the new added packages.
  
  @param array $packages
  @param int   $type
  @param array $requires
  
  @return array
docstring_tokens: Manipulates the given requires with the new added packages .