original_string: public function refine($role) {
          $fileSource = $role->getFileSpecification()->getSource();
          $parser = (new fphp\Helper\PhpParser())->parseFile($fileSource);
          $ast = $parser->getAst();
          $class = $parser->getExactlyOneClass($fileSource);
  
          if (!$this->targetClass) { // not refining, but defining the target class
              $this->targetClass = $class->name;
              $this->mangleClassName($class, $role);
          } else { // refining
              if ($class->name !== $this->targetClass)
                  throw new ClassComposerException("\"$fileSource\" refines \"$class->name\" (expected \"$this->targetClass\")");
              if ($class->extends)
                  throw new ClassComposerException("refining role at \"$fileSource\" may not extend a class");
              
              $this->mangleClassName($class, $role);
              $this->extendClass($class);
          }
          
          return new ClassComposer($this->targetClass, $class->name, array_merge($this->ast, $ast));
      }
code: public function refine($role) {
          $fileSource = $role->getFileSpecification()->getSource();
          $parser = (new fphp\Helper\PhpParser())->parseFile($fileSource);
          $ast = $parser->getAst();
          $class = $parser->getExactlyOneClass($fileSource);
  
          if (!$this->targetClass) { // not refining, but defining the target class
              $this->targetClass = $class->name;
              $this->mangleClassName($class, $role);
          } else { // refining
              if ($class->name !== $this->targetClass)
                  throw new ClassComposerException("\"$fileSource\" refines \"$class->name\" (expected \"$this->targetClass\")");
              if ($class->extends)
                  throw new ClassComposerException("refining role at \"$fileSource\" may not extend a class");
              
              $this->mangleClassName($class, $role);
              $this->extendClass($class);
          }
          
          return new ClassComposer($this->targetClass, $class->name, array_merge($this->ast, $ast));
      }
code_tokens: public function refine ( $ role ) { $ fileSource = $ role -> getFileSpecification ( ) -> getSource ( ) ; $ parser = ( new fphp \ Helper \ PhpParser ( ) ) -> parseFile ( $ fileSource ) ; $ ast = $ parser -> getAst ( ) ; $ class = $ parser -> getExactlyOneClass ( $ fileSource ) ; if ( ! $ this -> targetClass ) { // not refining, but defining the target class $ this -> targetClass = $ class -> name ; $ this -> mangleClassName ( $ class , $ role ) ; } else { // refining if ( $ class -> name !== $ this -> targetClass ) throw new ClassComposerException ( "\"$fileSource\" refines \"$class->name\" (expected \"$this->targetClass\")" ) ; if ( $ class -> extends ) throw new ClassComposerException ( "refining role at \"$fileSource\" may not extend a class" ) ; $ this -> mangleClassName ( $ class , $ role ) ; $ this -> extendClass ( $ class ) ; } return new ClassComposer ( $ this -> targetClass , $ class -> name , array_merge ( $ this -> ast , $ ast ) ) ; }
docstring: Returns a new class composer containing a role's refinements.
  @param Role $role
  @return ClassComposer
docstring_tokens: Returns a new class composer containing a role s refinements .