PhiO: Object-oriented filesystem library for PHP
  • Namespace
  • Class
  • Tree
  • Todo

Namespaces

  • amekusa
    • phio
  • PHP

Classes

  • amekusa\phio\Directory
  • amekusa\phio\File
  • amekusa\phio\FilePool
  • amekusa\phio\Filter
  • amekusa\phio\Perms
  • amekusa\phio\RegexFilter
  • amekusa\phio\RegFile

Exceptions

  • amekusa\phio\ErrorException
  • amekusa\phio\IOException
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 
<?php namespace amekusa\phio; main::required;

/**
 * File permissions abstraction
 * @author amekusa <post@amekusa.com>
 */
class Perms {
    protected
        $mode;

    /**
     * @param integer|string $Mode
     */
    public function __construct($Mode = 0777) {
        $this->mode = is_int($Mode) ? $Mode : octdec((string) $Mode);
    }

    public function isOwnerReadable() {
        return $this->getMode() & 0x0100;
    }

    public function isOwnerWritable() {
        return $this->getMode() & 0x0080;
    }

    public function isOwnerExecutable() {
        return $this->getMode() & 0x0040;
    }

    public function isGroupReadable() {
        return $this->getMode() & 0x0020;
    }

    public function isGroupWritable() {
        return $this->getMode() & 0x0010;
    }

    public function isGroupExecutable() {
        return $this->getMode() & 0x0008;
    }

    public function isUserReadable() {
        return $this->getMode() & 0x0004;
    }

    public function isUserWritable() {
        return $this->getMode() & 0x0002;
    }

    public function isUserExecutable() {
        return $this->getMode() & 0x0001;
    }

    /**
     * @return integer
     */
    public function getMode() {
        return $this->mode;
    }

    /**
     * @param integer $Mode File mode in octal number format
     */
    public function setMode($Mode) {
        $this->mode = $Mode;
        return $this;
    }
}
PhiO: Object-oriented filesystem library for PHP API documentation generated by ApiGen