コード例 #1
0
function _obj($list, $values = NULL)
{
    return Underscore::obj($list, $values);
}
コード例 #2
0
ファイル: Underscore.php プロジェクト: brombal/underscore.php
 /**
  * @tags arrays
  */
 public function testObj()
 {
     // it should convert arrays into objects
     $this->object(_::obj(['a', 'b', 'c'], [1, 2, 3]))->isInstanceOf('\\stdClass')->isEqualTo((object) ['a' => 1, 'b' => 2, 'c' => 3]);
     // it should be capable to create empty objects
     $this->object(_::obj(['a', 'b', 'c']))->isInstanceOf('\\stdClass')->isEqualTo((object) ['a' => null, 'b' => null, 'c' => null]);
     // if arrays are empty, return an empty object
     $this->object(_::obj([]))->isInstanceOf('\\stdClass')->isEqualTo(new \stdClass());
 }