create form instance of exception handler

@return Antares\Html\Form\FormBuilder
430813
protected function form()
    {
        $form = app('antares.form')->of("antares.widgets: report")->extend(function (FormGrid $form) {
            $url = handles('antares::logger/report', ['csrf' => true]);
            $form->name('Report form');
            $form->simple($url, ['id' => 'report-form']);
            $form->layout('antares/logger::admin.report.form');
            $form->fieldset(trans('Error Page Report'), function (Fieldset $fieldset) {
                $location = Input::get('location');
                $fieldset->control('input:hidden', 'url')
                        ->value($location);
                $fieldset->control('textarea', 'description')
                        ->label(trans('Additional message: '))
                        ->attributes(['required' => 'required']);
                $control  = $fieldset->control('input:checkbox', 'always_send')
                        ->label(trans('Always send notification as default action in error page'));
                if ((int) memory('notification.send.always')) {
                    $control->checked();
                }
            });
            $form->ajaxable();
            $form->rules([
                'description' => ['required', 'max:4000', 'min:1']
            ]);
        });
        return $form;
    }
35934
protected function newLoggerHandlerImpl()
    {
        $config  = $this->get('config');
        $factory = $config->get('psx_logger_factory');

        if ($factory instanceof \Closure) {
            return $factory($config);
        } else {
            $level = $config->get('psx_log_level');
            $level = !empty($level) ? $level : Logger::ERROR;

            $handler = new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $level, true, true);
            $handler->setFormatter(new ErrorFormatter());

            return $handler;
        }
    }
253031
public function getRequestHandler()
    {
        if (isset($this->requestHandler))
            return $this->requestHandler;

        // now instantiating handler from config
        $handlerClass = "\\" . ltrim($this->handlerClass, "\\");
        if (!class_exists($handlerClass))
            throw new RuntimeException("Unable to create HTTP Handler instance with class: " . var_export($handlerClass, true));

        $this->requestHandler = new $handlerClass();
        return $this->requestHandler;
    }
1224584
public function build(): DispatchSyncEventRequest
	{
		$instance = new DispatchSyncEventRequest();
		if ($this->origin === null) {
			throw new BuilderException('Property [origin] is required.');
		}
		$instance->origin = $this->origin;
		if ($this->registrationId === null) {
			throw new BuilderException('Property [registrationId] is required.');
		}
		$instance->registrationId = $this->registrationId;
		if ($this->tag === null) {
			throw new BuilderException('Property [tag] is required.');
		}
		$instance->tag = $this->tag;
		if ($this->lastChance === null) {
			throw new BuilderException('Property [lastChance] is required.');
		}
		$instance->lastChance = $this->lastChance;
		return $instance;
	}
821225
protected function buildForm()
    {
        if ($this->form) {
            return;
        }

        // append parent object if any
        // todo : clean the way the Admin class can retrieve set the object
        if ($this->isChild() && $this->getParentAssociationMapping()) {
            $parent = $this->getParent()->getObject($this->request->get($this->getParent()->getIdParameter()));

            $propertyAccessor = $this->getConfigurationPool()->getPropertyAccessor();
            $propertyPath = new PropertyPath($this->getParentAssociationMapping());

            $object = $this->getSubject();

            $value = $propertyAccessor->getValue($object, $propertyPath);

            if (\is_array($value) || ($value instanceof \Traversable && $value instanceof \ArrayAccess)) {
                $value[] = $parent;
                $propertyAccessor->setValue($object, $propertyPath, $value);
            } else {
                $propertyAccessor->setValue($object, $propertyPath, $parent);
            }
        }

        $formBuilder = $this->getFormBuilder();
        $formBuilder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
            $this->preValidate($event->getData());
        }, 100);

        $this->form = $formBuilder->getForm();
    }
1110776
public function createMethodElement() {
        $multiOptions = $this->util->getTranslated()->getBulkMailProcessOptions();
        $options      = array(
            'label'        => $this->translate->_('Method'),
            'multiOptions' => $multiOptions,
            'required'     => true,
        );

        return $this->_form->createElement('radio', 'multi_method', $options);
    }
765926
protected function registerExceptionHandler()
    {
        $previousHandler = null;
        if ($this->app->bound(ExceptionHandlerInterface::class) === true) {
            $previousHandler = $this->app->make(ExceptionHandlerInterface::class);
        }

        $this->app->singleton(ExceptionHandlerInterface::class, function () use ($previousHandler) {
            return new JsonApiExceptionHandler($this->app, $previousHandler);
        });
    }
