public function __construct($docstring, $file, $line) { parent::__construct('Docstring'); $this->file = $file; $this->line = $line; $this->contents = $docstring; }
public function __construct(SplFileInfo $fileInfo) { $this->perms = $fileInfo->getPerms(); $this->size = $fileInfo->getSize(); $this->is_dir = $fileInfo->isDir(); $this->is_file = $fileInfo->isFile(); $this->is_link = $fileInfo->isLink(); if (($this->perms & 0xc000) === 0xc000) { $this->typename = 'File socket'; $this->typeflag = 's'; } elseif ($this->is_file) { if ($this->is_link) { $this->typename = 'File symlink'; $this->typeflag = 'l'; } else { $this->typename = 'File'; $this->typeflag = '-'; } } elseif (($this->perms & 0x6000) === 0x6000) { $this->typename = 'Block special file'; $this->typeflag = 'b'; } elseif ($this->is_dir) { if ($this->is_link) { $this->typename = 'Directory symlink'; $this->typeflag = 'l'; } else { $this->typename = 'Directory'; $this->typeflag = 'd'; } } elseif (($this->perms & 0x2000) === 0x2000) { $this->typename = 'Character special file'; $this->typeflag = 'c'; } elseif (($this->perms & 0x1000) === 0x1000) { $this->typename = 'FIFO pipe file'; $this->typeflag = 'p'; } parent::__construct('FsPath'); $this->path = $fileInfo->getPathname(); $this->realpath = realpath($this->path); if ($this->is_link && method_exists($fileInfo, 'getLinktarget')) { $this->linktarget = $fileInfo->getLinktarget(); } $flags = array($this->typeflag); // User $flags[] = $this->perms & 0x100 ? 'r' : '-'; $flags[] = $this->perms & 0x80 ? 'w' : '-'; $flags[] = $this->perms & 0x40 ? $this->perms & 0x800 ? 's' : 'x' : ($this->perms & 0x800 ? 'S' : '-'); // Group $flags[] = $this->perms & 0x20 ? 'r' : '-'; $flags[] = $this->perms & 0x10 ? 'w' : '-'; $flags[] = $this->perms & 0x8 ? $this->perms & 0x400 ? 's' : 'x' : ($this->perms & 0x400 ? 'S' : '-'); // Other $flags[] = $this->perms & 0x4 ? 'r' : '-'; $flags[] = $this->perms & 0x2 ? 'w' : '-'; $flags[] = $this->perms & 0x1 ? $this->perms & 0x200 ? 't' : 'x' : ($this->perms & 0x200 ? 'T' : '-'); $this->contents = implode($flags); }
public function __construct($group, $lap = null, $total = null, $i = 0) { parent::__construct('Microtime'); $this->group = $group; $this->lap = $lap; $this->total = $total; $this->i = $i; if ($i) { $this->avg = $total / $i; } $this->mem = memory_get_usage(); $this->mem_real = memory_get_usage(true); $this->mem_peak = memory_get_peak_usage(); $this->mem_peak_real = memory_get_peak_usage(true); }
public function __construct($value) { parent::__construct('Color'); $this->contents = $value; $this->setValues($value); }