schmunk42\giiant\helpers\GiiantFaker::provider PHP Method

provider() public static method

Tries to execute Faker's provider methods like email, address, title etc, if method is found.
public static provider ( string $type = self::TYPE_STRING, string $methodName = '', null $format = null )
$type string model's attribute type
$methodName string model's attribute type trying to match Faker's method name
$format null custom data format used in Faker
    public static function provider($type = self::TYPE_STRING, $methodName = '', $format = null)
    {
        $fakerValue = null;
        try {
            $fakerValue = self::$fakerFactory->{$methodName};
            switch ($type) {
                case self::TYPE_INTEGER:
                    $fakerValue = (int) $fakerValue;
                    break;
                case self::TYPE_NUMBER:
                    $fakerValue = (double) $fakerValue;
                    break;
                default:
                    $fakerValue = (string) $fakerValue;
                    break;
            }
        } catch (\Exception $e) {
            $fakerValue = null;
        }
        return $fakerValue;
    }