public function serve()
    {
        $type       = $this->getSourceType();
        $sources    = $this->getSources();
        $contents   = $this->getContents();
        if ($type!='file' && count($sources)==1) {
            $response_data = array(
                'source'    => $sources[0],
                'content'   => $contents[0],
            );
        } else {
            $response_data = array(
                'sources'   => $sources,
                'contents'  => $contents,
            );
        }

        $errors_collection = $this->getErrors();
        $errors = array();
        foreach ($errors_collection as $_error) {
            $errors[] = $_error->getFullMessage();
        }
        $response_data['errors'] = $errors;

        if ($this->isDebug()) {
            $response_data['dump'] = serialize($this);
        }

        if (Container::get('request')->isMethod('head')) {
            Container::get('response')->fetchHeaders();
            exit(PHP_EOL);
        } else {
            try {
                Container::get('response')->send($response_data);
            } catch (\Exception $e) {
                $this->warning($e->getMessage());
                Container::get('response')
                    ->setContent(array('errors'=>$this->getErrors()))
                    ->fetch();
            }
        }
    }