PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.15.3
Independent Analytics – WordPress Analytics Plugin v2.15.3
2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / vendor / illuminate / database / Seeder.php
independent-analytics / vendor / illuminate / database Last commit date
Capsule 2 years ago Concerns 3 weeks ago Connectors 3 weeks ago Console 3 weeks ago DBAL 3 weeks ago Eloquent 3 weeks ago Events 3 weeks ago Migrations 3 weeks ago PDO 3 weeks ago Query 3 weeks ago Schema 3 weeks ago ClassMorphViolationException.php 2 years ago ConfigurationUrlParser.php 2 years ago Connection.php 3 weeks ago ConnectionInterface.php 2 years ago ConnectionResolver.php 3 weeks ago ConnectionResolverInterface.php 2 years ago DatabaseManager.php 3 weeks ago DatabaseServiceProvider.php 3 weeks ago DatabaseTransactionRecord.php 3 weeks ago DatabaseTransactionsManager.php 3 weeks ago DeadlockException.php 3 weeks ago DetectsConcurrencyErrors.php 2 years ago DetectsLostConnections.php 3 weeks ago Grammar.php 3 weeks ago LazyLoadingViolationException.php 2 years ago LostConnectionException.php 3 weeks ago MigrationServiceProvider.php 3 weeks ago MultipleColumnsSelectedException.php 3 weeks ago MultipleRecordsFoundException.php 3 weeks ago MySqlConnection.php 3 weeks ago PostgresConnection.php 3 weeks ago QueryException.php 2 years ago RecordsNotFoundException.php 2 years ago SQLiteConnection.php 3 weeks ago SQLiteDatabaseDoesNotExistException.php 3 weeks ago Seeder.php 3 weeks ago SqlServerConnection.php 3 weeks ago
Seeder.php
158 lines
1 <?php
2
3 namespace IAWPSCOPED\Illuminate\Database;
4
5 use IAWPSCOPED\Illuminate\Console\Command;
6 use IAWPSCOPED\Illuminate\Console\View\Components\TwoColumnDetail;
7 use IAWPSCOPED\Illuminate\Contracts\Container\Container;
8 use IAWPSCOPED\Illuminate\Database\Console\Seeds\WithoutModelEvents;
9 use IAWPSCOPED\Illuminate\Support\Arr;
10 use InvalidArgumentException;
11 /** @internal */
12 abstract class Seeder
13 {
14 /**
15 * The container instance.
16 *
17 * @var \Illuminate\Contracts\Container\Container
18 */
19 protected $container;
20 /**
21 * The console command instance.
22 *
23 * @var \Illuminate\Console\Command
24 */
25 protected $command;
26 /**
27 * Seeders that have been called at least one time.
28 *
29 * @var array
30 */
31 protected static $called = [];
32 /**
33 * Run the given seeder class.
34 *
35 * @param array|string $class
36 * @param bool $silent
37 * @param array $parameters
38 * @return $this
39 */
40 public function call($class, $silent = \false, array $parameters = [])
41 {
42 $classes = Arr::wrap($class);
43 foreach ($classes as $class) {
44 $seeder = $this->resolve($class);
45 $name = \get_class($seeder);
46 if ($silent === \false && isset($this->command)) {
47 with(new TwoColumnDetail($this->command->getOutput()))->render($name, '<fg=yellow;options=bold>RUNNING</>');
48 }
49 $startTime = \microtime(\true);
50 $seeder->__invoke($parameters);
51 if ($silent === \false && isset($this->command)) {
52 $runTime = \number_format((\microtime(\true) - $startTime) * 1000, 2);
53 with(new TwoColumnDetail($this->command->getOutput()))->render($name, "<fg=gray>{$runTime} ms</> <fg=green;options=bold>DONE</>");
54 $this->command->getOutput()->writeln('');
55 }
56 static::$called[] = $class;
57 }
58 return $this;
59 }
60 /**
61 * Run the given seeder class.
62 *
63 * @param array|string $class
64 * @param array $parameters
65 * @return void
66 */
67 public function callWith($class, array $parameters = [])
68 {
69 $this->call($class, \false, $parameters);
70 }
71 /**
72 * Silently run the given seeder class.
73 *
74 * @param array|string $class
75 * @param array $parameters
76 * @return void
77 */
78 public function callSilent($class, array $parameters = [])
79 {
80 $this->call($class, \true, $parameters);
81 }
82 /**
83 * Run the given seeder class once.
84 *
85 * @param array|string $class
86 * @param bool $silent
87 * @return void
88 */
89 public function callOnce($class, $silent = \false, array $parameters = [])
90 {
91 if (\in_array($class, static::$called)) {
92 return;
93 }
94 $this->call($class, $silent, $parameters);
95 }
96 /**
97 * Resolve an instance of the given seeder class.
98 *
99 * @param string $class
100 * @return \Illuminate\Database\Seeder
101 */
102 protected function resolve($class)
103 {
104 if (isset($this->container)) {
105 $instance = $this->container->make($class);
106 $instance->setContainer($this->container);
107 } else {
108 $instance = new $class();
109 }
110 if (isset($this->command)) {
111 $instance->setCommand($this->command);
112 }
113 return $instance;
114 }
115 /**
116 * Set the IoC container instance.
117 *
118 * @param \Illuminate\Contracts\Container\Container $container
119 * @return $this
120 */
121 public function setContainer(Container $container)
122 {
123 $this->container = $container;
124 return $this;
125 }
126 /**
127 * Set the console command instance.
128 *
129 * @param \Illuminate\Console\Command $command
130 * @return $this
131 */
132 public function setCommand(Command $command)
133 {
134 $this->command = $command;
135 return $this;
136 }
137 /**
138 * Run the database seeds.
139 *
140 * @param array $parameters
141 * @return mixed
142 *
143 * @throws \InvalidArgumentException
144 */
145 public function __invoke(array $parameters = [])
146 {
147 if (!\method_exists($this, 'run')) {
148 throw new InvalidArgumentException('Method [run] missing from ' . \get_class($this));
149 }
150 $callback = fn() => isset($this->container) ? $this->container->call([$this, 'run'], $parameters) : $this->run(...$parameters);
151 $uses = \array_flip(class_uses_recursive(static::class));
152 if (isset($uses[WithoutModelEvents::class])) {
153 $callback = $this->withoutModelEvents($callback);
154 }
155 return $callback();
156 }
157 }
158