/**
  * @param ReflectionClass $sus
  * @param Params          $params
  * @param Reporter        $reporter
  */
 public function check(ReflectionClass $sus, Params $params, Reporter $reporter)
 {
     foreach ($sus->getMethods($params->getFilterMethods()) as $method) {
         $lineSize = $method->getEndLine() - $method->getStartLine();
         if ($lineSize > $params->getMethodSize()) {
             $reporter->act($sus, self::class, "{$method->getName()}() size is {$lineSize} lines long", 'Method size');
         }
     }
 }
 function it_calculates_the_number_of_lines_in_a_method(ReflectionClass $sus, Params $params, ReflectionMethod $method, Reporter $reporter)
 {
     $method->getStartLine()->willReturn(self::START_LINE);
     $method->getEndLine()->willReturn(self::END_LINE);
     $method->getName()->willReturn('method_size_1');
     $sus->getMethods(0)->willReturn([$method]);
     $reporter->act($sus, 'Elfiggo\\Brobdingnagian\\Detector\\MethodSize', 'method_size_1() size is 40 lines long', 'Method size')->willThrow(MethodSizeTooLarge::class);
     $params->getMethodSize()->willReturn(15);
     $this->shouldThrow(MethodSizeTooLarge::class)->duringCheck($sus, $params, $reporter);
 }
 function it_should_analyse_the_number_of_methods_size(SpecificationEvent $specificationEvent, SpecificationNode $specificationNode, Params $params, Reporter $reporter)
 {
     $specificationEvent->getSpecification()->willReturn($specificationNode);
     $specificationNode->getTitle()->willReturn('Elfiggo\\Brobdingnagian\\Detector\\ClassSize');
     $this->shouldNotThrow('Elfiggo\\Brobdingnagian\\Exception\\TooManyMethodsDetected');
     $params->getClassSize()->willReturn(200);
     $params->getDependenciesLimit()->willReturn(2);
     $params->getNumberOfMethods()->willReturn(5);
     $params->getMethodSize()->willReturn(10);
     $params->getNumberOfInterfaces()->willReturn(2);
     $params->getNumberOfTraits()->willReturn(1);
     $this->analyse($specificationEvent, $params, $reporter);
 }