public function compile(callable $validator = NULL) {
        if(!($project = $this->getProject())) {
            $project = CC::get($this->getConfiguration(), CC::COMPILER_PROJECT);
            if(!$project)
                throw new CompilerException("Compilation without project settings is not possible");
        }

        $this->project = $project;

        try {
            set_error_handler(function($code, $msg, $file, $line) {
                switch(AbstractErrorHandlerService::detectErrorLevel($code)) {
                    case AbstractErrorHandlerService::NOTICE_ERROR_LEVEL: return $this->getLogger()->logNotice($msg, [$file, $line]);
                    case AbstractErrorHandlerService::DEPRECATED_ERROR_LEVEL:
                    case AbstractErrorHandlerService::WARNING_ERROR_LEVEL: return $this->getLogger()->logWarning($msg, [$file, $line]);
                    default: return $this->getLogger()->logError($msg, [$file, $line]);
                }
            });



            /** @var CompilerInterface $compiler */
            foreach($this->getOrganizedCompilers() as $compiler) {
                if(!$validator || $validator($compiler))
                    $compiler->compile($this);
            }
        } catch (Throwable $throwable) {
            $this->getLogger()->logException($throwable);
        } finally {
            restore_error_handler();
        }
    }