Code Duplication    Length = 17-17 lines in 2 locations

src/TelegramLog.php 2 locations

@@ 118-134 (lines=17) @@
115
     * @return Logger
116
     * @throws TelegramLogException
117
     */
118
    public static function initErrorLog($path, HandlerInterface $external_handler = null)
119
    {
120
        if (($path === null || $path === '') && is_null($external_handler)) {
121
            throw new TelegramLogException('Empty path for error log');
122
        }
123
        self::initialize();
124
125
        if (is_null($external_handler)) {
126
            self::$error_log_path = $path;
127
            $handler = new StreamHandler(self::$error_log_path, Logger::ERROR);
128
        } else {
129
            self::$error_log_path = 'true';
130
            $handler = $external_handler;
131
        }
132
133
        return self::$monolog->pushHandler($handler->setFormatter(new LineFormatter(null, null, true)));
134
    }
135
136
    /**
137
     * Initialize debug log
@@ 145-161 (lines=17) @@
142
     * @return Logger
143
     * @throws TelegramLogException
144
     */
145
    public static function initDebugLog($path, HandlerInterface $external_handler = null)
146
    {
147
        if (($path === null || $path === '') && is_null($external_handler)) {
148
            throw new TelegramLogException('Empty path for debug log');
149
        }
150
        self::initialize();
151
152
        if (is_null($external_handler)) {
153
            self::$debug_log_path = $path;
154
            $handler = new StreamHandler(self::$debug_log_path, Logger::DEBUG);
155
        } else {
156
            self::$debug_log_path = 'true';
157
            $handler = $external_handler;
158
        }
159
160
        return self::$monolog->pushHandler($handler->setFormatter(new LineFormatter(null, null, true)));
161
    }
162
163
    /**
164
     * Get the stream handle of the temporary debug output