/**
  * @param string     $field
  * @param integer    $type
  * @param bool|array $multiple
  * @param array      $options
  * @param Builder    $builder
  */
 private function addFieldOfType($field, $type, $multiple, array $options, Builder $builder)
 {
     switch ($type) {
         case Field::TYPE_FAKE:
             $builder->fake($field, $options[0], isset($options[1]) ? $options[1] : []);
             break;
         case Field::TYPE_LINK:
             $builder->link($field, $options[0]);
             break;
         case Field::TYPE_RELATION:
             $builder->relation($field, $options[0]);
             break;
         case Field::TYPE_VALUE:
             $builder->value($field, $options[0]);
             break;
         case Field::TYPE_CALLBACK:
             $builder->callback($field, $options[0]);
             break;
         case Field::TYPE_NONE:
             $builder->none($field);
             break;
         case Field::TYPE_SELECT:
             $builder->select($field, $options[0]);
             break;
     }
     if (false === $multiple) {
         $builder->single($field);
     } else {
         $builder->multiple($field, $multiple[0], $multiple[1]);
     }
 }
 private function makeField(array $mapping, Builder $builder)
 {
     $field = $mapping['fieldName'];
     switch ($mapping['type']) {
         case 'string':
             $length = isset($mapping['length']) && is_int($mapping['length']) ? $mapping['length'] : 255;
             $builder->fake($field, 'text', [$length]);
             break;
         case 'integer':
         case 'bigint':
             $builder->fake($field, 'randomNumber');
             break;
         case 'smallint':
             $builder->fake($field, 'numberBetween', [0, 65535]);
             break;
         case 'boolean':
             $builder->fake($field, 'boolean');
             break;
         case 'decimal':
             $precision = isset($mapping['precision']) ? $mapping['precision'] : 2;
             $builder->callback($field, function ($data, Dogmatist $dogmatist) use($precision) {
                 return $dogmatist->getFaker()->randomNumber($precision + 2) / 100;
             });
             break;
         case 'date':
         case 'time':
         case 'datetime':
             $builder->fake($field, 'datetime');
             break;
         case 'datetimetz':
             $builder->callback($field, function ($data, Dogmatist $dogmatist) {
                 $date = $dogmatist->getFaker()->dateTime;
                 $tz = $dogmatist->getFaker()->timezone;
                 return $date->setTimezone(new \DateTimeZone($tz));
             });
             break;
         case 'text':
             $builder->fake($field, 'text');
             break;
         case 'float':
             $builder->fake($field, 'randomFloat');
             break;
         case 'guid':
             $builder->fake($field, 'uuid');
             break;
     }
 }
 /**
  * @param string                        $name
  * @param Annotations\FieldInterface    $annot
  * @param Annotations\QuantityInterface $count
  * @param Builder                       $builder
  */
 private function addField($name, Annotations\FieldInterface $annot, $count, Builder $builder)
 {
     if ($annot instanceof Annotations\Fake) {
         $builder->fake($name, $annot->type, $annot->args);
     } elseif ($annot instanceof Annotations\Link) {
         $builder->link($name, $annot->target);
     } elseif ($annot instanceof Annotations\None) {
         $builder->none($name);
     } elseif ($annot instanceof Annotations\Select) {
         $builder->select($name, $annot->values);
     } elseif ($annot instanceof Annotations\Value) {
         $builder->value($name, $annot->value);
     } elseif ($annot instanceof Annotations\Relation) {
         $sub = $builder->relation($name, $annot->type);
         $this->processSub($annot->description, $sub);
     }
     if ($count instanceof Annotations\Multiple) {
         $builder->multiple($name, $count->min, $count->max);
     } else {
         $builder->single($name);
     }
 }