Predis\Response\Status::get PHP Method

get() public static method

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.
return 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

Ejemplo n.º 1
0
 /**
  * @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