Skip to content

Commit

Permalink
Update license date range to 2013-2014
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurian Sluiman committed May 8, 2014
1 parent aa17c8a commit 6442e62
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,7 +1,7 @@
New BSD License
===============

Copyright (c) 2013, Soflomo
Copyright (c) 2013-2014, Soflomo
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 2 additions & 2 deletions Module.php
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2013 Soflomo.
* Copyright (c) 2013-2014 Soflomo.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -33,7 +33,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @author Jurian Sluiman <jurian@soflomo.com>
* @copyright 2013 Soflomo.
* @copyright 2013-2014 Soflomo.
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://soflomo.com
*/
Expand Down
2 changes: 1 addition & 1 deletion config/module.config.php
Expand Up @@ -6,7 +6,7 @@
'routes' => array(
'cache-status' => array(
'options' => array(
'route' => 'cache --status [<name>]',
'route' => 'cache --status [<name>] [-h]',
'defaults' => array(
'controller' => 'Soflomo\Cache\Controller\CacheController',
'action' => 'status'
Expand Down
56 changes: 26 additions & 30 deletions src/Soflomo/Cache/Controller/CacheController.php
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2013 Soflomo.
* Copyright (c) 2013-2014 Soflomo.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -33,7 +33,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @author Jurian Sluiman <jurian@soflomo.com>
* @copyright 2013 Soflomo.
* @copyright 2013-2014 Soflomo.
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://soflomo.com
*/
Expand Down Expand Up @@ -61,54 +61,50 @@ public function statusAction()

if ($cache instanceof TotalSpaceCapableInterface) {
$space = $cache->getTotalSpace();
$unit = 'B';

if ($space > 1024) {
$space = $space/1024;
$unit = 'KB';
}
if ($space > 1024) {
$space = $space/1024;
$unit = 'MB';
}
if ($space > 1024) {
$space = $space/1024;
$unit = 'GB';
if ($this->params('h')) {
$space = $this->convertToHumanSpace($space);
}

$console->writeLine(sprintf(
'%d%s total space', $space, $unit
'%s total space', $space
));
} else {
$console->writeLine('Cache adapter does not provide information about the total space of this cache');
}

if ($cache instanceof AvailableSpaceCapableInterface) {
$space = $cache->getAvailableSpace();
$unit = 'B';

if ($space > 1024) {
$space = $space/1024;
$unit = 'KB';
}
if ($space > 1024) {
$space = $space/1024;
$unit = 'MB';
}
if ($space > 1024) {
$space = $space/1024;
$unit = 'GB';
if ($this->params('h')) {
$space = $this->convertToHumanSpace($space);
}

$console->writeLine(sprintf(
'%d%s available', $space, $unit
'%s available', $space
));
} else {
$console->writeLine('Cache adapter does not provide information about the available space of this cache');
}
}

protected function convertToHumanSpace($space)
{
$unit = 'B';
if ($space > 1024) {
$space = $space/1024;
$unit = 'KB';
}
if ($space > 1024) {
$space = $space/1024;
$unit = 'MB';
}
if ($space > 1024) {
$space = $space/1024;
$unit = 'GB';
}

// Create empty line
$console->writeLine('');
return sprintf('%d%s', $space, $unit);
}

public function clearAction()
Expand Down

0 comments on commit 6442e62

Please sign in to comment.