__construct() public method

public __construct ( $file )
Esempio n. 1
0
 public function __construct($fname)
 {
     // Такой синтаксис используется для вызова методов базового класса.
     // Обратите внимание, что ссылки $this нет! Она подразумевается.
     parent::__construct(basename($fname), $fname);
     // Здесь можно проинициализировать другие свойства текущего
     // класса, если они будут.
 }
Esempio n. 2
0
 /**
  * The primary constructor.
  *
  * This method validates the input parameters and trims them to limits.
  *
  * The filename parameter (and it's directory) are checked for appropriate permissions.  If a directory is not specified in the $filename parameter, the current working directory is assumed.
  *
  * @param  string                                          $filename    The destination filename.
  * @param  int                                             $max_age_h   The maximum age of a log file before rotation.  Default is 30*24.  Max is 60*24.
  * @param  int                                             $max_size_kb The maximum size of a file before rotation (kilobytes).  Default is 10*1024.  Max is 50*1024
  * @param  int keepmax The maximum number of files to keep.  Default is 10.
  * @throws \LogicException
  * @throws \RuntimeException
  */
 public function __construct($filename, $max_age_h = null, $max_size_kb = null, $keepmax = null)
 {
     parent::__construct($filename);
     if (!$max_age_h) {
         $max_age_h = 30 * 24;
     }
     if (!$max_size_kb) {
         $max_size_kb = 10 * 1024;
     }
     if (!$keepmax) {
         $keepmax = 10;
     }
     $this->_max_age = $max_age_h;
     $this->_max_size = $max_size_kb;
     $this->_keepmax = $keepmax;
 }
Esempio n. 3
0
 function __construct($scope)
 {
     parent::__construct(APP_ROOT . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $scope . '.log');
 }
Esempio n. 4
0
 function __construct($level = self::DEBUG)
 {
     parent::__construct(fopen('php://stdout', 'w'));
 }
 public function __construct($logsEnabled, $level = self::INFO)
 {
     $this->logsEnabled = $logsEnabled;
     parent::__construct($level);
 }