PayPal\Core\PPConfigManager::getIniPrefix PHP Метод

getIniPrefix() публичный Метод

If $userId is null, returns config keys corresponding to all configured accounts
public getIniPrefix ( $userId = null )
    public function getIniPrefix($userId = null)
    {
        if ($userId == null) {
            $arr = array();
            foreach ($this->config as $key => $value) {
                $pos = strpos($key, '.');
                if (strstr($key, "acct")) {
                    $arr[] = substr($key, 0, $pos);
                }
            }
            return array_unique($arr);
        } else {
            $iniPrefix = array_search($userId, $this->config);
            $pos = strpos($iniPrefix, '.');
            $acct = substr($iniPrefix, 0, $pos);
            return $acct;
        }
    }

Usage Example

 /**
  * @test
  */
 public function testGetIniPrefix()
 {
     $ret = $this->object->getIniPrefix();
     $this->assertContains('acct1', $ret);
     $this->assertEquals(sizeof($ret), 2);
     $ret = $this->object->getIniPrefix('jb-us-seller_api1.paypal.com');
     $this->assertEquals('acct1', $ret);
 }