510550
public function buildDeleterBehaviour()
    {
        return '$(document).ready(function() {
                    $("#' . $this->buildDeleteButtonId() . '").click(function() {
                        var $form = $(this).parents("form"),
                            $fileHandling = $form.find("[name=\'' . $this->getName() . '\']");
                        if(!$fileHandling.length) {
                            $fileHandling = $("<input>", { name: "' . $this->getName() . '", type: "hidden" });
                            $form.prepend($fileHandling); 
                        }
                        $fileHandling.val("{\\"action\\":\\"delete\\"}");
                        $("#' . $this->buildWidgetContainerId() . '").empty();
                        ' . $this->buildUploaderBehaviour(true) . '
                    });
                });';
    }
1333691
protected static function handleError()
	{
		if(self::$errorHandler === NULL)
		{
			self::$errorHandler = function ($type, $message, $file, $line) {
				throw new \RuntimeException($message);
			};
		}
		
		return self::$errorHandler;
	}
1188936
public static function build() {
        try {
            self::init();
            self::dependencies();
    
            $route = self::canRoute();
    
            if ($route !== false) {
                $actionContext = self::actionContext($route);
    
                if ($actionContext !== null && !self::cached($actionContext)) {
                    self::filters($actionContext);
                    self::headers();
                    self::validation();
                    self::render($actionContext);
                }
            }
        }
        catch (\Exception $ex) {
            $errorHandlerEventArgs = new ErrorHandlerEventArgs($ex);
            self::invokeAll(self::$appContext->getErrorHandler(), array($errorHandlerEventArgs));

            if ($errorHandlerEventArgs->getHandled() !== true) {
                throw $ex;
            }
        }
    }
735980
public function build()
    {
        if ($this->handler) {
            $handler = $this->handler;
        } elseif ($this->pdo || $this->dbCredentials) {
            $options = $this->dbCredentials;
            $options['table'] = $this->table;
            if ($this->pdo) {
                $options['pdo'] = $this->pdo;
            }
            $handler = new PdoHandler($options);
        } else {
            $handler = new FileHandler($this->locking);
        }
        return new Session($handler, $this->name, $this->savePath, $this->serializer);
    }
851987
private function getForm(FormHandlerInterface $handler, Options $options): FormInterface
    {
        $form = $handler->getForm($this->factory, $options);

        if (!$form instanceof FormInterface && !is_string($form)) {
            throw new \Exception(sprintf('%s::getForm() must return a string or instance of FormInterface, %s given', get_class($handler), is_object($form) ? get_class($form) : gettype($form)));
        }

        if (is_string($form)) {
            $form = $this->factory->create($form);
        }

        return $form;
    }
230941
private function buildException()
    {
        if($this->isJsonRequest()){
            $this->setException(new ExceptionJson($this->message,$this->debugCode,$this->details,$this->errors));
        }else{
            $exception = new ExceptionView($this->message,$this->debugCode,$this->details,$this->errors);
            $exception->setViewPath($this->getVewPath());
            $exception->setRedirectPath($this->getRedirect());
            $this->setException($exception);
        }
    }
1252237
private function registerExceptionHandler()
    {
        $handler = $this->app[ExceptionHandlerContract::class];

        $this->singleton(ExceptionHandlerContract::class, function ($app) use ($handler) {
            return new Exceptions\Handler($app[Contracts\Tracker::class], $handler);
        });
    }
205301
protected function defineExceptionHandler()
    {
        $exceptionRender = $this->obtainExceptionRender();
        
        //If not render to use
        if ($exceptionRender === false) {
            return;
        }
        
        //add the handler for exceptions
        set_exception_handler([$this, 'exceptionHandler']);
        
        \BFW\Application::getInstance()
            ->getMonolog()
            ->getLogger()
            ->debug('New exception handler defined.')
        ;
    }
48460
public function buildFormFactory()
    {
        $this->ensureCsrfTokenManagerAndTranslatorExist();
        $validator = $this->buildValidator();
        $csrf      = new CsrfExtension(
            $this->csrf_token_manager,
            $this->translator,
            TranslatorBuilder::TRANSLATION_DOMAIN
        );
        $builder   = Forms::createFormFactoryBuilder()->addExtension($csrf)
                                            ->addExtension(new ValidatorExtension($validator))
                                            ->addExtension(new HttpFoundationExtension());
        foreach ($this->form_extensions as $extension) {
            $builder->addExtension($extension);
        }
        return $builder->getFormFactory();
    }
1105003
public function handleException(Exception $exception)
    {
        $sentryHandler = new SentryHandler();
        $sentryHandler->handle($exception);
        return parent::handleException($exception);
    }