Last active
October 9, 2015 05:18
-
-
Save craiga/3444731 to your computer and use it in GitHub Desktop.
_logProgress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Log progress. | |
* | |
* Log progress with a message along the lines of "Processed 600 of 20,000 items (3%)." | |
* Makes use of {@link https://gist.github.com/1849563 _log}. | |
* | |
* @author Craig Anderson <[email protected]> | |
* @link https://gist.github.com/3444731 | |
*/ | |
protected function _logProgress($upto, $total, $pluralNoun = "items", $pastTenseVerb = "processed") | |
{ | |
$this->_log("%s %s of %s %s (%d%%).", | |
ucfirst($pastTenseVerb), | |
number_format($upto), | |
number_format($total), | |
$pluralNoun, | |
($upto / $total) * 100 | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment