original_string: protected function rebuild($path)
      {
          $uniqueName = str_replace('.', '', uniqid('', true)).'_'.md5(mt_rand());
          $className = 'Cms'.$uniqueName.'Class';
  
          $body = $this->object->code;
          $body = preg_replace('/^\s*function/m', 'public function', $body);
  
          $codeNamespaces = [];
          $pattern = '/(use\s+[a-z0-9_\\\\]+(\s+as\s+[a-z0-9_]+)?;\n?)/mi';
          preg_match_all($pattern, $body, $namespaces);
          $body = preg_replace($pattern, '', $body);
  
          $parentClass = $this->object->getCodeClassParent();
          if ($parentClass !== null) {
              $parentClass = ' extends '.$parentClass;
          }
  
          $fileContents = '<?php '.PHP_EOL;
  
          foreach ($namespaces[0] as $namespace) {
              $fileContents .= $namespace;
          }
  
          $fileContents .= 'class '.$className.$parentClass.PHP_EOL;
          $fileContents .= '{'.PHP_EOL;
          $fileContents .= $body.PHP_EOL;
          $fileContents .= '}'.PHP_EOL;
  
          $this->validate($fileContents);
  
          $this->makeDirectorySafe(dirname($path));
  
          $this->writeContentSafe($path, $fileContents);
  
          return $className;
      }
code: protected function rebuild($path)
      {
          $uniqueName = str_replace('.', '', uniqid('', true)).'_'.md5(mt_rand());
          $className = 'Cms'.$uniqueName.'Class';
  
          $body = $this->object->code;
          $body = preg_replace('/^\s*function/m', 'public function', $body);
  
          $codeNamespaces = [];
          $pattern = '/(use\s+[a-z0-9_\\\\]+(\s+as\s+[a-z0-9_]+)?;\n?)/mi';
          preg_match_all($pattern, $body, $namespaces);
          $body = preg_replace($pattern, '', $body);
  
          $parentClass = $this->object->getCodeClassParent();
          if ($parentClass !== null) {
              $parentClass = ' extends '.$parentClass;
          }
  
          $fileContents = '<?php '.PHP_EOL;
  
          foreach ($namespaces[0] as $namespace) {
              $fileContents .= $namespace;
          }
  
          $fileContents .= 'class '.$className.$parentClass.PHP_EOL;
          $fileContents .= '{'.PHP_EOL;
          $fileContents .= $body.PHP_EOL;
          $fileContents .= '}'.PHP_EOL;
  
          $this->validate($fileContents);
  
          $this->makeDirectorySafe(dirname($path));
  
          $this->writeContentSafe($path, $fileContents);
  
          return $className;
      }
code_tokens: protected function rebuild ( $ path ) { $ uniqueName = str_replace ( '.' , '' , uniqid ( '' , true ) ) . '_' . md5 ( mt_rand ( ) ) ; $ className = 'Cms' . $ uniqueName . 'Class' ; $ body = $ this -> object -> code ; $ body = preg_replace ( '/^\s*function/m' , 'public function' , $ body ) ; $ codeNamespaces = [ ] ; $ pattern = '/(use\s+[a-z0-9_\\\\]+(\s+as\s+[a-z0-9_]+)?;\n?)/mi' ; preg_match_all ( $ pattern , $ body , $ namespaces ) ; $ body = preg_replace ( $ pattern , '' , $ body ) ; $ parentClass = $ this -> object -> getCodeClassParent ( ) ; if ( $ parentClass !== null ) { $ parentClass = ' extends ' . $ parentClass ; } $ fileContents = '<?php ' . PHP_EOL ; foreach ( $ namespaces [ 0 ] as $ namespace ) { $ fileContents .= $ namespace ; } $ fileContents .= 'class ' . $ className . $ parentClass . PHP_EOL ; $ fileContents .= '{' . PHP_EOL ; $ fileContents .= $ body . PHP_EOL ; $ fileContents .= '}' . PHP_EOL ; $ this -> validate ( $ fileContents ) ; $ this -> makeDirectorySafe ( dirname ( $ path ) ) ; $ this -> writeContentSafe ( $ path , $ fileContents ) ; return $ className ; }
docstring: Rebuilds the current file cache.
  @param string The path in which the cached file should be stored
docstring_tokens: Rebuilds the current file cache .