1<?php
2/**
3 * Copyright since 2007 PrestaShop SA and Contributors
4 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
5 *
6 * NOTICE OF LICENSE
7 *
8 * This source file is subject to the Open Software License (OSL 3.0)
9 * that is bundled with this package in the file LICENSE.md.
10 * It is also available through the world-wide-web at this URL:
11 * https://opensource.org/licenses/OSL-3.0
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@prestashop.com so we can send you a copy immediately.
15 *
16 * DISCLAIMER
17 *
18 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
19 * versions in the future. If you wish to customize PrestaShop for your
20 * needs please refer to https://devdocs.prestashop.com/ for more information.
21 *
22 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
23 * @copyright Since 2007 PrestaShop SA and Contributors
24 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
25 */
26
27namespace PrestaShop\PrestaShop\Adapter\System;
28
29use PrestaShop\PrestaShop\Adapter\Hosting\HostingInformation;
30use PrestaShop\PrestaShop\Adapter\Mail\MailingInformation;
31use PrestaShop\PrestaShop\Adapter\Shop\ShopInformation;
32
33/**
34 * Provides a summary of system information.
35 */
36class SystemInformation
37{
38    /**
39     * @var HostingInformation
40     */
41    private $hostingInformation;
42
43    /**
44     * @var MailingInformation
45     */
46    private $mailingInformation;
47
48    /**
49     * @var ShopInformation
50     */
51    private $shopInformation;
52
53    public function __construct(
54        HostingInformation $hostingInformation,
55        MailingInformation $mailingInformation,
56        ShopInformation $shopInformation
57    ) {
58        $this->hostingInformation = $hostingInformation;
59        $this->mailingInformation = $mailingInformation;
60        $this->shopInformation = $shopInformation;
61    }
62
63    /**
64     * @return array
65     */
66    public function getSummary()
67    {
68        return [
69            'notHostMode' => !$this->hostingInformation->isHostMode(),
70            'server' => $this->hostingInformation->getServerInformation(),
71            'instaWebInstalled' => $this->hostingInformation->isApacheInstawebModule(),
72            'uname' => $this->hostingInformation->getUname(),
73            'database' => $this->hostingInformation->getDatabaseInformation(),
74            'overrides' => $this->shopInformation->getOverridesList(),
75            'shop' => $this->shopInformation->getShopInformation(),
76            'isNativePHPmail' => $this->mailingInformation->isNativeMailUsed(),
77            'smtp' => $this->mailingInformation->getSmtpInformation(),
78        ];
79    }
80}
81