Code Duplication    Length = 8-8 lines in 2 locations

src/App/Engine.php 2 locations

@@ 106-113 (lines=8) @@
103
            $this->log->notice("Reading index from database '$index_db_path'...");
104
            $index = $this->read_index_from($index_db);
105
        }
106
        if ($index instanceof Graph\IndexDB) {
107
            $this->run_analysis($index);
108
        }
109
        else {
110
            throw new \LogicException(
111
                "Expected index to be of type Graph\IndexDB, but it is '".
112
                get_class($index)."'");
113
        }
114
    }
115
116
    protected function index_database_path() {
@@ 168-175 (lines=8) @@
165
            , function () use ($db, &$index) {
166
                $index = $db->to_graph_index();
167
            });
168
        if ($index instanceof Graph\IndexDB) {
169
            return $index;
170
        }
171
        else {
172
            throw new \LogicException(
173
                "Expected index to be of type Graph\IndexDB, but it is '".
174
                get_class($index)."'");
175
        }
176
    }
177
178
    protected function with_time_measurement(\Closure $message, \Closure $what) {