PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.13.1
GiveWP – Donation Plugin and Fundraising Platform v2.13.1
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / TestData / Framework / Factory.php
Factory.php
45 lines 724 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\TestData\Framework;
4
5 use Faker\Generator;
6
7 abstract class Factory implements FactoryContract {
8 use ProviderForwarder;
9
10 /** @var Generator */
11 protected $faker;
12
13 public function __construct( Generator $faker ) {
14 $this->faker = $faker;
15 }
16
17 /**
18 * @param int $count
19 *
20 * @return \Generator
21 */
22 public function make( $count ) {
23 for ( $i = 0; $i < $count; $i ++ ) {
24 yield $this->definition();
25 }
26 }
27
28 /**
29 * Allways generate consistent data
30 *
31 * @param bool $consistent
32 *
33 * @return Factory
34 */
35 public function consistent( $consistent = true ) {
36 if ( $consistent ) {
37 $this->faker->seed( mt_getrandmax() );
38 }
39
40 return $this;
41 }
42
43 abstract public function definition();
44 }
45