Example #1
0
 /**
  * Get a faker formatter
  *
  * @param $schema
  * @param null $property
  * @return Callable
  * @throws InvalidArgumentException
  */
 private function getFormatter($schema, $property = null)
 {
     if ($this->provider->hasProperty($schema, 'format')) {
         $format = $this->provider->getProperty($schema, 'format');
         if (array_key_exists($format, self::$map)) {
             $format = self::$map[$format];
         }
         return $this->generator->getFormatter($format);
     }
     if (null !== $property) {
         return $this->generator->getFormatter($property);
     }
     throw new InvalidArgumentException('Formatter could not be found');
 }