コード例 #1
0
ファイル: Config.php プロジェクト: indigophp/fuel-core
 /**
  * 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);
 }
コード例 #2
0
ファイル: arr.php プロジェクト: SainsburysTests/sainsburys
 /**
  * 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);
 }