PluginProbe ʕ •ᴥ•ʔ
Backup Migration / 2.1.7
Backup Migration v2.1.7
2.1.7 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 3 weeks ago ActivateRequest.php 3 weeks ago DeactivateRequest.php 3 weeks ago InstallRequest.php 3 weeks ago OptInRequest.php 3 weeks ago OptOutRequest.php 3 weeks ago UninstallRequest.php 3 weeks 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