Skip to content

Commit

Permalink
MAGETWO-67557: Fixed coding standard violations in the Framework name…
Browse files Browse the repository at this point in the history
…space #9303
  • Loading branch information
Oleksii Korshenko authored Apr 19, 2017
2 parents 5a0aa91 + c4e6e2c commit fd25392
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
8 changes: 4 additions & 4 deletions lib/internal/Magento/Framework/CurrencyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

namespace Magento\Framework;

class CurrencyFactory
Expand All @@ -24,8 +22,10 @@ class CurrencyFactory
* @param ObjectManagerInterface $objectManager
* @param string $instanceName
*/
public function __construct(ObjectManagerInterface $objectManager, $instanceName = CurrencyInterface::class)
{
public function __construct(
ObjectManagerInterface $objectManager,
$instanceName = CurrencyInterface::class
) {
$this->_objectManager = $objectManager;
$this->_instanceName = $instanceName;
}
Expand Down
26 changes: 15 additions & 11 deletions lib/internal/Magento/Framework/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

namespace Magento\Framework;

use Magento\Framework\App\ObjectManager;
Expand Down Expand Up @@ -43,13 +41,15 @@
* - query_array: array('param1'=>'value1', 'param2'=>'value2')
* - fragment: (#)'fragment-anchor'
*
* @codingStandardsIgnoreStart
* URL structure:
*
* https://user:password@host:443/base_path/[base_script][scopeview_path]route_name/controller_name/action_name/param1/value1?query_param=query_value#fragment
* \__________A___________/\____________________________________B_____________________________________/
* \__________________C___________________/ \__________________D_________________/ \_____E_____/
* \_____________F______________/ \___________________________G______________________/
* \___________________________________________________H____________________________________________________/
* @codingStandardsIgnoreEnd
*
* - A: authority
* - B: path
Expand Down Expand Up @@ -145,6 +145,7 @@ class Url extends \Magento\Framework\DataObject implements \Magento\Framework\Ur
* @var \Magento\Framework\Url\RouteParamsResolverFactory
*/
private $_routeParamsResolverFactory;

/**
* @var \Magento\Framework\Url\ScopeResolverInterface
*/
Expand Down Expand Up @@ -290,7 +291,7 @@ public function setUseSession($useSession)
*/
public function getUseSession()
{
if (is_null($this->_useSession)) {
if ($this->_useSession === null) {
$this->_useSession = $this->_sidResolver->getUseSessionInUrl();
}
return $this->_useSession;
Expand All @@ -305,7 +306,7 @@ public function getUseSession()
*/
public function getConfigData($key, $prefix = null)
{
if (is_null($prefix)) {
if ($prefix === null) {
$prefix = 'web/' . ($this->_isSecure() ? 'secure' : 'unsecure') . '/';
}
$path = $prefix . $key;
Expand Down Expand Up @@ -583,7 +584,7 @@ protected function _getRoutePath($routeParams = [])
$routePath = $this->_getActionPath();
if ($this->_getRouteParams()) {
foreach ($this->_getRouteParams() as $key => $value) {
if (is_null($value) || false === $value || '' === $value || !is_scalar($value)) {
if ($value === null || false === $value || '' === $value || !is_scalar($value)) {
continue;
}
$routePath .= $key . '/' . $value . '/';
Expand Down Expand Up @@ -855,7 +856,7 @@ function ($item) use (&$isCached) {
);
}

if(!$isCached) {
if (!$isCached) {
return $this->getUrlModifier()->execute(
$this->createUrl($routePath, $routeParams)
);
Expand Down Expand Up @@ -953,7 +954,7 @@ private function createUrl($routePath = null, array $routeParams = null)
$this->_queryParamsResolver->unsetData('query_params');
}

if (!is_null($fragment)) {
if ($fragment !== null) {
$url .= '#' . $this->getEscaper()->encodeUrlParam($fragment);
}
$this->getRouteParamsResolver()->unsetData('secure');
Expand Down Expand Up @@ -1065,7 +1066,7 @@ public function sessionUrlVar($html)
function ($match) {
if ($this->useSessionIdForUrl($match[2] == 'S' ? true : false)) {
return $match[1] . $this->_sidResolver->getSessionIdQueryParam($this->_session) . '='
. $this->_session->getSessionId() . (isset($match[3]) ? $match[3] : '');
. $this->_session->getSessionId() . (isset($match[3]) ? $match[3] : '');
} else {
if ($match[1] == '?') {
return isset($match[3]) ? '?' : '';
Expand All @@ -1087,9 +1088,12 @@ function ($match) {
public function useSessionIdForUrl($secure = false)
{
$key = 'use_session_id_for_url_' . (int)$secure;
if (is_null($this->getData($key))) {
if ($this->getData($key) === null) {
$httpHost = $this->_request->getHttpHost();
$urlHost = parse_url($this->_getScope()->getBaseUrl(UrlInterface::URL_TYPE_LINK, $secure), PHP_URL_HOST);
$urlHost = parse_url(
$this->_getScope()->getBaseUrl(UrlInterface::URL_TYPE_LINK, $secure),
PHP_URL_HOST
);

if ($httpHost != $urlHost) {
$this->setData($key, true);
Expand Down Expand Up @@ -1192,7 +1196,7 @@ private function getEscaper()
{
if ($this->escaper == null) {
$this->escaper = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Escaper::class);
->get(\Magento\Framework\Escaper::class);
}
return $this->escaper;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/internal/Magento/Framework/UrlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

namespace Magento\Framework;

class UrlFactory
Expand All @@ -24,8 +22,10 @@ class UrlFactory
* @param ObjectManagerInterface $objectManager
* @param string $instanceName
*/
public function __construct(ObjectManagerInterface $objectManager, $instanceName = UrlInterface::class)
{
public function __construct(
ObjectManagerInterface $objectManager,
$instanceName = UrlInterface::class
) {
$this->_objectManager = $objectManager;
$this->_instanceName = $instanceName;
}
Expand Down

0 comments on commit fd25392

Please sign in to comment.