Opensoft\Rollout\Storage\MongoDBStorageAdapter::get PHP Method

get() public method

public get ( $key )
    public function get($key)
    {
        $collection = $this->getCollectionName();
        $result = $this->mongo->{$collection}->findOne(['name' => $key]);
        if (!$result) {
            return null;
        }
        return $result['value'];
    }

Usage Example

 public function testGetNoValue()
 {
     $adapter = new MongoDBStorageAdapter($this->mongo);
     $this->mongo->coll->method('findOne')->will($this->returnValue(null));
     $result = $adapter->get('key');
     $this->assertSame(true, $result);
 }