当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::getStatus方法代码示例

本文整理汇总了PHP中Response::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::getStatus方法的具体用法?PHP Response::getStatus怎么用?PHP Response::getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Response的用法示例。


在下文中一共展示了Response::getStatus方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetStatus

 function testSetStatus()
 {
     $response = new Response();
     $response->setStatus('402 Where\'s my money?');
     $this->assertEquals(402, $response->getStatus());
     $this->assertEquals('Where\'s my money?', $response->getStatusText());
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:7,代码来源:ResponseTest.php

示例2: testConstruct

 public function testConstruct()
 {
     $response = new Response(\Psc\Net\Service::OK, array('blubb' => 'blubb'));
     $this->assertEquals(array('blubb' => 'blubb'), $response->getBody());
     $this->assertEquals(\Psc\Net\Service::OK, $response->getStatus());
     $this->assertInstanceOf('Psc\\Net\\ServiceResponse', $response);
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:7,代码来源:ResponseTest.php

示例3: buildMessage

 public function buildMessage(Response $response)
 {
     $str = '';
     $str .= $response->getStatus();
     $str .= "\nURL:\n" . $response->getUrl();
     $str .= "\nPARAMS:\n" . var_export($response->getParams(), true);
     $str .= "\nRESPONSE HEADER:\n" . var_export($response->getHeaders(), true);
     $str .= "\nRESPONSE CONTENT:\n" . substr($response->getContent(), 0, 200);
     return $str;
 }
开发者ID:nikonehauser,项目名称:ptclient,代码行数:10,代码来源:ResponseException.php

示例4: output

 /**
  * Sets HTTP response headers and writes out the buffer.
  * @param Response $response Response to write out and to send to the client
  */
 protected static function output(Response $response)
 {
     header("HTTP/1.1 " . $response->getStatus());
     if ($response->getContentType() != null && $response->getCharacterEncoding() != null) {
         header("Content-Type: " . $response->getContentType() . "; charset=" . $response->getCharacterEncoding());
     }
     if ($response->getBuffer() != null) {
         print $response->getBuffer();
     }
     // exit
 }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:15,代码来源:Controller.class.php

示例5: render

 /** Renders a response. */
 public final function render(Response $response)
 {
     foreach ($response->getHeaders() as $h) {
         header($h);
     }
     http_response_code($response->getStatus());
     $e = $response->getEntity();
     if (!is_null($e)) {
         $this->renderEntity($e);
     }
 }
开发者ID:andresrc,项目名称:tcus-php-as,代码行数:12,代码来源:View.php

示例6: sendHeaders

 /**
  * Sends the headers of the response to the client.
  *
  * @return void
  */
 protected function sendHeaders()
 {
     if (!headers_sent()) {
         $status = $this->response->getMessage() ?: $this->response->getStatus();
         header(sprintf("%s %s", $this->response->getProtocol(), $status));
         foreach ($this->response->getHeaders() as $name => $value) {
             header("{$name}: {$value}", true);
         }
         foreach ($this->response->getCookies() as $cookie) {
             header("Set-Cookie: {$cookie}", false);
         }
     }
 }
开发者ID:rawebone,项目名称:wilson,代码行数:18,代码来源:Sender.php

示例7: __construct

 public function __construct(Response $parent)
 {
     $status = $parent->getStatus();
     $convertToJson = false;
     $ok = self::statusIsOK($status);
     if ($ok) {
         $contentType = $parent->getHeader('Content-Type');
         if (!empty($contentType)) {
             $convertToJson = stristr($contentType, '/json') !== false;
         }
     }
     $bodyString = $parent->getBody();
     parent::__construct($convertToJson ? json_decode($bodyString) : $bodyString, $parent->getHeaders(), $status);
     $this->ok = $ok;
 }
开发者ID:jonasvr,项目名称:lockedornot,代码行数:15,代码来源:InfogramResponse.php

示例8: findClasses

 public function findClasses($class)
 {
     try {
         $queryObject = array('queryObject' => json_encode(array('coursesection_title' => $class->getTitle(), 'date_from' => $class->getDateFrom(), 'integration_id' => $class->getIntegrationId(), 'user_id' => $class->getUserId(), 'user_role' => $class->getUserRole())));
         $soap = $this->discoverCourseSectionIds($queryObject);
         $response = new Response($this);
         if ($response->getStatus() == 'error') {
             throw new TurnitinSDKException($response->getStatusCode(), $response->getDescription(), parent::getLogPath());
         } else {
             $tiiClass = new TiiClass();
             $classids = array();
             if (isset($soap->sourcedIdSet->sourcedId)) {
                 if (!is_array($soap->sourcedIdSet->sourcedId)) {
                     $soap->sourcedIdSet->sourcedId = array($soap->sourcedIdSet->sourcedId);
                 }
                 foreach ($soap->sourcedIdSet->sourcedId as $id) {
                     $classids[] = $id;
                 }
             }
             $tiiClass->setClassIds($classids);
             $response->setClass($tiiClass);
         }
         return $response;
     } catch (SoapFault $e) {
         throw new TurnitinSDKException($e->faultcode, $e->faultstring, parent::getLogPath());
     }
 }
开发者ID:NeillM,项目名称:moodle-mod_turnitintooltwo,代码行数:27,代码来源:classsoap.class.php

示例9: testStatusSubcode

    /**
     * See if we can parse a StatusResponse with a subcode
     */
    public function testStatusSubcode()
    {
        $xml = <<<XML
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                ID="id-HW1q4BUkjB3GuVvTlqYtwr1cuuI-"
                Version="2.0"
                IssueInstant="2016-01-20T20:28:02Z"
                Destination="https://engine.example.edu/authentication/sp/consume-assertion"
                InResponseTo="CORTO8a275030e97351e68e7cc0f89d5b46393d9ee3d9">
  <saml:Issuer>https://example.org/</saml:Issuer>
  <samlp:Status>
    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Requester">
      <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:RequestDenied"/>
    </samlp:StatusCode>
    <samlp:StatusMessage>The AuthnRequest could not be validated</samlp:StatusMessage>
  </samlp:Status>
</samlp:Response>
XML;
        $fixtureResponseDom = DOMDocumentFactory::fromString($xml);
        $response = new Response($fixtureResponseDom->firstChild);
        $this->assertFalse($response->isSuccess());
        $status = $response->getStatus();
        $this->assertEquals("urn:oasis:names:tc:SAML:2.0:status:Requester", $status['Code']);
        $this->assertEquals("urn:oasis:names:tc:SAML:2.0:status:RequestDenied", $status['SubCode']);
        $this->assertEquals("The AuthnRequest could not be validated", $status['Message']);
    }
开发者ID:madmatt,项目名称:saml2,代码行数:30,代码来源:StatusResponseTest.php

示例10: findAssignments

 public function findAssignments($assignment)
 {
     try {
         $soap = $this->readLineItemIdsForCourseSection(array('sectionSourcedId' => $assignment->getClassId()));
         $response = new Response($this);
         if ($response->getStatus() == 'error') {
             throw new TurnitinSDKException($response->getStatusCode(), $response->getDescription());
         } else {
             $tiiAssignment = new TiiAssignment();
             $assignmentids = array();
             if (isset($soap->sourcedIdSet->sourcedId)) {
                 if (!is_array($soap->sourcedIdSet->sourcedId)) {
                     $soap->sourcedIdSet->sourcedId = array($soap->sourcedIdSet->sourcedId);
                 }
                 foreach ($soap->sourcedIdSet->sourcedId as $id) {
                     $assignmentids[] = $id;
                 }
             }
             $tiiAssignment->setAssignmentIds($assignmentids);
             $response->setAssignment($tiiAssignment);
         }
         return $response;
     } catch (SoapFault $e) {
         throw new TurnitinSDKException($e->faultcode, $e->faultstring, parent::getLogPath());
     }
 }
开发者ID:NeillM,项目名称:moodle-mod_turnitintooltwo,代码行数:26,代码来源:assignmentsoap.class.php

示例11: findUser

 public function findUser($user)
 {
     try {
         $request = array('queryObject' => $user->getEmail());
         $soap = $this->discoverPersonIds($request);
         $response = new Response($this);
         if ($response->getStatus() == 'error') {
             throw new TurnitinSDKException($response->getStatusCode(), $response->getDescription());
         } else {
             $tiiUser = new TiiUser();
             if (isset($soap->sourcedIdSet->sourcedId)) {
                 $tiiUser->setUserId($soap->sourcedIdSet->sourcedId);
             }
             $response->setUser($tiiUser);
         }
         return $response;
     } catch (SoapFault $e) {
         throw new TurnitinSDKException($e->faultcode, $e->faultstring, parent::getLogPath());
     }
 }
开发者ID:Dextirpe,项目名称:moodle-mod_turnitintooltwo,代码行数:20,代码来源:usersoap.class.php

示例12: appendToResponse

 /**
  * @param Response $response
  * @param Response $services
  * @return Response
  */
 private function appendToResponse(Response $response, Response $services)
 {
     foreach ($services as $service) {
         $response->append($service);
     }
     $response->setStatus($services->getStatus());
     return $response;
 }
开发者ID:swco,项目名称:appnexusapi,代码行数:13,代码来源:DataPool.php

示例13: findMemberships

 public function findMemberships($membership)
 {
     try {
         $soap = $this->readMembershipIdsForCollection(array('groupSourcedId' => $membership->getClassId(), 'collection' => 'courseSection'));
         $response = new Response($this);
         if ($response->getStatus() == 'error') {
             throw new TurnitinSDKException($response->getStatusCode(), $response->getDescription());
         } else {
             $tiiMembership = new TiiMembership();
             $membershipids = array();
             if (isset($soap->sourcedIdSet->sourcedId)) {
                 if (!is_array($soap->sourcedIdSet->sourcedId)) {
                     $soap->sourcedIdSet->sourcedId = array($soap->sourcedIdSet->sourcedId);
                 }
                 foreach ($soap->sourcedIdSet->sourcedId as $id) {
                     $membershipids[] = $id;
                 }
             }
             $tiiMembership->setMembershipIds($membershipids);
             $response->setMembership($tiiMembership);
         }
         return $response;
     } catch (SoapFault $e) {
         throw new TurnitinSDKException($e->faultcode, $e->faultstring, parent::getLogPath());
     }
 }
开发者ID:Dextirpe,项目名称:moodle-mod_turnitintooltwo,代码行数:26,代码来源:membershipsoap.class.php

示例14: createSubmission

 public function createSubmission($submission)
 {
     try {
         $request = array();
         $request['resultRecord']['sourcedGUID']['sourcedId'] = '';
         $request['resultRecord']['result']['personSourcedId'] = $submission->getAuthorUserId();
         $request['resultRecord']['result']['lineItemSourcedId'] = $submission->getAssignmentId();
         $request['resultRecord']['result']['extension']['extensionNameVocabulary'] = self::$extensionname_vocab;
         $request['resultRecord']['result']['extension']['extensionValueVocabulary'] = self::$extensionvalue_vocab;
         $request['resultRecord']['result']['extension']['extensionField'][0]['fieldName'] = 'Submitter';
         $request['resultRecord']['result']['extension']['extensionField'][0]['fieldType'] = 'Integer';
         $request['resultRecord']['result']['extension']['extensionField'][0]['fieldValue'] = $submission->getSubmitterUserId();
         $soap = $this->createByProxyResult($request);
         $response = new Response($this);
         if ($response->getStatus() == 'error') {
             throw new TurnitinSDKException($response->getStatusCode(), $response->getDescription());
         } else {
             $tiiSubmission = new TiiSubmission();
             $tiiSubmission->setSubmissionId($soap->sourcedId);
             $response->setSubmission($tiiSubmission);
         }
         return $response;
     } catch (SoapFault $e) {
         throw new TurnitinSDKException($e->faultcode, $e->faultstring, parent::getLogPath());
     }
 }
开发者ID:NeillM,项目名称:moodle-mod_turnitintooltwo,代码行数:26,代码来源:submissionsoap.class.php


注:本文中的Response::getStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。