/**
  * @param PhpMethod $a
  * @param PhpMethod $b
  */
 public function compare($a, $b)
 {
     if ($a->isStatic() !== ($isStatic = $b->isStatic())) {
         return $isStatic ? 1 : -1;
     }
     if (($aV = $a->getVisibility()) !== ($bV = $b->getVisibility())) {
         $aV = 'public' === $aV ? 3 : ('protected' === $aV ? 2 : 1);
         $bV = 'public' === $bV ? 3 : ('protected' === $bV ? 2 : 1);
         return $aV > $bV ? -1 : 1;
     }
     return strcasecmp($a->getName(), $b->getName());
 }
 public function visitMethod(PhpMethod $method)
 {
     $this->visitDocblock($method->getDocblock());
     if ($method->isAbstract()) {
         $this->writer->write('abstract ');
     }
     $this->writer->write($method->getVisibility() . ' ');
     if ($method->isStatic()) {
         $this->writer->write('static ');
     }
     $this->writer->write('function ');
     if ($method->isReferenceReturned()) {
         $this->writer->write('& ');
     }
     $this->writer->write($method->getName() . '(');
     $this->writeParameters($method->getParameters());
     $this->writer->write(")");
     $this->writeFunctionReturnType($method->getType());
     if ($method->isAbstract() || $method->getParent() instanceof PhpInterface) {
         $this->writer->write(";\n\n");
         return;
     }
     $this->writer->writeln(' {')->indent()->writeln(trim($method->getBody()))->outdent()->rtrim()->write("}\n\n");
 }