Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

   1  <?php
   2  /**
   3   * CFPropertyList
   4   * {@link http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html Property Lists}
   5   * @author Rodney Rehm <rodney.rehm@medialize.de>
   6   * @author Christian Kruse <cjk@wwwtech.de>
   7   * @package plist
   8   * @version $Id$
   9   */
  10  namespace CFPropertyList;
  11  
  12  /**
  13   * Basic Input / Output Exception
  14   * @author Rodney Rehm <rodney.rehm@medialize.de>
  15   * @author Christian Kruse <cjk@wwwtech.de>
  16   * @package plist
  17   */
  18  class IOException extends \Exception {
  19    /**
  20     * Flag telling the File could not be found
  21     */
  22    const NOT_FOUND = 1;
  23    
  24    /**
  25     * Flag telling the File is not readable
  26     */
  27    const NOT_READABLE = 2;
  28    
  29    /**
  30     * Flag telling the File is not writable
  31     */
  32    const NOT_WRITABLE = 3;
  33  
  34    /**
  35     * Flag telling there was a read error
  36     */
  37    const READ_ERROR = 4;
  38  
  39    /**
  40     * Flag telling there was a read error
  41     */
  42    const WRITE_ERROR = 5;
  43  
  44    /**
  45     * Create new IOException
  46     * @param string $path Source of the problem
  47     * @param integer $type Type of the problem
  48     */
  49    public function __construct($path, $type=null) {
  50      parent::__construct( $path, $type );
  51    }
  52    
  53    /**
  54     * Create new FileNotFound-Exception
  55     * @param string $path Source of the problem
  56     * @return IOException new FileNotFound-Exception
  57     */
  58    public static function notFound($path) {
  59      return new IOException( $path, self::NOT_FOUND );
  60    }
  61  
  62    /**
  63     * Create new FileNotReadable-Exception
  64     * @param string $path Source of the problem
  65     * @return IOException new FileNotReadable-Exception
  66     */
  67    public static function notReadable($path) {
  68      return new IOException( $path, self::NOT_READABLE );
  69    }
  70  
  71    /**
  72     * Create new FileNotWritable-Exception
  73     * @param string $path Source of the problem
  74     * @return IOException new FileNotWritable-Exception
  75     */
  76    public static function notWritable($path) {
  77      return new IOException( $path, self::NOT_WRITABLE );
  78    }
  79  
  80    /**
  81     * Create new ReadError-Exception
  82     * @param string $path Source of the problem
  83     * @return IOException new ReadError-Exception
  84     */
  85    public static function readError($path) {
  86      return new IOException( $path, self::READ_ERROR );
  87    }
  88  
  89    /**
  90     * Create new WriteError-Exception
  91     * @param string $path Source of the problem
  92     * @return IOException new WriteError-Exception
  93     */
  94    public static function writeError($path) {
  95      return new IOException( $path, self::WRITE_ERROR );
  96    }
  97  }
  98