Example #1
0
 public static function load($sSourcePath, $sInputEncoding = null)
 {
     if (!is_string($sSourcePath)) {
         throw ExceptionType::invalidArgument("Argument #1 doit être une chaîne de caractères.", Exception::FROM_MANIPULATOR);
     }
     $sString = @file_get_contents($sSourcePath);
     if ($sString === false) {
         throw ExceptionType::runtime("Une erreur est survenue lors de la récupération du contenu du fichier \"{$sSourcePath}\".", Exception::FROM_MANIPULATOR);
     }
     $oSelf = new self();
     try {
         $oSelf->_initString($sString, $sInputEncoding);
     } catch (Exception $oException) {
         throw ExceptionType::runtime("Une erreur est survenue lors de l'initialisation de la chaîne à manipuler depuis le contenu du fichier \"{$sSourcePath}\".", Exception::FROM_MANIPULATOR, $oException);
     }
     return $oSelf;
 }