Skip to content

Commit 45f95ac

Browse files
author
Oleksii Korshenko
committed
MAGETWO-67587: Fixed coding standard violations in the Framework\Cache namespace #9320
- Merge Pull Request #9320 from dverkade/magento2:Fix_coding_standard_in_Framework-Cache
2 parents d8a0b12 + a0a9f72 commit 45f95ac

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

lib/internal/Magento/Framework/Cache/Backend/Database.php

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,28 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
10-
Tables declaration:
11-
12-
CREATE TABLE IF NOT EXISTS `cache` (
13-
`id` VARCHAR(255) NOT NULL,
14-
`data` mediumblob,
15-
`create_time` int(11),
16-
`update_time` int(11),
17-
`expire_time` int(11),
18-
PRIMARY KEY (`id`),
19-
KEY `IDX_EXPIRE_TIME` (`expire_time`)
20-
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
21-
22-
CREATE TABLE IF NOT EXISTS `cache_tag` (
23-
`tag` VARCHAR(255) NOT NULL,
24-
`cache_id` VARCHAR(255) NOT NULL,
25-
KEY `IDX_TAG` (`tag`),
26-
KEY `IDX_CACHE_ID` (`cache_id`),
27-
CONSTRAINT `FK_CORE_CACHE_TAG` FOREIGN KEY (`cache_id`) REFERENCES `cache` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
28-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
29-
*/
8+
* Tables declaration:
9+
*
10+
* CREATE TABLE IF NOT EXISTS `cache` (
11+
* `id` VARCHAR(255) NOT NULL,
12+
* `data` mediumblob,
13+
* `create_time` int(11),
14+
* `update_time` int(11),
15+
* `expire_time` int(11),
16+
* PRIMARY KEY (`id`),
17+
* KEY `IDX_EXPIRE_TIME` (`expire_time`)
18+
* )ENGINE=InnoDB DEFAULT CHARSET=utf8;
19+
*
20+
* CREATE TABLE IF NOT EXISTS `cache_tag` (
21+
* `tag` VARCHAR(255) NOT NULL,
22+
* `cache_id` VARCHAR(255) NOT NULL,
23+
* KEY `IDX_TAG` (`tag`),
24+
* KEY `IDX_CACHE_ID` (`cache_id`),
25+
* CONSTRAINT `FK_CORE_CACHE_TAG` FOREIGN KEY (`cache_id`)
26+
* REFERENCES `cache` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
27+
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
28+
*/
3029

3130
/**
3231
* Database cache backend
@@ -148,7 +147,10 @@ public function load($id, $doNotTestCacheValidity = false)
148147
{
149148
if ($this->_options['store_data'] && !$this->_options['infinite_loop_flag']) {
150149
$this->_options['infinite_loop_flag'] = true;
151-
$select = $this->_getConnection()->select()->from($this->_getDataTable(), 'data')->where('id=:cache_id');
150+
$select = $this->_getConnection()->select()->from(
151+
$this->_getDataTable(),
152+
'data'
153+
)->where('id=:cache_id');
152154

153155
if (!$doNotTestCacheValidity) {
154156
$select->where('expire_time=0 OR expire_time>?', time());
@@ -197,7 +199,7 @@ public function test($id)
197199
* @param string $data Datas to cache
198200
* @param string $id Cache id
199201
* @param string[] $tags Array of strings, the cache record will be tagged by each string entry
200-
* @param int|bool $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
202+
* @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime
201203
* @return bool true if no problem
202204
*/
203205
public function save($data, $id, $tags = [], $specificLifetime = false)
@@ -222,7 +224,8 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
222224
'create_time'
223225
)},\n {$connection->quoteIdentifier(
224226
'update_time'
225-
)},\n {$expireCol})\n VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE\n {$dataCol}=VALUES({$dataCol}),\n {$expireCol}=VALUES({$expireCol})";
227+
)},\n {$expireCol})\n VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE\n
228+
{$dataCol}=VALUES({$dataCol}),\n {$expireCol}=VALUES({$expireCol})";
226229

227230
$result = $connection->query($query, [$id, $data, $time, $time, $expire])->rowCount();
228231
}
@@ -554,10 +557,10 @@ protected function _cleanByTags($mode, $tags)
554557
/**
555558
* Clean all cache entries
556559
*
557-
* @param $connection
560+
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
558561
* @return bool
559562
*/
560-
private function cleanAll($connection)
563+
private function cleanAll(\Magento\Framework\DB\Adapter\AdapterInterface $connection)
561564
{
562565
if ($this->_options['store_data']) {
563566
$result = $connection->query('TRUNCATE TABLE ' . $this->_getDataTable());
@@ -571,10 +574,10 @@ private function cleanAll($connection)
571574
/**
572575
* Clean old cache entries
573576
*
574-
* @param $connection
577+
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
575578
* @return bool
576579
*/
577-
private function cleanOld($connection)
580+
private function cleanOld(\Magento\Framework\DB\Adapter\AdapterInterface $connection)
578581
{
579582
if ($this->_options['store_data']) {
580583
$result = $connection->delete(

lib/internal/Magento/Framework/Cache/Backend/Eaccelerator.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Cache\Backend;
108

119
class Eaccelerator extends \Zend_Cache_Backend implements \Zend_Cache_Backend_ExtendedInterface
@@ -76,7 +74,7 @@ public function test($id)
7674
* @param string $data datas to cache
7775
* @param string $id cache id
7876
* @param string[] $tags array of strings, the cache record will be tagged by each string entry
79-
* @param int|bool $specificLifetime if != false, set a specific lifetime for this cache record (null => infinite lifetime)
77+
* @param int|bool $specificLifetime Integer to set a specific lifetime or null for infinite lifetime
8078
* @return bool true if no problem
8179
*/
8280
public function save($data, $id, $tags = [], $specificLifetime = false)
@@ -124,7 +122,8 @@ public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = [])
124122
break;
125123
case \Zend_Cache::CLEANING_MODE_OLD:
126124
$this->_log(
127-
"Magento\Framework\Cache\Backend\Eaccelerator::clean() : CLEANING_MODE_OLD is unsupported by the Eaccelerator backend"
125+
"Magento\Framework\Cache\Backend\Eaccelerator::clean() : ".
126+
"CLEANING_MODE_OLD is unsupported by the Eaccelerator backend"
128127
);
129128
break;
130129
case \Zend_Cache::CLEANING_MODE_MATCHING_TAG:

lib/internal/Magento/Framework/Cache/Test/Unit/CoreTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* \Magento\Framework\Cache\Core test case
119
*/

0 commit comments

Comments
 (0)