Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401]

   1  <?php
   2  /**
   3   * LICENSE
   4   *
   5   * This file is part of CFPropertyList.
   6   *
   7   * The PHP implementation of Apple's PropertyList can handle XML PropertyLists
   8   * as well as binary PropertyLists. It offers functionality to easily convert
   9   * data between worlds, e.g. recalculating timestamps from unix epoch to apple
  10   * epoch and vice versa. A feature to automagically create (guess) the plist
  11   * structure from a normal PHP data structure will help you dump your data to
  12   * plist in no time.
  13   *
  14   * Copyright (c) 2018 Teclib'
  15   *
  16   * Permission is hereby granted, free of charge, to any person obtaining a copy
  17   * of this software and associated documentation files (the "Software"), to deal
  18   * in the Software without restriction, including without limitation the rights
  19   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  20   * copies of the Software, and to permit persons to whom the Software is
  21   * furnished to do so, subject to the following conditions:
  22   *
  23   * The above copyright notice and this permission notice shall be included in all
  24   * copies or substantial portions of the Software.
  25   *
  26   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  28   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  29   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  30   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  31   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32   * SOFTWARE.
  33   *
  34   * ------------------------------------------------------------------------------
  35   * @author    Rodney Rehm <rodney.rehm@medialize.de>
  36   * @author    Christian Kruse <cjk@wwwtech.de>
  37   * @copyright Copyright © 2018 Teclib
  38   * @package   plist
  39   * @license   MIT
  40   * @link      https://github.com/TECLIB/CFPropertyList/
  41   * @link      http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html Property Lists
  42   * ------------------------------------------------------------------------------
  43   */
  44  
  45  namespace CFPropertyList;
  46  
  47  class IOException extends \Exception
  48  {
  49    /**
  50     * Flag telling the File could not be found
  51     */
  52      const NOT_FOUND = 1;
  53  
  54    /**
  55     * Flag telling the File is not readable
  56     */
  57      const NOT_READABLE = 2;
  58  
  59    /**
  60     * Flag telling the File is not writable
  61     */
  62      const NOT_WRITABLE = 3;
  63  
  64    /**
  65     * Flag telling there was a read error
  66     */
  67      const READ_ERROR = 4;
  68  
  69    /**
  70     * Flag telling there was a read error
  71     */
  72      const WRITE_ERROR = 5;
  73  
  74    /**
  75     * Create new IOException
  76     * @param string $path Source of the problem
  77     * @param integer $type Type of the problem
  78     */
  79      public function __construct($path, $type = null)
  80      {
  81          parent::__construct($path, $type);
  82      }
  83  
  84    /**
  85     * Create new FileNotFound-Exception
  86     * @param string $path Source of the problem
  87     * @return IOException new FileNotFound-Exception
  88     */
  89      public static function notFound($path)
  90      {
  91          return new IOException($path, self::NOT_FOUND);
  92      }
  93  
  94    /**
  95     * Create new FileNotReadable-Exception
  96     * @param string $path Source of the problem
  97     * @return IOException new FileNotReadable-Exception
  98     */
  99      public static function notReadable($path)
 100      {
 101          return new IOException($path, self::NOT_READABLE);
 102      }
 103  
 104    /**
 105     * Create new FileNotWritable-Exception
 106     * @param string $path Source of the problem
 107     * @return IOException new FileNotWritable-Exception
 108     */
 109      public static function notWritable($path)
 110      {
 111          return new IOException($path, self::NOT_WRITABLE);
 112      }
 113  
 114    /**
 115     * Create new ReadError-Exception
 116     * @param string $path Source of the problem
 117     * @return IOException new ReadError-Exception
 118     */
 119      public static function readError($path)
 120      {
 121          return new IOException($path, self::READ_ERROR);
 122      }
 123  
 124    /**
 125     * Create new WriteError-Exception
 126     * @param string $path Source of the problem
 127     * @return IOException new WriteError-Exception
 128     */
 129      public static function writeError($path)
 130      {
 131          return new IOException($path, self::WRITE_ERROR);
 132      }
 133  }