PluginProbe ʕ •ᴥ•ʔ
Backup Migration / 2.0.0
Backup Migration v2.0.0
2.1.6 2.1.5.2 trunk 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.6.1 1.4.7 1.4.8 1.4.9 1.4.9.1 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.5.1
backup-backup / analyst / src / Http / Requests / AbstractLoggerRequest.php
backup-backup / analyst / src / Http / Requests Last commit date
AbstractLoggerRequest.php 8 months ago ActivateRequest.php 8 months ago DeactivateRequest.php 8 months ago InstallRequest.php 8 months ago OptInRequest.php 8 months ago OptOutRequest.php 8 months ago UninstallRequest.php 8 months ago
AbstractLoggerRequest.php
65 lines
1 <?php
2
3 namespace Analyst\Http\Requests;
4
5 use Analyst\ApiResponse;
6 use Analyst\Collector;
7 use Analyst\Contracts\RequestContract;
8 use Analyst\Contracts\RequestorContract;
9
10 abstract class AbstractLoggerRequest implements RequestContract
11 {
12 /**
13 * @var Collector
14 */
15 protected $collector;
16
17 /**
18 * @var integer
19 */
20 protected $id;
21
22 /**
23 * @var string
24 */
25 protected $path;
26
27 public function __construct(Collector $collector, $pluginId, $path)
28 {
29 $this->collector = $collector;
30 $this->id = $pluginId;
31 $this->path = $path;
32 }
33
34 /**
35 * Cast request data to array
36 *
37 * @return array
38 */
39 public function toArray()
40 {
41 return [
42 'plugin_id' => $this->id,
43 'php_version' => $this->collector->getPHPVersion(),
44 'wp_version' => $this->collector->getWordPressVersion(),
45 'plugin_version' => $this->collector->getPluginVersion($this->path),
46 'url' => $this->collector->getSiteUrl(),
47 'sdk_version' => $this->collector->getSDKVersion(),
48 'ip' => $this->collector->getServerIp(),
49 'mysql_version' => $this->collector->getMysqlVersion(),
50 'locale' => $this->collector->getSiteLanguage(),
51 'current_theme' => $this->collector->getCurrentThemeName(),
52 'active_plugins_list' => implode(', ', $this->collector->getActivePluginsList()),
53 'email' => $this->collector->getGeneralEmailAddress(),
54 'name' => $this->collector->getCurrentUserName()
55 ];
56 }
57
58 /**
59 * Execute the request
60 * @param RequestorContract $requestor
61 * @return ApiResponse
62 */
63 public abstract function execute(RequestorContract $requestor);
64 }
65