GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 51-52 lines in 2 locations

Slim/Handlers/Renderables/XmlErrorMessage.php 1 location

@@ 6-56 (lines=51) @@
3
4
use Slim\Interfaces\RenderableInterface;
5
6
class XmlErrorMessage implements RenderableInterface
7
{
8
9
    private $displayErrorDetails;
10
11
    public function render($args)
12
    {
13
        $this->displayErrorDetails = $args[1];
14
        return $this->renderXmlErrorMessage($args[0]);
15
    }
16
17
18
    /**
19
     * Render XML error
20
     *
21
     * @param \Exception $exception
22
     *
23
     * @return string
24
     */
25
    protected function renderXmlErrorMessage(\Exception $exception)
26
    {
27
        $xml = "<error>\n  <message>Slim Application Error</message>\n";
28
        if ($this->displayErrorDetails) {
29
            do {
30
                $xml .= "  <exception>\n";
31
                $xml .= "    <type>" . get_class($exception) . "</type>\n";
32
                $xml .= "    <code>" . $exception->getCode() . "</code>\n";
33
                $xml .= "    <message>" . $this->createCdataSection($exception->getMessage()) . "</message>\n";
34
                $xml .= "    <file>" . $exception->getFile() . "</file>\n";
35
                $xml .= "    <line>" . $exception->getLine() . "</line>\n";
36
                $xml .= "    <trace>" . $this->createCdataSection($exception->getTraceAsString()) . "</trace>\n";
37
                $xml .= "  </exception>\n";
38
            } while ($exception = $exception->getPrevious());
39
        }
40
        $xml .= "</error>";
41
42
        return $xml;
43
    }
44
45
    /**
46
     * Returns a CDATA section with the given content.
47
     *
48
     * @param  string $content
49
     * @return string
50
     */
51
    private function createCdataSection($content)
52
    {
53
        return sprintf('<![CDATA[%s]]>', str_replace(']]>', ']]]]><![CDATA[>', $content));
54
    }
55
56
}

Slim/Handlers/Renderables/XmlPhpErrorMessage.php 1 location

@@ 6-57 (lines=52) @@
3
4
use Slim\Interfaces\RenderableInterface;
5
6
class XmlPhpErrorMessage implements RenderableInterface
7
{
8
9
    private $displayErrorDetails;
10
11
    public function render($args)
12
    {
13
        $this->displayErrorDetails = $args[1];
14
        return $this->renderXmlErrorMessage($args[0]);
15
    }
16
17
18
     /**
19
     * Render XML error
20
     *
21
     * @param \Throwable $error
22
     *
23
     * @return string
24
     */
25
    protected function renderXmlErrorMessage(\Throwable $error)
26
    {
27
        $xml = "<error>\n  <message>Slim Application Error</message>\n";
28
        if ($this->displayErrorDetails) {
29
            do {
30
                $xml .= "  <error>\n";
31
                $xml .= "    <type>" . get_class($error) . "</type>\n";
32
                $xml .= "    <code>" . $error->getCode() . "</code>\n";
33
                $xml .= "    <message>" . $this->createCdataSection($error->getMessage()) . "</message>\n";
34
                $xml .= "    <file>" . $error->getFile() . "</file>\n";
35
                $xml .= "    <line>" . $error->getLine() . "</line>\n";
36
                $xml .= "    <trace>" . $this->createCdataSection($error->getTraceAsString()) . "</trace>\n";
37
                $xml .= "  </error>\n";
38
            } while ($error = $error->getPrevious());
39
        }
40
        $xml .= "</error>";
41
42
        return $xml;
43
    }
44
45
46
    /**
47
     * Returns a CDATA section with the given content.
48
     *
49
     * @param  string $content
50
     * @return string
51
     */
52
    private function createCdataSection($content)
53
    {
54
        return sprintf('<![CDATA[%s]]>', str_replace(']]>', ']]]]><![CDATA[>', $content));
55
    }
56
57
}