コード例 #1
0
ファイル: Multiple.php プロジェクト: dennis84/mapped
 /**
  * Adds prototype objects depending on given data.
  *
  * @param Mapping $mapping The mapping object
  * @param Mapping $proto   The prototype mapping object
  * @param mixed   $input   The input
  *
  * @throw InvalidArgumentException If given data is not an array
  */
 private function resize(Mapping $mapping, Mapping $proto, $input)
 {
     if (!is_array($input)) {
         throw new \InvalidArgumentException('The input must be an array.');
     }
     $children = [];
     foreach ($input as $index => $value) {
         $children[$index] = $proto;
     }
     $mapping->setChildren($children);
 }