Code Duplication    Length = 15-15 lines in 2 locations

src/phpFastCache/Drivers/Memcache/Driver.php 1 location

@@ 167-181 (lines=15) @@
164
    /**
165
     * @return driverStatistic
166
     */
167
    public function getStats()
168
    {
169
        $stats = (array) $this->instance->getstats();
170
        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
171
        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
172
        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
173
        
174
        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
175
176
        return (new driverStatistic())
177
          ->setData(implode(', ', array_keys($this->itemInstances)))
178
          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
179
          ->setRawData($stats)
180
          ->setSize($stats[ 'bytes' ]);
181
    }
182
}

src/phpFastCache/Drivers/Memcached/Driver.php 1 location

@@ 166-180 (lines=15) @@
163
    /**
164
     * @return driverStatistic
165
     */
166
    public function getStats()
167
    {
168
        $stats = (array) $this->instance->getStats();
169
        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
170
        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
171
        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
172
173
        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
174
175
        return (new driverStatistic())
176
          ->setData(implode(', ', array_keys($this->itemInstances)))
177
          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
178
          ->setRawData($stats)
179
          ->setSize($stats[ 'bytes' ]);
180
    }
181
}