/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/HTTP/PhpEnvironment/ServerAddress.php
44 строки
903 B
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2014 Adobe * All Rights Reserved. */ namespace Magento\Framework\HTTP\PhpEnvironment; use Magento\Framework\App\RequestInterface; /** * Library for working with server ip address */ class ServerAddress { /** * Request object * * @var RequestInterface */ protected $request; /** * @param RequestInterface $httpRequest */ public function __construct(RequestInterface $httpRequest) { $this->request = $httpRequest; } /** * Retrieve Server IP address * * @param bool $ipToLong converting IP to long format * @return string IPv4|long */ public function getServerAddress($ipToLong = false) { $address = $this->request->getServer('SERVER_ADDR'); if (!$address) { return false; } return $ipToLong ? ip2long($address) : $address; } }