original_string: public function replaceText($search, $replace)
      {
          if (!$this->open('r+')) {
              return false;
          }
  
          if ($this->lock !== null && flock($this->handle, LOCK_EX) === false) {
              return false;
          }
  
          $replaced = $this->write(str_replace($search, $replace, $this->read()), 'w', true);
  
          if ($this->lock !== null) {
              flock($this->handle, LOCK_UN);
          }
          $this->close();
  
          return $replaced;
      }
code: public function replaceText($search, $replace)
      {
          if (!$this->open('r+')) {
              return false;
          }
  
          if ($this->lock !== null && flock($this->handle, LOCK_EX) === false) {
              return false;
          }
  
          $replaced = $this->write(str_replace($search, $replace, $this->read()), 'w', true);
  
          if ($this->lock !== null) {
              flock($this->handle, LOCK_UN);
          }
          $this->close();
  
          return $replaced;
      }
code_tokens: public function replaceText ( $ search , $ replace ) { if ( ! $ this -> open ( 'r+' ) ) { return false ; } if ( $ this -> lock !== null && flock ( $ this -> handle , LOCK_EX ) === false ) { return false ; } $ replaced = $ this -> write ( str_replace ( $ search , $ replace , $ this -> read ( ) ) , 'w' , true ) ; if ( $ this -> lock !== null ) { flock ( $ this -> handle , LOCK_UN ) ; } $ this -> close ( ) ; return $ replaced ; }
docstring: Searches for a given text and replaces the text if found.
  
  @param string|array $search Text(s) to search for.
  @param string|array $replace Text(s) to replace with.
  @return bool Success
docstring_tokens: Searches for a given text and replaces the text if found .