Phundament-Components
[ class tree: Phundament-Components ] [ index: Phundament-Components ] [ all elements ]

Source for file LPhpSettingsModule.php

Documentation is available at LPhpSettingsModule.php

  1. <?php
  2. /**
  3.  * Class file.
  4.  *
  5.  * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  6.  * @copyright 2005, diemeisterei GmbH. All rights reserved.
  7.  * @author $Author: schmunk $
  8.  * @version $Revision: 1 $  $Date: 2006-06-01 15:11:24 +0000 (Do, 01 Jun 2006) $
  9.  * @package Phundament.Components
  10.  * @subpackage Modules
  11.  */
  12.  
  13. /**
  14.  * LPhpSettings provides (read-only) acces to php.ini settings
  15.  *
  16.  * @package System.Util
  17.  * @subpackage Modules
  18.  */
  19. class LPhpSettingsModule extends TModule
  20. {
  21.  
  22.     private $_startTime;
  23.  
  24.     /**
  25.      * @return float Time the script has taken until now
  26.      */
  27.     public function getExecutionTime()
  28.     {
  29.         return microtime(true$this->_startTime;
  30.     }
  31.  
  32.     /**
  33.      * @return float Time the script can run
  34.      */
  35.     public function getMaxExecutionTime()
  36.     {
  37.         return ini_get('max_execution_time');
  38.     }
  39.  
  40.     /**
  41.      * @return float Remaining time the script has available for running
  42.      */
  43.     public function getRemainingExecutionTime()
  44.     {
  45.         $r$this->getMaxExecutionTime($this->getExecutionTime();
  46.         return $r;
  47.     }
  48.  
  49.     /**
  50.      * @return float Percentage the script has taken until now
  51.      */
  52.     public function getExecutionTimePercentage()
  53.     {
  54.         $p100 ($this->getExecutionTime($this->getMaxExecutionTime());
  55.         return number_format($p2);
  56.     }
  57.  
  58.     /**
  59.      * @return float Remaining percentage the script has available for running
  60.      */
  61.     public function getRemainingExecutionTimePercentage()
  62.     {
  63.         return (100 $this->getExecutionTimePercentage());
  64.     }
  65.  
  66.     /**
  67.      * Initializes start time
  68.      * @ignore
  69.      */
  70.     public function __construct()
  71.     {
  72.         $this->_startTimemicrotime(true);
  73.     }
  74.  
  75.     /**
  76.      * @ignore
  77.      */
  78.     public function init($config)
  79.     {
  80.         parent :: init($config);
  81.     }
  82. }
  83. ?>

Documentation generated on Sun, 25 Feb 2007 16:11:33 +0100 by phpDocumentor 1.3.1