Altax\Module\Server\Resource\KeyPassphraseMap::getSharedInstance PHP Method

getSharedInstance() public static method

public static getSharedInstance ( )
    public static function getSharedInstance()
    {
        if (!self::$instance) {
            self::$instance = new KeyPassphraseMap();
        }
        return self::$instance;
    }

Usage Example

 public function testDefault()
 {
     $keyPath = __DIR__ . "/../../../../keys/id_rsa_pass";
     $keyPath2 = __DIR__ . "/../../../../keys/id_rsa_nopass";
     KeyPassphraseMap::getSharedInstance()->setPassphraseAtKey($keyPath, "passpass");
     $this->assertEquals("passpass", KeyPassphraseMap::getSharedInstance()->getPassphraseAtKey($keyPath));
     $this->assertEquals(null, KeyPassphraseMap::getSharedInstance()->getPassphraseAtKey($keyPath2));
     $this->assertEquals(true, KeyPassphraseMap::getSharedInstance()->hasPassphraseAtKey($keyPath));
     $this->assertEquals(false, KeyPassphraseMap::getSharedInstance()->hasPassphraseAtKey($keyPath2));
 }
All Usage Examples Of Altax\Module\Server\Resource\KeyPassphraseMap::getSharedInstance