PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
4.16.8.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 All 254 releases
give / src / TestData / Factories / LogFactory.php

LogFactory.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/TestData/Factories/LogFactory.php

102 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\TestData\Factories;
4
5 use Give\TestData\Framework\Factory;
6
7 /**
8 * Class LogFactory
9 * @package Give\TestData\Factories
10 */
11 class LogFactory extends Factory
12 {
13 /**
14 * @var string
15 */
16 private $type;
17
18 /**
19 * @var string
20 */
21 private $category;
22
23 /**
24 * @param string $type
25 */
26 public function setLogType($type)
27 {
28 $this->type = $type;
29 }
30
31 /**
32 * @param string $category
33 */
34 public function setLogCategory($category)
35 {
36 $this->category = $category;
37 }
38
39 /**
40 * @param string $category
41 */
42 public function setLogSource($source)
43 {
44 $this->source = $source;
45 }
46
47 /**
48 * @return string
49 */
50 public function getLogType()
51 {
52 if ('random' === $this->type) {
53 return $this->randomLogType();
54 }
55
56 return $this->type;
57 }
58
59 /**
60 * @return string
61 */
62 public function getLogCategory()
63 {
64 if ('random' === $this->category) {
65 return $this->randomLogCategory();
66 }
67
68 return $this->category;
69 }
70
71 /**
72 * @return string
73 */
74 public function getLogSource()
75 {
76 if ('random' === $this->source) {
77 return $this->faker->sentence($nbWords = 3);
78 }
79
80 return $this->source;
81 }
82
83 /**
84 * Donor definition
85 *
86 * @since 1.0.0
87 * @return array
88 */
89 public function definition()
90 {
91 return [
92 'type' => $this->getLogType(),
93 'message' => $this->faker->sentence($nbWords = 6),
94 'category' => $this->getLogCategory(),
95 'source' => $this->getLogSource(),
96 'context' => [
97 'Info' => $this->faker->sentence($nbWords = 6),
98 ],
99 ];
100 }
101 }
102