original_string: public function replaceName($name)
      {
          $atoms = $this->atoms();
          $numAtoms = count($atoms);
  
          if ($numAtoms > 0) {
              if ('' === $name) {
                  array_pop($atoms);
              } else {
                  $atoms[$numAtoms - 1] = $name;
              }
          } elseif ('' !== $name) {
              $atoms[] = $name;
          }
  
          return $this->createPath(
              $atoms,
              $this instanceof AbsolutePathInterface,
              false
          );
      }
code: public function replaceName($name)
      {
          $atoms = $this->atoms();
          $numAtoms = count($atoms);
  
          if ($numAtoms > 0) {
              if ('' === $name) {
                  array_pop($atoms);
              } else {
                  $atoms[$numAtoms - 1] = $name;
              }
          } elseif ('' !== $name) {
              $atoms[] = $name;
          }
  
          return $this->createPath(
              $atoms,
              $this instanceof AbsolutePathInterface,
              false
          );
      }
code_tokens: public function replaceName ( $ name ) { $ atoms = $ this -> atoms ( ) ; $ numAtoms = count ( $ atoms ) ; if ( $ numAtoms > 0 ) { if ( '' === $ name ) { array_pop ( $ atoms ) ; } else { $ atoms [ $ numAtoms - 1 ] = $ name ; } } elseif ( '' !== $ name ) { $ atoms [ ] = $ name ; } return $ this -> createPath ( $ atoms , $ this instanceof AbsolutePathInterface , false ) ; }
docstring: Replace this path's name.
  
  @param string $name The new path name.
  
  @return PathInterface A new path instance with the supplied name replacing the existing one.
docstring_tokens: Replace this path s name .