original_string: public static function remove( $itemName )
      {
          $returnVar = true;
          if ( !is_dir( $itemName ) && file_exists( $itemName ) )
          {
              unlink( $itemName );
              return true;
          }
  
          if ( !file_exists( $itemName ) )
          {
              return true;
          }
  
          $dir = dir( $itemName );
          $item = $dir->read();
          while ( $item !== false )
          {
              if ( $item != '.' && $item != '..' )
              {
                  self::remove( $dir->path . DIRECTORY_SEPARATOR . $item );
                  $returnVar = false;
              }
              $item = $dir->read();
          }
  
          $dir->close();
          $returnVar = rmdir( $itemName ) && $returnVar ? true : false; // if rmdir succeeds and everything else succeeded
          return $returnVar;
      }
code: public static function remove( $itemName )
      {
          $returnVar = true;
          if ( !is_dir( $itemName ) && file_exists( $itemName ) )
          {
              unlink( $itemName );
              return true;
          }
  
          if ( !file_exists( $itemName ) )
          {
              return true;
          }
  
          $dir = dir( $itemName );
          $item = $dir->read();
          while ( $item !== false )
          {
              if ( $item != '.' && $item != '..' )
              {
                  self::remove( $dir->path . DIRECTORY_SEPARATOR . $item );
                  $returnVar = false;
              }
              $item = $dir->read();
          }
  
          $dir->close();
          $returnVar = rmdir( $itemName ) && $returnVar ? true : false; // if rmdir succeeds and everything else succeeded
          return $returnVar;
      }
code_tokens: public static function remove ( $ itemName ) { $ returnVar = true ; if ( ! is_dir ( $ itemName ) && file_exists ( $ itemName ) ) { unlink ( $ itemName ) ; return true ; } if ( ! file_exists ( $ itemName ) ) { return true ; } $ dir = dir ( $ itemName ) ; $ item = $ dir -> read ( ) ; while ( $ item !== false ) { if ( $ item != '.' && $ item != '..' ) { self :: remove ( $ dir -> path . DIRECTORY_SEPARATOR . $ item ) ; $ returnVar = false ; } $ item = $ dir -> read ( ) ; } $ dir -> close ( ) ; $ returnVar = rmdir ( $ itemName ) && $ returnVar ? true : false ; // if rmdir succeeds and everything else succeeded return $ returnVar ; }
docstring: Recursively removes a directory and its contents or a file.
  
  Returns true on success and false on error.
  
  @param string $itemName
  @return bool
docstring_tokens: Recursively removes a directory and its contents or a file .