Пример #1
0
 /**
  * Returns a new Dictionary object.
  *
  * @param array $array
  *
  * @return self
  */
 public static function fromNative()
 {
     $array = \func_get_arg(0);
     $keyValuePairs = array();
     foreach ($array as $arrayKey => $arrayValue) {
         $key = new StringLiteral(\strval($arrayKey));
         if ($arrayValue instanceof \Traversable || \is_array($arrayValue)) {
             $value = Collection::fromNative($arrayValue);
         } else {
             $value = new StringLiteral(\strval($arrayValue));
         }
         $keyValuePairs[] = new KeyValuePair($key, $value);
     }
     $fixedArray = \SplFixedArray::fromArray($keyValuePairs);
     return new self($fixedArray);
 }
Пример #2
0
 public function testToString()
 {
     $this->assertEquals('EmbarkNow\\ValueObjects\\Structure\\Collection(3)', $this->collection->__toString());
 }