# give/4.16.9/src/TestData/Framework/Factory.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.9. 49 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.9/code/src/TestData/Framework/Factory.php
- Raw: https://pluginprobe.com/plugins/give/4.16.9/raw/src/TestData/Framework/Factory.php
- Modified: 2024-11-06T18:55:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.9/code/src/TestData/Framework/Factory.php#L10-L20`.

```php
<?php

namespace Give\TestData\Framework;

use Faker\Generator;

abstract class Factory implements FactoryContract
{
    use ProviderForwarder;

    /** @var Generator */
    protected $faker;

    public function __construct(Generator $faker)
    {
        $this->faker = $faker;
    }

    /**
     * @param int $count
     *
     * @return \Generator
     */
    public function make($count)
    {
        for ($i = 0; $i < $count; $i++) {
            yield $this->definition();
        }
    }

    /**
     * Always generate consistent data
     *
     * @param bool $consistent
     *
     * @return Factory
     */
    public function consistent($consistent = true)
    {
        if ($consistent) {
            $this->faker->seed(mt_getrandmax());
        }

        return $this;
    }

    abstract public function definition();
}

```
