/** * Get config * * @param mixed $key Config key * @param mixed $default Default value * * @return mixed Config setting value or the whole config array */ public function getConfig($key = null, $default = null) { if (is_array($key)) { return \Arr::subset($this->config, $key, $default); } return \Arr::get($this->config, $key, $default); }
/** * Tests Arr::subset() * * @test * @dataProvider person_provider */ public function test_subset_missing_items($person) { $expected = array("name" => "Jack", "location" => array("street" => null, "country" => "US"), "occupation" => null); $got = \Arr::subset($person, array("name", "location.street", "location.country", "occupation")); $this->assertEquals($expected, $got); $expected = array("name" => "Jack", "location" => array("street" => "Unknown", "country" => "US"), "occupation" => "Unknown"); $got = \Arr::subset($person, array("name", "location.street", "location.country", "occupation"), "Unknown"); $this->assertEquals($expected, $got); }