/** * @param Request $Request * @return ReflectionMethod * @throws MethodNotFound */ private function getMethodForRequest($Request) { $methodName = $Request->getMethod(); if ($this->VisibilityClass && !$this->VisibilityClass->hasMethod($methodName)) { throw new MethodNotFound(); } if (!$this->SubjectClass->hasMethod($methodName)) { throw new MethodNotFound(); } $Method = $this->SubjectClass->getMethod($methodName); if (!$Method->isPublic()) { throw new MethodNotFound(); } if (!$Method->isStatic() && $this->isStatic) { throw new MethodNotFound(); } return $Method; }
public function testThatWithIdDoesNotChangeRequest() { $Request = new Request('foo'); $this->assertSame('foo', $Request->getMethod()); $this->assertSame([], $Request->getParams()); $this->assertNull($Request->getId()); $OtherRequest = $Request->withId(123); $this->assertSame('foo', $Request->getMethod()); $this->assertSame([], $Request->getParams()); $this->assertNull($Request->getId()); $this->assertSame('foo', $OtherRequest->getMethod()); $this->assertSame([], $OtherRequest->getParams()); $this->assertSame(123, $OtherRequest->getId()); }