Ejemplo n.º 1
0
 public function apply($code, MockConfiguration $config)
 {
     foreach ($config->getMethodsToMock() as $method) {
         if ($method->isPublic()) {
             $methodDef = 'public';
         } elseif ($method->isProtected()) {
             $methodDef = 'protected';
         } else {
             $methodDef = 'private';
         }
         if ($method->isStatic()) {
             $methodDef .= ' static';
         }
         $methodDef .= ' function ';
         $methodDef .= $method->returnsReference() ? ' & ' : '';
         $methodDef .= $method->getName();
         $methodDef .= $this->renderParams($method, $config);
         $methodDef .= $this->renderMethodBody($method, $config);
         $code = $this->appendToClass($code, $methodDef);
     }
     return $code;
 }