public function register()
 {
     if (function_exists('ini_set')) {
         ini_set('display_errors', 0);
     }
     $run = new Run();
     $handler = new ErrorHandler();
     $run->pushHandler($handler);
     $json_handler = new JsonErrorHandler();
     $run->pushHandler($json_handler);
     if (Misc::isCommandLine()) {
         $cli_handler = new PlainTextHandler();
         $cli_handler->addTraceFunctionArgsToOutput(true);
         $cli_handler->addTraceToOutput(true);
         $run->pushHandler($cli_handler);
     }
     $run->register();
 }
Exemplo n.º 2
0
 public static function init()
 {
     error_reporting(E_ALL);
     if (Config\Config::get('WHOOPS_ERROR', FALSE) || Config\Config::get('DEBUG', FALSE)) {
         $whoops = new \Whoops\Run();
         $request = \Biome\Biome::getService('request');
         if ($request->acceptHtml()) {
             $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
         } else {
             if (\Whoops\Util\Misc::isCommandLine()) {
                 $whoops->pushHandler(new \Whoops\Handler\PlainTextHandler());
             } else {
                 $whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler());
             }
         }
         $whoops->register();
     }
 }
Exemplo n.º 3
0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============================================================================ */
use Opis\Colibri\Application;
use Whoops\Run as WhoopsRun;
use Whoops\Handler\JsonResponseHandler;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Handler\PlainTextHandler;
use Whoops\Util\Misc;
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('opcache.enable', 0);
$loader = (require_once 'vendor/autoload.php');
if (getenv('APP_PRODUCTION') === false) {
    $whoops = new WhoopsRun();
    if (Misc::isCommandLine()) {
        $whoops->pushHandler(new PlainTextHandler());
    } elseif (Misc::isAjaxRequest()) {
        $whoops->pushHandler(new JsonResponseHandler());
    } else {
        $whoops->pushHandler(new PrettyPageHandler());
    }
    $whoops->register();
}
$app = new Application(__DIR__, $loader);
return $app->bootstrap();