Example #1
0
 public function testNesting()
 {
     $original = array('a' => 1, 'b' => 2, 'c' => 3);
     $expected = array('a' => 2, 'b' => 4, 'c' => 6);
     $instanceFirst = ArrayMap::create($original);
     $instanceSecond = ArrayMap::create($instanceFirst);
     $instanceThird = ArrayMap::create($instanceSecond);
     $instanceThird->map(function ($value, $key) {
         return array($key => $value * 2);
     });
     $this->assertEquals($expected, $instanceFirst->getArray());
 }
Example #2
0
 /**
  * @return ArrayMap
  */
 public function getMap()
 {
     if (!$this->map) {
         $this->map = ArrayMap::create($this);
     }
     return $this->map;
 }
 public function testMap()
 {
     $instance = new ArrayAccess();
     $this->assertInstanceOf(ArrayMap::className(), $instance->getMap());
 }