Predis\Response\Status::get PHP Méthode

get() public static méthode

Common status responses such as OK or QUEUED are cached in order to lower the global memory usage especially when using pipelines.
public static get ( string $payload ) : string
$payload string Status response payload.
Résultat string
    public static function get($payload)
    {
        switch ($payload) {
            case 'OK':
            case 'QUEUED':
                if (isset(self::${$payload})) {
                    return self::${$payload};
                }
                return self::${$payload} = new self($payload);
            default:
                return new self($payload);
        }
    }

Usage Example

 /**
  * @group disconnected
  */
 public function testStaticGetMethodCachesOnlyCommonStatuses()
 {
     $response = Status::get('OK');
     $this->assertSame($response, Status::get('OK'));
     $response = Status::get('QUEUED');
     $this->assertSame($response, Status::get('QUEUED'));
     $response = Status::get('PONG');
     $this->assertNotSame($response, Status::get('PONG'));
 }
All Usage Examples Of Predis\Response\Status::get