Scalr\Api\Rest\Http\Response::getCodeMessage PHP Method

getCodeMessage() public static method

Gets the message for the specified HTTP code
public static getCodeMessage ( integer $code ) : string
$code integer
return string Returns the message for the specified HTTP code
    public static function getCodeMessage($code)
    {
        return isset(static::$messages[$code]) ? static::$messages[$code] : null;
    }

Usage Example

Example #1
0
 /**
  * Asserts describe response has all properties and deprecated paths response are identical current response
  *
  * @param string $basePath
  * @param array $listPaths
  * @param bool $environment optional if variable is true replace envId for test environment
  */
 public function assertApiListResponse($basePath, $listPaths, $environment = false)
 {
     $this->assertNotEmpty($listPaths);
     foreach ($listPaths as $path => $property) {
         $pathInfo = $basePath . $path;
         if ($environment) {
             $pathInfo = str_replace('{envId}', static::$testEnvId, $pathInfo);
         }
         $resp = $this->request($pathInfo, Request::METHOD_GET);
         $envelope = $resp->getBody();
         $this->assertDescribeResponseNotEmpty($resp);
         $pathInfoDeprecated = preg_replace("#/(v\\d.*?)/(user|admin|account)/#", '/$2/$1/', $pathInfo);
         $resDepPath = $this->request($pathInfoDeprecated, Request::METHOD_GET);
         $this->assertDescribeResponseNotEmpty($resDepPath);
         $envelopeDep = $resDepPath->getBody();
         $this->assertObjectHasAttribute('warnings', $envelopeDep);
         $this->assertNotEmpty($envelopeDep->warnings);
         $code = [];
         $message = [];
         /* @var $warning ApiMessage */
         foreach ($envelopeDep->warnings as $warning) {
             $code[] = $warning->code;
             $message[] = $warning->message;
         }
         $this->assertContains(Response::getCodeMessage(301), $code);
         $this->assertContains(sprintf('Location %s', $pathInfo), $message);
         $this->assertEquals($envelope->data, $envelopeDep->data);
     }
 }
All Usage Examples Of Scalr\Api\Rest\Http\Response::getCodeMessage