public get ( $searchKey ) |
public function get($searchKey)
{
if (array_key_exists($searchKey, $this->config)) {
return $this->config[$searchKey];
} else {
$arr = array();
foreach ($this->config as $k => $v) {
if (strstr($k, $searchKey)) {
$arr[$k] = $v;
}
}
return $arr;
}
}
/** * @test */ public function testGet() { $ret = $this->object->get('acct1'); $this->assertContains('jb-us-seller_api1.paypal.com', $ret); $this->assertArrayHasKey('acct1.UserName', $ret); $this->assertTrue(sizeof($ret) == 7); $ret = $this->object->get('acct1.UserName'); $this->assertEquals('jb-us-seller_api1.paypal.com', $ret); $ret = $this->object->get("acct"); $this->assertEquals(sizeof($ret), 10); }